merge with main.

This commit is contained in:
coohu committed 2025-05-27 17:19:33 +08:00
commit bee06fb46b
220 files changed
+44006 -8427

No files matched your search

+286 -49
View File
@@ -19,11 +19,13 @@ export type ApiProvider =
| "vscode-lm"
| "cline"
| "litellm"
| "nebius"
| "fireworks"
| "asksage"
| "xai"
| "sambanova"
| "shengsuanyun"
| "cerebras"
export interface ApiHandlerOptions {
apiModelId?: string
@@ -82,12 +84,14 @@ export interface ApiHandlerOptions {
azureApiVersion?: string
vsCodeLmModelSelector?: LanguageModelChatSelector
qwenApiLine?: string
nebiusApiKey?: string
asksageApiUrl?: string
asksageApiKey?: string
xaiApiKey?: string
thinkingBudgetTokens?: number
reasoningEffort?: string
sambanovaApiKey?: string
cerebrasApiKey?: string
requestTimeoutMs?: number
shengsuanyunApiKey?: string
shengsuanyunToken?: string
@@ -141,8 +145,29 @@ export interface OpenAiCompatibleModelInfo extends ModelInfo {
// Anthropic
// https://docs.anthropic.com/en/docs/about-claude/models // prices updated 2025-01-02
export type AnthropicModelId = keyof typeof anthropicModels
export const anthropicDefaultModelId: AnthropicModelId = "claude-3-7-sonnet-20250219"
export const anthropicDefaultModelId: AnthropicModelId = "claude-sonnet-4-20250514"
export const anthropicModels = {
"claude-sonnet-4-20250514": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
},
"claude-opus-4-20250514": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
},
"claude-3-7-sonnet-20250219": {
maxTokens: 8192,
contextWindow: 200_000,
@@ -200,8 +225,28 @@ export const anthropicModels = {
// AWS Bedrock
// https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html
export type BedrockModelId = keyof typeof bedrockModels
export const bedrockDefaultModelId: BedrockModelId = "anthropic.claude-3-7-sonnet-20250219-v1:0"
export const bedrockDefaultModelId: BedrockModelId = "anthropic.claude-sonnet-4-20250514-v1:0"
export const bedrockModels = {
"anthropic.claude-sonnet-4-20250514-v1:0": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
},
"anthropic.claude-opus-4-20250514-v1:0": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
},
"amazon.nova-premier-v1:0": {
maxTokens: 10_000,
contextWindow: 1_000_000,
@@ -320,7 +365,7 @@ export const bedrockModels = {
// OpenRouter
// https://openrouter.ai/models?order=newest&supported_parameters=tools
export const openRouterDefaultModelId = "anthropic/claude-3.7-sonnet" // will always exist in openRouterModels
export const openRouterDefaultModelId = "anthropic/claude-sonnet-4" // will always exist in openRouterModels
export const openRouterDefaultModelInfo: ModelInfo = {
maxTokens: 8192,
contextWindow: 200_000,
@@ -332,14 +377,34 @@ export const openRouterDefaultModelInfo: ModelInfo = {
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
description:
"Claude 3.7 Sonnet is an advanced large language model with improved reasoning, coding, and problem-solving capabilities. It introduces a hybrid reasoning approach, allowing users to choose between rapid responses and extended, step-by-step processing for complex tasks. The model demonstrates notable improvements in coding, particularly in front-end development and full-stack updates, and excels in agentic workflows, where it can autonomously navigate multi-step processes. \n\nClaude 3.7 Sonnet maintains performance parity with its predecessor in standard mode while offering an extended reasoning mode for enhanced accuracy in math, coding, and instruction-following tasks.\n\nRead more at the [blog post here](https://www.anthropic.com/news/claude-3-7-sonnet)",
"Claude 4 Sonnet is an advanced large language model with improved reasoning, coding, and problem-solving capabilities. It introduces a hybrid reasoning approach, allowing users to choose between rapid responses and extended, step-by-step processing for complex tasks. The model demonstrates notable improvements in coding, particularly in front-end development and full-stack updates, and excels in agentic workflows, where it can autonomously navigate multi-step processes. \n\nClaude 4 Sonnet maintains performance parity with its predecessor in standard mode while offering an extended reasoning mode for enhanced accuracy in math, coding, and instruction-following tasks.\n\nRead more at the [blog post here](https://www.anthropic.com/news/claude-4)",
}
// Vertex AI
// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude
// https://cloud.google.com/vertex-ai/generative-ai/pricing#partner-models
export type VertexModelId = keyof typeof vertexModels
export const vertexDefaultModelId: VertexModelId = "claude-3-7-sonnet@20250219"
export const vertexDefaultModelId: VertexModelId = "claude-sonnet-4@20250514"
export const vertexModels = {
"claude-sonnet-4@20250514": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
},
"claude-opus-4@20250514": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
},
"claude-3-7-sonnet@20250219": {
maxTokens: 8192,
contextWindow: 200_000,
@@ -488,6 +553,19 @@ export const vertexModels = {
outputPrice: 3.5,
},
},
"gemini-2.5-flash-preview-05-20": {
maxTokens: 65536,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: false,
supportsGlobalEndpoint: true,
inputPrice: 0.15,
outputPrice: 0.6,
thinkingConfig: {
maxBudget: 24576,
outputPrice: 3.5,
},
},
"gemini-2.0-flash-thinking-exp-01-21": {
maxTokens: 65_536,
contextWindow: 1_048_576,
@@ -606,6 +684,18 @@ export const geminiModels = {
},
],
},
"gemini-2.5-flash-preview-05-20": {
maxTokens: 65536,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 0.15,
outputPrice: 0.6,
thinkingConfig: {
maxBudget: 24576,
outputPrice: 3.5,
},
},
"gemini-2.5-flash-preview-04-17": {
maxTokens: 65536,
contextWindow: 1_048_576,
@@ -1372,7 +1462,7 @@ export const doubaoModels = {
// Mistral
// https://docs.mistral.ai/getting-started/models/models_overview/
export type MistralModelId = keyof typeof mistralModels
export const mistralDefaultModelId: MistralModelId = "codestral-2501"
export const mistralDefaultModelId: MistralModelId = "devstral-small-2505"
export const mistralModels = {
"mistral-large-2411": {
maxTokens: 131_000,
@@ -1462,6 +1552,14 @@ export const mistralModels = {
inputPrice: 0.3,
outputPrice: 0.9,
},
"devstral-small-2505": {
maxTokens: 128_000,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.1,
outputPrice: 0.3,
},
} as const satisfies Record<string, ModelInfo>
// LiteLLM
@@ -1532,6 +1630,93 @@ export const askSageModels = {
},
}
// Nebius AI Studio
// https://docs.nebius.com/studio/inference/models
export const nebiusModels = {
"deepseek-ai/DeepSeek-V3": {
maxTokens: 32_000,
contextWindow: 96_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.5,
outputPrice: 1.5,
},
"deepseek-ai/DeepSeek-V3-0324-fast": {
maxTokens: 128_000,
contextWindow: 128_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 2,
outputPrice: 6,
},
"deepseek-ai/DeepSeek-R1": {
maxTokens: 32_000,
contextWindow: 96_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.8,
outputPrice: 2.4,
},
"deepseek-ai/DeepSeek-R1-fast": {
maxTokens: 32_000,
contextWindow: 96_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 2,
outputPrice: 6,
},
"meta-llama/Llama-3.3-70B-Instruct-fast": {
maxTokens: 32_000,
contextWindow: 96_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.25,
outputPrice: 0.75,
},
"Qwen/Qwen2.5-32B-Instruct-fast": {
maxTokens: 8_192,
contextWindow: 32_768,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.13,
outputPrice: 0.4,
},
"Qwen/Qwen2.5-Coder-32B-Instruct-fast": {
maxTokens: 128_000,
contextWindow: 128_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.1,
outputPrice: 0.3,
},
"Qwen/Qwen3-4B-fast": {
maxTokens: 32_000,
contextWindow: 41_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.08,
outputPrice: 0.24,
},
"Qwen/Qwen3-30B-A3B-fast": {
maxTokens: 32_000,
contextWindow: 41_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.3,
outputPrice: 0.9,
},
"Qwen/Qwen3-235B-A22B": {
maxTokens: 32_000,
contextWindow: 41_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.2,
outputPrice: 0.6,
},
} as const satisfies Record<string, ModelInfo>
export type NebiusModelId = keyof typeof nebiusModels
export const nebiusDefaultModelId = "Qwen/Qwen2.5-32B-Instruct-fast" satisfies NebiusModelId
// X AI
// https://docs.x.ai/docs/api-reference
export type XAIModelId = keyof typeof xaiModels
@@ -1652,85 +1837,85 @@ export const xaiModels = {
export type SambanovaModelId = keyof typeof sambanovaModels
export const sambanovaDefaultModelId: SambanovaModelId = "Meta-Llama-3.3-70B-Instruct"
export const sambanovaModels = {
"Llama-4-Maverick-17B-128E-Instruct": {
maxTokens: 4096,
contextWindow: 8_000,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 0.63,
outputPrice: 1.8,
},
"Llama-4-Scout-17B-16E-Instruct": {
maxTokens: 4096,
contextWindow: 8_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.4,
outputPrice: 0.7,
},
"Meta-Llama-3.3-70B-Instruct": {
maxTokens: 4096,
contextWindow: 128_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
inputPrice: 0.6,
outputPrice: 1.2,
},
"DeepSeek-R1-Distill-Llama-70B": {
maxTokens: 4096,
contextWindow: 32_000,
contextWindow: 128_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
inputPrice: 0.7,
outputPrice: 1.4,
},
"Llama-3.1-Swallow-70B-Instruct-v0.3": {
"DeepSeek-R1": {
maxTokens: 4096,
contextWindow: 16_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
},
"Llama-3.1-Swallow-8B-Instruct-v0.3": {
maxTokens: 4096,
contextWindow: 16_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
inputPrice: 5.0,
outputPrice: 7.0,
},
"Meta-Llama-3.1-405B-Instruct": {
maxTokens: 4096,
contextWindow: 16_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
inputPrice: 5.0,
outputPrice: 10.0,
},
"Meta-Llama-3.1-8B-Instruct": {
maxTokens: 4096,
contextWindow: 16_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
inputPrice: 0.1,
outputPrice: 0.2,
},
"Meta-Llama-3.2-1B-Instruct": {
maxTokens: 4096,
contextWindow: 16_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
inputPrice: 0.04,
outputPrice: 0.08,
},
"Qwen2.5-72B-Instruct": {
"Meta-Llama-3.2-3B-Instruct": {
maxTokens: 4096,
contextWindow: 8_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.08,
outputPrice: 0.16,
},
"Qwen3-32B": {
maxTokens: 4096,
contextWindow: 16_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
},
"Qwen2.5-Coder-32B-Instruct": {
maxTokens: 4096,
contextWindow: 16_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
},
"QwQ-32B-Preview": {
maxTokens: 4096,
contextWindow: 16_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
inputPrice: 0.4,
outputPrice: 0.8,
},
"QwQ-32B": {
maxTokens: 4096,
@@ -1742,11 +1927,63 @@ export const sambanovaModels = {
},
"DeepSeek-V3-0324": {
maxTokens: 4096,
contextWindow: 8_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 3.0,
outputPrice: 4.5,
},
} as const satisfies Record<string, ModelInfo>
// Cerebras
// https://inference-docs.cerebras.ai/api-reference/models
export type CerebrasModelId = keyof typeof cerebrasModels
export const cerebrasDefaultModelId: CerebrasModelId = "llama3.1-8b"
export const cerebrasModels = {
"llama-4-scout-17b-16e-instruct": {
maxTokens: 8192,
contextWindow: 8192,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 1.0,
outputPrice: 1.5,
inputPrice: 0,
outputPrice: 0,
description: "Fast inference model with ~2700 tokens/s",
},
"llama3.1-8b": {
maxTokens: 8192,
contextWindow: 8192,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
description: "Efficient model with ~2100 tokens/s",
},
"llama-3.3-70b": {
maxTokens: 8192,
contextWindow: 8192,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
description: "Powerful model with ~2600 tokens/s",
},
"qwen-3-32b": {
maxTokens: 16382,
contextWindow: 16382,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
description: "SOTA coding performance with ~2500 tokens/s",
},
"deepseek-r1-distill-llama-70b": {
maxTokens: 8192,
contextWindow: 8192,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
description: "Advanced reasoning model with ~2300 tokens/s (private preview)",
},
} as const satisfies Record<string, ModelInfo>