@hiper2d/ai-agents 0.28.1 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +41 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -580,7 +580,9 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
|
|
|
580
580
|
* alias for thinking_budget (low = 4,096, medium = 16,384, xhigh = 262,144 tokens) and the
|
|
581
581
|
* two are mutually exclusive — sending both is a 400. QwenAgent sends the budget instead,
|
|
582
582
|
* because 1,024 is tighter than the lowest level effort can express.
|
|
583
|
-
* MiniMax
|
|
583
|
+
* - MiniMax M3.1 Flash (platform.minimax.io text-chat-openai reference, 2026-10-27):
|
|
584
|
+
* low|medium|high|xhigh|max, default max, top-level `reasoning_effort` on Chat Completions;
|
|
585
|
+
* "none" → 400. Only M3.1 Flash honours it — M3 and M2.x ignore the field.
|
|
584
586
|
*/
|
|
585
587
|
type OpenAIReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
586
588
|
type AnthropicReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
@@ -592,6 +594,7 @@ type MetaReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'ma
|
|
|
592
594
|
type MistralReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
593
595
|
type XaiReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh';
|
|
594
596
|
type KimiReasoningEffort = 'low' | 'high' | 'max';
|
|
597
|
+
type MiniMaxReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
595
598
|
/** The shared scale, lowest first. */
|
|
596
599
|
declare const REASONING_EFFORT_SCALE: readonly ReasoningEffort[];
|
|
597
600
|
declare const OPENAI_REASONING_EFFORTS: readonly OpenAIReasoningEffort[];
|
|
@@ -604,6 +607,7 @@ declare const META_REASONING_EFFORTS: readonly MetaReasoningEffort[];
|
|
|
604
607
|
declare const MISTRAL_REASONING_EFFORTS: readonly MistralReasoningEffort[];
|
|
605
608
|
declare const XAI_REASONING_EFFORTS: readonly XaiReasoningEffort[];
|
|
606
609
|
declare const KIMI_REASONING_EFFORTS: readonly KimiReasoningEffort[];
|
|
610
|
+
declare const MINIMAX_REASONING_EFFORTS: readonly MiniMaxReasoningEffort[];
|
|
607
611
|
/** Clamps `effort` to the nearest level in `allowed` (by rank on the shared scale, ties go up). */
|
|
608
612
|
declare function clampReasoningEffort<T extends ReasoningEffort>(effort: ReasoningEffort, allowed: readonly T[]): T;
|
|
609
613
|
declare const toOpenAIEffort: (effort: ReasoningEffort) => OpenAIReasoningEffort;
|
|
@@ -616,6 +620,7 @@ declare const toFuguEffort: (effort: ReasoningEffort) => FuguReasoningEffort;
|
|
|
616
620
|
declare const toMistralEffort: (effort: ReasoningEffort) => MistralReasoningEffort;
|
|
617
621
|
declare const toXaiEffort: (effort: ReasoningEffort) => XaiReasoningEffort;
|
|
618
622
|
declare const toKimiEffort: (effort: ReasoningEffort) => KimiReasoningEffort;
|
|
623
|
+
declare const toMiniMaxEffort: (effort: ReasoningEffort) => MiniMaxReasoningEffort;
|
|
619
624
|
|
|
620
625
|
/**
|
|
621
626
|
* Unified token usage utilities for all AI providers
|
|
@@ -1858,4 +1863,4 @@ declare class MiniMaxAgent extends AbstractAgent {
|
|
|
1858
1863
|
doAskText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1859
1864
|
}
|
|
1860
1865
|
|
|
1861
|
-
export { type AIMessage, ANTHROPIC_REASONING_EFFORTS, API_KEY_CONSTANTS, AbstractAgent, type AgentActivityData, AgentFactory, type AgentLoggingConfig, type AnthropicReasoningEffort, type AnthropicTokenUsage, type ApiKeyMap, type BeforeAskHook, BotResponseError, BudgetController, type BudgetControllerOptions, BudgetExceededError, type BudgetLimit, type BudgetVerdict, CACHE_TIER_MARKER, ClaudeAgent, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_REQUEST_TIMEOUT_MS, type DeepSeekReasoningEffort, type DeepSeekTokenUsage, DeepSeekV2Agent, FUGU_REASONING_EFFORTS, FuguAgent, type FuguReasoningEffort, GEMINI_AUDIO_TOKENS_PER_SECOND, GEMINI_REASONING_EFFORTS, GLM_REASONING_EFFORTS, type GeminiReasoningEffort, GlmAgent, type GlmReasoningEffort, GoogleAgent, type GoogleSttOptions, type GoogleSttResult, type GoogleTokenUsage, type GoogleTtsAudioOptions, type GoogleTtsResult, GoogleVoiceAgent, Gpt5Agent, GrokAgent, type GrokTokenUsage, InMemorySpendStore, type JsonSchemaOptions, KIMI_REASONING_EFFORTS, KimiAgent, type KimiReasoningEffort, type KimiTokenUsage, type LLMModel, LLM_CONSTANTS, type LlmLogger, type LoggingConfig, MESSAGE_ROLE, META_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelTimeoutError, ModelUnavailableError, OPENAI_REASONING_EFFORTS, type OpenAIReasoningEffort, type OpenAITokenUsage, type OpenAiSttOptions, type OpenAiSttResult, type OpenAiTtsAudioOptions, type OpenAiTtsVoice, OpenAiVoiceAgent, type PeakPricing, type PricingUnit, type ProviderSchema, type TokenUsage as ProviderTokenUsage, type ProviderType, QwenAgent, REASONING_EFFORT_SCALE, type ReasoningEffort, SUPPORTED_VOICE_PROVIDERS, type SpeechRequest, type SpeechResult, type SpeechUsage, type SpendInput, type SpendKind, type SpendLedger, type SpendLedgers, type SpendStore, type SpendWindow, SupportedAiKeyNames, SupportedAiModels, type TokenPairUsage, type TokenUsage$1 as TokenUsage, type TranscriptionRequest, type TranscriptionResult, type TranscriptionUsage, VOICE_MODEL_CONSTANTS, VOICE_MODEL_PRICING, VOICE_PROVIDER_API_KEY, type VoiceAgent, VoiceAgentFactory, type VoiceModelPricing, type VoiceProvider, XAI_REASONING_EFFORTS, type XaiReasoningEffort, ZodSchemaConverter, applySpend, calculateAnthropicCost, calculateCost, calculateDeepSeekCost, calculateGeminiSttCost, calculateGeminiTtsCost, calculateGoogleCost, calculateGrokCost, calculateKimiCost, calculateMetaCost, calculateMistralCost, calculateModelCost, calculateOpenAICost, calculateOpenAiSttCost, calculateOpenAiTtsCost, clampReasoningEffort, cleanResponse, createCatalog, createVoiceAgent, describeEmptyTtsResponse, evaluateBudget, extractAnthropicTokenUsage, extractTokenUsageFromResponse$2 as extractAnthropicTokenUsageFromResponse, extractDeepSeekTokenUsage, extractTokenUsageFromResponse$6 as extractDeepSeekTokenUsageFromResponse, extractFirstJsonObject, extractGoogleTokenUsage, extractTokenUsageFromResponse$1 as extractGoogleTokenUsageFromResponse, extractGrokTokenUsage, extractTokenUsageFromResponse$4 as extractGrokTokenUsageFromResponse, extractKimiTokenUsage, extractTokenUsageFromResponse$5 as extractKimiTokenUsageFromResponse, extractMetaTokenUsage, extractTokenUsageFromResponse$3 as extractMetaTokenUsageFromResponse, extractMistralTokenUsage, extractTokenUsageFromResponse as extractMistralTokenUsageFromResponse, extractOpenAITokenUsage, extractTokenUsageFromResponse$7 as extractOpenAITokenUsageFromResponse, extractTokenUsage, extractUsageAndCalculateCost, firstRefusal, generateGoogleTtsAudio, generateOpenAiTtsAudio, generateSchemaInstructions, getModelConfigByApiName, getModelDisplayName, getModelProviderName, getModelTags, getProviderSignatureFields, isBudgetExceededError, isHybridThinkingModel, isInPeakWindow, isPeakBilling, isSafetyBlocked, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, normalizeTtsStyle, parseAndValidateLlmJson, pcmToWav, periodEnd, periodKey, safeValidateResponse, setBeforeAskHook, setLlmLogger, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
|
1866
|
+
export { type AIMessage, ANTHROPIC_REASONING_EFFORTS, API_KEY_CONSTANTS, AbstractAgent, type AgentActivityData, AgentFactory, type AgentLoggingConfig, type AnthropicReasoningEffort, type AnthropicTokenUsage, type ApiKeyMap, type BeforeAskHook, BotResponseError, BudgetController, type BudgetControllerOptions, BudgetExceededError, type BudgetLimit, type BudgetVerdict, CACHE_TIER_MARKER, ClaudeAgent, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_REQUEST_TIMEOUT_MS, type DeepSeekReasoningEffort, type DeepSeekTokenUsage, DeepSeekV2Agent, FUGU_REASONING_EFFORTS, FuguAgent, type FuguReasoningEffort, GEMINI_AUDIO_TOKENS_PER_SECOND, GEMINI_REASONING_EFFORTS, GLM_REASONING_EFFORTS, type GeminiReasoningEffort, GlmAgent, type GlmReasoningEffort, GoogleAgent, type GoogleSttOptions, type GoogleSttResult, type GoogleTokenUsage, type GoogleTtsAudioOptions, type GoogleTtsResult, GoogleVoiceAgent, Gpt5Agent, GrokAgent, type GrokTokenUsage, InMemorySpendStore, type JsonSchemaOptions, KIMI_REASONING_EFFORTS, KimiAgent, type KimiReasoningEffort, type KimiTokenUsage, type LLMModel, LLM_CONSTANTS, type LlmLogger, type LoggingConfig, MESSAGE_ROLE, META_REASONING_EFFORTS, MINIMAX_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, type MiniMaxReasoningEffort, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelTimeoutError, ModelUnavailableError, OPENAI_REASONING_EFFORTS, type OpenAIReasoningEffort, type OpenAITokenUsage, type OpenAiSttOptions, type OpenAiSttResult, type OpenAiTtsAudioOptions, type OpenAiTtsVoice, OpenAiVoiceAgent, type PeakPricing, type PricingUnit, type ProviderSchema, type TokenUsage as ProviderTokenUsage, type ProviderType, QwenAgent, REASONING_EFFORT_SCALE, type ReasoningEffort, SUPPORTED_VOICE_PROVIDERS, type SpeechRequest, type SpeechResult, type SpeechUsage, type SpendInput, type SpendKind, type SpendLedger, type SpendLedgers, type SpendStore, type SpendWindow, SupportedAiKeyNames, SupportedAiModels, type TokenPairUsage, type TokenUsage$1 as TokenUsage, type TranscriptionRequest, type TranscriptionResult, type TranscriptionUsage, VOICE_MODEL_CONSTANTS, VOICE_MODEL_PRICING, VOICE_PROVIDER_API_KEY, type VoiceAgent, VoiceAgentFactory, type VoiceModelPricing, type VoiceProvider, XAI_REASONING_EFFORTS, type XaiReasoningEffort, ZodSchemaConverter, applySpend, calculateAnthropicCost, calculateCost, calculateDeepSeekCost, calculateGeminiSttCost, calculateGeminiTtsCost, calculateGoogleCost, calculateGrokCost, calculateKimiCost, calculateMetaCost, calculateMistralCost, calculateModelCost, calculateOpenAICost, calculateOpenAiSttCost, calculateOpenAiTtsCost, clampReasoningEffort, cleanResponse, createCatalog, createVoiceAgent, describeEmptyTtsResponse, evaluateBudget, extractAnthropicTokenUsage, extractTokenUsageFromResponse$2 as extractAnthropicTokenUsageFromResponse, extractDeepSeekTokenUsage, extractTokenUsageFromResponse$6 as extractDeepSeekTokenUsageFromResponse, extractFirstJsonObject, extractGoogleTokenUsage, extractTokenUsageFromResponse$1 as extractGoogleTokenUsageFromResponse, extractGrokTokenUsage, extractTokenUsageFromResponse$4 as extractGrokTokenUsageFromResponse, extractKimiTokenUsage, extractTokenUsageFromResponse$5 as extractKimiTokenUsageFromResponse, extractMetaTokenUsage, extractTokenUsageFromResponse$3 as extractMetaTokenUsageFromResponse, extractMistralTokenUsage, extractTokenUsageFromResponse as extractMistralTokenUsageFromResponse, extractOpenAITokenUsage, extractTokenUsageFromResponse$7 as extractOpenAITokenUsageFromResponse, extractTokenUsage, extractUsageAndCalculateCost, firstRefusal, generateGoogleTtsAudio, generateOpenAiTtsAudio, generateSchemaInstructions, getModelConfigByApiName, getModelDisplayName, getModelProviderName, getModelTags, getProviderSignatureFields, isBudgetExceededError, isHybridThinkingModel, isInPeakWindow, isPeakBilling, isSafetyBlocked, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, normalizeTtsStyle, parseAndValidateLlmJson, pcmToWav, periodEnd, periodKey, safeValidateResponse, setBeforeAskHook, setLlmLogger, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMiniMaxEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -580,7 +580,9 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
|
|
|
580
580
|
* alias for thinking_budget (low = 4,096, medium = 16,384, xhigh = 262,144 tokens) and the
|
|
581
581
|
* two are mutually exclusive — sending both is a 400. QwenAgent sends the budget instead,
|
|
582
582
|
* because 1,024 is tighter than the lowest level effort can express.
|
|
583
|
-
* MiniMax
|
|
583
|
+
* - MiniMax M3.1 Flash (platform.minimax.io text-chat-openai reference, 2026-10-27):
|
|
584
|
+
* low|medium|high|xhigh|max, default max, top-level `reasoning_effort` on Chat Completions;
|
|
585
|
+
* "none" → 400. Only M3.1 Flash honours it — M3 and M2.x ignore the field.
|
|
584
586
|
*/
|
|
585
587
|
type OpenAIReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
586
588
|
type AnthropicReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
@@ -592,6 +594,7 @@ type MetaReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'ma
|
|
|
592
594
|
type MistralReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
593
595
|
type XaiReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh';
|
|
594
596
|
type KimiReasoningEffort = 'low' | 'high' | 'max';
|
|
597
|
+
type MiniMaxReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
595
598
|
/** The shared scale, lowest first. */
|
|
596
599
|
declare const REASONING_EFFORT_SCALE: readonly ReasoningEffort[];
|
|
597
600
|
declare const OPENAI_REASONING_EFFORTS: readonly OpenAIReasoningEffort[];
|
|
@@ -604,6 +607,7 @@ declare const META_REASONING_EFFORTS: readonly MetaReasoningEffort[];
|
|
|
604
607
|
declare const MISTRAL_REASONING_EFFORTS: readonly MistralReasoningEffort[];
|
|
605
608
|
declare const XAI_REASONING_EFFORTS: readonly XaiReasoningEffort[];
|
|
606
609
|
declare const KIMI_REASONING_EFFORTS: readonly KimiReasoningEffort[];
|
|
610
|
+
declare const MINIMAX_REASONING_EFFORTS: readonly MiniMaxReasoningEffort[];
|
|
607
611
|
/** Clamps `effort` to the nearest level in `allowed` (by rank on the shared scale, ties go up). */
|
|
608
612
|
declare function clampReasoningEffort<T extends ReasoningEffort>(effort: ReasoningEffort, allowed: readonly T[]): T;
|
|
609
613
|
declare const toOpenAIEffort: (effort: ReasoningEffort) => OpenAIReasoningEffort;
|
|
@@ -616,6 +620,7 @@ declare const toFuguEffort: (effort: ReasoningEffort) => FuguReasoningEffort;
|
|
|
616
620
|
declare const toMistralEffort: (effort: ReasoningEffort) => MistralReasoningEffort;
|
|
617
621
|
declare const toXaiEffort: (effort: ReasoningEffort) => XaiReasoningEffort;
|
|
618
622
|
declare const toKimiEffort: (effort: ReasoningEffort) => KimiReasoningEffort;
|
|
623
|
+
declare const toMiniMaxEffort: (effort: ReasoningEffort) => MiniMaxReasoningEffort;
|
|
619
624
|
|
|
620
625
|
/**
|
|
621
626
|
* Unified token usage utilities for all AI providers
|
|
@@ -1858,4 +1863,4 @@ declare class MiniMaxAgent extends AbstractAgent {
|
|
|
1858
1863
|
doAskText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1859
1864
|
}
|
|
1860
1865
|
|
|
1861
|
-
export { type AIMessage, ANTHROPIC_REASONING_EFFORTS, API_KEY_CONSTANTS, AbstractAgent, type AgentActivityData, AgentFactory, type AgentLoggingConfig, type AnthropicReasoningEffort, type AnthropicTokenUsage, type ApiKeyMap, type BeforeAskHook, BotResponseError, BudgetController, type BudgetControllerOptions, BudgetExceededError, type BudgetLimit, type BudgetVerdict, CACHE_TIER_MARKER, ClaudeAgent, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_REQUEST_TIMEOUT_MS, type DeepSeekReasoningEffort, type DeepSeekTokenUsage, DeepSeekV2Agent, FUGU_REASONING_EFFORTS, FuguAgent, type FuguReasoningEffort, GEMINI_AUDIO_TOKENS_PER_SECOND, GEMINI_REASONING_EFFORTS, GLM_REASONING_EFFORTS, type GeminiReasoningEffort, GlmAgent, type GlmReasoningEffort, GoogleAgent, type GoogleSttOptions, type GoogleSttResult, type GoogleTokenUsage, type GoogleTtsAudioOptions, type GoogleTtsResult, GoogleVoiceAgent, Gpt5Agent, GrokAgent, type GrokTokenUsage, InMemorySpendStore, type JsonSchemaOptions, KIMI_REASONING_EFFORTS, KimiAgent, type KimiReasoningEffort, type KimiTokenUsage, type LLMModel, LLM_CONSTANTS, type LlmLogger, type LoggingConfig, MESSAGE_ROLE, META_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelTimeoutError, ModelUnavailableError, OPENAI_REASONING_EFFORTS, type OpenAIReasoningEffort, type OpenAITokenUsage, type OpenAiSttOptions, type OpenAiSttResult, type OpenAiTtsAudioOptions, type OpenAiTtsVoice, OpenAiVoiceAgent, type PeakPricing, type PricingUnit, type ProviderSchema, type TokenUsage as ProviderTokenUsage, type ProviderType, QwenAgent, REASONING_EFFORT_SCALE, type ReasoningEffort, SUPPORTED_VOICE_PROVIDERS, type SpeechRequest, type SpeechResult, type SpeechUsage, type SpendInput, type SpendKind, type SpendLedger, type SpendLedgers, type SpendStore, type SpendWindow, SupportedAiKeyNames, SupportedAiModels, type TokenPairUsage, type TokenUsage$1 as TokenUsage, type TranscriptionRequest, type TranscriptionResult, type TranscriptionUsage, VOICE_MODEL_CONSTANTS, VOICE_MODEL_PRICING, VOICE_PROVIDER_API_KEY, type VoiceAgent, VoiceAgentFactory, type VoiceModelPricing, type VoiceProvider, XAI_REASONING_EFFORTS, type XaiReasoningEffort, ZodSchemaConverter, applySpend, calculateAnthropicCost, calculateCost, calculateDeepSeekCost, calculateGeminiSttCost, calculateGeminiTtsCost, calculateGoogleCost, calculateGrokCost, calculateKimiCost, calculateMetaCost, calculateMistralCost, calculateModelCost, calculateOpenAICost, calculateOpenAiSttCost, calculateOpenAiTtsCost, clampReasoningEffort, cleanResponse, createCatalog, createVoiceAgent, describeEmptyTtsResponse, evaluateBudget, extractAnthropicTokenUsage, extractTokenUsageFromResponse$2 as extractAnthropicTokenUsageFromResponse, extractDeepSeekTokenUsage, extractTokenUsageFromResponse$6 as extractDeepSeekTokenUsageFromResponse, extractFirstJsonObject, extractGoogleTokenUsage, extractTokenUsageFromResponse$1 as extractGoogleTokenUsageFromResponse, extractGrokTokenUsage, extractTokenUsageFromResponse$4 as extractGrokTokenUsageFromResponse, extractKimiTokenUsage, extractTokenUsageFromResponse$5 as extractKimiTokenUsageFromResponse, extractMetaTokenUsage, extractTokenUsageFromResponse$3 as extractMetaTokenUsageFromResponse, extractMistralTokenUsage, extractTokenUsageFromResponse as extractMistralTokenUsageFromResponse, extractOpenAITokenUsage, extractTokenUsageFromResponse$7 as extractOpenAITokenUsageFromResponse, extractTokenUsage, extractUsageAndCalculateCost, firstRefusal, generateGoogleTtsAudio, generateOpenAiTtsAudio, generateSchemaInstructions, getModelConfigByApiName, getModelDisplayName, getModelProviderName, getModelTags, getProviderSignatureFields, isBudgetExceededError, isHybridThinkingModel, isInPeakWindow, isPeakBilling, isSafetyBlocked, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, normalizeTtsStyle, parseAndValidateLlmJson, pcmToWav, periodEnd, periodKey, safeValidateResponse, setBeforeAskHook, setLlmLogger, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
|
1866
|
+
export { type AIMessage, ANTHROPIC_REASONING_EFFORTS, API_KEY_CONSTANTS, AbstractAgent, type AgentActivityData, AgentFactory, type AgentLoggingConfig, type AnthropicReasoningEffort, type AnthropicTokenUsage, type ApiKeyMap, type BeforeAskHook, BotResponseError, BudgetController, type BudgetControllerOptions, BudgetExceededError, type BudgetLimit, type BudgetVerdict, CACHE_TIER_MARKER, ClaudeAgent, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_REQUEST_TIMEOUT_MS, type DeepSeekReasoningEffort, type DeepSeekTokenUsage, DeepSeekV2Agent, FUGU_REASONING_EFFORTS, FuguAgent, type FuguReasoningEffort, GEMINI_AUDIO_TOKENS_PER_SECOND, GEMINI_REASONING_EFFORTS, GLM_REASONING_EFFORTS, type GeminiReasoningEffort, GlmAgent, type GlmReasoningEffort, GoogleAgent, type GoogleSttOptions, type GoogleSttResult, type GoogleTokenUsage, type GoogleTtsAudioOptions, type GoogleTtsResult, GoogleVoiceAgent, Gpt5Agent, GrokAgent, type GrokTokenUsage, InMemorySpendStore, type JsonSchemaOptions, KIMI_REASONING_EFFORTS, KimiAgent, type KimiReasoningEffort, type KimiTokenUsage, type LLMModel, LLM_CONSTANTS, type LlmLogger, type LoggingConfig, MESSAGE_ROLE, META_REASONING_EFFORTS, MINIMAX_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, type MiniMaxReasoningEffort, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelTimeoutError, ModelUnavailableError, OPENAI_REASONING_EFFORTS, type OpenAIReasoningEffort, type OpenAITokenUsage, type OpenAiSttOptions, type OpenAiSttResult, type OpenAiTtsAudioOptions, type OpenAiTtsVoice, OpenAiVoiceAgent, type PeakPricing, type PricingUnit, type ProviderSchema, type TokenUsage as ProviderTokenUsage, type ProviderType, QwenAgent, REASONING_EFFORT_SCALE, type ReasoningEffort, SUPPORTED_VOICE_PROVIDERS, type SpeechRequest, type SpeechResult, type SpeechUsage, type SpendInput, type SpendKind, type SpendLedger, type SpendLedgers, type SpendStore, type SpendWindow, SupportedAiKeyNames, SupportedAiModels, type TokenPairUsage, type TokenUsage$1 as TokenUsage, type TranscriptionRequest, type TranscriptionResult, type TranscriptionUsage, VOICE_MODEL_CONSTANTS, VOICE_MODEL_PRICING, VOICE_PROVIDER_API_KEY, type VoiceAgent, VoiceAgentFactory, type VoiceModelPricing, type VoiceProvider, XAI_REASONING_EFFORTS, type XaiReasoningEffort, ZodSchemaConverter, applySpend, calculateAnthropicCost, calculateCost, calculateDeepSeekCost, calculateGeminiSttCost, calculateGeminiTtsCost, calculateGoogleCost, calculateGrokCost, calculateKimiCost, calculateMetaCost, calculateMistralCost, calculateModelCost, calculateOpenAICost, calculateOpenAiSttCost, calculateOpenAiTtsCost, clampReasoningEffort, cleanResponse, createCatalog, createVoiceAgent, describeEmptyTtsResponse, evaluateBudget, extractAnthropicTokenUsage, extractTokenUsageFromResponse$2 as extractAnthropicTokenUsageFromResponse, extractDeepSeekTokenUsage, extractTokenUsageFromResponse$6 as extractDeepSeekTokenUsageFromResponse, extractFirstJsonObject, extractGoogleTokenUsage, extractTokenUsageFromResponse$1 as extractGoogleTokenUsageFromResponse, extractGrokTokenUsage, extractTokenUsageFromResponse$4 as extractGrokTokenUsageFromResponse, extractKimiTokenUsage, extractTokenUsageFromResponse$5 as extractKimiTokenUsageFromResponse, extractMetaTokenUsage, extractTokenUsageFromResponse$3 as extractMetaTokenUsageFromResponse, extractMistralTokenUsage, extractTokenUsageFromResponse as extractMistralTokenUsageFromResponse, extractOpenAITokenUsage, extractTokenUsageFromResponse$7 as extractOpenAITokenUsageFromResponse, extractTokenUsage, extractUsageAndCalculateCost, firstRefusal, generateGoogleTtsAudio, generateOpenAiTtsAudio, generateSchemaInstructions, getModelConfigByApiName, getModelDisplayName, getModelProviderName, getModelTags, getProviderSignatureFields, isBudgetExceededError, isHybridThinkingModel, isInPeakWindow, isPeakBilling, isSafetyBlocked, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, normalizeTtsStyle, parseAndValidateLlmJson, pcmToWav, periodEnd, periodKey, safeValidateResponse, setBeforeAskHook, setLlmLogger, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMiniMaxEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ __export(src_exports, {
|
|
|
61
61
|
LLM_CONSTANTS: () => LLM_CONSTANTS,
|
|
62
62
|
MESSAGE_ROLE: () => MESSAGE_ROLE,
|
|
63
63
|
META_REASONING_EFFORTS: () => META_REASONING_EFFORTS,
|
|
64
|
+
MINIMAX_REASONING_EFFORTS: () => MINIMAX_REASONING_EFFORTS,
|
|
64
65
|
MISTRAL_REASONING_EFFORTS: () => MISTRAL_REASONING_EFFORTS,
|
|
65
66
|
MODEL_PRICING: () => MODEL_PRICING,
|
|
66
67
|
MetaAgent: () => MetaAgent,
|
|
@@ -167,6 +168,7 @@ __export(src_exports, {
|
|
|
167
168
|
toGlmEffort: () => toGlmEffort,
|
|
168
169
|
toKimiEffort: () => toKimiEffort,
|
|
169
170
|
toMetaEffort: () => toMetaEffort,
|
|
171
|
+
toMiniMaxEffort: () => toMiniMaxEffort,
|
|
170
172
|
toMistralEffort: () => toMistralEffort,
|
|
171
173
|
toOpenAIEffort: () => toOpenAIEffort,
|
|
172
174
|
toXaiEffort: () => toXaiEffort,
|
|
@@ -1445,20 +1447,29 @@ var SupportedAiModels = {
|
|
|
1445
1447
|
thinkingBudgetTokens: 1024,
|
|
1446
1448
|
tags: ["slow", "cheap"]
|
|
1447
1449
|
},
|
|
1448
|
-
// MiniMax M3 (OpenAI-compatible endpoint, 1M context).
|
|
1449
|
-
//
|
|
1450
|
-
//
|
|
1451
|
-
//
|
|
1452
|
-
//
|
|
1453
|
-
//
|
|
1454
|
-
// Temperature
|
|
1450
|
+
// MiniMax M3.1 Flash (OpenAI-compatible endpoint, 1M context). `minimax` repointed 2026-10-27
|
|
1451
|
+
// from MiniMax-M3 ($0.30/$1.20 after the permanent 50% off, 25s single-sample turn, 60s
|
|
1452
|
+
// timeouts in prod on 2026-10-25 and 10-27) to MiniMax-M3.1-Flash: half the price
|
|
1453
|
+
// ($0.15/$0.60), and the first MiniMax model with an effort dial — low|medium|high|xhigh|max,
|
|
1454
|
+
// provider default max, so it is pinned. Thinking is always on (`thinking: disabled` → 400),
|
|
1455
|
+
// thinking arrives in `reasoning_content` because the agent sends `reasoning_split: true`
|
|
1456
|
+
// (M3.1 rejects false). Temperature and top_p are documented as ignored ("not supported
|
|
1457
|
+
// yet", always 1 / 0.95), so the entry sets none and the agent sends none.
|
|
1458
|
+
// Live 2026-10-27 at medium: the all-providers sweep ran the schema ask in 3.1s, prose in
|
|
1459
|
+
// 1.7s and the 8-character scene (363 output tokens) in 2.4s — ~150 tok/s, the fastest
|
|
1460
|
+
// provider in the sweep that day (Kimi Highspeed's scene takes 8s); a 3.2k-token game
|
|
1461
|
+
// prompt with a two-sentence JSON reply took 1.9-2.1s at every effort level vs 3.5s for M3.
|
|
1462
|
+
// Tagged `fast` rather than `very-fast`: the sweep straddles the 3s line and production
|
|
1463
|
+
// turns carry 10k+ tokens of context. Launched 2026-09-27 as Token-Plan-only (the
|
|
1464
|
+
// 2026-10-02 probe got `unknown model` on the pay-as-you-go key); on the key since at
|
|
1465
|
+
// least 2026-10-27.
|
|
1455
1466
|
[LLM_CONSTANTS.MINIMAX]: {
|
|
1456
|
-
displayName: "MiniMax M3",
|
|
1457
|
-
modelApiName: "MiniMax-M3",
|
|
1467
|
+
displayName: "MiniMax M3.1 Flash",
|
|
1468
|
+
modelApiName: "MiniMax-M3.1-Flash",
|
|
1458
1469
|
apiKeyName: API_KEY_CONSTANTS.MINIMAX,
|
|
1459
1470
|
hasThinking: true,
|
|
1460
|
-
|
|
1461
|
-
tags: ["
|
|
1471
|
+
reasoningEffort: "medium",
|
|
1472
|
+
tags: ["fast", "cheap"]
|
|
1462
1473
|
},
|
|
1463
1474
|
// Meta Muse Spark 1.3 (added 2026-09-12) on Meta's own Model API — Standard tier, i.e.
|
|
1464
1475
|
// the private model id (the `-contributor` id is a quarter of the price but Meta trains
|
|
@@ -1775,18 +1786,14 @@ var MODEL_PRICING = {
|
|
|
1775
1786
|
outputPrice: 0.47,
|
|
1776
1787
|
cacheHitPrice: 0.016
|
|
1777
1788
|
},
|
|
1778
|
-
// MiniMax M3. Rates from platform.minimax.io/docs/guides/pricing-paygo (2026-
|
|
1779
|
-
//
|
|
1780
|
-
// (≥512 input tokens), hits reported in
|
|
1781
|
-
//
|
|
1789
|
+
// MiniMax M3.1 Flash. Rates from platform.minimax.io/docs/guides/pricing-paygo (2026-10-27,
|
|
1790
|
+
// USD): one tier across the 1M window (M3 had ≤512k / >512k tiers; the page lists none for
|
|
1791
|
+
// M3.1 Flash). Caching is automatic (≥512 input tokens), hits reported in
|
|
1792
|
+
// prompt_tokens_details.cached_tokens; no write fee listed.
|
|
1782
1793
|
[SupportedAiModels[LLM_CONSTANTS.MINIMAX].modelApiName]: {
|
|
1783
|
-
inputPrice: 0.
|
|
1784
|
-
outputPrice:
|
|
1785
|
-
cacheHitPrice: 0.
|
|
1786
|
-
extendedContextInputPrice: 0.6,
|
|
1787
|
-
extendedContextOutputPrice: 2.4,
|
|
1788
|
-
extendedContextCacheHitPrice: 0.12,
|
|
1789
|
-
extendedContextThresholdTokens: 512e3
|
|
1794
|
+
inputPrice: 0.15,
|
|
1795
|
+
outputPrice: 0.6,
|
|
1796
|
+
cacheHitPrice: 0.015
|
|
1790
1797
|
},
|
|
1791
1798
|
// Meta Muse Spark 1.3, Standard tier. Rates from ai.developer.meta.com/docs/pricing-rate-limits
|
|
1792
1799
|
// (2026-09-12): no long-context premium at any point of the 1M window; reasoning tokens bill
|
|
@@ -1816,7 +1823,7 @@ var HYBRID_THINKING_API_NAMES = /* @__PURE__ */ new Set([
|
|
|
1816
1823
|
// hybrid by the same definition: we force reasoning on, so they carry the multiplier.
|
|
1817
1824
|
SupportedAiModels[LLM_CONSTANTS.QWEN_MAX].modelApiName,
|
|
1818
1825
|
SupportedAiModels[LLM_CONSTANTS.QWEN_FLASH].modelApiName,
|
|
1819
|
-
|
|
1826
|
+
// MiniMax left the set 2026-10-27: M3.1 Flash cannot turn thinking off (M3 could).
|
|
1820
1827
|
// Mistral reasons only when asked (`reasoning_effort`), and we always ask — hybrid by the
|
|
1821
1828
|
// same definition as Qwen. Added 2026-09-18 when the Mistral entries went thinking-on.
|
|
1822
1829
|
SupportedAiModels[LLM_CONSTANTS.MISTRAL_SMALL].modelApiName
|
|
@@ -1889,6 +1896,7 @@ var META_REASONING_EFFORTS = ["minimal", "low", "medium", "high", "xhigh", "max"
|
|
|
1889
1896
|
var MISTRAL_REASONING_EFFORTS = ["high"];
|
|
1890
1897
|
var XAI_REASONING_EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
1891
1898
|
var KIMI_REASONING_EFFORTS = ["low", "high", "max"];
|
|
1899
|
+
var MINIMAX_REASONING_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
1892
1900
|
function clampReasoningEffort(effort, allowed) {
|
|
1893
1901
|
const rank = REASONING_EFFORT_SCALE.indexOf(effort);
|
|
1894
1902
|
let best = allowed[0];
|
|
@@ -1912,6 +1920,7 @@ var toFuguEffort = (effort) => clampReasoningEffort(effort, FUGU_REASONING_EFFOR
|
|
|
1912
1920
|
var toMistralEffort = (effort) => clampReasoningEffort(effort, MISTRAL_REASONING_EFFORTS);
|
|
1913
1921
|
var toXaiEffort = (effort) => clampReasoningEffort(effort, XAI_REASONING_EFFORTS);
|
|
1914
1922
|
var toKimiEffort = (effort) => clampReasoningEffort(effort, KIMI_REASONING_EFFORTS);
|
|
1923
|
+
var toMiniMaxEffort = (effort) => clampReasoningEffort(effort, MINIMAX_REASONING_EFFORTS);
|
|
1915
1924
|
|
|
1916
1925
|
// src/pricing/token-usage-utils.ts
|
|
1917
1926
|
function extractTokenUsage(response) {
|
|
@@ -5229,10 +5238,10 @@ var MiniMaxAgent = class extends AbstractAgent {
|
|
|
5229
5238
|
get defaultParams() {
|
|
5230
5239
|
return {
|
|
5231
5240
|
model: this.model,
|
|
5232
|
-
temperature: this.temperature,
|
|
5241
|
+
...this.temperature !== void 0 ? { temperature: this.temperature } : {},
|
|
5233
5242
|
stream: false,
|
|
5234
|
-
// MiniMax deprecates max_tokens in favor of max_completion_tokens (
|
|
5235
|
-
// far above anything a turn needs).
|
|
5243
|
+
// MiniMax deprecates max_tokens in favor of max_completion_tokens (the M-series max is
|
|
5244
|
+
// 512K, far above anything a turn needs).
|
|
5236
5245
|
max_completion_tokens: this.maxOutputTokens
|
|
5237
5246
|
};
|
|
5238
5247
|
}
|
|
@@ -5254,7 +5263,9 @@ var MiniMaxAgent = class extends AbstractAgent {
|
|
|
5254
5263
|
thinkingParams() {
|
|
5255
5264
|
return {
|
|
5256
5265
|
thinking: { type: this.enableThinking ? "adaptive" : "disabled" },
|
|
5257
|
-
reasoning_split: true
|
|
5266
|
+
reasoning_split: true,
|
|
5267
|
+
// Provider default is max; the catalog pins M3.1 Flash to medium. Older models ignore it.
|
|
5268
|
+
...this.enableThinking && this.reasoningEffort ? { reasoning_effort: toMiniMaxEffort(this.reasoningEffort) } : {}
|
|
5258
5269
|
};
|
|
5259
5270
|
}
|
|
5260
5271
|
convertToOpenAIMessages(messages) {
|
|
@@ -5667,7 +5678,7 @@ var AgentFactory = class {
|
|
|
5667
5678
|
case LLM_CONSTANTS.QWEN_MAX:
|
|
5668
5679
|
case LLM_CONSTANTS.QWEN_FLASH:
|
|
5669
5680
|
return new QwenAgent(name, instruction, model.modelApiName, key, model.temperature, shouldEnableThinking);
|
|
5670
|
-
// MiniMax M3 — adaptive thinking
|
|
5681
|
+
// MiniMax M3.1 Flash — always-on adaptive thinking, effort from the catalog
|
|
5671
5682
|
case LLM_CONSTANTS.MINIMAX:
|
|
5672
5683
|
return new MiniMaxAgent(name, instruction, model.modelApiName, key, model.temperature, shouldEnableThinking);
|
|
5673
5684
|
// Meta Muse Spark — Responses API with encrypted reasoning replay, effort from the catalog
|
|
@@ -5719,6 +5730,7 @@ var AgentFactory = class {
|
|
|
5719
5730
|
LLM_CONSTANTS,
|
|
5720
5731
|
MESSAGE_ROLE,
|
|
5721
5732
|
META_REASONING_EFFORTS,
|
|
5733
|
+
MINIMAX_REASONING_EFFORTS,
|
|
5722
5734
|
MISTRAL_REASONING_EFFORTS,
|
|
5723
5735
|
MODEL_PRICING,
|
|
5724
5736
|
MetaAgent,
|
|
@@ -5825,6 +5837,7 @@ var AgentFactory = class {
|
|
|
5825
5837
|
toGlmEffort,
|
|
5826
5838
|
toKimiEffort,
|
|
5827
5839
|
toMetaEffort,
|
|
5840
|
+
toMiniMaxEffort,
|
|
5828
5841
|
toMistralEffort,
|
|
5829
5842
|
toOpenAIEffort,
|
|
5830
5843
|
toXaiEffort,
|