MiniMax SDK

Go and Rust SDK for the MiniMax AI platform API.

Official API Documentation: api/README.md

Design Goals

  1. Full API Coverage: Support all MiniMax API capabilities
  2. Idiomatic Language Design: Natural Go/Rust patterns
  3. Streaming Support: First-class support for streaming responses
  4. Async Task Handling: Convenient polling for long-running operations

API Coverage

API FeatureGoRustOfficial Doc
Text Generation (Chat)api/text.md
Sync Speech (T2A)api/speech-t2a.md
Async Speech (Long Text)api/speech-t2a-async.md
Voice Cloningapi/voice-cloning.md
Voice Designapi/voice-design.md
Voice Managementapi/voice-management.md
Video Generationapi/video.md
Video Agentapi/video-agent.md
Image Generationapi/image.md
Music Generationapi/music.md
File Managementapi/file.md

Architecture

graph TB
    subgraph client["Client"]
        subgraph services1[" "]
            text[Text Service]
            speech[Speech Service]
            voice[Voice Service]
            video[Video Service]
        end
        subgraph services2[" "]
            image[Image Service]
            music[Music Service]
            file[File Service]
        end
    end
    
    subgraph http["HTTP Client"]
        retry[Retry]
        auth[Auth]
        error[Error Handling]
    end
    
    client --> http
    http --> api["https://api.minimaxi.com"]

Services

ServiceDescription
TextChat completion, streaming, tool calls
SpeechTTS sync/stream, async long-text
VoiceList voices, clone, design
VideoText-to-video, image-to-video, agent
ImageText-to-image, image reference
MusicMusic generation from lyrics
FileUpload, list, retrieve, delete files

Authentication

Uses Bearer token authentication:

Authorization: Bearer <api_key>

API keys are obtained from MiniMax Platform.

Base URLs

RegionURL
China (Default)https://api.minimaxi.com
Globalhttps://api.minimaxi.chat

Response Patterns

Synchronous

Direct response with data.

Streaming

SSE (Server-Sent Events) for real-time data:

  • Text: Token-by-token chat responses
  • Speech: Audio chunk streaming

Async Tasks

For long-running operations (video, async speech):

sequenceDiagram
    participant C as Client
    participant S as Server
    C->>S: Create Task
    S-->>C: task_id
    loop Poll Status
        C->>S: Query Status
        S-->>C: Pending/Running
    end
    S-->>C: Success + Result

Error Handling

All errors include:

  • status_code: Numeric error code
  • status_msg: Human-readable message

Common error codes:

  • 1000: General error
  • 1001: Rate limit exceeded
  • 1002: Invalid parameters
  • 1004: Authentication failed

Examples Directory

  • examples/go/minimax/ - Go SDK examples
  • examples/rust/minimax/ - Rust SDK examples
  • examples/cmd/minimax/ - CLI test scripts
  • CLI tool: go/cmd/minimax/
  • CLI tests: examples/cmd/minimax/