Documentation
¶
Overview ¶
Package minimax provides a MiniMax LLM provider using the Anthropic-compatible API. MiniMax recommends their Anthropic-compatible endpoint for new integrations. Docs: https://platform.minimax.io/docs/api-reference/text-anthropic-api
Index ¶
- Constants
- Variables
- func DefaultOptions() []llm.Option
- func FillCost(model string, usage *llm.Usage)
- type Option
- type Provider
- func (p *Provider) CountTokens(_ context.Context, req tokencount.TokenCountRequest) (*tokencount.TokenCount, error)
- func (p *Provider) CreateStream(ctx context.Context, opts llm.Request) (llm.Stream, error)
- func (p *Provider) Models() llm.Models
- func (p *Provider) Name() string
- func (p *Provider) Resolve(model string) (llm.Model, error)
Constants ¶
const ( ModelM27 = "MiniMax-M2.7" ModelM27Highspeed = "MiniMax-M2.7-highspeed" ModelM25 = "MiniMax-M2.5" ModelM25Highspeed = "MiniMax-M2.5-highspeed" ModelM21 = "MiniMax-M2.1" ModelM21Highspeed = "MiniMax-M2.1-highspeed" ModelM2 = "MiniMax-M2" )
Model ToolCallID constants for programmatic use.
Variables ¶
var ModelAliases = map[string]string{ "minimax": ModelM27, "minimax:fast": ModelM27, "minimax:2.7": ModelM27, "minimax:2.5": ModelM25, "minimax:2.1": ModelM21, "minimax:2": ModelM2, }
ModelAliases maps short alias names to full model IDs. Used by the auto package for provider-prefixed resolution (e.g., "minimax/fast").
Functions ¶
func DefaultOptions ¶
DefaultOptions returns the default options for MiniMax.
Types ¶
type Option ¶
type Option func(*Provider)
Option is a functional option for configuring the MiniMax provider.
func WithLLMOpts ¶
WithLLMOpts adds custom llm.Option configurations.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the MiniMax LLM backend via the Anthropic-compatible API.
func (*Provider) CountTokens ¶ added in v0.26.0
func (p *Provider) CountTokens(_ context.Context, req tokencount.TokenCountRequest) (*tokencount.TokenCount, error)
CountTokens estimates the number of input tokens for the given request using the MiniMax BPE tokenizer (200K vocab, loaded from HuggingFace on first use).
The estimate accounts for:
- Raw BPE token counts per message and tool definition
- Per-message framing overhead (6 tokens/message)
- Hidden default system prompt (35 tokens) when no system message is provided
- Tool schema framing (116 tokens once + 20 tokens per additional tool)
All constants are empirically calibrated against the MiniMax-M2.7 API.