fix shengsuanyun and requesty models get function.

This commit is contained in:
coohu committed 2025-05-14 14:51:50 +08:00
commit 005feaa3f4
287 files changed
+51016 -4961

No files matched your search

+154 -48
View File
@@ -19,6 +19,7 @@ export type ApiProvider =
| "vscode-lm"
| "cline"
| "litellm"
| "fireworks"
| "asksage"
| "xai"
| "sambanova"
@@ -34,6 +35,7 @@ export interface ApiHandlerOptions {
liteLlmApiKey?: string
liteLlmUsePromptCache?: boolean
openAiHeaders?: Record<string, string> // Custom headers for OpenAI requests
liteLlmModelInfo?: LiteLLMModelInfo
anthropicBaseUrl?: string
openRouterApiKey?: string
openRouterModelId?: string
@@ -48,6 +50,8 @@ export interface ApiHandlerOptions {
awsUseProfile?: boolean
awsProfile?: string
awsBedrockEndpoint?: string
awsBedrockCustomSelected?: boolean
awsBedrockCustomModelBaseId?: BedrockModelId
vertexProjectId?: string
vertexRegion?: string
openAiBaseUrl?: string
@@ -68,6 +72,10 @@ export interface ApiHandlerOptions {
requestyModelInfo?: ModelInfo
togetherApiKey?: string
togetherModelId?: string
fireworksApiKey?: string
fireworksModelId?: string
fireworksModelMaxCompletionTokens?: number
fireworksModelMaxTokens?: number
qwenApiKey?: string
doubaoApiKey?: string
mistralApiKey?: string
@@ -84,8 +92,8 @@ export interface ApiHandlerOptions {
requestTimeoutMs?: number
shengsuanyunApiKey?: string
shengsuanyunToken?: string
ssyModelId?: string
ssyModelInfo?: ModelInfo
shengSuanYunModelId?: string
shengSuanYunModelInfo?: ModelInfo
}
export type ApiConfiguration = ApiHandlerOptions & {
@@ -106,9 +114,7 @@ export interface ModelInfo {
supportsImages?: boolean
supportsPromptCache: boolean // this value is hardcoded for now
inputPrice?: number // Keep for non-tiered input models
inputPriceTiers?: PriceTier[] // Add for tiered input pricing
outputPrice?: number // Keep for non-tiered output models
outputPriceTiers?: PriceTier[] // Add for tiered output pricing
thinkingConfig?: {
maxBudget?: number // Max allowed thinking budget tokens
outputPrice?: number // Output price per million tokens when budget > 0
@@ -117,6 +123,13 @@ export interface ModelInfo {
cacheWritesPrice?: number
cacheReadsPrice?: number
description?: string
tiers?: {
contextWindow: number
inputPrice?: number
outputPrice?: number
cacheWritesPrice?: number
cacheReadsPrice?: number
}[]
}
export interface OpenAiCompatibleModelInfo extends ModelInfo {
@@ -188,32 +201,47 @@ export const anthropicModels = {
export type BedrockModelId = keyof typeof bedrockModels
export const bedrockDefaultModelId: BedrockModelId = "anthropic.claude-3-7-sonnet-20250219-v1:0"
export const bedrockModels = {
"amazon.nova-premier-v1:0": {
maxTokens: 10_000,
contextWindow: 1_000_000,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 2.5,
outputPrice: 12.5,
},
"amazon.nova-pro-v1:0": {
maxTokens: 5000,
contextWindow: 300_000,
supportsImages: true,
supportsPromptCache: false,
supportsPromptCache: true,
inputPrice: 0.8,
outputPrice: 3.2,
// cacheWritesPrice: 3.2, // not written
cacheReadsPrice: 0.2,
},
"amazon.nova-lite-v1:0": {
maxTokens: 5000,
contextWindow: 300_000,
supportsImages: true,
supportsPromptCache: false,
supportsPromptCache: true,
inputPrice: 0.06,
outputPrice: 0.24,
// cacheWritesPrice: 0.24, // not written
cacheReadsPrice: 0.015,
},
"amazon.nova-micro-v1:0": {
maxTokens: 5000,
contextWindow: 128_000,
supportsImages: false,
supportsPromptCache: false,
supportsPromptCache: true,
inputPrice: 0.035,
outputPrice: 0.14,
// cacheWritesPrice: 0.14, // not written
cacheReadsPrice: 0.00875,
},
"anthropic.claude-3-7-sonnet-20250219-v1:0": {
maxTokens: 8192,
@@ -240,10 +268,10 @@ export const bedrockModels = {
"anthropic.claude-3-5-haiku-20241022-v1:0": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: false,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 1.0,
outputPrice: 5.0,
inputPrice: 0.8,
outputPrice: 4.0,
cacheWritesPrice: 1.0,
cacheReadsPrice: 0.08,
},
@@ -315,10 +343,15 @@ export const vertexModels = {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
thinkingConfig: {
maxBudget: 64000,
outputPrice: 15.0,
},
},
"claude-3-5-sonnet-v2@20241022": {
maxTokens: 8192,
@@ -372,12 +405,22 @@ export const vertexModels = {
cacheReadsPrice: 0.03,
},
"gemini-2.0-flash-001": {
maxTokens: 8192,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 0.15,
outputPrice: 0.6,
cacheWritesPrice: 1.0,
cacheReadsPrice: 0.025,
},
"gemini-2.0-flash-lite-001": {
maxTokens: 8192,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 0.1,
outputPrice: 0.4,
inputPrice: 0.075,
outputPrice: 0.3,
},
"gemini-2.0-flash-thinking-exp-1219": {
maxTokens: 8192,
@@ -403,20 +446,27 @@ export const vertexModels = {
inputPrice: 0,
outputPrice: 0,
},
"gemini-2.5-pro-preview-03-25": {
"gemini-2.5-pro-preview-05-06": {
maxTokens: 65536,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: false,
// inputPrice: 1.25, // Removed
// outputPrice: 10, // Removed
inputPriceTiers: [
{ tokenLimit: 200000, price: 1.25 }, // Input price for <= 200k input tokens
{ tokenLimit: Infinity, price: 2.5 }, // Input price for > 200k input tokens
],
outputPriceTiers: [
{ tokenLimit: 200000, price: 10.0 }, // Output price for <= 200k input tokens
{ tokenLimit: Infinity, price: 15.0 }, // Output price for > 200k input tokens
supportsPromptCache: true,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.31,
tiers: [
{
contextWindow: 200000,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.31,
},
{
contextWindow: Infinity,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.625,
},
],
},
"gemini-2.5-flash-preview-04-17": {
@@ -451,9 +501,25 @@ export const vertexModels = {
maxTokens: 8192,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
supportsPromptCache: true,
inputPrice: 0.15,
outputPrice: 0.6,
cacheWritesPrice: 1.0,
cacheReadsPrice: 0.0375,
tiers: [
{
contextWindow: 128000,
inputPrice: 0.075,
outputPrice: 0.3,
cacheReadsPrice: 0.01875,
},
{
contextWindow: Infinity,
inputPrice: 0.15,
outputPrice: 0.6,
cacheReadsPrice: 0.0375,
},
],
},
"gemini-1.5-flash-exp-0827": {
maxTokens: 8192,
@@ -476,8 +542,8 @@ export const vertexModels = {
contextWindow: 2_097_152,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
inputPrice: 1.25,
outputPrice: 5,
},
"gemini-1.5-pro-exp-0827": {
maxTokens: 8192,
@@ -513,18 +579,27 @@ export const geminiModels = {
inputPrice: 0,
outputPrice: 0,
},
"gemini-2.5-pro-preview-03-25": {
"gemini-2.5-pro-preview-05-06": {
maxTokens: 65536,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: false,
inputPriceTiers: [
{ tokenLimit: 200000, price: 1.25 }, // Input price for <= 200k input tokens
{ tokenLimit: Infinity, price: 2.5 }, // Input price for > 200k input tokens
],
outputPriceTiers: [
{ tokenLimit: 200000, price: 10.0 }, // Output price for <= 200k input tokens
{ tokenLimit: Infinity, price: 15.0 }, // Output price for > 200k input tokens
supportsPromptCache: true,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.31,
tiers: [
{
contextWindow: 200000,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.31,
},
{
contextWindow: Infinity,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.625,
},
],
},
"gemini-2.5-flash-preview-04-17": {
@@ -543,9 +618,11 @@ export const geminiModels = {
maxTokens: 8192,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
supportsPromptCache: true,
inputPrice: 0.1,
outputPrice: 0.4,
cacheReadsPrice: 0.025,
cacheWritesPrice: 1.0,
},
"gemini-2.0-flash-lite-preview-02-05": {
maxTokens: 8192,
@@ -591,9 +668,25 @@ export const geminiModels = {
maxTokens: 8192,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 0,
outputPrice: 0,
supportsPromptCache: true,
inputPrice: 0.15, // Default price (highest tier)
outputPrice: 0.6, // Default price (highest tier)
cacheReadsPrice: 0.0375,
cacheWritesPrice: 1.0,
tiers: [
{
contextWindow: 128000,
inputPrice: 0.075,
outputPrice: 0.3,
cacheReadsPrice: 0.01875,
},
{
contextWindow: Infinity,
inputPrice: 0.15,
outputPrice: 0.6,
cacheReadsPrice: 0.0375,
},
],
},
"gemini-1.5-flash-exp-0827": {
maxTokens: 8192,
@@ -1317,6 +1410,14 @@ export const mistralModels = {
inputPrice: 0.1,
outputPrice: 0.3,
},
"mistral-medium-latest": {
maxTokens: 128_000,
contextWindow: 128_000,
supportsImages: true,
supportsPromptCache: false,
inputPrice: 0.4,
outputPrice: 2.0,
},
"mistral-small-2501": {
maxTokens: 32_000,
contextWindow: 32_000,
@@ -1362,8 +1463,12 @@ export const mistralModels = {
// LiteLLM
// https://docs.litellm.ai/docs/
export type LiteLLMModelId = string
export const liteLlmDefaultModelId = "gpt-3.5-turbo"
export const liteLlmModelInfoSaneDefaults: ModelInfo = {
export const liteLlmDefaultModelId = "anthropic/claude-3-7-sonnet-20250219"
export interface LiteLLMModelInfo extends ModelInfo {
temperature?: number
}
export const liteLlmModelInfoSaneDefaults: LiteLLMModelInfo = {
maxTokens: -1,
contextWindow: 128_000,
supportsImages: true,
@@ -1372,6 +1477,7 @@ export const liteLlmModelInfoSaneDefaults: ModelInfo = {
outputPrice: 0,
cacheWritesPrice: 0,
cacheReadsPrice: 0,
temperature: 0,
}
// AskSage Models
@@ -1658,8 +1764,8 @@ export const requestyDefaultModelInfo: ModelInfo = {
// ShengSuanYun
// https://router.shengsuanyun.com/model
export const ssyDefaultModelId: string = "anthropic/claude-3.7-sonnet"
export const ssyDefaultModelInfo: ModelInfo = {
export const shengSuanYunDefaultModelId: string = "anthropic/claude-3.7-sonnet"
export const shengSuanYunDefaultModelInfo: ModelInfo = {
maxTokens: 128_000,
contextWindow: 200_000,
supportsImages: true,