Skip to content

minimax

@ai-sdk/minimax

AIProviders.miniMax

  • Language
  • Video

minimax-m3.1-flash and later M-series versions support explicit reasoning effort, image/video input, and MiniMax cache markers. Model IDs are compared by numeric version components: M3.10 and M4 inherit these capabilities. M3.0, older models, and unrecognized IDs retain the earlier Anthropic-compatible behavior.

Set reasoning to low, medium, high, xhigh, or max, or pass MiniMaxLanguageModelOptions(effort: .high).providerOptions. minimal maps to low effort with a compatibility warning. none also maps to low effort with a warning because these models always reason. Explicit minimax.effort or anthropic.effort takes precedence. Omit reasoning or use provider-default to retain the server default.

When reasoning is mapped to MiniMax effort, usage metadata is available under both anthropic and minimax in generation results and stream finish metadata.

M3.1 and later accept temperature from 0 through 2. Temperature and top-p remain available with adaptive thinking; top-k is removed with a warning. Earlier models retain the Anthropic temperature and thinking restrictions.

Use image URLs, inline .data/.file content, .videoURL(...), or a video reference returned by MiniMax. Hosted image and video URLs pass through to the provider. Uploaded video IDs use the minimax reference key; the adapter adds mm_file:// once. Image file references are unsupported.

let provider = try AIProviders.miniMax()
let model = try provider.languageModel("minimax-m3.1-flash")
let request = LanguageModelRequest(
messages: [AIMessage(role: .user, content: [
.text("Describe what changes between these scenes."),
.imageURL(
"https://example.com/scene.png",
providerMetadata: MiniMaxImagePartOptions(detail: .high).providerOptions
),
.videoURL(
"https://example.com/clip.mp4",
providerMetadata: MiniMaxVideoPartOptions(fps: 1).providerOptions
),
.providerReference(mimeType: "video/mp4", reference: ["minimax": "uploaded-video-id"])
])],
reasoning: "high"
)
let result = try await model.generate(request)
print(result.text)

Image detail supports low, default, or high. Video fps must be a finite number from 0.2 through 5. Omitted options use server defaults; invalid values fail before the request is sent. PDF input continues through the shared Anthropic document conversion. The same media and reasoning options work with stream.

Attach MiniMaxCacheControlOptions(cacheControl: .ephemeral).providerOptions as message or content-part providerMetadata. A message marker applies to its final block unless that block already has its own marker. The minimax namespace takes precedence over the canonical anthropic namespace; both cacheControl and cache_control spellings work. Up to four breakpoints are retained across prompt blocks and tools, with a warning for each excess marker. A marker does not guarantee a cache hit.

videoModel(...) continues to support async video operations and polling independently of chat video input. Persist the returned operation to resume status checks. Polling treats the task ID as one URL path segment, including IDs containing slashes or standalone dots. Chat file references require an existing uploaded MiniMax file; this provider does not add a file-upload client.

MiniMax language and video models mirror upstream 3.0.65: MINIMAX_API_KEY, separate language/video base URLs, custom headers, versioned user-agent suffix, callable provider plus languageModel/chat and video/videoModel aliases, and minimax.messages/minimax.video provider IDs. Language reuses the Anthropic Messages request builder, error handling, streaming lifecycle, telemetry metadata, and ordered generate-content parser, including signed/redacted reasoning, citation metadata, compaction, and adaptive/disabled thinking options. MiniMax H3/H3-Max video uses model-aware 480P/768P/2K tiers, duration bounds, audio support, and reference-input validation, and covers text-to-video, first/last-frame and reference-to-video inputs, 2K resolution and ratio mapping, reference audio, text-to-video 16:9 default/fallback behavior, duration/cap warnings, submit/poll lifecycle, aborts, structured errors, response/provider metadata, and custom polling controls. Embedding and image families remain unsupported. Status polling now follows only validated redirects and never forwards credentials away from the configured origin. The 2026-10-23 pass: M3.1+ and future model IDs support image/video inputs and reasoning effort; older M2 families remain text-only. MiniMax cache options and sampling semantics use the compatible Messages hooks.

Factory argument requirements are defined by the public Swift factory signatures. Use Public symbols when you need the exact initializer or factory declaration.

Return to the provider matrix.