Get a key and balance
Sign in on the homepage, create a key, and add a one-time balance from $5. Keys start with sk_minimaxm4-io_ and can be revoked at any time.
- Install the SDK. pip install openai, or npm install openai.
- Point it at the API. Create the client with base_url https://minimaxm4.io/v1 and your key.
- Send a message. Call chat.completions.create with model minimax-m4 and your messages.
Images and tools
To ask about an image, send a user message whose content is a list with a text part and an image_url part. The URL can be https or a base64 data URL for PNG, JPEG, GIF or WebP.
Tool calling uses the standard tools array. M4 thinks between tool calls; when you send the conversation back, keep the assistant message as you received it so the model can continue its reasoning.
Coding agents
Agents that accept an OpenAI-compatible provider work out of the box. Choose the OpenAI Compatible provider, paste the base URL and key, and type minimax-m4 as the model ID. Use minimax-m4-pro for the hardest steps.
- Cline, Roo Code and Kilo Code: API Provider “OpenAI Compatible”.
- Aider: aider --model openai/minimax-m4 with OPENAI_API_BASE set.
- OpenCode: add a provider with @ai-sdk/openai-compatible.