@earendil-works/pi-ai 0.80.6 → 0.80.8
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/README.md +79 -24
- package/dist/api/anthropic-messages.d.ts.map +1 -1
- package/dist/api/anthropic-messages.js +95 -46
- package/dist/api/anthropic-messages.js.map +1 -1
- package/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/dist/api/bedrock-converse-stream.js +14 -7
- package/dist/api/bedrock-converse-stream.js.map +1 -1
- package/dist/api/lazy.d.ts.map +1 -1
- package/dist/api/lazy.js +9 -10
- package/dist/api/lazy.js.map +1 -1
- package/dist/api/openai-codex-responses.d.ts +1 -0
- package/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/dist/api/openai-codex-responses.js +9 -5
- package/dist/api/openai-codex-responses.js.map +1 -1
- package/dist/api/openai-completions.d.ts.map +1 -1
- package/dist/api/openai-completions.js +12 -3
- package/dist/api/openai-completions.js.map +1 -1
- package/dist/api/openai-responses-shared.d.ts +3 -1
- package/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/dist/api/openai-responses-shared.js +51 -0
- package/dist/api/openai-responses-shared.js.map +1 -1
- package/dist/api/openai-responses.d.ts +1 -0
- package/dist/api/openai-responses.d.ts.map +1 -1
- package/dist/api/openai-responses.js +26 -8
- package/dist/api/openai-responses.js.map +1 -1
- package/dist/api/pi-messages.d.ts +97 -0
- package/dist/api/pi-messages.d.ts.map +1 -0
- package/dist/api/pi-messages.js +309 -0
- package/dist/api/pi-messages.js.map +1 -0
- package/dist/api/pi-messages.lazy.d.ts +3 -0
- package/dist/api/pi-messages.lazy.d.ts.map +1 -0
- package/dist/api/pi-messages.lazy.js +3 -0
- package/dist/api/pi-messages.lazy.js.map +1 -0
- package/dist/auth/credential-store.d.ts +2 -1
- package/dist/auth/credential-store.d.ts.map +1 -1
- package/dist/auth/credential-store.js +3 -0
- package/dist/auth/credential-store.js.map +1 -1
- package/dist/auth/helpers.d.ts.map +1 -1
- package/dist/auth/helpers.js +3 -3
- package/dist/auth/helpers.js.map +1 -1
- package/dist/auth/oauth/anthropic.d.ts +9 -0
- package/dist/auth/oauth/anthropic.d.ts.map +1 -0
- package/dist/{utils → auth}/oauth/anthropic.js +51 -116
- package/dist/auth/oauth/anthropic.js.map +1 -0
- package/dist/auth/oauth/device-code.d.ts.map +1 -0
- package/dist/auth/oauth/device-code.js.map +1 -0
- package/dist/auth/oauth/github-copilot.d.ts +6 -0
- package/dist/auth/oauth/github-copilot.d.ts.map +1 -0
- package/dist/{utils → auth}/oauth/github-copilot.js +18 -77
- package/dist/auth/oauth/github-copilot.js.map +1 -0
- package/dist/auth/oauth/load.d.ts +23 -0
- package/dist/auth/oauth/load.d.ts.map +1 -0
- package/dist/auth/oauth/load.js +49 -0
- package/dist/auth/oauth/load.js.map +1 -0
- package/dist/auth/oauth/oauth-page.d.ts.map +1 -0
- package/dist/auth/oauth/oauth-page.js.map +1 -0
- package/dist/auth/oauth/openai-codex.d.ts +9 -0
- package/dist/auth/oauth/openai-codex.d.ts.map +1 -0
- package/dist/{utils → auth}/oauth/openai-codex.js +61 -155
- package/dist/auth/oauth/openai-codex.js.map +1 -0
- package/dist/auth/oauth/pkce.d.ts.map +1 -0
- package/dist/auth/oauth/pkce.js.map +1 -0
- package/dist/auth/oauth/radius.d.ts +16 -0
- package/dist/auth/oauth/radius.d.ts.map +1 -0
- package/dist/auth/oauth/radius.js +318 -0
- package/dist/auth/oauth/radius.js.map +1 -0
- package/dist/auth/oauth/xai.d.ts +6 -0
- package/dist/auth/oauth/xai.d.ts.map +1 -0
- package/dist/auth/oauth/xai.js +184 -0
- package/dist/auth/oauth/xai.js.map +1 -0
- package/dist/auth/resolve.d.ts +2 -4
- package/dist/auth/resolve.d.ts.map +1 -1
- package/dist/auth/resolve.js +9 -7
- package/dist/auth/resolve.js.map +1 -1
- package/dist/auth/types.d.ts +47 -10
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/bun-oauth.d.ts +3 -0
- package/dist/bun-oauth.d.ts.map +1 -0
- package/dist/bun-oauth.js +17 -0
- package/dist/bun-oauth.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +58 -76
- package/dist/cli.js.map +1 -1
- package/dist/compat/extension-oauth-types.d.ts +39 -0
- package/dist/compat/extension-oauth-types.d.ts.map +1 -0
- package/dist/compat/extension-oauth-types.js +2 -0
- package/dist/compat/extension-oauth-types.js.map +1 -0
- package/dist/compat.d.ts +2 -0
- package/dist/compat.d.ts.map +1 -1
- package/dist/compat.js +25 -8
- package/dist/compat.js.map +1 -1
- package/dist/env-api-keys.d.ts.map +1 -1
- package/dist/env-api-keys.js +1 -0
- package/dist/env-api-keys.js.map +1 -1
- package/dist/images-models.d.ts +4 -2
- package/dist/images-models.d.ts.map +1 -1
- package/dist/images-models.js +5 -4
- package/dist/images-models.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/models-store.d.ts +25 -0
- package/dist/models-store.d.ts.map +1 -0
- package/dist/models-store.js +14 -0
- package/dist/models-store.js.map +1 -0
- package/dist/models.d.ts +66 -30
- package/dist/models.d.ts.map +1 -1
- package/dist/models.generated.d.ts +570 -163
- package/dist/models.generated.d.ts.map +1 -1
- package/dist/models.js +214 -29
- package/dist/models.js.map +1 -1
- package/dist/oauth.d.ts +2 -1
- package/dist/oauth.d.ts.map +1 -1
- package/dist/oauth.js +1 -1
- package/dist/oauth.js.map +1 -1
- package/dist/providers/all.d.ts +11 -6
- package/dist/providers/all.d.ts.map +1 -1
- package/dist/providers/all.js +3 -0
- package/dist/providers/all.js.map +1 -1
- package/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/dist/providers/amazon-bedrock.js +51 -6
- package/dist/providers/amazon-bedrock.js.map +1 -1
- package/dist/providers/amazon-bedrock.models.d.ts +60 -0
- package/dist/providers/amazon-bedrock.models.d.ts.map +1 -1
- package/dist/providers/amazon-bedrock.models.js +54 -0
- package/dist/providers/amazon-bedrock.models.js.map +1 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/azure-openai-responses.models.d.ts +17 -0
- package/dist/providers/azure-openai-responses.models.d.ts.map +1 -1
- package/dist/providers/azure-openai-responses.models.js +17 -0
- package/dist/providers/azure-openai-responses.models.js.map +1 -1
- package/dist/providers/cerebras.models.d.ts.map +1 -1
- package/dist/providers/cerebras.models.js +1 -1
- package/dist/providers/cerebras.models.js.map +1 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
- package/dist/providers/cloudflare-ai-gateway.js +4 -3
- package/dist/providers/cloudflare-ai-gateway.js.map +1 -1
- package/dist/providers/cloudflare-ai-gateway.models.d.ts +92 -0
- package/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -1
- package/dist/providers/cloudflare-ai-gateway.models.js +72 -0
- package/dist/providers/cloudflare-ai-gateway.models.js.map +1 -1
- package/dist/providers/cloudflare-auth.d.ts.map +1 -1
- package/dist/providers/cloudflare-auth.js +22 -26
- package/dist/providers/cloudflare-auth.js.map +1 -1
- package/dist/providers/cloudflare-stream.d.ts +8 -0
- package/dist/providers/cloudflare-stream.d.ts.map +1 -0
- package/dist/providers/cloudflare-stream.js +21 -0
- package/dist/providers/cloudflare-stream.js.map +1 -0
- package/dist/providers/cloudflare-workers-ai.d.ts.map +1 -1
- package/dist/providers/cloudflare-workers-ai.js +2 -1
- package/dist/providers/cloudflare-workers-ai.js.map +1 -1
- package/dist/providers/github-copilot.d.ts.map +1 -1
- package/dist/providers/github-copilot.js +11 -1
- package/dist/providers/github-copilot.js.map +1 -1
- package/dist/providers/github-copilot.models.d.ts +93 -6
- package/dist/providers/github-copilot.models.d.ts.map +1 -1
- package/dist/providers/github-copilot.models.js +60 -3
- package/dist/providers/github-copilot.models.js.map +1 -1
- package/dist/providers/google-vertex.d.ts.map +1 -1
- package/dist/providers/google-vertex.js +56 -5
- package/dist/providers/google-vertex.js.map +1 -1
- package/dist/providers/kimi-coding.models.d.ts +20 -0
- package/dist/providers/kimi-coding.models.d.ts.map +1 -1
- package/dist/providers/kimi-coding.models.js +18 -0
- package/dist/providers/kimi-coding.models.js.map +1 -1
- package/dist/providers/openai-codex.d.ts.map +1 -1
- package/dist/providers/openai-codex.js +1 -1
- package/dist/providers/openai-codex.js.map +1 -1
- package/dist/providers/openai-codex.models.d.ts +18 -0
- package/dist/providers/openai-codex.models.d.ts.map +1 -1
- package/dist/providers/openai-codex.models.js +6 -0
- package/dist/providers/openai-codex.models.js.map +1 -1
- package/dist/providers/openai.models.d.ts +38 -0
- package/dist/providers/openai.models.d.ts.map +1 -1
- package/dist/providers/openai.models.js +24 -0
- package/dist/providers/openai.models.js.map +1 -1
- package/dist/providers/opencode.models.d.ts +123 -0
- package/dist/providers/opencode.models.d.ts.map +1 -1
- package/dist/providers/opencode.models.js +74 -1
- package/dist/providers/opencode.models.js.map +1 -1
- package/dist/providers/openrouter.models.d.ts +28 -43
- package/dist/providers/openrouter.models.d.ts.map +1 -1
- package/dist/providers/openrouter.models.js +186 -203
- package/dist/providers/openrouter.models.js.map +1 -1
- package/dist/providers/radius-config.d.ts +26 -0
- package/dist/providers/radius-config.d.ts.map +1 -0
- package/dist/providers/radius-config.js +59 -0
- package/dist/providers/radius-config.js.map +1 -0
- package/dist/providers/radius.d.ts +9 -0
- package/dist/providers/radius.d.ts.map +1 -0
- package/dist/providers/radius.js +54 -0
- package/dist/providers/radius.js.map +1 -0
- package/dist/providers/vercel-ai-gateway.models.d.ts +71 -106
- package/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
- package/dist/providers/vercel-ai-gateway.models.js +89 -136
- package/dist/providers/vercel-ai-gateway.models.js.map +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.d.ts.map +1 -1
- package/dist/providers/xai.js +11 -3
- package/dist/providers/xai.js.map +1 -1
- package/dist/providers/xai.models.d.ts +6 -4
- package/dist/providers/xai.models.d.ts.map +1 -1
- package/dist/providers/xai.models.js +3 -2
- package/dist/providers/xai.models.js.map +1 -1
- package/dist/types.d.ts +25 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/deferred-tools.d.ts +9 -0
- package/dist/utils/deferred-tools.d.ts.map +1 -0
- package/dist/utils/deferred-tools.js +36 -0
- package/dist/utils/deferred-tools.js.map +1 -0
- package/dist/utils/estimate.d.ts.map +1 -1
- package/dist/utils/estimate.js +18 -5
- package/dist/utils/estimate.js.map +1 -1
- package/package.json +6 -1
- package/dist/utils/oauth/anthropic.d.ts +0 -27
- package/dist/utils/oauth/anthropic.d.ts.map +0 -1
- package/dist/utils/oauth/anthropic.js.map +0 -1
- package/dist/utils/oauth/device-code.d.ts.map +0 -1
- package/dist/utils/oauth/device-code.js.map +0 -1
- package/dist/utils/oauth/github-copilot.d.ts +0 -32
- package/dist/utils/oauth/github-copilot.d.ts.map +0 -1
- package/dist/utils/oauth/github-copilot.js.map +0 -1
- package/dist/utils/oauth/index.d.ts +0 -58
- package/dist/utils/oauth/index.d.ts.map +0 -1
- package/dist/utils/oauth/index.js +0 -122
- package/dist/utils/oauth/index.js.map +0 -1
- package/dist/utils/oauth/load.d.ts +0 -5
- package/dist/utils/oauth/load.d.ts.map +0 -1
- package/dist/utils/oauth/load.js +0 -22
- package/dist/utils/oauth/load.js.map +0 -1
- package/dist/utils/oauth/oauth-page.d.ts.map +0 -1
- package/dist/utils/oauth/oauth-page.js.map +0 -1
- package/dist/utils/oauth/openai-codex.d.ts +0 -45
- package/dist/utils/oauth/openai-codex.d.ts.map +0 -1
- package/dist/utils/oauth/openai-codex.js.map +0 -1
- package/dist/utils/oauth/pkce.d.ts.map +0 -1
- package/dist/utils/oauth/pkce.js.map +0 -1
- package/dist/utils/oauth/types.d.ts +0 -64
- package/dist/utils/oauth/types.d.ts.map +0 -1
- package/dist/utils/oauth/types.js +0 -2
- package/dist/utils/oauth/types.js.map +0 -1
- /package/dist/{utils → auth}/oauth/device-code.d.ts +0 -0
- /package/dist/{utils → auth}/oauth/device-code.js +0 -0
- /package/dist/{utils → auth}/oauth/oauth-page.d.ts +0 -0
- /package/dist/{utils → auth}/oauth/oauth-page.js +0 -0
- /package/dist/{utils → auth}/oauth/pkce.d.ts +0 -0
- /package/dist/{utils → auth}/oauth/pkce.js +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OAuthCredential } from "../auth/types.ts";
|
|
2
|
+
import type { Model, ThinkingLevelMap } from "../types.ts";
|
|
3
|
+
export declare const DEFAULT_RADIUS_GATEWAY = "https://radius.pi.dev";
|
|
4
|
+
export type RadiusGatewayModel = {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
reasoning: boolean;
|
|
8
|
+
thinkingLevelMap?: ThinkingLevelMap;
|
|
9
|
+
input: ("text" | "image")[];
|
|
10
|
+
cost: Model<"pi-messages">["cost"];
|
|
11
|
+
contextWindow: number;
|
|
12
|
+
maxTokens: number;
|
|
13
|
+
};
|
|
14
|
+
export type RadiusGatewayConfig = {
|
|
15
|
+
baseUrl: string;
|
|
16
|
+
models: RadiusGatewayModel[];
|
|
17
|
+
};
|
|
18
|
+
export type RadiusOAuthCredential = OAuthCredential & {
|
|
19
|
+
gatewayConfig?: RadiusGatewayConfig;
|
|
20
|
+
};
|
|
21
|
+
export declare function normalizeRadiusGatewayUrl(value: string): string;
|
|
22
|
+
export declare function getRadiusCredentialConfig(credential: OAuthCredential | undefined): RadiusGatewayConfig | undefined;
|
|
23
|
+
export declare function getRadiusModelsFromConfig(providerId: string, config: RadiusGatewayConfig): Model<"pi-messages">[];
|
|
24
|
+
export declare function getRadiusModels(providerId: string, credential: OAuthCredential | undefined): Model<"pi-messages">[];
|
|
25
|
+
export declare function loadRadiusGatewayConfig(gateway: string, apiKey?: string, signal?: AbortSignal): Promise<RadiusGatewayConfig>;
|
|
26
|
+
//# sourceMappingURL=radius-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radius-config.d.ts","sourceRoot":"","sources":["../../src/providers/radius-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,KAAK,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IAC5B,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG;IACrD,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC;AA2BF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,eAAe,GAAG,SAAS,GAAG,mBAAmB,GAAG,SAAS,CAElH;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAAC,EAAE,CAOjH;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,EAAE,CAGnH;AAOD,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,mBAAmB,CAAC,CAY9B","sourcesContent":["import type { OAuthCredential } from \"../auth/types.ts\";\nimport type { Model, ThinkingLevelMap } from \"../types.ts\";\n\nexport const DEFAULT_RADIUS_GATEWAY = \"https://radius.pi.dev\";\n\nexport type RadiusGatewayModel = {\n\tid: string;\n\tname: string;\n\treasoning: boolean;\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\")[];\n\tcost: Model<\"pi-messages\">[\"cost\"];\n\tcontextWindow: number;\n\tmaxTokens: number;\n};\n\nexport type RadiusGatewayConfig = {\n\tbaseUrl: string;\n\tmodels: RadiusGatewayModel[];\n};\n\nexport type RadiusOAuthCredential = OAuthCredential & {\n\tgatewayConfig?: RadiusGatewayConfig;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isRadiusGatewayModel(value: unknown): value is RadiusGatewayModel {\n\treturn (\n\t\tisRecord(value) &&\n\t\ttypeof value.id === \"string\" &&\n\t\ttypeof value.name === \"string\" &&\n\t\ttypeof value.reasoning === \"boolean\" &&\n\t\tArray.isArray(value.input) &&\n\t\tisRecord(value.cost) &&\n\t\ttypeof value.contextWindow === \"number\" &&\n\t\ttypeof value.maxTokens === \"number\"\n\t);\n}\n\nfunction sanitizeRadiusGatewayConfig(config: unknown): RadiusGatewayConfig | undefined {\n\tif (!isRecord(config) || typeof config.baseUrl !== \"string\" || !Array.isArray(config.models)) return undefined;\n\treturn {\n\t\tbaseUrl: config.baseUrl,\n\t\tmodels: config.models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),\n\t};\n}\n\nexport function normalizeRadiusGatewayUrl(value: string): string {\n\tconst withScheme = /^https?:\\/\\//iu.test(value) ? value : `https://${value}`;\n\treturn withScheme.replace(/\\/+$/u, \"\");\n}\n\nexport function getRadiusCredentialConfig(credential: OAuthCredential | undefined): RadiusGatewayConfig | undefined {\n\treturn sanitizeRadiusGatewayConfig((credential as RadiusOAuthCredential | undefined)?.gatewayConfig);\n}\n\nexport function getRadiusModelsFromConfig(providerId: string, config: RadiusGatewayConfig): Model<\"pi-messages\">[] {\n\treturn config.models.map((model) => ({\n\t\t...model,\n\t\tapi: \"pi-messages\",\n\t\tprovider: providerId,\n\t\tbaseUrl: config.baseUrl,\n\t}));\n}\n\nexport function getRadiusModels(providerId: string, credential: OAuthCredential | undefined): Model<\"pi-messages\">[] {\n\tconst config = getRadiusCredentialConfig(credential);\n\treturn config ? getRadiusModelsFromConfig(providerId, config) : [];\n}\n\nfunction truncateHttpBody(body: string): string {\n\tconst trimmed = body.trim();\n\treturn trimmed.length > 512 ? `${trimmed.slice(0, 512)}…` : trimmed;\n}\n\nexport async function loadRadiusGatewayConfig(\n\tgateway: string,\n\tapiKey?: string,\n\tsignal?: AbortSignal,\n): Promise<RadiusGatewayConfig> {\n\tconst headers: Record<string, string> = { accept: \"application/json\" };\n\tif (apiKey) headers.authorization = `Bearer ${apiKey}`;\n\tconst response = await fetch(new URL(\"/v1/config\", gateway), { headers, signal });\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}`,\n\t\t);\n\t}\n\tconst config = sanitizeRadiusGatewayConfig(await response.json());\n\tif (!config) throw new Error(`Invalid Radius config from ${gateway}`);\n\treturn config;\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const DEFAULT_RADIUS_GATEWAY = "https://radius.pi.dev";
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
function isRadiusGatewayModel(value) {
|
|
6
|
+
return (isRecord(value) &&
|
|
7
|
+
typeof value.id === "string" &&
|
|
8
|
+
typeof value.name === "string" &&
|
|
9
|
+
typeof value.reasoning === "boolean" &&
|
|
10
|
+
Array.isArray(value.input) &&
|
|
11
|
+
isRecord(value.cost) &&
|
|
12
|
+
typeof value.contextWindow === "number" &&
|
|
13
|
+
typeof value.maxTokens === "number");
|
|
14
|
+
}
|
|
15
|
+
function sanitizeRadiusGatewayConfig(config) {
|
|
16
|
+
if (!isRecord(config) || typeof config.baseUrl !== "string" || !Array.isArray(config.models))
|
|
17
|
+
return undefined;
|
|
18
|
+
return {
|
|
19
|
+
baseUrl: config.baseUrl,
|
|
20
|
+
models: config.models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function normalizeRadiusGatewayUrl(value) {
|
|
24
|
+
const withScheme = /^https?:\/\//iu.test(value) ? value : `https://${value}`;
|
|
25
|
+
return withScheme.replace(/\/+$/u, "");
|
|
26
|
+
}
|
|
27
|
+
export function getRadiusCredentialConfig(credential) {
|
|
28
|
+
return sanitizeRadiusGatewayConfig(credential?.gatewayConfig);
|
|
29
|
+
}
|
|
30
|
+
export function getRadiusModelsFromConfig(providerId, config) {
|
|
31
|
+
return config.models.map((model) => ({
|
|
32
|
+
...model,
|
|
33
|
+
api: "pi-messages",
|
|
34
|
+
provider: providerId,
|
|
35
|
+
baseUrl: config.baseUrl,
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
export function getRadiusModels(providerId, credential) {
|
|
39
|
+
const config = getRadiusCredentialConfig(credential);
|
|
40
|
+
return config ? getRadiusModelsFromConfig(providerId, config) : [];
|
|
41
|
+
}
|
|
42
|
+
function truncateHttpBody(body) {
|
|
43
|
+
const trimmed = body.trim();
|
|
44
|
+
return trimmed.length > 512 ? `${trimmed.slice(0, 512)}…` : trimmed;
|
|
45
|
+
}
|
|
46
|
+
export async function loadRadiusGatewayConfig(gateway, apiKey, signal) {
|
|
47
|
+
const headers = { accept: "application/json" };
|
|
48
|
+
if (apiKey)
|
|
49
|
+
headers.authorization = `Bearer ${apiKey}`;
|
|
50
|
+
const response = await fetch(new URL("/v1/config", gateway), { headers, signal });
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
throw new Error(`Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}`);
|
|
53
|
+
}
|
|
54
|
+
const config = sanitizeRadiusGatewayConfig(await response.json());
|
|
55
|
+
if (!config)
|
|
56
|
+
throw new Error(`Invalid Radius config from ${gateway}`);
|
|
57
|
+
return config;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=radius-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radius-config.js","sourceRoot":"","sources":["../../src/providers/radius-config.ts"],"names":[],"mappings":"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","sourcesContent":["import type { OAuthCredential } from \"../auth/types.ts\";\nimport type { Model, ThinkingLevelMap } from \"../types.ts\";\n\nexport const DEFAULT_RADIUS_GATEWAY = \"https://radius.pi.dev\";\n\nexport type RadiusGatewayModel = {\n\tid: string;\n\tname: string;\n\treasoning: boolean;\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\")[];\n\tcost: Model<\"pi-messages\">[\"cost\"];\n\tcontextWindow: number;\n\tmaxTokens: number;\n};\n\nexport type RadiusGatewayConfig = {\n\tbaseUrl: string;\n\tmodels: RadiusGatewayModel[];\n};\n\nexport type RadiusOAuthCredential = OAuthCredential & {\n\tgatewayConfig?: RadiusGatewayConfig;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isRadiusGatewayModel(value: unknown): value is RadiusGatewayModel {\n\treturn (\n\t\tisRecord(value) &&\n\t\ttypeof value.id === \"string\" &&\n\t\ttypeof value.name === \"string\" &&\n\t\ttypeof value.reasoning === \"boolean\" &&\n\t\tArray.isArray(value.input) &&\n\t\tisRecord(value.cost) &&\n\t\ttypeof value.contextWindow === \"number\" &&\n\t\ttypeof value.maxTokens === \"number\"\n\t);\n}\n\nfunction sanitizeRadiusGatewayConfig(config: unknown): RadiusGatewayConfig | undefined {\n\tif (!isRecord(config) || typeof config.baseUrl !== \"string\" || !Array.isArray(config.models)) return undefined;\n\treturn {\n\t\tbaseUrl: config.baseUrl,\n\t\tmodels: config.models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),\n\t};\n}\n\nexport function normalizeRadiusGatewayUrl(value: string): string {\n\tconst withScheme = /^https?:\\/\\//iu.test(value) ? value : `https://${value}`;\n\treturn withScheme.replace(/\\/+$/u, \"\");\n}\n\nexport function getRadiusCredentialConfig(credential: OAuthCredential | undefined): RadiusGatewayConfig | undefined {\n\treturn sanitizeRadiusGatewayConfig((credential as RadiusOAuthCredential | undefined)?.gatewayConfig);\n}\n\nexport function getRadiusModelsFromConfig(providerId: string, config: RadiusGatewayConfig): Model<\"pi-messages\">[] {\n\treturn config.models.map((model) => ({\n\t\t...model,\n\t\tapi: \"pi-messages\",\n\t\tprovider: providerId,\n\t\tbaseUrl: config.baseUrl,\n\t}));\n}\n\nexport function getRadiusModels(providerId: string, credential: OAuthCredential | undefined): Model<\"pi-messages\">[] {\n\tconst config = getRadiusCredentialConfig(credential);\n\treturn config ? getRadiusModelsFromConfig(providerId, config) : [];\n}\n\nfunction truncateHttpBody(body: string): string {\n\tconst trimmed = body.trim();\n\treturn trimmed.length > 512 ? `${trimmed.slice(0, 512)}…` : trimmed;\n}\n\nexport async function loadRadiusGatewayConfig(\n\tgateway: string,\n\tapiKey?: string,\n\tsignal?: AbortSignal,\n): Promise<RadiusGatewayConfig> {\n\tconst headers: Record<string, string> = { accept: \"application/json\" };\n\tif (apiKey) headers.authorization = `Bearer ${apiKey}`;\n\tconst response = await fetch(new URL(\"/v1/config\", gateway), { headers, signal });\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}`,\n\t\t);\n\t}\n\tconst config = sanitizeRadiusGatewayConfig(await response.json());\n\tif (!config) throw new Error(`Invalid Radius config from ${gateway}`);\n\treturn config;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Provider } from "../models.ts";
|
|
2
|
+
export interface RadiusProviderOptions {
|
|
3
|
+
id?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
gateway?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Radius gateway provider with a persisted, dynamically refreshed catalog. */
|
|
8
|
+
export declare function radiusProvider(options?: RadiusProviderOptions): Provider<"pi-messages">;
|
|
9
|
+
//# sourceMappingURL=radius.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radius.d.ts","sourceRoot":"","sources":["../../src/providers/radius.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAS7C,MAAM,WAAW,qBAAqB;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,QAAQ,CAAC,aAAa,CAAC,CA+C3F","sourcesContent":["import { piMessagesApi } from \"../api/pi-messages.lazy.ts\";\nimport { envApiKeyAuth, lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadRadiusOAuth } from \"../auth/oauth/load.ts\";\nimport type { Provider } from \"../models.ts\";\nimport {\n\tDEFAULT_RADIUS_GATEWAY,\n\tgetRadiusModels,\n\tgetRadiusModelsFromConfig,\n\tloadRadiusGatewayConfig,\n\tnormalizeRadiusGatewayUrl,\n} from \"./radius-config.ts\";\n\nexport interface RadiusProviderOptions {\n\tid?: string;\n\tname?: string;\n\tgateway?: string;\n}\n\n/** Radius gateway provider with a persisted, dynamically refreshed catalog. */\nexport function radiusProvider(options: RadiusProviderOptions = {}): Provider<\"pi-messages\"> {\n\tconst id = options.id ?? \"radius\";\n\tconst name = options.name ?? \"Radius\";\n\tconst gateway = normalizeRadiusGatewayUrl(options.gateway ?? DEFAULT_RADIUS_GATEWAY);\n\tlet models = getRadiusModels(id, undefined);\n\tlet inflightRefresh: Promise<void> | undefined;\n\tconst streams = piMessagesApi();\n\n\treturn {\n\t\tid,\n\t\tname,\n\t\tauth: {\n\t\t\tapiKey: envApiKeyAuth(\"Radius API key\", [\"RADIUS_API_KEY\"]),\n\t\t\toauth: lazyOAuth({ name, load: () => loadRadiusOAuth({ name, gateway }) }),\n\t\t},\n\t\tgetModels: () => models,\n\t\trefreshModels: (context) => {\n\t\t\tinflightRefresh ??= (async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst stored = await context.store.read();\n\t\t\t\t\tif (stored) models = stored.models.filter((model) => model.provider === id) as typeof models;\n\n\t\t\t\t\t// Import catalogs cached by the pre-ModelsStore Radius implementation.\n\t\t\t\t\tif (!stored && context.credential?.type === \"oauth\") {\n\t\t\t\t\t\tconst legacy = getRadiusModels(id, context.credential);\n\t\t\t\t\t\tif (legacy.length > 0) {\n\t\t\t\t\t\t\tmodels = legacy;\n\t\t\t\t\t\t\tawait context.store.write({ models: legacy, checkedAt: Date.now() });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!context.allowNetwork || context.signal?.aborted) return;\n\t\t\t\t\tconst apiKey =\n\t\t\t\t\t\tcontext.credential?.type === \"oauth\" ? context.credential.access : context.credential?.key;\n\t\t\t\t\tconst config = await loadRadiusGatewayConfig(gateway, apiKey, context.signal);\n\t\t\t\t\tif (context.signal?.aborted) return;\n\t\t\t\t\tmodels = getRadiusModelsFromConfig(id, config);\n\t\t\t\t\tawait context.store.write({ models, checkedAt: Date.now() });\n\t\t\t\t} finally {\n\t\t\t\t\tinflightRefresh = undefined;\n\t\t\t\t}\n\t\t\t})();\n\t\t\treturn inflightRefresh;\n\t\t},\n\t\tstream: (model, context, streamOptions) => streams.stream(model, context, streamOptions),\n\t\tstreamSimple: (model, context, streamOptions) => streams.streamSimple(model, context, streamOptions),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { piMessagesApi } from "../api/pi-messages.lazy.js";
|
|
2
|
+
import { envApiKeyAuth, lazyOAuth } from "../auth/helpers.js";
|
|
3
|
+
import { loadRadiusOAuth } from "../auth/oauth/load.js";
|
|
4
|
+
import { DEFAULT_RADIUS_GATEWAY, getRadiusModels, getRadiusModelsFromConfig, loadRadiusGatewayConfig, normalizeRadiusGatewayUrl, } from "./radius-config.js";
|
|
5
|
+
/** Radius gateway provider with a persisted, dynamically refreshed catalog. */
|
|
6
|
+
export function radiusProvider(options = {}) {
|
|
7
|
+
const id = options.id ?? "radius";
|
|
8
|
+
const name = options.name ?? "Radius";
|
|
9
|
+
const gateway = normalizeRadiusGatewayUrl(options.gateway ?? DEFAULT_RADIUS_GATEWAY);
|
|
10
|
+
let models = getRadiusModels(id, undefined);
|
|
11
|
+
let inflightRefresh;
|
|
12
|
+
const streams = piMessagesApi();
|
|
13
|
+
return {
|
|
14
|
+
id,
|
|
15
|
+
name,
|
|
16
|
+
auth: {
|
|
17
|
+
apiKey: envApiKeyAuth("Radius API key", ["RADIUS_API_KEY"]),
|
|
18
|
+
oauth: lazyOAuth({ name, load: () => loadRadiusOAuth({ name, gateway }) }),
|
|
19
|
+
},
|
|
20
|
+
getModels: () => models,
|
|
21
|
+
refreshModels: (context) => {
|
|
22
|
+
inflightRefresh ??= (async () => {
|
|
23
|
+
try {
|
|
24
|
+
const stored = await context.store.read();
|
|
25
|
+
if (stored)
|
|
26
|
+
models = stored.models.filter((model) => model.provider === id);
|
|
27
|
+
// Import catalogs cached by the pre-ModelsStore Radius implementation.
|
|
28
|
+
if (!stored && context.credential?.type === "oauth") {
|
|
29
|
+
const legacy = getRadiusModels(id, context.credential);
|
|
30
|
+
if (legacy.length > 0) {
|
|
31
|
+
models = legacy;
|
|
32
|
+
await context.store.write({ models: legacy, checkedAt: Date.now() });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!context.allowNetwork || context.signal?.aborted)
|
|
36
|
+
return;
|
|
37
|
+
const apiKey = context.credential?.type === "oauth" ? context.credential.access : context.credential?.key;
|
|
38
|
+
const config = await loadRadiusGatewayConfig(gateway, apiKey, context.signal);
|
|
39
|
+
if (context.signal?.aborted)
|
|
40
|
+
return;
|
|
41
|
+
models = getRadiusModelsFromConfig(id, config);
|
|
42
|
+
await context.store.write({ models, checkedAt: Date.now() });
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
inflightRefresh = undefined;
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
return inflightRefresh;
|
|
49
|
+
},
|
|
50
|
+
stream: (model, context, streamOptions) => streams.stream(model, context, streamOptions),
|
|
51
|
+
streamSimple: (model, context, streamOptions) => streams.streamSimple(model, context, streamOptions),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=radius.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radius.js","sourceRoot":"","sources":["../../src/providers/radius.ts"],"names":[],"mappings":"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","sourcesContent":["import { piMessagesApi } from \"../api/pi-messages.lazy.ts\";\nimport { envApiKeyAuth, lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadRadiusOAuth } from \"../auth/oauth/load.ts\";\nimport type { Provider } from \"../models.ts\";\nimport {\n\tDEFAULT_RADIUS_GATEWAY,\n\tgetRadiusModels,\n\tgetRadiusModelsFromConfig,\n\tloadRadiusGatewayConfig,\n\tnormalizeRadiusGatewayUrl,\n} from \"./radius-config.ts\";\n\nexport interface RadiusProviderOptions {\n\tid?: string;\n\tname?: string;\n\tgateway?: string;\n}\n\n/** Radius gateway provider with a persisted, dynamically refreshed catalog. */\nexport function radiusProvider(options: RadiusProviderOptions = {}): Provider<\"pi-messages\"> {\n\tconst id = options.id ?? \"radius\";\n\tconst name = options.name ?? \"Radius\";\n\tconst gateway = normalizeRadiusGatewayUrl(options.gateway ?? DEFAULT_RADIUS_GATEWAY);\n\tlet models = getRadiusModels(id, undefined);\n\tlet inflightRefresh: Promise<void> | undefined;\n\tconst streams = piMessagesApi();\n\n\treturn {\n\t\tid,\n\t\tname,\n\t\tauth: {\n\t\t\tapiKey: envApiKeyAuth(\"Radius API key\", [\"RADIUS_API_KEY\"]),\n\t\t\toauth: lazyOAuth({ name, load: () => loadRadiusOAuth({ name, gateway }) }),\n\t\t},\n\t\tgetModels: () => models,\n\t\trefreshModels: (context) => {\n\t\t\tinflightRefresh ??= (async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst stored = await context.store.read();\n\t\t\t\t\tif (stored) models = stored.models.filter((model) => model.provider === id) as typeof models;\n\n\t\t\t\t\t// Import catalogs cached by the pre-ModelsStore Radius implementation.\n\t\t\t\t\tif (!stored && context.credential?.type === \"oauth\") {\n\t\t\t\t\t\tconst legacy = getRadiusModels(id, context.credential);\n\t\t\t\t\t\tif (legacy.length > 0) {\n\t\t\t\t\t\t\tmodels = legacy;\n\t\t\t\t\t\t\tawait context.store.write({ models: legacy, checkedAt: Date.now() });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!context.allowNetwork || context.signal?.aborted) return;\n\t\t\t\t\tconst apiKey =\n\t\t\t\t\t\tcontext.credential?.type === \"oauth\" ? context.credential.access : context.credential?.key;\n\t\t\t\t\tconst config = await loadRadiusGatewayConfig(gateway, apiKey, context.signal);\n\t\t\t\t\tif (context.signal?.aborted) return;\n\t\t\t\t\tmodels = getRadiusModelsFromConfig(id, config);\n\t\t\t\t\tawait context.store.write({ models, checkedAt: Date.now() });\n\t\t\t\t} finally {\n\t\t\t\t\tinflightRefresh = undefined;\n\t\t\t\t}\n\t\t\t})();\n\t\t\treturn inflightRefresh;\n\t\t},\n\t\tstream: (model, context, streamOptions) => streams.stream(model, context, streamOptions),\n\t\tstreamSimple: (model, context, streamOptions) => streams.streamSimple(model, context, streamOptions),\n\t};\n}\n"]}
|
|
@@ -492,23 +492,6 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
492
492
|
contextWindow: number;
|
|
493
493
|
maxTokens: number;
|
|
494
494
|
};
|
|
495
|
-
readonly "anthropic/claude-3.5-haiku": {
|
|
496
|
-
id: string;
|
|
497
|
-
name: string;
|
|
498
|
-
api: "anthropic-messages";
|
|
499
|
-
provider: string;
|
|
500
|
-
baseUrl: string;
|
|
501
|
-
reasoning: false;
|
|
502
|
-
input: ("image" | "text")[];
|
|
503
|
-
cost: {
|
|
504
|
-
input: number;
|
|
505
|
-
output: number;
|
|
506
|
-
cacheRead: number;
|
|
507
|
-
cacheWrite: number;
|
|
508
|
-
};
|
|
509
|
-
contextWindow: number;
|
|
510
|
-
maxTokens: number;
|
|
511
|
-
};
|
|
512
495
|
readonly "anthropic/claude-fable-5": {
|
|
513
496
|
id: string;
|
|
514
497
|
name: string;
|
|
@@ -650,7 +633,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
650
633
|
contextWindow: number;
|
|
651
634
|
maxTokens: number;
|
|
652
635
|
};
|
|
653
|
-
readonly "anthropic/claude-opus-4.
|
|
636
|
+
readonly "anthropic/claude-opus-4.7-fast": {
|
|
654
637
|
id: string;
|
|
655
638
|
name: string;
|
|
656
639
|
api: "anthropic-messages";
|
|
@@ -675,13 +658,21 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
675
658
|
contextWindow: number;
|
|
676
659
|
maxTokens: number;
|
|
677
660
|
};
|
|
678
|
-
readonly "anthropic/claude-
|
|
661
|
+
readonly "anthropic/claude-opus-4.8": {
|
|
679
662
|
id: string;
|
|
680
663
|
name: string;
|
|
681
664
|
api: "anthropic-messages";
|
|
682
665
|
provider: string;
|
|
683
666
|
baseUrl: string;
|
|
667
|
+
compat: {
|
|
668
|
+
forceAdaptiveThinking: true;
|
|
669
|
+
supportsTemperature: false;
|
|
670
|
+
};
|
|
684
671
|
reasoning: true;
|
|
672
|
+
thinkingLevelMap: {
|
|
673
|
+
xhigh: string;
|
|
674
|
+
max: string;
|
|
675
|
+
};
|
|
685
676
|
input: ("image" | "text")[];
|
|
686
677
|
cost: {
|
|
687
678
|
input: number;
|
|
@@ -692,13 +683,21 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
692
683
|
contextWindow: number;
|
|
693
684
|
maxTokens: number;
|
|
694
685
|
};
|
|
695
|
-
readonly "anthropic/claude-
|
|
686
|
+
readonly "anthropic/claude-opus-4.8-fast": {
|
|
696
687
|
id: string;
|
|
697
688
|
name: string;
|
|
698
689
|
api: "anthropic-messages";
|
|
699
690
|
provider: string;
|
|
700
691
|
baseUrl: string;
|
|
692
|
+
compat: {
|
|
693
|
+
forceAdaptiveThinking: true;
|
|
694
|
+
supportsTemperature: false;
|
|
695
|
+
};
|
|
701
696
|
reasoning: true;
|
|
697
|
+
thinkingLevelMap: {
|
|
698
|
+
xhigh: string;
|
|
699
|
+
max: string;
|
|
700
|
+
};
|
|
702
701
|
input: ("image" | "text")[];
|
|
703
702
|
cost: {
|
|
704
703
|
input: number;
|
|
@@ -709,19 +708,30 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
709
708
|
contextWindow: number;
|
|
710
709
|
maxTokens: number;
|
|
711
710
|
};
|
|
712
|
-
readonly "anthropic/claude-sonnet-4
|
|
711
|
+
readonly "anthropic/claude-sonnet-4": {
|
|
713
712
|
id: string;
|
|
714
713
|
name: string;
|
|
715
714
|
api: "anthropic-messages";
|
|
716
715
|
provider: string;
|
|
717
716
|
baseUrl: string;
|
|
718
|
-
compat: {
|
|
719
|
-
forceAdaptiveThinking: true;
|
|
720
|
-
};
|
|
721
717
|
reasoning: true;
|
|
722
|
-
|
|
723
|
-
|
|
718
|
+
input: ("image" | "text")[];
|
|
719
|
+
cost: {
|
|
720
|
+
input: number;
|
|
721
|
+
output: number;
|
|
722
|
+
cacheRead: number;
|
|
723
|
+
cacheWrite: number;
|
|
724
724
|
};
|
|
725
|
+
contextWindow: number;
|
|
726
|
+
maxTokens: number;
|
|
727
|
+
};
|
|
728
|
+
readonly "anthropic/claude-sonnet-4.5": {
|
|
729
|
+
id: string;
|
|
730
|
+
name: string;
|
|
731
|
+
api: "anthropic-messages";
|
|
732
|
+
provider: string;
|
|
733
|
+
baseUrl: string;
|
|
734
|
+
reasoning: true;
|
|
725
735
|
input: ("image" | "text")[];
|
|
726
736
|
cost: {
|
|
727
737
|
input: number;
|
|
@@ -732,7 +742,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
732
742
|
contextWindow: number;
|
|
733
743
|
maxTokens: number;
|
|
734
744
|
};
|
|
735
|
-
readonly "anthropic/claude-sonnet-
|
|
745
|
+
readonly "anthropic/claude-sonnet-4.6": {
|
|
736
746
|
id: string;
|
|
737
747
|
name: string;
|
|
738
748
|
api: "anthropic-messages";
|
|
@@ -743,7 +753,6 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
743
753
|
};
|
|
744
754
|
reasoning: true;
|
|
745
755
|
thinkingLevelMap: {
|
|
746
|
-
xhigh: string;
|
|
747
756
|
max: string;
|
|
748
757
|
};
|
|
749
758
|
input: ("image" | "text")[];
|
|
@@ -756,14 +765,21 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
756
765
|
contextWindow: number;
|
|
757
766
|
maxTokens: number;
|
|
758
767
|
};
|
|
759
|
-
readonly "
|
|
768
|
+
readonly "anthropic/claude-sonnet-5": {
|
|
760
769
|
id: string;
|
|
761
770
|
name: string;
|
|
762
771
|
api: "anthropic-messages";
|
|
763
772
|
provider: string;
|
|
764
773
|
baseUrl: string;
|
|
765
|
-
|
|
766
|
-
|
|
774
|
+
compat: {
|
|
775
|
+
forceAdaptiveThinking: true;
|
|
776
|
+
};
|
|
777
|
+
reasoning: true;
|
|
778
|
+
thinkingLevelMap: {
|
|
779
|
+
xhigh: string;
|
|
780
|
+
max: string;
|
|
781
|
+
};
|
|
782
|
+
input: ("image" | "text")[];
|
|
767
783
|
cost: {
|
|
768
784
|
input: number;
|
|
769
785
|
output: number;
|
|
@@ -1232,13 +1248,13 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
1232
1248
|
contextWindow: number;
|
|
1233
1249
|
maxTokens: number;
|
|
1234
1250
|
};
|
|
1235
|
-
readonly "kwaipilot/kat-coder-
|
|
1251
|
+
readonly "kwaipilot/kat-coder-air-v2.5": {
|
|
1236
1252
|
id: string;
|
|
1237
1253
|
name: string;
|
|
1238
1254
|
api: "anthropic-messages";
|
|
1239
1255
|
provider: string;
|
|
1240
1256
|
baseUrl: string;
|
|
1241
|
-
reasoning:
|
|
1257
|
+
reasoning: true;
|
|
1242
1258
|
input: "text"[];
|
|
1243
1259
|
cost: {
|
|
1244
1260
|
input: number;
|
|
@@ -1249,13 +1265,13 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
1249
1265
|
contextWindow: number;
|
|
1250
1266
|
maxTokens: number;
|
|
1251
1267
|
};
|
|
1252
|
-
readonly "kwaipilot/kat-coder-pro-
|
|
1268
|
+
readonly "kwaipilot/kat-coder-pro-v1": {
|
|
1253
1269
|
id: string;
|
|
1254
1270
|
name: string;
|
|
1255
1271
|
api: "anthropic-messages";
|
|
1256
1272
|
provider: string;
|
|
1257
1273
|
baseUrl: string;
|
|
1258
|
-
reasoning:
|
|
1274
|
+
reasoning: false;
|
|
1259
1275
|
input: "text"[];
|
|
1260
1276
|
cost: {
|
|
1261
1277
|
input: number;
|
|
@@ -1266,13 +1282,13 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
1266
1282
|
contextWindow: number;
|
|
1267
1283
|
maxTokens: number;
|
|
1268
1284
|
};
|
|
1269
|
-
readonly "
|
|
1285
|
+
readonly "kwaipilot/kat-coder-pro-v2": {
|
|
1270
1286
|
id: string;
|
|
1271
1287
|
name: string;
|
|
1272
1288
|
api: "anthropic-messages";
|
|
1273
1289
|
provider: string;
|
|
1274
1290
|
baseUrl: string;
|
|
1275
|
-
reasoning:
|
|
1291
|
+
reasoning: true;
|
|
1276
1292
|
input: "text"[];
|
|
1277
1293
|
cost: {
|
|
1278
1294
|
input: number;
|
|
@@ -1283,7 +1299,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
1283
1299
|
contextWindow: number;
|
|
1284
1300
|
maxTokens: number;
|
|
1285
1301
|
};
|
|
1286
|
-
readonly "
|
|
1302
|
+
readonly "kwaipilot/kat-coder-pro-v2.5": {
|
|
1287
1303
|
id: string;
|
|
1288
1304
|
name: string;
|
|
1289
1305
|
api: "anthropic-messages";
|
|
@@ -1606,23 +1622,6 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
1606
1622
|
contextWindow: number;
|
|
1607
1623
|
maxTokens: number;
|
|
1608
1624
|
};
|
|
1609
|
-
readonly "mistral/devstral-small": {
|
|
1610
|
-
id: string;
|
|
1611
|
-
name: string;
|
|
1612
|
-
api: "anthropic-messages";
|
|
1613
|
-
provider: string;
|
|
1614
|
-
baseUrl: string;
|
|
1615
|
-
reasoning: false;
|
|
1616
|
-
input: "text"[];
|
|
1617
|
-
cost: {
|
|
1618
|
-
input: number;
|
|
1619
|
-
output: number;
|
|
1620
|
-
cacheRead: number;
|
|
1621
|
-
cacheWrite: number;
|
|
1622
|
-
};
|
|
1623
|
-
contextWindow: number;
|
|
1624
|
-
maxTokens: number;
|
|
1625
|
-
};
|
|
1626
1625
|
readonly "mistral/devstral-small-2": {
|
|
1627
1626
|
id: string;
|
|
1628
1627
|
name: string;
|
|
@@ -1827,23 +1826,6 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
1827
1826
|
contextWindow: number;
|
|
1828
1827
|
maxTokens: number;
|
|
1829
1828
|
};
|
|
1830
|
-
readonly "mistral/pixtral-large": {
|
|
1831
|
-
id: string;
|
|
1832
|
-
name: string;
|
|
1833
|
-
api: "anthropic-messages";
|
|
1834
|
-
provider: string;
|
|
1835
|
-
baseUrl: string;
|
|
1836
|
-
reasoning: false;
|
|
1837
|
-
input: ("image" | "text")[];
|
|
1838
|
-
cost: {
|
|
1839
|
-
input: number;
|
|
1840
|
-
output: number;
|
|
1841
|
-
cacheRead: number;
|
|
1842
|
-
cacheWrite: number;
|
|
1843
|
-
};
|
|
1844
|
-
contextWindow: number;
|
|
1845
|
-
maxTokens: number;
|
|
1846
|
-
};
|
|
1847
1829
|
readonly "moonshotai/kimi-k2": {
|
|
1848
1830
|
id: string;
|
|
1849
1831
|
name: string;
|
|
@@ -2844,13 +2826,13 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2844
2826
|
contextWindow: number;
|
|
2845
2827
|
maxTokens: number;
|
|
2846
2828
|
};
|
|
2847
|
-
readonly "
|
|
2829
|
+
readonly "thinkingmachines/inkling": {
|
|
2848
2830
|
id: string;
|
|
2849
2831
|
name: string;
|
|
2850
2832
|
api: "anthropic-messages";
|
|
2851
2833
|
provider: string;
|
|
2852
2834
|
baseUrl: string;
|
|
2853
|
-
reasoning:
|
|
2835
|
+
reasoning: true;
|
|
2854
2836
|
input: ("image" | "text")[];
|
|
2855
2837
|
cost: {
|
|
2856
2838
|
input: number;
|
|
@@ -2861,13 +2843,13 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2861
2843
|
contextWindow: number;
|
|
2862
2844
|
maxTokens: number;
|
|
2863
2845
|
};
|
|
2864
|
-
readonly "xai/grok-4.1-fast-reasoning": {
|
|
2846
|
+
readonly "xai/grok-4.1-fast-non-reasoning": {
|
|
2865
2847
|
id: string;
|
|
2866
2848
|
name: string;
|
|
2867
2849
|
api: "anthropic-messages";
|
|
2868
2850
|
provider: string;
|
|
2869
2851
|
baseUrl: string;
|
|
2870
|
-
reasoning:
|
|
2852
|
+
reasoning: false;
|
|
2871
2853
|
input: ("image" | "text")[];
|
|
2872
2854
|
cost: {
|
|
2873
2855
|
input: number;
|
|
@@ -2878,7 +2860,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2878
2860
|
contextWindow: number;
|
|
2879
2861
|
maxTokens: number;
|
|
2880
2862
|
};
|
|
2881
|
-
readonly "xai/grok-4.
|
|
2863
|
+
readonly "xai/grok-4.1-fast-reasoning": {
|
|
2882
2864
|
id: string;
|
|
2883
2865
|
name: string;
|
|
2884
2866
|
api: "anthropic-messages";
|
|
@@ -2895,7 +2877,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2895
2877
|
contextWindow: number;
|
|
2896
2878
|
maxTokens: number;
|
|
2897
2879
|
};
|
|
2898
|
-
readonly "xai/grok-4.20-multi-agent
|
|
2880
|
+
readonly "xai/grok-4.20-multi-agent": {
|
|
2899
2881
|
id: string;
|
|
2900
2882
|
name: string;
|
|
2901
2883
|
api: "anthropic-messages";
|
|
@@ -2912,13 +2894,13 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2912
2894
|
contextWindow: number;
|
|
2913
2895
|
maxTokens: number;
|
|
2914
2896
|
};
|
|
2915
|
-
readonly "xai/grok-4.20-
|
|
2897
|
+
readonly "xai/grok-4.20-multi-agent-beta": {
|
|
2916
2898
|
id: string;
|
|
2917
2899
|
name: string;
|
|
2918
2900
|
api: "anthropic-messages";
|
|
2919
2901
|
provider: string;
|
|
2920
2902
|
baseUrl: string;
|
|
2921
|
-
reasoning:
|
|
2903
|
+
reasoning: true;
|
|
2922
2904
|
input: ("image" | "text")[];
|
|
2923
2905
|
cost: {
|
|
2924
2906
|
input: number;
|
|
@@ -2929,7 +2911,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2929
2911
|
contextWindow: number;
|
|
2930
2912
|
maxTokens: number;
|
|
2931
2913
|
};
|
|
2932
|
-
readonly "xai/grok-4.20-non-reasoning
|
|
2914
|
+
readonly "xai/grok-4.20-non-reasoning": {
|
|
2933
2915
|
id: string;
|
|
2934
2916
|
name: string;
|
|
2935
2917
|
api: "anthropic-messages";
|
|
@@ -2946,13 +2928,13 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2946
2928
|
contextWindow: number;
|
|
2947
2929
|
maxTokens: number;
|
|
2948
2930
|
};
|
|
2949
|
-
readonly "xai/grok-4.20-reasoning": {
|
|
2931
|
+
readonly "xai/grok-4.20-non-reasoning-beta": {
|
|
2950
2932
|
id: string;
|
|
2951
2933
|
name: string;
|
|
2952
2934
|
api: "anthropic-messages";
|
|
2953
2935
|
provider: string;
|
|
2954
2936
|
baseUrl: string;
|
|
2955
|
-
reasoning:
|
|
2937
|
+
reasoning: false;
|
|
2956
2938
|
input: ("image" | "text")[];
|
|
2957
2939
|
cost: {
|
|
2958
2940
|
input: number;
|
|
@@ -2963,7 +2945,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2963
2945
|
contextWindow: number;
|
|
2964
2946
|
maxTokens: number;
|
|
2965
2947
|
};
|
|
2966
|
-
readonly "xai/grok-4.20-reasoning
|
|
2948
|
+
readonly "xai/grok-4.20-reasoning": {
|
|
2967
2949
|
id: string;
|
|
2968
2950
|
name: string;
|
|
2969
2951
|
api: "anthropic-messages";
|
|
@@ -2980,7 +2962,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2980
2962
|
contextWindow: number;
|
|
2981
2963
|
maxTokens: number;
|
|
2982
2964
|
};
|
|
2983
|
-
readonly "xai/grok-4.
|
|
2965
|
+
readonly "xai/grok-4.20-reasoning-beta": {
|
|
2984
2966
|
id: string;
|
|
2985
2967
|
name: string;
|
|
2986
2968
|
api: "anthropic-messages";
|
|
@@ -2997,7 +2979,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
2997
2979
|
contextWindow: number;
|
|
2998
2980
|
maxTokens: number;
|
|
2999
2981
|
};
|
|
3000
|
-
readonly "xai/grok-4.
|
|
2982
|
+
readonly "xai/grok-4.3": {
|
|
3001
2983
|
id: string;
|
|
3002
2984
|
name: string;
|
|
3003
2985
|
api: "anthropic-messages";
|
|
@@ -3014,7 +2996,7 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
3014
2996
|
contextWindow: number;
|
|
3015
2997
|
maxTokens: number;
|
|
3016
2998
|
};
|
|
3017
|
-
readonly "xai/grok-
|
|
2999
|
+
readonly "xai/grok-4.5": {
|
|
3018
3000
|
id: string;
|
|
3019
3001
|
name: string;
|
|
3020
3002
|
api: "anthropic-messages";
|
|
@@ -3031,31 +3013,14 @@ export declare const VERCEL_AI_GATEWAY_MODELS: {
|
|
|
3031
3013
|
contextWindow: number;
|
|
3032
3014
|
maxTokens: number;
|
|
3033
3015
|
};
|
|
3034
|
-
readonly "
|
|
3035
|
-
id: string;
|
|
3036
|
-
name: string;
|
|
3037
|
-
api: "anthropic-messages";
|
|
3038
|
-
provider: string;
|
|
3039
|
-
baseUrl: string;
|
|
3040
|
-
reasoning: true;
|
|
3041
|
-
input: "text"[];
|
|
3042
|
-
cost: {
|
|
3043
|
-
input: number;
|
|
3044
|
-
output: number;
|
|
3045
|
-
cacheRead: number;
|
|
3046
|
-
cacheWrite: number;
|
|
3047
|
-
};
|
|
3048
|
-
contextWindow: number;
|
|
3049
|
-
maxTokens: number;
|
|
3050
|
-
};
|
|
3051
|
-
readonly "xiaomi/mimo-v2-pro": {
|
|
3016
|
+
readonly "xai/grok-build-0.1": {
|
|
3052
3017
|
id: string;
|
|
3053
3018
|
name: string;
|
|
3054
3019
|
api: "anthropic-messages";
|
|
3055
3020
|
provider: string;
|
|
3056
3021
|
baseUrl: string;
|
|
3057
3022
|
reasoning: true;
|
|
3058
|
-
input: "text"[];
|
|
3023
|
+
input: ("image" | "text")[];
|
|
3059
3024
|
cost: {
|
|
3060
3025
|
input: number;
|
|
3061
3026
|
output: number;
|