@bastani/atomic-ai 0.0.0-stage → 0.9.88
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/CHANGELOG.md +1629 -0
- package/LICENSE +22 -0
- package/NOTICE.md +16 -0
- package/README.md +165 -2
- package/dist/api/anthropic-assistant-content.d.ts +24 -0
- package/dist/api/anthropic-assistant-content.d.ts.map +1 -0
- package/dist/api/anthropic-assistant-content.js +99 -0
- package/dist/api/anthropic-assistant-content.js.map +1 -0
- package/dist/api/anthropic-messages.d.ts +71 -0
- package/dist/api/anthropic-messages.d.ts.map +1 -0
- package/dist/api/anthropic-messages.js +1814 -0
- package/dist/api/anthropic-messages.js.map +1 -0
- package/dist/api/anthropic-messages.lazy.d.ts +3 -0
- package/dist/api/anthropic-messages.lazy.d.ts.map +1 -0
- package/dist/api/anthropic-messages.lazy.js +3 -0
- package/dist/api/anthropic-messages.lazy.js.map +1 -0
- package/dist/api/azure-openai-config.d.ts +14 -0
- package/dist/api/azure-openai-config.d.ts.map +1 -0
- package/dist/api/azure-openai-config.js +61 -0
- package/dist/api/azure-openai-config.js.map +1 -0
- package/dist/api/azure-openai-responses.d.ts +14 -0
- package/dist/api/azure-openai-responses.d.ts.map +1 -0
- package/dist/api/azure-openai-responses.js +213 -0
- package/dist/api/azure-openai-responses.js.map +1 -0
- package/dist/api/azure-openai-responses.lazy.d.ts +3 -0
- package/dist/api/azure-openai-responses.lazy.d.ts.map +1 -0
- package/dist/api/azure-openai-responses.lazy.js +3 -0
- package/dist/api/azure-openai-responses.lazy.js.map +1 -0
- package/dist/api/bedrock-converse-stream.d.ts +38 -0
- package/dist/api/bedrock-converse-stream.d.ts.map +1 -0
- package/dist/api/bedrock-converse-stream.js +1301 -0
- package/dist/api/bedrock-converse-stream.js.map +1 -0
- package/dist/api/bedrock-converse-stream.lazy.d.ts +16 -0
- package/dist/api/bedrock-converse-stream.lazy.d.ts.map +1 -0
- package/dist/api/bedrock-converse-stream.lazy.js +43 -0
- package/dist/api/bedrock-converse-stream.lazy.js.map +1 -0
- package/dist/api/classifier-shared.d.ts +11 -0
- package/dist/api/classifier-shared.d.ts.map +1 -0
- package/dist/api/classifier-shared.js +90 -0
- package/dist/api/classifier-shared.js.map +1 -0
- package/dist/api/cloudflare-gateway-binding.d.ts +58 -0
- package/dist/api/cloudflare-gateway-binding.d.ts.map +1 -0
- package/dist/api/cloudflare-gateway-binding.js +33 -0
- package/dist/api/cloudflare-gateway-binding.js.map +1 -0
- package/dist/api/cloudflare-workers-ai-system-one.d.ts +4 -0
- package/dist/api/cloudflare-workers-ai-system-one.d.ts.map +1 -0
- package/dist/api/cloudflare-workers-ai-system-one.js +57 -0
- package/dist/api/cloudflare-workers-ai-system-one.js.map +1 -0
- package/dist/api/cloudflare-workers-ai-system-one.lazy.d.ts +3 -0
- package/dist/api/cloudflare-workers-ai-system-one.lazy.d.ts.map +1 -0
- package/dist/api/cloudflare-workers-ai-system-one.lazy.js +4 -0
- package/dist/api/cloudflare-workers-ai-system-one.lazy.js.map +1 -0
- package/dist/api/cloudflare.d.ts +11 -0
- package/dist/api/cloudflare.d.ts.map +1 -0
- package/dist/api/cloudflare.js +11 -0
- package/dist/api/cloudflare.js.map +1 -0
- package/dist/api/constrained-sampling.d.ts +38 -0
- package/dist/api/constrained-sampling.d.ts.map +1 -0
- package/dist/api/constrained-sampling.js +271 -0
- package/dist/api/constrained-sampling.js.map +1 -0
- package/dist/api/github-copilot-headers.d.ts +40 -0
- package/dist/api/github-copilot-headers.d.ts.map +1 -0
- package/dist/api/github-copilot-headers.js +76 -0
- package/dist/api/github-copilot-headers.js.map +1 -0
- package/dist/api/google-generative-ai.d.ts +15 -0
- package/dist/api/google-generative-ai.d.ts.map +1 -0
- package/dist/api/google-generative-ai.js +376 -0
- package/dist/api/google-generative-ai.js.map +1 -0
- package/dist/api/google-generative-ai.lazy.d.ts +3 -0
- package/dist/api/google-generative-ai.lazy.d.ts.map +1 -0
- package/dist/api/google-generative-ai.lazy.js +3 -0
- package/dist/api/google-generative-ai.lazy.js.map +1 -0
- package/dist/api/google-shared.d.ts +103 -0
- package/dist/api/google-shared.d.ts.map +1 -0
- package/dist/api/google-shared.js +536 -0
- package/dist/api/google-shared.js.map +1 -0
- package/dist/api/google-vertex.d.ts +17 -0
- package/dist/api/google-vertex.d.ts.map +1 -0
- package/dist/api/google-vertex.js +440 -0
- package/dist/api/google-vertex.js.map +1 -0
- package/dist/api/google-vertex.lazy.d.ts +3 -0
- package/dist/api/google-vertex.lazy.d.ts.map +1 -0
- package/dist/api/google-vertex.lazy.js +3 -0
- package/dist/api/google-vertex.lazy.js.map +1 -0
- package/dist/api/lazy.d.ts +19 -0
- package/dist/api/lazy.d.ts.map +1 -0
- package/dist/api/lazy.js +72 -0
- package/dist/api/lazy.js.map +1 -0
- package/dist/api/llama-cpp-classify.d.ts +33 -0
- package/dist/api/llama-cpp-classify.d.ts.map +1 -0
- package/dist/api/llama-cpp-classify.js +368 -0
- package/dist/api/llama-cpp-classify.js.map +1 -0
- package/dist/api/llama-cpp-classify.lazy.d.ts +3 -0
- package/dist/api/llama-cpp-classify.lazy.d.ts.map +1 -0
- package/dist/api/llama-cpp-classify.lazy.js +4 -0
- package/dist/api/llama-cpp-classify.lazy.js.map +1 -0
- package/dist/api/mistral-conversations.d.ts +25 -0
- package/dist/api/mistral-conversations.d.ts.map +1 -0
- package/dist/api/mistral-conversations.js +779 -0
- package/dist/api/mistral-conversations.js.map +1 -0
- package/dist/api/mistral-conversations.lazy.d.ts +3 -0
- package/dist/api/mistral-conversations.lazy.d.ts.map +1 -0
- package/dist/api/mistral-conversations.lazy.js +3 -0
- package/dist/api/mistral-conversations.lazy.js.map +1 -0
- package/dist/api/openai-codex-responses.d.ts +32 -0
- package/dist/api/openai-codex-responses.d.ts.map +1 -0
- package/dist/api/openai-codex-responses.js +1357 -0
- package/dist/api/openai-codex-responses.js.map +1 -0
- package/dist/api/openai-codex-responses.lazy.d.ts +3 -0
- package/dist/api/openai-codex-responses.lazy.d.ts.map +1 -0
- package/dist/api/openai-codex-responses.lazy.js +3 -0
- package/dist/api/openai-codex-responses.lazy.js.map +1 -0
- package/dist/api/openai-completions.d.ts +30 -0
- package/dist/api/openai-completions.d.ts.map +1 -0
- package/dist/api/openai-completions.js +1529 -0
- package/dist/api/openai-completions.js.map +1 -0
- package/dist/api/openai-completions.lazy.d.ts +3 -0
- package/dist/api/openai-completions.lazy.d.ts.map +1 -0
- package/dist/api/openai-completions.lazy.js +3 -0
- package/dist/api/openai-completions.lazy.js.map +1 -0
- package/dist/api/openai-decisions.d.ts +3 -0
- package/dist/api/openai-decisions.d.ts.map +1 -0
- package/dist/api/openai-decisions.js +157 -0
- package/dist/api/openai-decisions.js.map +1 -0
- package/dist/api/openai-decisions.lazy.d.ts +3 -0
- package/dist/api/openai-decisions.lazy.d.ts.map +1 -0
- package/dist/api/openai-decisions.lazy.js +4 -0
- package/dist/api/openai-decisions.lazy.js.map +1 -0
- package/dist/api/openai-images-options.d.ts +120 -0
- package/dist/api/openai-images-options.d.ts.map +1 -0
- package/dist/api/openai-images-options.js +112 -0
- package/dist/api/openai-images-options.js.map +1 -0
- package/dist/api/openai-images.d.ts +9 -0
- package/dist/api/openai-images.d.ts.map +1 -0
- package/dist/api/openai-images.js +317 -0
- package/dist/api/openai-images.js.map +1 -0
- package/dist/api/openai-images.lazy.d.ts +3 -0
- package/dist/api/openai-images.lazy.d.ts.map +1 -0
- package/dist/api/openai-images.lazy.js +4 -0
- package/dist/api/openai-images.lazy.js.map +1 -0
- package/dist/api/openai-prompt-cache.d.ts +3 -0
- package/dist/api/openai-prompt-cache.d.ts.map +1 -0
- package/dist/api/openai-prompt-cache.js +10 -0
- package/dist/api/openai-prompt-cache.js.map +1 -0
- package/dist/api/openai-responses-shared.d.ts +133 -0
- package/dist/api/openai-responses-shared.d.ts.map +1 -0
- package/dist/api/openai-responses-shared.js +970 -0
- package/dist/api/openai-responses-shared.js.map +1 -0
- package/dist/api/openai-responses.d.ts +15 -0
- package/dist/api/openai-responses.d.ts.map +1 -0
- package/dist/api/openai-responses.js +444 -0
- package/dist/api/openai-responses.js.map +1 -0
- package/dist/api/openai-responses.lazy.d.ts +3 -0
- package/dist/api/openai-responses.lazy.d.ts.map +1 -0
- package/dist/api/openai-responses.lazy.js +3 -0
- package/dist/api/openai-responses.lazy.js.map +1 -0
- package/dist/api/openai-retry-hint-client.d.ts +10 -0
- package/dist/api/openai-retry-hint-client.d.ts.map +1 -0
- package/dist/api/openai-retry-hint-client.js +17 -0
- package/dist/api/openai-retry-hint-client.js.map +1 -0
- package/dist/api/openrouter-images.d.ts +4 -0
- package/dist/api/openrouter-images.d.ts.map +1 -0
- package/dist/api/openrouter-images.js +135 -0
- package/dist/api/openrouter-images.js.map +1 -0
- package/dist/api/openrouter-images.lazy.d.ts +3 -0
- package/dist/api/openrouter-images.lazy.d.ts.map +1 -0
- package/dist/api/openrouter-images.lazy.js +4 -0
- package/dist/api/openrouter-images.lazy.js.map +1 -0
- package/dist/api/pi-messages.d.ts +101 -0
- package/dist/api/pi-messages.d.ts.map +1 -0
- package/dist/api/pi-messages.js +338 -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/api/simple-options.d.ts +17 -0
- package/dist/api/simple-options.d.ts.map +1 -0
- package/dist/api/simple-options.js +89 -0
- package/dist/api/simple-options.js.map +1 -0
- package/dist/api/strict-tool-limits.d.ts +13 -0
- package/dist/api/strict-tool-limits.d.ts.map +1 -0
- package/dist/api/strict-tool-limits.js +50 -0
- package/dist/api/strict-tool-limits.js.map +1 -0
- package/dist/api/system-one-shared.d.ts +48 -0
- package/dist/api/system-one-shared.d.ts.map +1 -0
- package/dist/api/system-one-shared.js +175 -0
- package/dist/api/system-one-shared.js.map +1 -0
- package/dist/api/transform-messages.d.ts +27 -0
- package/dist/api/transform-messages.d.ts.map +1 -0
- package/dist/api/transform-messages.js +353 -0
- package/dist/api/transform-messages.js.map +1 -0
- package/dist/api/typesafe-system-one.d.ts +4 -0
- package/dist/api/typesafe-system-one.d.ts.map +1 -0
- package/dist/api/typesafe-system-one.js +29 -0
- package/dist/api/typesafe-system-one.js.map +1 -0
- package/dist/api/typesafe-system-one.lazy.d.ts +3 -0
- package/dist/api/typesafe-system-one.lazy.d.ts.map +1 -0
- package/dist/api/typesafe-system-one.lazy.js +4 -0
- package/dist/api/typesafe-system-one.lazy.js.map +1 -0
- package/dist/auth/context.d.ts +7 -0
- package/dist/auth/context.d.ts.map +1 -0
- package/dist/auth/context.js +42 -0
- package/dist/auth/context.js.map +1 -0
- package/dist/auth/credential-store.d.ts +17 -0
- package/dist/auth/credential-store.d.ts.map +1 -0
- package/dist/auth/credential-store.js +52 -0
- package/dist/auth/credential-store.js.map +1 -0
- package/dist/auth/helpers.d.ts +30 -0
- package/dist/auth/helpers.d.ts.map +1 -0
- package/dist/auth/helpers.js +66 -0
- package/dist/auth/helpers.js.map +1 -0
- package/dist/auth/oauth/anthropic.d.ts +9 -0
- package/dist/auth/oauth/anthropic.d.ts.map +1 -0
- package/dist/auth/oauth/anthropic.js +266 -0
- package/dist/auth/oauth/anthropic.js.map +1 -0
- package/dist/auth/oauth/callback-server.d.ts +31 -0
- package/dist/auth/oauth/callback-server.d.ts.map +1 -0
- package/dist/auth/oauth/callback-server.js +138 -0
- package/dist/auth/oauth/callback-server.js.map +1 -0
- package/dist/auth/oauth/device-code.d.ts +24 -0
- package/dist/auth/oauth/device-code.d.ts.map +1 -0
- package/dist/auth/oauth/device-code.js +69 -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/auth/oauth/github-copilot.js +352 -0
- package/dist/auth/oauth/github-copilot.js.map +1 -0
- package/dist/auth/oauth/kimi-coding.d.ts +10 -0
- package/dist/auth/oauth/kimi-coding.d.ts.map +1 -0
- package/dist/auth/oauth/kimi-coding.js +238 -0
- package/dist/auth/oauth/kimi-coding.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 +67 -0
- package/dist/auth/oauth/load.js.map +1 -0
- package/dist/auth/oauth/meta.d.ts +17 -0
- package/dist/auth/oauth/meta.d.ts.map +1 -0
- package/dist/auth/oauth/meta.js +182 -0
- package/dist/auth/oauth/meta.js.map +1 -0
- package/dist/auth/oauth/oauth-page.d.ts +3 -0
- package/dist/auth/oauth/oauth-page.d.ts.map +1 -0
- package/dist/auth/oauth/oauth-page.js +105 -0
- package/dist/auth/oauth/oauth-page.js.map +1 -0
- package/dist/auth/oauth/openai-chatgpt.d.ts +3 -0
- package/dist/auth/oauth/openai-chatgpt.d.ts.map +1 -0
- package/dist/auth/oauth/openai-chatgpt.js +271 -0
- package/dist/auth/oauth/openai-chatgpt.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/auth/oauth/openai-codex.js +360 -0
- package/dist/auth/oauth/openai-codex.js.map +1 -0
- package/dist/auth/oauth/openrouter.d.ts +15 -0
- package/dist/auth/oauth/openrouter.d.ts.map +1 -0
- package/dist/auth/oauth/openrouter.js +159 -0
- package/dist/auth/oauth/openrouter.js.map +1 -0
- package/dist/auth/oauth/pkce.d.ts +13 -0
- package/dist/auth/oauth/pkce.d.ts.map +1 -0
- package/dist/auth/oauth/pkce.js +31 -0
- package/dist/auth/oauth/pkce.js.map +1 -0
- package/dist/auth/oauth/token-response.d.ts +25 -0
- package/dist/auth/oauth/token-response.d.ts.map +1 -0
- package/dist/auth/oauth/token-response.js +43 -0
- package/dist/auth/oauth/token-response.js.map +1 -0
- package/dist/auth/oauth/trusted-url.d.ts +7 -0
- package/dist/auth/oauth/trusted-url.d.ts.map +1 -0
- package/dist/auth/oauth/trusted-url.js +12 -0
- package/dist/auth/oauth/trusted-url.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 +193 -0
- package/dist/auth/oauth/xai.js.map +1 -0
- package/dist/auth/oauth-refresh-errors.d.ts +46 -0
- package/dist/auth/oauth-refresh-errors.d.ts.map +1 -0
- package/dist/auth/oauth-refresh-errors.js +150 -0
- package/dist/auth/oauth-refresh-errors.js.map +1 -0
- package/dist/auth/resolve.d.ts +62 -0
- package/dist/auth/resolve.d.ts.map +1 -0
- package/dist/auth/resolve.js +357 -0
- package/dist/auth/resolve.js.map +1 -0
- package/dist/auth/types.d.ts +267 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +2 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/bedrock-provider.d.ts +5 -0
- package/dist/bedrock-provider.d.ts.map +1 -0
- package/dist/bedrock-provider.js +6 -0
- package/dist/bedrock-provider.js.map +1 -0
- package/dist/bun-oauth.d.ts +3 -0
- package/dist/bun-oauth.d.ts.map +1 -0
- package/dist/bun-oauth.js +23 -0
- package/dist/bun-oauth.js.map +1 -0
- package/dist/cache-warming.d.ts +53 -0
- package/dist/cache-warming.d.ts.map +1 -0
- package/dist/cache-warming.js +82 -0
- package/dist/cache-warming.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +118 -0
- package/dist/cli.js.map +1 -0
- package/dist/compat/extension-oauth-types.d.ts +43 -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 +67 -0
- package/dist/compat.d.ts.map +1 -0
- package/dist/compat.js +202 -0
- package/dist/compat.js.map +1 -0
- package/dist/decision-models.d.ts +21 -0
- package/dist/decision-models.d.ts.map +1 -0
- package/dist/decision-models.generated.d.ts +3 -0
- package/dist/decision-models.generated.d.ts.map +1 -0
- package/dist/decision-models.generated.js +47 -0
- package/dist/decision-models.generated.js.map +1 -0
- package/dist/decision-models.js +8 -0
- package/dist/decision-models.js.map +1 -0
- package/dist/env-api-keys.d.ts +28 -0
- package/dist/env-api-keys.d.ts.map +1 -0
- package/dist/env-api-keys.js +185 -0
- package/dist/env-api-keys.js.map +1 -0
- package/dist/image-generation-error.d.ts +210 -0
- package/dist/image-generation-error.d.ts.map +1 -0
- package/dist/image-generation-error.js +442 -0
- package/dist/image-generation-error.js.map +1 -0
- package/dist/image-models.d.ts +21 -0
- package/dist/image-models.d.ts.map +1 -0
- package/dist/image-models.js +24 -0
- package/dist/image-models.js.map +1 -0
- package/dist/images-api-registry.d.ts +14 -0
- package/dist/images-api-registry.d.ts.map +1 -0
- package/dist/images-api-registry.js +22 -0
- package/dist/images-api-registry.js.map +1 -0
- package/dist/images.d.ts +9 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +19 -0
- package/dist/images.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/lazy-bedrock-provider.d.ts +10 -0
- package/dist/lazy-bedrock-provider.d.ts.map +1 -0
- package/dist/lazy-bedrock-provider.js +13 -0
- package/dist/lazy-bedrock-provider.js.map +1 -0
- package/dist/lazy-oauth.d.ts +10 -0
- package/dist/lazy-oauth.d.ts.map +1 -0
- package/dist/lazy-oauth.js +22 -0
- package/dist/lazy-oauth.js.map +1 -0
- package/dist/legacy-api-aliases.d.ts +42 -0
- package/dist/legacy-api-aliases.d.ts.map +1 -0
- package/dist/legacy-api-aliases.js +49 -0
- package/dist/legacy-api-aliases.js.map +1 -0
- package/dist/model-catalog.d.ts +33 -0
- package/dist/model-catalog.d.ts.map +1 -0
- package/dist/model-catalog.js +46 -0
- package/dist/model-catalog.js.map +1 -0
- package/dist/models-store.d.ts +30 -0
- package/dist/models-store.d.ts.map +1 -0
- package/dist/models-store.js +17 -0
- package/dist/models-store.js.map +1 -0
- package/dist/models.d.ts +297 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.generated.d.ts +183 -0
- package/dist/models.generated.d.ts.map +1 -0
- package/dist/models.generated.js +185 -0
- package/dist/models.generated.js.map +1 -0
- package/dist/models.js +817 -0
- package/dist/models.js.map +1 -0
- package/dist/oauth.d.ts +3 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +2 -0
- package/dist/oauth.js.map +1 -0
- package/dist/provider-id.d.ts +2 -0
- package/dist/provider-id.d.ts.map +1 -0
- package/dist/provider-id.js +4 -0
- package/dist/provider-id.js.map +1 -0
- package/dist/providers/all.d.ts +41 -0
- package/dist/providers/all.d.ts.map +1 -0
- package/dist/providers/all.js +145 -0
- package/dist/providers/all.js.map +1 -0
- package/dist/providers/amazon-bedrock.d.ts +3 -0
- package/dist/providers/amazon-bedrock.d.ts.map +1 -0
- package/dist/providers/amazon-bedrock.js +93 -0
- package/dist/providers/amazon-bedrock.js.map +1 -0
- package/dist/providers/amazon-bedrock.models.d.ts +5 -0
- package/dist/providers/amazon-bedrock.models.d.ts.map +1 -0
- package/dist/providers/amazon-bedrock.models.js +8 -0
- package/dist/providers/amazon-bedrock.models.js.map +1 -0
- package/dist/providers/ant-ling.d.ts +3 -0
- package/dist/providers/ant-ling.d.ts.map +1 -0
- package/dist/providers/ant-ling.js +15 -0
- package/dist/providers/ant-ling.js.map +1 -0
- package/dist/providers/ant-ling.models.d.ts +5 -0
- package/dist/providers/ant-ling.models.d.ts.map +1 -0
- package/dist/providers/ant-ling.models.js +8 -0
- package/dist/providers/ant-ling.models.js.map +1 -0
- package/dist/providers/anthropic.d.ts +4 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +87 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/anthropic.models.d.ts +5 -0
- package/dist/providers/anthropic.models.d.ts.map +1 -0
- package/dist/providers/anthropic.models.js +8 -0
- package/dist/providers/anthropic.models.js.map +1 -0
- package/dist/providers/azure-openai-responses.d.ts +3 -0
- package/dist/providers/azure-openai-responses.d.ts.map +1 -0
- package/dist/providers/azure-openai-responses.js +3 -0
- package/dist/providers/azure-openai-responses.js.map +1 -0
- package/dist/providers/azure-openai-responses.models.d.ts +3 -0
- package/dist/providers/azure-openai-responses.models.d.ts.map +1 -0
- package/dist/providers/azure-openai-responses.models.js +5 -0
- package/dist/providers/azure-openai-responses.models.js.map +1 -0
- package/dist/providers/azure.d.ts +3 -0
- package/dist/providers/azure.d.ts.map +1 -0
- package/dist/providers/azure.js +41 -0
- package/dist/providers/azure.js.map +1 -0
- package/dist/providers/azure.models.d.ts +5 -0
- package/dist/providers/azure.models.d.ts.map +1 -0
- package/dist/providers/azure.models.js +8 -0
- package/dist/providers/azure.models.js.map +1 -0
- package/dist/providers/baseten.d.ts +3 -0
- package/dist/providers/baseten.d.ts.map +1 -0
- package/dist/providers/baseten.js +15 -0
- package/dist/providers/baseten.js.map +1 -0
- package/dist/providers/baseten.models.d.ts +5 -0
- package/dist/providers/baseten.models.d.ts.map +1 -0
- package/dist/providers/baseten.models.js +8 -0
- package/dist/providers/baseten.models.js.map +1 -0
- package/dist/providers/cerebras.d.ts +3 -0
- package/dist/providers/cerebras.d.ts.map +1 -0
- package/dist/providers/cerebras.js +15 -0
- package/dist/providers/cerebras.js.map +1 -0
- package/dist/providers/cerebras.models.d.ts +5 -0
- package/dist/providers/cerebras.models.d.ts.map +1 -0
- package/dist/providers/cerebras.models.js +8 -0
- package/dist/providers/cerebras.models.js.map +1 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +5 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -0
- package/dist/providers/cloudflare-ai-gateway.js +21 -0
- package/dist/providers/cloudflare-ai-gateway.js.map +1 -0
- package/dist/providers/cloudflare-ai-gateway.models.d.ts +5 -0
- package/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -0
- package/dist/providers/cloudflare-ai-gateway.models.js +8 -0
- package/dist/providers/cloudflare-ai-gateway.models.js.map +1 -0
- package/dist/providers/cloudflare-auth.d.ts +4 -0
- package/dist/providers/cloudflare-auth.d.ts.map +1 -0
- package/dist/providers/cloudflare-auth.js +86 -0
- package/dist/providers/cloudflare-auth.js.map +1 -0
- package/dist/providers/cloudflare-stream.d.ts +12 -0
- package/dist/providers/cloudflare-stream.d.ts.map +1 -0
- package/dist/providers/cloudflare-stream.js +27 -0
- package/dist/providers/cloudflare-stream.js.map +1 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +3 -0
- package/dist/providers/cloudflare-workers-ai.d.ts.map +1 -0
- package/dist/providers/cloudflare-workers-ai.js +22 -0
- package/dist/providers/cloudflare-workers-ai.js.map +1 -0
- package/dist/providers/cloudflare-workers-ai.models.d.ts +5 -0
- package/dist/providers/cloudflare-workers-ai.models.d.ts.map +1 -0
- package/dist/providers/cloudflare-workers-ai.models.js +8 -0
- package/dist/providers/cloudflare-workers-ai.models.js.map +1 -0
- package/dist/providers/compat-schema.d.ts +549 -0
- package/dist/providers/compat-schema.d.ts.map +1 -0
- package/dist/providers/compat-schema.js +452 -0
- package/dist/providers/compat-schema.js.map +1 -0
- package/dist/providers/data/.manifest.json +1 -0
- package/dist/providers/data/amazon-bedrock.json +1 -0
- package/dist/providers/data/ant-ling.json +1 -0
- package/dist/providers/data/anthropic.json +1 -0
- package/dist/providers/data/azure.json +1 -0
- package/dist/providers/data/baseten.json +1 -0
- package/dist/providers/data/cerebras.json +1 -0
- package/dist/providers/data/cloudflare-ai-gateway.json +1 -0
- package/dist/providers/data/cloudflare-workers-ai.json +1 -0
- package/dist/providers/data/deepseek.json +1 -0
- package/dist/providers/data/fireworks.json +1 -0
- package/dist/providers/data/github-copilot.json +1 -0
- package/dist/providers/data/google-vertex.json +1 -0
- package/dist/providers/data/google.json +1 -0
- package/dist/providers/data/groq.json +1 -0
- package/dist/providers/data/huggingface.json +1 -0
- package/dist/providers/data/kimi-coding.json +1 -0
- package/dist/providers/data/meta.json +1 -0
- package/dist/providers/data/minimax-cn.json +1 -0
- package/dist/providers/data/minimax.json +1 -0
- package/dist/providers/data/mistral.json +1 -0
- package/dist/providers/data/moonshotai-cn.json +1 -0
- package/dist/providers/data/moonshotai.json +1 -0
- package/dist/providers/data/nvidia.json +1 -0
- package/dist/providers/data/openai-codex.json +1 -0
- package/dist/providers/data/openai-decisions.json +1 -0
- package/dist/providers/data/openai-images.json +1 -0
- package/dist/providers/data/openai.json +1 -0
- package/dist/providers/data/opencode-go.json +1 -0
- package/dist/providers/data/opencode.json +1 -0
- package/dist/providers/data/openrouter.json +1 -0
- package/dist/providers/data/qwen-token-plan-cn.json +1 -0
- package/dist/providers/data/qwen-token-plan-individual-cn.json +1 -0
- package/dist/providers/data/qwen-token-plan-individual.json +1 -0
- package/dist/providers/data/qwen-token-plan.json +1 -0
- package/dist/providers/data/together.json +1 -0
- package/dist/providers/data/typesafe.json +1 -0
- package/dist/providers/data/vercel-ai-gateway.json +1 -0
- package/dist/providers/data/xai.json +1 -0
- package/dist/providers/data/xiaomi-token-plan-ams.json +1 -0
- package/dist/providers/data/xiaomi-token-plan-cn.json +1 -0
- package/dist/providers/data/xiaomi-token-plan-sgp.json +1 -0
- package/dist/providers/data/xiaomi.json +1 -0
- package/dist/providers/data/zai-coding-cn.json +1 -0
- package/dist/providers/data/zai.json +1 -0
- package/dist/providers/deepseek.d.ts +3 -0
- package/dist/providers/deepseek.d.ts.map +1 -0
- package/dist/providers/deepseek.js +15 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/deepseek.models.d.ts +5 -0
- package/dist/providers/deepseek.models.d.ts.map +1 -0
- package/dist/providers/deepseek.models.js +8 -0
- package/dist/providers/deepseek.models.js.map +1 -0
- package/dist/providers/faux.d.ts +103 -0
- package/dist/providers/faux.d.ts.map +1 -0
- package/dist/providers/faux.js +521 -0
- package/dist/providers/faux.js.map +1 -0
- package/dist/providers/fireworks.d.ts +3 -0
- package/dist/providers/fireworks.d.ts.map +1 -0
- package/dist/providers/fireworks.js +19 -0
- package/dist/providers/fireworks.js.map +1 -0
- package/dist/providers/fireworks.models.d.ts +5 -0
- package/dist/providers/fireworks.models.d.ts.map +1 -0
- package/dist/providers/fireworks.models.js +8 -0
- package/dist/providers/fireworks.models.js.map +1 -0
- package/dist/providers/github-copilot-account.d.ts +18 -0
- package/dist/providers/github-copilot-account.d.ts.map +1 -0
- package/dist/providers/github-copilot-account.js +57 -0
- package/dist/providers/github-copilot-account.js.map +1 -0
- package/dist/providers/github-copilot-capabilities.d.ts +67 -0
- package/dist/providers/github-copilot-capabilities.d.ts.map +1 -0
- package/dist/providers/github-copilot-capabilities.js +81 -0
- package/dist/providers/github-copilot-capabilities.js.map +1 -0
- package/dist/providers/github-copilot-env.d.ts +41 -0
- package/dist/providers/github-copilot-env.d.ts.map +1 -0
- package/dist/providers/github-copilot-env.js +108 -0
- package/dist/providers/github-copilot-env.js.map +1 -0
- package/dist/providers/github-copilot-errors.d.ts +255 -0
- package/dist/providers/github-copilot-errors.d.ts.map +1 -0
- package/dist/providers/github-copilot-errors.js +764 -0
- package/dist/providers/github-copilot-errors.js.map +1 -0
- package/dist/providers/github-copilot-stream-attempt.d.ts +27 -0
- package/dist/providers/github-copilot-stream-attempt.d.ts.map +1 -0
- package/dist/providers/github-copilot-stream-attempt.js +45 -0
- package/dist/providers/github-copilot-stream-attempt.js.map +1 -0
- package/dist/providers/github-copilot.d.ts +40 -0
- package/dist/providers/github-copilot.d.ts.map +1 -0
- package/dist/providers/github-copilot.js +363 -0
- package/dist/providers/github-copilot.js.map +1 -0
- package/dist/providers/github-copilot.models.d.ts +5 -0
- package/dist/providers/github-copilot.models.d.ts.map +1 -0
- package/dist/providers/github-copilot.models.js +8 -0
- package/dist/providers/github-copilot.models.js.map +1 -0
- package/dist/providers/google-vertex.d.ts +3 -0
- package/dist/providers/google-vertex.d.ts.map +1 -0
- package/dist/providers/google-vertex.js +94 -0
- package/dist/providers/google-vertex.js.map +1 -0
- package/dist/providers/google-vertex.models.d.ts +5 -0
- package/dist/providers/google-vertex.models.d.ts.map +1 -0
- package/dist/providers/google-vertex.models.js +8 -0
- package/dist/providers/google-vertex.models.js.map +1 -0
- package/dist/providers/google.d.ts +3 -0
- package/dist/providers/google.d.ts.map +1 -0
- package/dist/providers/google.js +15 -0
- package/dist/providers/google.js.map +1 -0
- package/dist/providers/google.models.d.ts +5 -0
- package/dist/providers/google.models.d.ts.map +1 -0
- package/dist/providers/google.models.js +8 -0
- package/dist/providers/google.models.js.map +1 -0
- package/dist/providers/groq.d.ts +3 -0
- package/dist/providers/groq.d.ts.map +1 -0
- package/dist/providers/groq.js +15 -0
- package/dist/providers/groq.js.map +1 -0
- package/dist/providers/groq.models.d.ts +5 -0
- package/dist/providers/groq.models.d.ts.map +1 -0
- package/dist/providers/groq.models.js +8 -0
- package/dist/providers/groq.models.js.map +1 -0
- package/dist/providers/huggingface.d.ts +3 -0
- package/dist/providers/huggingface.d.ts.map +1 -0
- package/dist/providers/huggingface.js +15 -0
- package/dist/providers/huggingface.js.map +1 -0
- package/dist/providers/huggingface.models.d.ts +5 -0
- package/dist/providers/huggingface.models.d.ts.map +1 -0
- package/dist/providers/huggingface.models.js +8 -0
- package/dist/providers/huggingface.models.js.map +1 -0
- package/dist/providers/images/register-builtins.d.ts +5 -0
- package/dist/providers/images/register-builtins.d.ts.map +1 -0
- package/dist/providers/images/register-builtins.js +52 -0
- package/dist/providers/images/register-builtins.js.map +1 -0
- package/dist/providers/kimi-coding.d.ts +3 -0
- package/dist/providers/kimi-coding.d.ts.map +1 -0
- package/dist/providers/kimi-coding.js +24 -0
- package/dist/providers/kimi-coding.js.map +1 -0
- package/dist/providers/kimi-coding.models.d.ts +5 -0
- package/dist/providers/kimi-coding.models.d.ts.map +1 -0
- package/dist/providers/kimi-coding.models.js +8 -0
- package/dist/providers/kimi-coding.models.js.map +1 -0
- package/dist/providers/meta.d.ts +3 -0
- package/dist/providers/meta.d.ts.map +1 -0
- package/dist/providers/meta.js +24 -0
- package/dist/providers/meta.js.map +1 -0
- package/dist/providers/meta.models.d.ts +5 -0
- package/dist/providers/meta.models.d.ts.map +1 -0
- package/dist/providers/meta.models.js +8 -0
- package/dist/providers/meta.models.js.map +1 -0
- package/dist/providers/minimax-cn.d.ts +3 -0
- package/dist/providers/minimax-cn.d.ts.map +1 -0
- package/dist/providers/minimax-cn.js +15 -0
- package/dist/providers/minimax-cn.js.map +1 -0
- package/dist/providers/minimax-cn.models.d.ts +5 -0
- package/dist/providers/minimax-cn.models.d.ts.map +1 -0
- package/dist/providers/minimax-cn.models.js +8 -0
- package/dist/providers/minimax-cn.models.js.map +1 -0
- package/dist/providers/minimax.d.ts +3 -0
- package/dist/providers/minimax.d.ts.map +1 -0
- package/dist/providers/minimax.js +15 -0
- package/dist/providers/minimax.js.map +1 -0
- package/dist/providers/minimax.models.d.ts +5 -0
- package/dist/providers/minimax.models.d.ts.map +1 -0
- package/dist/providers/minimax.models.js +8 -0
- package/dist/providers/minimax.models.js.map +1 -0
- package/dist/providers/mistral.d.ts +3 -0
- package/dist/providers/mistral.d.ts.map +1 -0
- package/dist/providers/mistral.js +15 -0
- package/dist/providers/mistral.js.map +1 -0
- package/dist/providers/mistral.models.d.ts +5 -0
- package/dist/providers/mistral.models.d.ts.map +1 -0
- package/dist/providers/mistral.models.js +8 -0
- package/dist/providers/mistral.models.js.map +1 -0
- package/dist/providers/model-schema.d.ts +91 -0
- package/dist/providers/model-schema.d.ts.map +1 -0
- package/dist/providers/model-schema.js +57 -0
- package/dist/providers/model-schema.js.map +1 -0
- package/dist/providers/moonshotai-cn.d.ts +3 -0
- package/dist/providers/moonshotai-cn.d.ts.map +1 -0
- package/dist/providers/moonshotai-cn.js +15 -0
- package/dist/providers/moonshotai-cn.js.map +1 -0
- package/dist/providers/moonshotai-cn.models.d.ts +5 -0
- package/dist/providers/moonshotai-cn.models.d.ts.map +1 -0
- package/dist/providers/moonshotai-cn.models.js +8 -0
- package/dist/providers/moonshotai-cn.models.js.map +1 -0
- package/dist/providers/moonshotai.d.ts +3 -0
- package/dist/providers/moonshotai.d.ts.map +1 -0
- package/dist/providers/moonshotai.js +15 -0
- package/dist/providers/moonshotai.js.map +1 -0
- package/dist/providers/moonshotai.models.d.ts +5 -0
- package/dist/providers/moonshotai.models.d.ts.map +1 -0
- package/dist/providers/moonshotai.models.js +8 -0
- package/dist/providers/moonshotai.models.js.map +1 -0
- package/dist/providers/morph.d.ts +3 -0
- package/dist/providers/morph.d.ts.map +1 -0
- package/dist/providers/morph.js +22 -0
- package/dist/providers/morph.js.map +1 -0
- package/dist/providers/nvidia.d.ts +3 -0
- package/dist/providers/nvidia.d.ts.map +1 -0
- package/dist/providers/nvidia.js +15 -0
- package/dist/providers/nvidia.js.map +1 -0
- package/dist/providers/nvidia.models.d.ts +5 -0
- package/dist/providers/nvidia.models.d.ts.map +1 -0
- package/dist/providers/nvidia.models.js +8 -0
- package/dist/providers/nvidia.models.js.map +1 -0
- package/dist/providers/openai-codex.d.ts +3 -0
- package/dist/providers/openai-codex.d.ts.map +1 -0
- package/dist/providers/openai-codex.js +25 -0
- package/dist/providers/openai-codex.js.map +1 -0
- package/dist/providers/openai-codex.models.d.ts +5 -0
- package/dist/providers/openai-codex.models.d.ts.map +1 -0
- package/dist/providers/openai-codex.models.js +8 -0
- package/dist/providers/openai-codex.models.js.map +1 -0
- package/dist/providers/openai-decisions.d.ts +3 -0
- package/dist/providers/openai-decisions.d.ts.map +1 -0
- package/dist/providers/openai-decisions.js +19 -0
- package/dist/providers/openai-decisions.js.map +1 -0
- package/dist/providers/openai-decisions.models.d.ts +5 -0
- package/dist/providers/openai-decisions.models.d.ts.map +1 -0
- package/dist/providers/openai-decisions.models.js +8 -0
- package/dist/providers/openai-decisions.models.js.map +1 -0
- package/dist/providers/openai-images.d.ts +3 -0
- package/dist/providers/openai-images.d.ts.map +1 -0
- package/dist/providers/openai-images.js +19 -0
- package/dist/providers/openai-images.js.map +1 -0
- package/dist/providers/openai-images.models.d.ts +5 -0
- package/dist/providers/openai-images.models.d.ts.map +1 -0
- package/dist/providers/openai-images.models.js +8 -0
- package/dist/providers/openai-images.models.js.map +1 -0
- package/dist/providers/openai-mid-convo-effort.d.ts +2 -0
- package/dist/providers/openai-mid-convo-effort.d.ts.map +1 -0
- package/dist/providers/openai-mid-convo-effort.js +8 -0
- package/dist/providers/openai-mid-convo-effort.js.map +1 -0
- package/dist/providers/openai-subscription-models.d.ts +3 -0
- package/dist/providers/openai-subscription-models.d.ts.map +1 -0
- package/dist/providers/openai-subscription-models.js +19 -0
- package/dist/providers/openai-subscription-models.js.map +1 -0
- package/dist/providers/openai.d.ts +4 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +48 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/openai.models.d.ts +5 -0
- package/dist/providers/openai.models.d.ts.map +1 -0
- package/dist/providers/openai.models.js +8 -0
- package/dist/providers/openai.models.js.map +1 -0
- package/dist/providers/opencode-go.d.ts +5 -0
- package/dist/providers/opencode-go.d.ts.map +1 -0
- package/dist/providers/opencode-go.js +22 -0
- package/dist/providers/opencode-go.js.map +1 -0
- package/dist/providers/opencode-go.models.d.ts +5 -0
- package/dist/providers/opencode-go.models.d.ts.map +1 -0
- package/dist/providers/opencode-go.models.js +8 -0
- package/dist/providers/opencode-go.models.js.map +1 -0
- package/dist/providers/opencode.d.ts +5 -0
- package/dist/providers/opencode.d.ts.map +1 -0
- package/dist/providers/opencode.js +24 -0
- package/dist/providers/opencode.js.map +1 -0
- package/dist/providers/opencode.models.d.ts +5 -0
- package/dist/providers/opencode.models.d.ts.map +1 -0
- package/dist/providers/opencode.models.js +8 -0
- package/dist/providers/opencode.models.js.map +1 -0
- package/dist/providers/openrouter-api.d.ts +40 -0
- package/dist/providers/openrouter-api.d.ts.map +1 -0
- package/dist/providers/openrouter-api.js +41 -0
- package/dist/providers/openrouter-api.js.map +1 -0
- package/dist/providers/openrouter.d.ts +13 -0
- package/dist/providers/openrouter.d.ts.map +1 -0
- package/dist/providers/openrouter.js +88 -0
- package/dist/providers/openrouter.js.map +1 -0
- package/dist/providers/openrouter.models.d.ts +5 -0
- package/dist/providers/openrouter.models.d.ts.map +1 -0
- package/dist/providers/openrouter.models.js +8 -0
- package/dist/providers/openrouter.models.js.map +1 -0
- package/dist/providers/qwen-token-plan-cn.d.ts +3 -0
- package/dist/providers/qwen-token-plan-cn.d.ts.map +1 -0
- package/dist/providers/qwen-token-plan-cn.js +20 -0
- package/dist/providers/qwen-token-plan-cn.js.map +1 -0
- package/dist/providers/qwen-token-plan-cn.models.d.ts +5 -0
- package/dist/providers/qwen-token-plan-cn.models.d.ts.map +1 -0
- package/dist/providers/qwen-token-plan-cn.models.js +8 -0
- package/dist/providers/qwen-token-plan-cn.models.js.map +1 -0
- package/dist/providers/qwen-token-plan-individual-cn.d.ts +3 -0
- package/dist/providers/qwen-token-plan-individual-cn.d.ts.map +1 -0
- package/dist/providers/qwen-token-plan-individual-cn.js +20 -0
- package/dist/providers/qwen-token-plan-individual-cn.js.map +1 -0
- package/dist/providers/qwen-token-plan-individual-cn.models.d.ts +5 -0
- package/dist/providers/qwen-token-plan-individual-cn.models.d.ts.map +1 -0
- package/dist/providers/qwen-token-plan-individual-cn.models.js +8 -0
- package/dist/providers/qwen-token-plan-individual-cn.models.js.map +1 -0
- package/dist/providers/qwen-token-plan-individual.d.ts +3 -0
- package/dist/providers/qwen-token-plan-individual.d.ts.map +1 -0
- package/dist/providers/qwen-token-plan-individual.js +20 -0
- package/dist/providers/qwen-token-plan-individual.js.map +1 -0
- package/dist/providers/qwen-token-plan-individual.models.d.ts +5 -0
- package/dist/providers/qwen-token-plan-individual.models.d.ts.map +1 -0
- package/dist/providers/qwen-token-plan-individual.models.js +8 -0
- package/dist/providers/qwen-token-plan-individual.models.js.map +1 -0
- package/dist/providers/qwen-token-plan.d.ts +3 -0
- package/dist/providers/qwen-token-plan.d.ts.map +1 -0
- package/dist/providers/qwen-token-plan.js +20 -0
- package/dist/providers/qwen-token-plan.js.map +1 -0
- package/dist/providers/qwen-token-plan.models.d.ts +5 -0
- package/dist/providers/qwen-token-plan.models.d.ts.map +1 -0
- package/dist/providers/qwen-token-plan.models.js +8 -0
- package/dist/providers/qwen-token-plan.models.js.map +1 -0
- package/dist/providers/together.d.ts +3 -0
- package/dist/providers/together.d.ts.map +1 -0
- package/dist/providers/together.js +15 -0
- package/dist/providers/together.js.map +1 -0
- package/dist/providers/together.models.d.ts +5 -0
- package/dist/providers/together.models.d.ts.map +1 -0
- package/dist/providers/together.models.js +8 -0
- package/dist/providers/together.models.js.map +1 -0
- package/dist/providers/typesafe.d.ts +3 -0
- package/dist/providers/typesafe.d.ts.map +1 -0
- package/dist/providers/typesafe.js +18 -0
- package/dist/providers/typesafe.js.map +1 -0
- package/dist/providers/typesafe.models.d.ts +5 -0
- package/dist/providers/typesafe.models.d.ts.map +1 -0
- package/dist/providers/typesafe.models.js +8 -0
- package/dist/providers/typesafe.models.js.map +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +3 -0
- package/dist/providers/vercel-ai-gateway.d.ts.map +1 -0
- package/dist/providers/vercel-ai-gateway.js +17 -0
- package/dist/providers/vercel-ai-gateway.js.map +1 -0
- package/dist/providers/vercel-ai-gateway.models.d.ts +5 -0
- package/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -0
- package/dist/providers/vercel-ai-gateway.models.js +8 -0
- package/dist/providers/vercel-ai-gateway.models.js.map +1 -0
- package/dist/providers/xai.d.ts +3 -0
- package/dist/providers/xai.d.ts.map +1 -0
- package/dist/providers/xai.js +24 -0
- package/dist/providers/xai.js.map +1 -0
- package/dist/providers/xai.models.d.ts +5 -0
- package/dist/providers/xai.models.d.ts.map +1 -0
- package/dist/providers/xai.models.js +8 -0
- package/dist/providers/xai.models.js.map +1 -0
- package/dist/providers/xiaomi-token-plan-ams.d.ts +3 -0
- package/dist/providers/xiaomi-token-plan-ams.d.ts.map +1 -0
- package/dist/providers/xiaomi-token-plan-ams.js +15 -0
- package/dist/providers/xiaomi-token-plan-ams.js.map +1 -0
- package/dist/providers/xiaomi-token-plan-ams.models.d.ts +5 -0
- package/dist/providers/xiaomi-token-plan-ams.models.d.ts.map +1 -0
- package/dist/providers/xiaomi-token-plan-ams.models.js +8 -0
- package/dist/providers/xiaomi-token-plan-ams.models.js.map +1 -0
- package/dist/providers/xiaomi-token-plan-cn.d.ts +3 -0
- package/dist/providers/xiaomi-token-plan-cn.d.ts.map +1 -0
- package/dist/providers/xiaomi-token-plan-cn.js +15 -0
- package/dist/providers/xiaomi-token-plan-cn.js.map +1 -0
- package/dist/providers/xiaomi-token-plan-cn.models.d.ts +5 -0
- package/dist/providers/xiaomi-token-plan-cn.models.d.ts.map +1 -0
- package/dist/providers/xiaomi-token-plan-cn.models.js +8 -0
- package/dist/providers/xiaomi-token-plan-cn.models.js.map +1 -0
- package/dist/providers/xiaomi-token-plan-sgp.d.ts +3 -0
- package/dist/providers/xiaomi-token-plan-sgp.d.ts.map +1 -0
- package/dist/providers/xiaomi-token-plan-sgp.js +15 -0
- package/dist/providers/xiaomi-token-plan-sgp.js.map +1 -0
- package/dist/providers/xiaomi-token-plan-sgp.models.d.ts +5 -0
- package/dist/providers/xiaomi-token-plan-sgp.models.d.ts.map +1 -0
- package/dist/providers/xiaomi-token-plan-sgp.models.js +8 -0
- package/dist/providers/xiaomi-token-plan-sgp.models.js.map +1 -0
- package/dist/providers/xiaomi.d.ts +3 -0
- package/dist/providers/xiaomi.d.ts.map +1 -0
- package/dist/providers/xiaomi.js +15 -0
- package/dist/providers/xiaomi.js.map +1 -0
- package/dist/providers/xiaomi.models.d.ts +5 -0
- package/dist/providers/xiaomi.models.d.ts.map +1 -0
- package/dist/providers/xiaomi.models.js +8 -0
- package/dist/providers/xiaomi.models.js.map +1 -0
- package/dist/providers/zai-coding-cn.d.ts +3 -0
- package/dist/providers/zai-coding-cn.d.ts.map +1 -0
- package/dist/providers/zai-coding-cn.js +15 -0
- package/dist/providers/zai-coding-cn.js.map +1 -0
- package/dist/providers/zai-coding-cn.models.d.ts +5 -0
- package/dist/providers/zai-coding-cn.models.d.ts.map +1 -0
- package/dist/providers/zai-coding-cn.models.js +8 -0
- package/dist/providers/zai-coding-cn.models.js.map +1 -0
- package/dist/providers/zai.d.ts +3 -0
- package/dist/providers/zai.d.ts.map +1 -0
- package/dist/providers/zai.js +15 -0
- package/dist/providers/zai.js.map +1 -0
- package/dist/providers/zai.models.d.ts +5 -0
- package/dist/providers/zai.models.d.ts.map +1 -0
- package/dist/providers/zai.models.js +8 -0
- package/dist/providers/zai.models.js.map +1 -0
- package/dist/session-resources.d.ts +4 -0
- package/dist/session-resources.d.ts.map +1 -0
- package/dist/session-resources.js +22 -0
- package/dist/session-resources.js.map +1 -0
- package/dist/types.d.ts +845 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/abort-signals.d.ts +6 -0
- package/dist/utils/abort-signals.d.ts.map +1 -0
- package/dist/utils/abort-signals.js +34 -0
- package/dist/utils/abort-signals.js.map +1 -0
- package/dist/utils/abort.d.ts +8 -0
- package/dist/utils/abort.d.ts.map +1 -0
- package/dist/utils/abort.js +49 -0
- package/dist/utils/abort.js.map +1 -0
- package/dist/utils/azure-openai-thinking-level-map.d.ts +19 -0
- package/dist/utils/azure-openai-thinking-level-map.d.ts.map +1 -0
- package/dist/utils/azure-openai-thinking-level-map.js +45 -0
- package/dist/utils/azure-openai-thinking-level-map.js.map +1 -0
- package/dist/utils/diagnostics.d.ts +20 -0
- package/dist/utils/diagnostics.d.ts.map +1 -0
- package/dist/utils/diagnostics.js +25 -0
- package/dist/utils/diagnostics.js.map +1 -0
- package/dist/utils/document-input.d.ts +21 -0
- package/dist/utils/document-input.d.ts.map +1 -0
- package/dist/utils/document-input.js +28 -0
- package/dist/utils/document-input.js.map +1 -0
- package/dist/utils/error-body.d.ts +40 -0
- package/dist/utils/error-body.d.ts.map +1 -0
- package/dist/utils/error-body.js +177 -0
- package/dist/utils/error-body.js.map +1 -0
- package/dist/utils/estimate.d.ts +17 -0
- package/dist/utils/estimate.d.ts.map +1 -0
- package/dist/utils/estimate.js +107 -0
- package/dist/utils/estimate.js.map +1 -0
- package/dist/utils/event-stream.d.ts +24 -0
- package/dist/utils/event-stream.d.ts.map +1 -0
- package/dist/utils/event-stream.js +118 -0
- package/dist/utils/event-stream.js.map +1 -0
- package/dist/utils/hash.d.ts +3 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +14 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/headers.d.ts +4 -0
- package/dist/utils/headers.d.ts.map +1 -0
- package/dist/utils/headers.js +20 -0
- package/dist/utils/headers.js.map +1 -0
- package/dist/utils/identity.d.ts +67 -0
- package/dist/utils/identity.d.ts.map +1 -0
- package/dist/utils/identity.js +148 -0
- package/dist/utils/identity.js.map +1 -0
- package/dist/utils/inline-images.d.ts +24 -0
- package/dist/utils/inline-images.d.ts.map +1 -0
- package/dist/utils/inline-images.js +55 -0
- package/dist/utils/inline-images.js.map +1 -0
- package/dist/utils/json-parse.d.ts +18 -0
- package/dist/utils/json-parse.d.ts.map +1 -0
- package/dist/utils/json-parse.js +167 -0
- package/dist/utils/json-parse.js.map +1 -0
- package/dist/utils/model-operations.d.ts +12 -0
- package/dist/utils/model-operations.d.ts.map +1 -0
- package/dist/utils/model-operations.js +58 -0
- package/dist/utils/model-operations.js.map +1 -0
- package/dist/utils/models-dev-catalog.d.ts +324 -0
- package/dist/utils/models-dev-catalog.d.ts.map +1 -0
- package/dist/utils/models-dev-catalog.js +3166 -0
- package/dist/utils/models-dev-catalog.js.map +1 -0
- package/dist/utils/models-dev-reasoning-options.d.ts +18 -0
- package/dist/utils/models-dev-reasoning-options.d.ts.map +1 -0
- package/dist/utils/models-dev-reasoning-options.js +20 -0
- package/dist/utils/models-dev-reasoning-options.js.map +1 -0
- package/dist/utils/models-error.d.ts +8 -0
- package/dist/utils/models-error.d.ts.map +1 -0
- package/dist/utils/models-error.js +19 -0
- package/dist/utils/models-error.js.map +1 -0
- package/dist/utils/node-http-proxy.d.ts +4 -0
- package/dist/utils/node-http-proxy.d.ts.map +1 -0
- package/dist/utils/node-http-proxy.js +141 -0
- package/dist/utils/node-http-proxy.js.map +1 -0
- package/dist/utils/oauth-page.d.ts +2 -0
- package/dist/utils/oauth-page.d.ts.map +1 -0
- package/dist/utils/oauth-page.js +2 -0
- package/dist/utils/oauth-page.js.map +1 -0
- package/dist/utils/openrouter-cost.d.ts +24 -0
- package/dist/utils/openrouter-cost.d.ts.map +1 -0
- package/dist/utils/openrouter-cost.js +34 -0
- package/dist/utils/openrouter-cost.js.map +1 -0
- package/dist/utils/overflow.d.ts +73 -0
- package/dist/utils/overflow.d.ts.map +1 -0
- package/dist/utils/overflow.js +204 -0
- package/dist/utils/overflow.js.map +1 -0
- package/dist/utils/provider-env.d.ts +12 -0
- package/dist/utils/provider-env.d.ts.map +1 -0
- package/dist/utils/provider-env.js +51 -0
- package/dist/utils/provider-env.js.map +1 -0
- package/dist/utils/provider-retry.d.ts +21 -0
- package/dist/utils/provider-retry.d.ts.map +1 -0
- package/dist/utils/provider-retry.js +100 -0
- package/dist/utils/provider-retry.js.map +1 -0
- package/dist/utils/request-admission.d.ts +12 -0
- package/dist/utils/request-admission.d.ts.map +1 -0
- package/dist/utils/request-admission.js +37 -0
- package/dist/utils/request-admission.js.map +1 -0
- package/dist/utils/retry-hints.d.ts +15 -0
- package/dist/utils/retry-hints.d.ts.map +1 -0
- package/dist/utils/retry-hints.js +130 -0
- package/dist/utils/retry-hints.js.map +1 -0
- package/dist/utils/retry.d.ts +78 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +251 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/sanitize-unicode.d.ts +22 -0
- package/dist/utils/sanitize-unicode.d.ts.map +1 -0
- package/dist/utils/sanitize-unicode.js +26 -0
- package/dist/utils/sanitize-unicode.js.map +1 -0
- package/dist/utils/sleep.d.ts +2 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +15 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/sse.d.ts +29 -0
- package/dist/utils/sse.d.ts.map +1 -0
- package/dist/utils/sse.js +73 -0
- package/dist/utils/sse.js.map +1 -0
- package/dist/utils/stream-deadline.d.ts +78 -0
- package/dist/utils/stream-deadline.d.ts.map +1 -0
- package/dist/utils/stream-deadline.js +205 -0
- package/dist/utils/stream-deadline.js.map +1 -0
- package/dist/utils/streaming-json.d.ts +84 -0
- package/dist/utils/streaming-json.d.ts.map +1 -0
- package/dist/utils/streaming-json.js +513 -0
- package/dist/utils/streaming-json.js.map +1 -0
- package/dist/utils/text.d.ts +21 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +45 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/thinking-off.d.ts +23 -0
- package/dist/utils/thinking-off.d.ts.map +1 -0
- package/dist/utils/thinking-off.js +51 -0
- package/dist/utils/thinking-off.js.map +1 -0
- package/dist/utils/transcript.d.ts +101 -0
- package/dist/utils/transcript.d.ts.map +1 -0
- package/dist/utils/transcript.js +218 -0
- package/dist/utils/transcript.js.map +1 -0
- package/dist/utils/typebox-helpers.d.ts +17 -0
- package/dist/utils/typebox-helpers.d.ts.map +1 -0
- package/dist/utils/typebox-helpers.js +21 -0
- package/dist/utils/typebox-helpers.js.map +1 -0
- package/dist/utils/uuid.d.ts +3 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/utils/uuid.js +46 -0
- package/dist/utils/uuid.js.map +1 -0
- package/dist/utils/validation.d.ts +24 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +363 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/utils/version.d.ts +2 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +3 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +138 -4
|
@@ -0,0 +1,3166 @@
|
|
|
1
|
+
// Atomic's model catalog transform: models.dev's api.json into the catalog's chat models. Shared by the build-time
|
|
2
|
+
// generator (scripts/generate-models.ts) and the runtime catalog refresh, so both produce the same models.
|
|
3
|
+
// Pure: no I/O, no network.
|
|
4
|
+
import { CLOUDFLARE_AI_GATEWAY_ANTHROPIC_BASE_URL, CLOUDFLARE_AI_GATEWAY_COMPAT_BASE_URL, CLOUDFLARE_AI_GATEWAY_OPENAI_BASE_URL, CLOUDFLARE_WORKERS_AI_BASE_URL, } from "../api/cloudflare.js";
|
|
5
|
+
import { githubCopilotApiForSdk } from "../providers/github-copilot-capabilities.js";
|
|
6
|
+
import { OPENAI_MID_CONVO_EFFORT_MODEL_IDS } from "../providers/openai-mid-convo-effort.js";
|
|
7
|
+
import { applyAzureOpenAIListedEfforts, applyAzureOpenAIThinkingOffMasks } from "./azure-openai-thinking-level-map.js";
|
|
8
|
+
import { getEffortThinkingLevelMap } from "./models-dev-reasoning-options.js";
|
|
9
|
+
function assertExactModelIds(label, expected, actual) {
|
|
10
|
+
const expectedIds = Array.from(new Set(expected)).sort();
|
|
11
|
+
const actualIds = Array.from(new Set(actual)).sort();
|
|
12
|
+
if (expectedIds.length === actualIds.length && expectedIds.every((id, index) => id === actualIds[index]))
|
|
13
|
+
return;
|
|
14
|
+
const missing = expectedIds.filter((id) => !actualIds.includes(id));
|
|
15
|
+
const extra = actualIds.filter((id) => !expectedIds.includes(id));
|
|
16
|
+
const difference = [
|
|
17
|
+
missing.length > 0 ? `missing: ${missing.join(", ")}` : "",
|
|
18
|
+
extra.length > 0 ? `extra: ${extra.join(", ")}` : "",
|
|
19
|
+
]
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.join("; ");
|
|
22
|
+
// The same message as scripts/model-data.ts, which the generator's strict checks report.
|
|
23
|
+
throw new Error(`${label} model IDs do not match (${difference})`);
|
|
24
|
+
}
|
|
25
|
+
export const CLOUDFLARE_DEFAULT_WORKERS_AI_MODEL_ID = "@cf/moonshotai/kimi-k2.6";
|
|
26
|
+
export const CLOUDFLARE_DEFAULT_WORKERS_AI_MODEL = {
|
|
27
|
+
id: CLOUDFLARE_DEFAULT_WORKERS_AI_MODEL_ID,
|
|
28
|
+
name: "Kimi K2.6",
|
|
29
|
+
tool_call: true,
|
|
30
|
+
reasoning: true,
|
|
31
|
+
reasoning_options: [{ type: "toggle" }, { type: "effort", values: ["low", "medium", "high"] }],
|
|
32
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
33
|
+
cost: { input: 0.95, output: 4, cache_read: 0.16 },
|
|
34
|
+
limit: { context: 262_144, output: 256_000 },
|
|
35
|
+
};
|
|
36
|
+
export const COPILOT_STATIC_HEADERS = {
|
|
37
|
+
"User-Agent": "GitHubCopilotChat/0.35.0",
|
|
38
|
+
"Editor-Version": "vscode/1.107.0",
|
|
39
|
+
"Editor-Plugin-Version": "copilot-chat/0.35.0",
|
|
40
|
+
"Copilot-Integration-Id": "vscode-chat",
|
|
41
|
+
};
|
|
42
|
+
export const TOGETHER_BASE_URL = "https://api.together.ai/v1";
|
|
43
|
+
export const TOGETHER_BASE_COMPAT = {
|
|
44
|
+
supportsStore: false,
|
|
45
|
+
supportsDeveloperRole: false,
|
|
46
|
+
supportsReasoningEffort: false,
|
|
47
|
+
maxTokensField: "max_tokens",
|
|
48
|
+
supportsStrictMode: false,
|
|
49
|
+
supportsLongCacheRetention: false,
|
|
50
|
+
};
|
|
51
|
+
export const TOGETHER_TOGGLE_REASONING_COMPAT = {
|
|
52
|
+
...TOGETHER_BASE_COMPAT,
|
|
53
|
+
thinkingFormat: "together",
|
|
54
|
+
};
|
|
55
|
+
export const TOGETHER_REASONING_EFFORT_COMPAT = {
|
|
56
|
+
...TOGETHER_BASE_COMPAT,
|
|
57
|
+
supportsReasoningEffort: true,
|
|
58
|
+
thinkingFormat: "openai",
|
|
59
|
+
};
|
|
60
|
+
export const TOGETHER_TOGGLE_REASONING_EFFORT_COMPAT = {
|
|
61
|
+
...TOGETHER_TOGGLE_REASONING_COMPAT,
|
|
62
|
+
supportsReasoningEffort: true,
|
|
63
|
+
};
|
|
64
|
+
export const TOGETHER_REASONING_EFFORT_MODELS = new Set(["openai/gpt-oss-20b", "openai/gpt-oss-120b"]);
|
|
65
|
+
export const TOGETHER_TOGGLE_REASONING_EFFORT_MODELS = new Set([
|
|
66
|
+
"deepseek-ai/DeepSeek-V4-Pro",
|
|
67
|
+
"deepseek-ai/DeepSeek-V4-Pro-0813",
|
|
68
|
+
]);
|
|
69
|
+
export const TOGETHER_REASONING_EFFORT_LEVEL_MAP = {
|
|
70
|
+
off: null,
|
|
71
|
+
minimal: null,
|
|
72
|
+
};
|
|
73
|
+
export const TOGETHER_DEEPSEEK_V4_THINKING_LEVEL_MAP = {
|
|
74
|
+
minimal: null,
|
|
75
|
+
low: null,
|
|
76
|
+
medium: null,
|
|
77
|
+
high: "high",
|
|
78
|
+
xhigh: null,
|
|
79
|
+
};
|
|
80
|
+
export const TOGETHER_TOGGLE_REASONING_LEVEL_MAP = {
|
|
81
|
+
minimal: null,
|
|
82
|
+
low: null,
|
|
83
|
+
medium: null,
|
|
84
|
+
};
|
|
85
|
+
export const AI_GATEWAY_MODELS_URL = "https://ai-gateway.vercel.sh/v1";
|
|
86
|
+
export const AI_GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh";
|
|
87
|
+
export const AI_GATEWAY_TYPESAFE_BASE_URL = "https://ai-gateway.vercel.sh/typesafe/v1";
|
|
88
|
+
export const VERTEX_BASE_URL = "https://{location}-aiplatform.googleapis.com";
|
|
89
|
+
export const NVIDIA_BASE_URL = "https://integrate.api.nvidia.com/v1";
|
|
90
|
+
export const NVIDIA_HEADERS = {
|
|
91
|
+
"NVCF-POLL-SECONDS": "3600",
|
|
92
|
+
};
|
|
93
|
+
export const NVIDIA_OPENAI_COMPAT = {
|
|
94
|
+
supportsStore: false,
|
|
95
|
+
supportsDeveloperRole: false,
|
|
96
|
+
supportsReasoningEffort: false,
|
|
97
|
+
maxTokensField: "max_tokens",
|
|
98
|
+
supportsStrictMode: false,
|
|
99
|
+
supportsLongCacheRetention: false,
|
|
100
|
+
};
|
|
101
|
+
export const NVIDIA_NIM_UNSUPPORTED_MODELS = new Set([
|
|
102
|
+
"abacusai/dracarys-llama-3.1-70b-instruct",
|
|
103
|
+
"bytedance/seed-oss-36b-instruct",
|
|
104
|
+
"deepseek-ai/deepseek-v4-flash",
|
|
105
|
+
"deepseek-ai/deepseek-v4-pro",
|
|
106
|
+
"google/gemma-2-2b-it",
|
|
107
|
+
"google/gemma-3n-e2b-it",
|
|
108
|
+
"google/gemma-3n-e4b-it",
|
|
109
|
+
"google/gemma-4-31b-it",
|
|
110
|
+
"meta/llama-3.2-1b-instruct",
|
|
111
|
+
"meta/llama-4-maverick-17b-128e-instruct",
|
|
112
|
+
"microsoft/phi-4-mini-instruct",
|
|
113
|
+
"minimaxai/minimax-m2.7",
|
|
114
|
+
"mistralai/mistral-nemotron",
|
|
115
|
+
"nvidia/nemotron-mini-4b-instruct",
|
|
116
|
+
"qwen/qwen3-next-80b-a3b-instruct",
|
|
117
|
+
"qwen/qwen3.5-397b-a17b",
|
|
118
|
+
"sarvamai/sarvam-m",
|
|
119
|
+
"upstage/solar-10.7b-instruct",
|
|
120
|
+
]);
|
|
121
|
+
export const ZAI_TOOL_STREAM_UNSUPPORTED_MODELS = new Set(["glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v"]);
|
|
122
|
+
export const OPENCODE_GO_GLM52_THINKING_LEVEL_MAP = {
|
|
123
|
+
off: null,
|
|
124
|
+
minimal: null,
|
|
125
|
+
low: null,
|
|
126
|
+
medium: null,
|
|
127
|
+
high: "high",
|
|
128
|
+
max: "max",
|
|
129
|
+
};
|
|
130
|
+
export const EAGER_TOOL_INPUT_STREAMING_UNSUPPORTED_ANTHROPIC_MODELS = new Set([
|
|
131
|
+
"github-copilot:claude-haiku-4.5",
|
|
132
|
+
"github-copilot:claude-sonnet-4",
|
|
133
|
+
"github-copilot:claude-sonnet-4.5",
|
|
134
|
+
]);
|
|
135
|
+
// Anthropic publishes the permitted server-side `fallbacks` targets per model. Claude Fable 5.1:
|
|
136
|
+
// "The permitted fallback targets for Claude Fable 5.1 are Claude Opus 4.8 and Claude Opus 5."
|
|
137
|
+
// https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1
|
|
138
|
+
export const ANTHROPIC_ALLOWED_FALLBACK_MODELS = {
|
|
139
|
+
"claude-fable-5": ["claude-opus-4-8", "claude-opus-5"],
|
|
140
|
+
"claude-fable-5-1": ["claude-opus-4-8", "claude-opus-5"],
|
|
141
|
+
"claude-fable-5-2": ["claude-opus-4-8", "claude-opus-5"],
|
|
142
|
+
"claude-opus-5": ["claude-opus-4-8"],
|
|
143
|
+
};
|
|
144
|
+
export const DEEPSEEK_V4_THINKING_LEVEL_MAP = {
|
|
145
|
+
minimal: null,
|
|
146
|
+
low: null,
|
|
147
|
+
medium: null,
|
|
148
|
+
high: "high",
|
|
149
|
+
max: "max",
|
|
150
|
+
};
|
|
151
|
+
export const DEEPSEEK_V4_FLASH_THINKING_LEVEL_MAP = {
|
|
152
|
+
...DEEPSEEK_V4_THINKING_LEVEL_MAP,
|
|
153
|
+
low: "low",
|
|
154
|
+
};
|
|
155
|
+
export const AZURE_DEEPSEEK_V4_THINKING_LEVEL_MAP = {
|
|
156
|
+
minimal: null,
|
|
157
|
+
low: "low",
|
|
158
|
+
medium: "medium",
|
|
159
|
+
high: "high",
|
|
160
|
+
xhigh: null,
|
|
161
|
+
max: null,
|
|
162
|
+
};
|
|
163
|
+
// Verified against Fireworks Messages raw_output on 2026-09-10 (#9323).
|
|
164
|
+
// Fall back to verified support when models.dev omits effort metadata; this is
|
|
165
|
+
// not an allowlist. Any Fireworks Messages model advertising effort uses adaptive thinking.
|
|
166
|
+
export const FIREWORKS_ADAPTIVE_THINKING_FALLBACK_MODELS = new Set([
|
|
167
|
+
"accounts/fireworks/models/deepseek-v4-flash-0731",
|
|
168
|
+
"accounts/fireworks/models/deepseek-v4-flash-vision-exp",
|
|
169
|
+
"accounts/fireworks/models/deepseek-v4-pro-0813",
|
|
170
|
+
"accounts/fireworks/models/qwen3p8-max",
|
|
171
|
+
"accounts/fireworks/models/qwen3p8-2p4t-a95b",
|
|
172
|
+
]);
|
|
173
|
+
export const QWEN_TOKEN_PLAN_FALLBACK_THINKING_LEVEL_MAP = {
|
|
174
|
+
minimal: null,
|
|
175
|
+
low: null,
|
|
176
|
+
medium: null,
|
|
177
|
+
high: "high",
|
|
178
|
+
xhigh: null,
|
|
179
|
+
max: "max",
|
|
180
|
+
};
|
|
181
|
+
export const QWEN_TOKEN_PLAN_REASONING_EFFORT_FALLBACK_MODEL_IDS = new Set(["glm-5", "glm-5.1"]);
|
|
182
|
+
export const QWEN_TOKEN_PLAN_PROVIDER_IDS = new Set([
|
|
183
|
+
"qwen-token-plan",
|
|
184
|
+
"qwen-token-plan-cn",
|
|
185
|
+
"qwen-token-plan-individual",
|
|
186
|
+
"qwen-token-plan-individual-cn",
|
|
187
|
+
]);
|
|
188
|
+
// Token Plan Individual (Personal) text-model allowlist, verified 2026-11-09 against both regions' docs.
|
|
189
|
+
// qwen-token-plan-individual-cn applies it to the China endpoint.
|
|
190
|
+
// https://docs.qwencloud.com/token-plan/personal/token-plan-personal-overview
|
|
191
|
+
// https://platform.qianwenai.com/docs/token-plan/personal/token-plan-personal-overview
|
|
192
|
+
export const QWEN_TOKEN_PLAN_INDIVIDUAL_MODEL_IDS = new Set([
|
|
193
|
+
"deepseek-v4-flash-0731",
|
|
194
|
+
"deepseek-v4-pro",
|
|
195
|
+
"deepseek-v4-pro-0813",
|
|
196
|
+
"deepseek-v4.1-flash",
|
|
197
|
+
"deepseek-v4.1-flash-1017",
|
|
198
|
+
"glm-5.2",
|
|
199
|
+
"glm-5.3",
|
|
200
|
+
"qwen3.6-flash",
|
|
201
|
+
"qwen3.7-max",
|
|
202
|
+
"qwen3.7-plus",
|
|
203
|
+
"qwen3.8-flash",
|
|
204
|
+
"qwen3.8-max",
|
|
205
|
+
]);
|
|
206
|
+
export const KIMI_K3_MAX_TOKENS = 131072;
|
|
207
|
+
export const KIMI_K3_COST = {
|
|
208
|
+
input: 3,
|
|
209
|
+
output: 15,
|
|
210
|
+
cacheRead: 0.3,
|
|
211
|
+
cacheWrite: 0,
|
|
212
|
+
};
|
|
213
|
+
// Kimi Chat Completions settings shared by Moonshot and Kimi Coding.
|
|
214
|
+
export const KIMI_OPENAI_COMPAT = {
|
|
215
|
+
supportsStore: false,
|
|
216
|
+
supportsDeveloperRole: false,
|
|
217
|
+
supportsReasoningEffort: false,
|
|
218
|
+
maxTokensField: "max_tokens",
|
|
219
|
+
supportsStrictMode: false,
|
|
220
|
+
thinkingFormat: "deepseek",
|
|
221
|
+
};
|
|
222
|
+
// Kimi K3-style models take reasoning_effort and need earlier reasoning sent back.
|
|
223
|
+
export const KIMI_K3_OPENAI_COMPAT = {
|
|
224
|
+
...KIMI_OPENAI_COMPAT,
|
|
225
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
226
|
+
thinkingFormat: "openai",
|
|
227
|
+
supportsReasoningEffort: true,
|
|
228
|
+
};
|
|
229
|
+
// Kimi K3 and its point releases (kimi-k3.1-pro, kimi-k3.1-pro-highspeed) share K3's request
|
|
230
|
+
// format. https://api.moonshot.ai/v1/models reports effort levels and dynamic tool loading for all.
|
|
231
|
+
export function isKimiK3FamilyId(modelId) {
|
|
232
|
+
return /^kimi-k3(?:\.\d+)?(?:-|$)/.test(modelId);
|
|
233
|
+
}
|
|
234
|
+
export const ANT_LING_RING_THINKING_LEVEL_MAP = {
|
|
235
|
+
off: null,
|
|
236
|
+
minimal: null,
|
|
237
|
+
low: null,
|
|
238
|
+
medium: null,
|
|
239
|
+
high: "high",
|
|
240
|
+
xhigh: "xhigh",
|
|
241
|
+
};
|
|
242
|
+
export const BEDROCK_INFERENCE_PROFILE_ONLY_MODEL_IDS = new Set(["anthropic.claude-opus-5"]);
|
|
243
|
+
export const MODELS_DEV_OPENAI_UNSUPPORTED_MODEL_IDS = new Set(["gpt-5.6"]);
|
|
244
|
+
// GPT-5.5 and older put tools loaded through tool search or additional_tools in a namespace named
|
|
245
|
+
// after the tool and reject replayed calls without it, so history from other models fails there
|
|
246
|
+
// (earendil-works/pi#11415). Like Codex, dynamic tool loading therefore starts with GPT-5.6, which does not do this.
|
|
247
|
+
export const OPENAI_TOOL_SEARCH_MODEL_IDS = new Set([
|
|
248
|
+
"gpt-5.6-sol",
|
|
249
|
+
"gpt-5.6-terra",
|
|
250
|
+
"gpt-5.6-luna",
|
|
251
|
+
"gpt-6-astra",
|
|
252
|
+
"gpt-6-sol",
|
|
253
|
+
"gpt-6-luna",
|
|
254
|
+
"gpt-6.1-sol",
|
|
255
|
+
"gpt-6.1-terra",
|
|
256
|
+
]);
|
|
257
|
+
export const OPENAI_ADDITIONAL_TOOLS_MODEL_IDS = OPENAI_TOOL_SEARCH_MODEL_IDS;
|
|
258
|
+
export const OPENAI_MID_CONVO_SYSTEM_MESSAGE_MODEL_IDS = new Set([
|
|
259
|
+
"gpt-5.4",
|
|
260
|
+
"gpt-5.4-mini",
|
|
261
|
+
"gpt-5.4-pro",
|
|
262
|
+
"gpt-5.5",
|
|
263
|
+
...OPENAI_TOOL_SEARCH_MODEL_IDS,
|
|
264
|
+
]);
|
|
265
|
+
export const OPENAI_CODEX_ADDITIONAL_TOOLS_MODEL_IDS = new Set([
|
|
266
|
+
"gpt-5.6-sol",
|
|
267
|
+
"gpt-5.6-terra",
|
|
268
|
+
"gpt-5.6-luna",
|
|
269
|
+
"gpt-6-astra",
|
|
270
|
+
"gpt-6-sol",
|
|
271
|
+
"gpt-6-luna",
|
|
272
|
+
"gpt-6.1-sol",
|
|
273
|
+
"gpt-6.1-terra",
|
|
274
|
+
]);
|
|
275
|
+
// OpenAI documents configuration_update for the GPT-6 family.
|
|
276
|
+
// https://developers.openai.com/api/docs/guides/reasoning
|
|
277
|
+
export const OPENAI_LONG_CONTEXT_INPUT_THRESHOLD = 272000;
|
|
278
|
+
export const OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS = new Set([
|
|
279
|
+
"gpt-5.4",
|
|
280
|
+
"gpt-5.5",
|
|
281
|
+
"gpt-5.6-sol",
|
|
282
|
+
"gpt-5.6-terra",
|
|
283
|
+
"gpt-5.6-luna",
|
|
284
|
+
"gpt-6-astra",
|
|
285
|
+
"gpt-6-sol",
|
|
286
|
+
"gpt-6-luna",
|
|
287
|
+
"gpt-6.1-sol",
|
|
288
|
+
"gpt-6.1-terra",
|
|
289
|
+
]);
|
|
290
|
+
export const OPENAI_LONG_CONTEXT_PRICING_MODEL_IDS = new Set([
|
|
291
|
+
"gpt-5.4",
|
|
292
|
+
"gpt-5.4-pro",
|
|
293
|
+
"gpt-5.5",
|
|
294
|
+
"gpt-5.5-pro",
|
|
295
|
+
"gpt-5.6-sol",
|
|
296
|
+
"gpt-5.6-terra",
|
|
297
|
+
"gpt-5.6-luna",
|
|
298
|
+
"gpt-6-astra",
|
|
299
|
+
"gpt-6-sol",
|
|
300
|
+
"gpt-6-luna",
|
|
301
|
+
"gpt-6.1-sol",
|
|
302
|
+
"gpt-6.1-terra",
|
|
303
|
+
]);
|
|
304
|
+
// Keep the generated default no less restrictive than coding-agent's historical
|
|
305
|
+
// image preprocessing. Provider limits can narrow this profile, but unknown
|
|
306
|
+
// providers retain the cache-safe 2000px / 4.5 MiB behavior.
|
|
307
|
+
export const DEFAULT_IMAGE_RESIZE = {
|
|
308
|
+
maxWidth: 2000,
|
|
309
|
+
maxHeight: 2000,
|
|
310
|
+
maxBytes: 4.5 * 1024 * 1024,
|
|
311
|
+
jpegQuality: 80,
|
|
312
|
+
};
|
|
313
|
+
export function withOpenAiLongContextPricing(cost) {
|
|
314
|
+
return {
|
|
315
|
+
...cost,
|
|
316
|
+
tiers: [
|
|
317
|
+
{
|
|
318
|
+
inputTokensAbove: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
319
|
+
input: roundCost(cost.input * 2),
|
|
320
|
+
output: roundCost(cost.output * 1.5),
|
|
321
|
+
cacheRead: roundCost(cost.cacheRead * 2),
|
|
322
|
+
cacheWrite: roundCost(cost.cacheWrite * 2),
|
|
323
|
+
},
|
|
324
|
+
],
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
// Keep current OpenAI prices authoritative until models.dev and passthrough
|
|
328
|
+
// catalogs catch up.
|
|
329
|
+
// https://developers.openai.com/api/docs/pricing
|
|
330
|
+
export const OPENAI_STANDARD_COSTS = {
|
|
331
|
+
"gpt-5.6-luna": { input: 0.2, output: 1.2, cacheRead: 0.02, cacheWrite: 0.25 },
|
|
332
|
+
"gpt-5.6-sol": { input: 4, output: 20, cacheRead: 0.4, cacheWrite: 5 },
|
|
333
|
+
"gpt-5.6-terra": { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 2.5 },
|
|
334
|
+
"gpt-6-astra": { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
|
|
335
|
+
"gpt-6-luna": { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125 },
|
|
336
|
+
"gpt-6-sol": { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 },
|
|
337
|
+
"gpt-6.1-sol": { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2.5 },
|
|
338
|
+
"gpt-6.1-terra": { input: 1, output: 5, cacheRead: 0.05, cacheWrite: 1.25 },
|
|
339
|
+
};
|
|
340
|
+
// Published Fast and Ultrafast rates per model. A model absent from a table does not offer that tier.
|
|
341
|
+
// https://developers.openai.com/api/docs/pricing (Fast and Ultrafast tabs)
|
|
342
|
+
export const OPENAI_FAST_COSTS = {
|
|
343
|
+
"gpt-6-astra": { input: 20, output: 100, cacheRead: 2, cacheWrite: 25 },
|
|
344
|
+
"gpt-6.1-sol": { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 5 },
|
|
345
|
+
// GPT-6.1 Terra Fast is published as 2x Standard (https://developers.openai.com/api/docs/models/gpt-6.1-terra).
|
|
346
|
+
"gpt-6.1-terra": { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2.5 },
|
|
347
|
+
"gpt-6-luna": { input: 0.2, output: 1, cacheRead: 0.02, cacheWrite: 0.25 },
|
|
348
|
+
"gpt-6-sol": { input: 4, output: 20, cacheRead: 0.4, cacheWrite: 5 },
|
|
349
|
+
"gpt-5.6-sol": { input: 8, output: 40, cacheRead: 0.8, cacheWrite: 10 },
|
|
350
|
+
"gpt-5.6-terra": { input: 4, output: 24, cacheRead: 0.4, cacheWrite: 5 },
|
|
351
|
+
"gpt-5.6-luna": { input: 0.4, output: 2.4, cacheRead: 0.04, cacheWrite: 0.5 },
|
|
352
|
+
"gpt-5.5": { input: 12.5, output: 75, cacheRead: 1.25, cacheWrite: 0 },
|
|
353
|
+
"gpt-5.4": { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 },
|
|
354
|
+
"gpt-5.4-mini": { input: 1.5, output: 9, cacheRead: 0.15, cacheWrite: 0 },
|
|
355
|
+
"gpt-5.2": { input: 3.5, output: 28, cacheRead: 0.35, cacheWrite: 0 },
|
|
356
|
+
"gpt-5.1": { input: 2.5, output: 20, cacheRead: 0.25, cacheWrite: 0 },
|
|
357
|
+
"gpt-5": { input: 2.5, output: 20, cacheRead: 0.25, cacheWrite: 0 },
|
|
358
|
+
"gpt-5-mini": { input: 0.45, output: 3.6, cacheRead: 0.045, cacheWrite: 0 },
|
|
359
|
+
"gpt-4.1": { input: 3.5, output: 14, cacheRead: 0.875, cacheWrite: 0 },
|
|
360
|
+
"gpt-4.1-mini": { input: 0.7, output: 2.8, cacheRead: 0.175, cacheWrite: 0 },
|
|
361
|
+
"gpt-4.1-nano": { input: 0.2, output: 0.8, cacheRead: 0.05, cacheWrite: 0 },
|
|
362
|
+
"gpt-4o": { input: 4.25, output: 17, cacheRead: 2.125, cacheWrite: 0 },
|
|
363
|
+
"gpt-4o-2024-05-13": { input: 8.75, output: 26.25, cacheRead: 0, cacheWrite: 0 },
|
|
364
|
+
"gpt-4o-mini": { input: 0.25, output: 1, cacheRead: 0.125, cacheWrite: 0 },
|
|
365
|
+
o3: { input: 3.5, output: 14, cacheRead: 0.875, cacheWrite: 0 },
|
|
366
|
+
"o4-mini": { input: 2, output: 8, cacheRead: 0.5, cacheWrite: 0 },
|
|
367
|
+
};
|
|
368
|
+
// GPT-6 Astra and GPT-6.1 Sol Ultrafast rates are published, at 6x Standard for input, cached input, cache write and
|
|
369
|
+
// output (https://developers.openai.com/api/docs/pricing?latest-pricing=ultrafast). GPT-5.6 Sol Ultrafast is a preview without published
|
|
370
|
+
// rates, so it follows the 6x-Standard convention.
|
|
371
|
+
export const OPENAI_ULTRAFAST_COSTS = {
|
|
372
|
+
"gpt-6-astra": { input: 60, output: 300, cacheRead: 6, cacheWrite: 75 },
|
|
373
|
+
"gpt-6.1-sol": { input: 12, output: 60, cacheRead: 0.6, cacheWrite: 15 },
|
|
374
|
+
"gpt-5.6-sol": { input: 24, output: 120, cacheRead: 2.4, cacheWrite: 30 },
|
|
375
|
+
};
|
|
376
|
+
export function openAiServiceTierCost(modelId, cost) {
|
|
377
|
+
return OPENAI_LONG_CONTEXT_PRICING_MODEL_IDS.has(modelId) ? withOpenAiLongContextPricing(cost) : cost;
|
|
378
|
+
}
|
|
379
|
+
export function openAiServiceTiers(modelId) {
|
|
380
|
+
const tiers = [];
|
|
381
|
+
const fast = OPENAI_FAST_COSTS[modelId];
|
|
382
|
+
if (fast)
|
|
383
|
+
tiers.push({ id: "priority", cost: openAiServiceTierCost(modelId, fast) });
|
|
384
|
+
const ultrafast = OPENAI_ULTRAFAST_COSTS[modelId];
|
|
385
|
+
if (ultrafast)
|
|
386
|
+
tiers.push({ id: "ultrafast", cost: openAiServiceTierCost(modelId, ultrafast) });
|
|
387
|
+
return tiers;
|
|
388
|
+
}
|
|
389
|
+
// Mirrors the service_tiers each model advertises in openai/codex codex-rs/models-manager/models.json
|
|
390
|
+
// (90abcfac02665ad882853a04155591cd863b2ca7), priced at the matching OpenAI API tier rates. GPT-6.1 Sol also gets
|
|
391
|
+
// Ultrafast, which the ChatGPT backend applies (about 2.7x faster on a ChatGPT sign-in) before Codex lists it.
|
|
392
|
+
export const CODEX_SERVICE_TIER_IDS = {
|
|
393
|
+
"gpt-5.3-codex-spark": [],
|
|
394
|
+
"gpt-5.5": ["priority"],
|
|
395
|
+
"gpt-5.6-luna": ["priority"],
|
|
396
|
+
"gpt-5.6-sol": ["priority"],
|
|
397
|
+
"gpt-5.6-terra": ["priority"],
|
|
398
|
+
"gpt-6-astra": ["priority", "ultrafast"],
|
|
399
|
+
"gpt-6.1-sol": ["priority", "ultrafast"],
|
|
400
|
+
// Codex's bundled catalog does not list GPT-6.1 Terra yet, so it advertises no service tiers.
|
|
401
|
+
"gpt-6.1-terra": [],
|
|
402
|
+
"gpt-6-sol": ["priority"],
|
|
403
|
+
"gpt-6-luna": ["priority"],
|
|
404
|
+
};
|
|
405
|
+
// The Codex subscription charges no long-context fee for these models, on any service tier (OpenAI announcement).
|
|
406
|
+
export const CODEX_NO_LONG_CONTEXT_FEE_MODEL_IDS = new Set(["gpt-6.1-sol"]);
|
|
407
|
+
export function codexServiceTiers(modelId) {
|
|
408
|
+
const advertised = CODEX_SERVICE_TIER_IDS[modelId];
|
|
409
|
+
if (!advertised)
|
|
410
|
+
throw new Error(`Codex model ${modelId} has no advertised service tiers`);
|
|
411
|
+
const priced = CODEX_NO_LONG_CONTEXT_FEE_MODEL_IDS.has(modelId)
|
|
412
|
+
? openAiServiceTiers(modelId).map(({ cost: { tiers: _longContext, ...flat }, ...tier }) => ({
|
|
413
|
+
...tier,
|
|
414
|
+
cost: flat,
|
|
415
|
+
}))
|
|
416
|
+
: openAiServiceTiers(modelId);
|
|
417
|
+
return advertised.map((id) => {
|
|
418
|
+
const tier = priced.find((candidate) => candidate.id === id);
|
|
419
|
+
if (!tier)
|
|
420
|
+
throw new Error(`Codex model ${modelId} advertises ${id} without published OpenAI rates`);
|
|
421
|
+
return tier;
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
export const OPENAI_RESPONSES_NONE_REASONING_MODELS = new Set([
|
|
425
|
+
"gpt-5.1",
|
|
426
|
+
"gpt-5.2",
|
|
427
|
+
"gpt-5.3-codex",
|
|
428
|
+
"gpt-5.4",
|
|
429
|
+
"gpt-5.4-mini",
|
|
430
|
+
"gpt-5.4-nano",
|
|
431
|
+
"gpt-5.5",
|
|
432
|
+
"gpt-5.6-sol",
|
|
433
|
+
"gpt-5.6-terra",
|
|
434
|
+
"gpt-5.6-luna",
|
|
435
|
+
"gpt-6-sol",
|
|
436
|
+
"gpt-6-luna",
|
|
437
|
+
]);
|
|
438
|
+
export const XAI_BUILTIN_EXCLUDED_MODEL_IDS = new Set([
|
|
439
|
+
"grok-3",
|
|
440
|
+
"grok-3-fast",
|
|
441
|
+
"grok-4.20-0309-non-reasoning",
|
|
442
|
+
"grok-4.20-0309-reasoning",
|
|
443
|
+
"grok-build-0.1",
|
|
444
|
+
"grok-code-fast-1",
|
|
445
|
+
]);
|
|
446
|
+
export const XAI_RESPONSES_COMPAT = {
|
|
447
|
+
supportsLongCacheRetention: false,
|
|
448
|
+
};
|
|
449
|
+
export const OPENCODE_OPENAI_COMPLETIONS_LONG_CACHE_RETENTION_UNSUPPORTED_MODELS = new Set([
|
|
450
|
+
"opencode:deepseek-v4-flash",
|
|
451
|
+
"opencode:deepseek-v4.1-flash",
|
|
452
|
+
"opencode:deepseek-v4-pro",
|
|
453
|
+
"opencode:kimi-k2.5",
|
|
454
|
+
"opencode:kimi-k2.6",
|
|
455
|
+
"opencode:minimax-m2.7",
|
|
456
|
+
]);
|
|
457
|
+
// GitHub's "Models with extended capabilities" table lists these Copilot models as supporting
|
|
458
|
+
// the extended 1 million token context window.
|
|
459
|
+
export const GITHUB_COPILOT_EXTENDED_CONTEXT_MODELS = new Set([
|
|
460
|
+
"claude-fable-5",
|
|
461
|
+
"claude-opus-4.8",
|
|
462
|
+
"claude-opus-5",
|
|
463
|
+
"claude-opus-5.5",
|
|
464
|
+
"claude-sonnet-4.6",
|
|
465
|
+
"claude-sonnet-5",
|
|
466
|
+
"gpt-5.3-codex",
|
|
467
|
+
"gpt-6-astra",
|
|
468
|
+
"gpt-6-luna",
|
|
469
|
+
"gpt-6-sol",
|
|
470
|
+
]);
|
|
471
|
+
export const GITHUB_COPILOT_CLAUDE_FABLE_MODEL_IDS = ["claude-fable-5", "claude-fable-5-1"];
|
|
472
|
+
// GitHub Copilot serves these models, and models.dev's Copilot catalog lists them since they launched
|
|
473
|
+
// (Claude Fable 5.2 on 2026-11-09, Gemini 4 Carbon on 2026-11-10). A build that fetches an older
|
|
474
|
+
// models.dev snapshot would ship without them, so keep their published rows here. A models.dev row with
|
|
475
|
+
// the same ID wins.
|
|
476
|
+
export const GITHUB_COPILOT_MODELS_DEV_FALLBACKS = {
|
|
477
|
+
"claude-fable-5.2": {
|
|
478
|
+
id: "claude-fable-5.2",
|
|
479
|
+
name: "Claude Fable 5.2",
|
|
480
|
+
reasoning: true,
|
|
481
|
+
reasoning_options: [{ type: "effort", values: ["low", "medium", "high", "xhigh", "max"] }],
|
|
482
|
+
tool_call: true,
|
|
483
|
+
structured_output: true,
|
|
484
|
+
modalities: { input: ["text", "image", "pdf"], output: ["text"] },
|
|
485
|
+
limit: { context: 1000000, output: 128000 },
|
|
486
|
+
provider: { npm: "@ai-sdk/anthropic" },
|
|
487
|
+
cost: { input: 8, output: 40, cache_read: 0.2, cache_write: 10 },
|
|
488
|
+
},
|
|
489
|
+
"gemini-4-carbon": {
|
|
490
|
+
id: "gemini-4-carbon",
|
|
491
|
+
name: "Gemini 4 Carbon",
|
|
492
|
+
reasoning: true,
|
|
493
|
+
reasoning_options: [{ type: "effort", values: ["low", "medium", "high"] }],
|
|
494
|
+
tool_call: true,
|
|
495
|
+
structured_output: true,
|
|
496
|
+
modalities: { input: ["text", "image", "pdf"], output: ["text"] },
|
|
497
|
+
limit: { context: 1048576, output: 65536 },
|
|
498
|
+
cost: { input: 2, output: 10, cache_read: 0.1 },
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
// Checked manually against the authenticated GitHub Copilot /models endpoint on 2026-06-15.
|
|
502
|
+
// Keep this to narrow corrections over models.dev metadata instead of snapshotting Copilot's catalog.
|
|
503
|
+
export const GITHUB_COPILOT_THINKING_LEVEL_OVERRIDES = {
|
|
504
|
+
"claude-opus-4.8": { minimal: "low" },
|
|
505
|
+
"claude-opus-5": { minimal: "low" },
|
|
506
|
+
"claude-sonnet-4.6": { minimal: "low", max: "max" },
|
|
507
|
+
};
|
|
508
|
+
export function mergeThinkingLevelMap(model, map) {
|
|
509
|
+
model.thinkingLevelMap = { ...model.thinkingLevelMap, ...map };
|
|
510
|
+
}
|
|
511
|
+
export const modelsDevReasoningOptions = new Map();
|
|
512
|
+
export function getModelKey(model) {
|
|
513
|
+
return `${model.provider}:${model.id}`;
|
|
514
|
+
}
|
|
515
|
+
export function recordModelsDevReasoningOptions(provider, id, sourceModel) {
|
|
516
|
+
if (sourceModel.reasoning_options !== undefined) {
|
|
517
|
+
modelsDevReasoningOptions.set(`${provider}:${id}`, sourceModel.reasoning_options);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
export function supportsDirectReasoningEffort(model) {
|
|
521
|
+
if (model.api === "anthropic-messages")
|
|
522
|
+
return model.compat?.forceAdaptiveThinking === true;
|
|
523
|
+
if (model.api === "openai-responses" ||
|
|
524
|
+
model.api === "azure-openai-responses" ||
|
|
525
|
+
model.api === "openai-codex-responses") {
|
|
526
|
+
return true;
|
|
527
|
+
}
|
|
528
|
+
if (model.api !== "openai-completions")
|
|
529
|
+
return false;
|
|
530
|
+
const compat = {
|
|
531
|
+
...detectOpenAICompletionsCompat(model),
|
|
532
|
+
...model.compat,
|
|
533
|
+
};
|
|
534
|
+
return compat.thinkingFormat === "openai" && compat.supportsReasoningEffort === true;
|
|
535
|
+
}
|
|
536
|
+
export function applyModelsDevReasoningOptionMetadata(model) {
|
|
537
|
+
const reasoningOptions = modelsDevReasoningOptions.get(getModelKey(model));
|
|
538
|
+
if (!reasoningOptions || !supportsDirectReasoningEffort(model))
|
|
539
|
+
return;
|
|
540
|
+
const thinkingLevelMap = getEffortThinkingLevelMap(reasoningOptions);
|
|
541
|
+
if (thinkingLevelMap)
|
|
542
|
+
mergeThinkingLevelMap(model, thinkingLevelMap);
|
|
543
|
+
}
|
|
544
|
+
export function getTogetherCompat(modelId, reasoning) {
|
|
545
|
+
if (!reasoning)
|
|
546
|
+
return TOGETHER_BASE_COMPAT;
|
|
547
|
+
if (TOGETHER_REASONING_EFFORT_MODELS.has(modelId))
|
|
548
|
+
return TOGETHER_REASONING_EFFORT_COMPAT;
|
|
549
|
+
if (TOGETHER_TOGGLE_REASONING_EFFORT_MODELS.has(modelId))
|
|
550
|
+
return TOGETHER_TOGGLE_REASONING_EFFORT_COMPAT;
|
|
551
|
+
return TOGETHER_TOGGLE_REASONING_COMPAT;
|
|
552
|
+
}
|
|
553
|
+
export function getTogetherThinkingLevelMap(modelId, reasoning) {
|
|
554
|
+
if (!reasoning)
|
|
555
|
+
return undefined;
|
|
556
|
+
if (TOGETHER_REASONING_EFFORT_MODELS.has(modelId))
|
|
557
|
+
return { ...TOGETHER_REASONING_EFFORT_LEVEL_MAP };
|
|
558
|
+
if (TOGETHER_TOGGLE_REASONING_EFFORT_MODELS.has(modelId))
|
|
559
|
+
return { ...TOGETHER_DEEPSEEK_V4_THINKING_LEVEL_MAP };
|
|
560
|
+
return { ...TOGETHER_TOGGLE_REASONING_LEVEL_MAP };
|
|
561
|
+
}
|
|
562
|
+
export function isOpenAiGpt6AstraModelId(modelId) {
|
|
563
|
+
return (modelId === "gpt-6-astra" ||
|
|
564
|
+
modelId === "openai.gpt-6-astra" ||
|
|
565
|
+
modelId === "global.openai.gpt-6-astra" ||
|
|
566
|
+
modelId === "us.openai.gpt-6-astra");
|
|
567
|
+
}
|
|
568
|
+
export function isOpenAiGpt6ModelId(modelId) {
|
|
569
|
+
return (isOpenAiGpt6AstraModelId(modelId) ||
|
|
570
|
+
modelId === "gpt-6-sol" ||
|
|
571
|
+
modelId === "gpt-6-luna" ||
|
|
572
|
+
modelId === "gpt-6.1-sol" ||
|
|
573
|
+
modelId === "gpt-6.1-terra");
|
|
574
|
+
}
|
|
575
|
+
/** Strips Bedrock's `openai.` model prefix and optional `us.`/`global.` inference-profile prefix. */
|
|
576
|
+
export function getOpenAiBaseModelId(model) {
|
|
577
|
+
return model.api === "bedrock-converse-stream" ? model.id.replace(/^(?:global\.|us\.)?openai\./, "") : model.id;
|
|
578
|
+
}
|
|
579
|
+
// Bedrock serves OpenAI's first-party GPT-6 family, so its routes take the same efforts as the direct API.
|
|
580
|
+
// https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-6-sol.html
|
|
581
|
+
// https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-6-luna.html
|
|
582
|
+
// https://developers.openai.com/api/docs/models/gpt-6.1-sol
|
|
583
|
+
export function isBedrockOpenAiGpt6Model(model) {
|
|
584
|
+
return model.api === "bedrock-converse-stream" && isOpenAiGpt6ModelId(getOpenAiBaseModelId(model));
|
|
585
|
+
}
|
|
586
|
+
export function supportsOpenAiXhigh(modelId) {
|
|
587
|
+
return (modelId.includes("gpt-5.2") ||
|
|
588
|
+
modelId.includes("gpt-5.3") ||
|
|
589
|
+
modelId.includes("gpt-5.4") ||
|
|
590
|
+
modelId.includes("gpt-5.5") ||
|
|
591
|
+
modelId.includes("gpt-5.6") ||
|
|
592
|
+
isOpenAiGpt6ModelId(modelId));
|
|
593
|
+
}
|
|
594
|
+
export function supportsOpenAiMax(model) {
|
|
595
|
+
const supportedApi = model.api === "openai-responses" ||
|
|
596
|
+
model.api === "azure-openai-responses" ||
|
|
597
|
+
model.api === "openai-codex-responses" ||
|
|
598
|
+
model.api === "openai-completions";
|
|
599
|
+
return (((model.id.includes("gpt-5.6") || isOpenAiGpt6ModelId(model.id)) && supportedApi) ||
|
|
600
|
+
isBedrockOpenAiGpt6Model(model));
|
|
601
|
+
}
|
|
602
|
+
// OpenCode Zen and Go forward per-message effort and `thinking.block_binding`. Without
|
|
603
|
+
// `drop_block`, Go rejects replayed thinking after the system prompt or tools change.
|
|
604
|
+
export const VERIFIED_ANTHROPIC_MID_CONVO_EFFORT_PROVIDERS = new Set([
|
|
605
|
+
"anthropic",
|
|
606
|
+
"openrouter",
|
|
607
|
+
"opencode",
|
|
608
|
+
"opencode-go",
|
|
609
|
+
]);
|
|
610
|
+
// OpenRouter rejects `configuration_update` system messages on Opus 5 ("Mid-conversation
|
|
611
|
+
// reasoning effort (configuration_update) is not supported on anthropic/claude-opus-5-20260723")
|
|
612
|
+
// while accepting them on Fable 5.1, so gate that model there.
|
|
613
|
+
export const MID_CONVO_EFFORT_UNSUPPORTED_ANTHROPIC_MODELS = new Set(["openrouter:anthropic/claude-opus-5"]);
|
|
614
|
+
export function supportsAnthropicMidConvoEffort(modelId) {
|
|
615
|
+
const id = modelId.toLowerCase().replace(/^~?anthropic\//, "");
|
|
616
|
+
return (/^claude-opus-(?:5|5[.-]5)(?:-\d{8})?$/.test(id) ||
|
|
617
|
+
/^claude-(?:sonnet|haiku)-5[.-]5(?:-\d{8})?$/.test(id) ||
|
|
618
|
+
/^claude-(?:fable|mythos)-5[.-][12](?:-\d{8})?$/.test(id));
|
|
619
|
+
}
|
|
620
|
+
// Claude models that accept `thinking: {type: "disabled"}` alongside per-message effort.
|
|
621
|
+
// Opus 5.5, Sonnet 5.5, Fable 5.1/5.2, and Mythos 5.1/5.2 reject it.
|
|
622
|
+
// https://platform.claude.com/docs/en/build-with-claude/thinking#configuring-thinking
|
|
623
|
+
export const ANTHROPIC_DISABLED_THINKING_MODELS = new Set(["claude-opus-5", "claude-haiku-5-5", "claude-haiku-5.5"]);
|
|
624
|
+
export function supportsAnthropicDisabledThinkingWithMidConvoEffort(modelId) {
|
|
625
|
+
// Strip OpenRouter's "anthropic/" or "~anthropic/" prefix and any dated snapshot suffix.
|
|
626
|
+
const id = modelId
|
|
627
|
+
.toLowerCase()
|
|
628
|
+
.replace(/^~?anthropic\//, "")
|
|
629
|
+
.replace(/-\d{8}$/, "");
|
|
630
|
+
return ANTHROPIC_DISABLED_THINKING_MODELS.has(id);
|
|
631
|
+
}
|
|
632
|
+
export function supportsAnthropicMidConvoSystemMessages(modelId) {
|
|
633
|
+
return (/^claude-opus-(?:4[.-]8|5(?:[.-]5)?)(?:-\d{8})?$/.test(modelId) ||
|
|
634
|
+
/^claude-(?:sonnet|haiku)-5[.-]5(?:-\d{8})?$/.test(modelId) ||
|
|
635
|
+
/^claude-(?:fable|mythos)-5(?:[.-][12])?(?:-\d{8})?$/.test(modelId));
|
|
636
|
+
}
|
|
637
|
+
export function isAnthropicAdaptiveThinkingModel(modelId) {
|
|
638
|
+
return (
|
|
639
|
+
// OpenRouter's `~anthropic/claude-*-latest` aliases follow the newest model of each family,
|
|
640
|
+
// all of which use adaptive thinking.
|
|
641
|
+
/^~anthropic\/claude-[a-z]+-latest$/.test(modelId) ||
|
|
642
|
+
modelId.includes("opus-4-6") ||
|
|
643
|
+
modelId.includes("opus-4.6") ||
|
|
644
|
+
modelId.includes("opus-4-7") ||
|
|
645
|
+
modelId.includes("opus-4.7") ||
|
|
646
|
+
modelId.includes("opus-4-8") ||
|
|
647
|
+
modelId.includes("opus-4.8") ||
|
|
648
|
+
modelId.includes("opus-5") ||
|
|
649
|
+
modelId.includes("opus.5") ||
|
|
650
|
+
modelId.includes("sonnet-4-6") ||
|
|
651
|
+
modelId.includes("sonnet-4.6") ||
|
|
652
|
+
modelId.includes("sonnet-5") ||
|
|
653
|
+
modelId.includes("sonnet.5") ||
|
|
654
|
+
modelId.includes("haiku-5") ||
|
|
655
|
+
modelId.includes("haiku.5") ||
|
|
656
|
+
modelId.includes("fable-5") ||
|
|
657
|
+
modelId.includes("mythos-5"));
|
|
658
|
+
}
|
|
659
|
+
// Models that reject non-default `temperature`, `top_p`, or `top_k` with a 400 on every request,
|
|
660
|
+
// whether or not thinking is on. The list is published in "Limits and feature compatibility >
|
|
661
|
+
// Sampling parameters": https://platform.claude.com/docs/en/build-with-claude/thinking
|
|
662
|
+
// The `fable-5` clause covers Claude Fable 5 and Claude Fable 5.1, which the same sentence names.
|
|
663
|
+
export function isAnthropicTemperatureUnsupportedModel(modelId) {
|
|
664
|
+
const id = modelId.toLowerCase();
|
|
665
|
+
return (id.includes("opus-4-7") ||
|
|
666
|
+
id.includes("opus-4.7") ||
|
|
667
|
+
id.includes("opus-4-8") ||
|
|
668
|
+
id.includes("opus-4.8") ||
|
|
669
|
+
id.includes("opus-5") ||
|
|
670
|
+
id.includes("opus.5") ||
|
|
671
|
+
id.includes("sonnet-5") ||
|
|
672
|
+
id.includes("sonnet.5") ||
|
|
673
|
+
id.includes("haiku-5-5") ||
|
|
674
|
+
id.includes("haiku-5.5") ||
|
|
675
|
+
id.includes("fable-5"));
|
|
676
|
+
}
|
|
677
|
+
export const OPENAI_COMPLETIONS_DEFAULT_COMPAT = {
|
|
678
|
+
supportsStore: true,
|
|
679
|
+
supportsDeveloperRole: true,
|
|
680
|
+
supportsReasoningEffort: true,
|
|
681
|
+
supportsUsageInStreaming: true,
|
|
682
|
+
supportsFinishReason: true,
|
|
683
|
+
maxTokensField: "max_completion_tokens",
|
|
684
|
+
requiresToolResultName: false,
|
|
685
|
+
requiresAssistantAfterToolResult: false,
|
|
686
|
+
requiresThinkingAsText: false,
|
|
687
|
+
requiresReasoningContentOnAssistantMessages: false,
|
|
688
|
+
thinkingFormat: "openai",
|
|
689
|
+
openRouterRouting: {},
|
|
690
|
+
vercelGatewayRouting: {},
|
|
691
|
+
chatTemplateKwargs: {},
|
|
692
|
+
chatTemplateArgs: {},
|
|
693
|
+
zaiToolStream: false,
|
|
694
|
+
supportsStrictMode: false,
|
|
695
|
+
supportsOpenAIGrammarTools: false,
|
|
696
|
+
supportsMidConvoSystemMessages: false,
|
|
697
|
+
supportsMidConvoToolAdditions: false,
|
|
698
|
+
sendSessionAffinityHeaders: false,
|
|
699
|
+
supportsLongCacheRetention: true,
|
|
700
|
+
};
|
|
701
|
+
export function mergeAnthropicMessagesCompat(model, compat) {
|
|
702
|
+
model.compat = { ...model.compat, ...compat };
|
|
703
|
+
}
|
|
704
|
+
export function detectOpenAICompletionsCompat(model) {
|
|
705
|
+
const provider = model.provider;
|
|
706
|
+
const baseUrl = model.baseUrl;
|
|
707
|
+
const isZai = provider === "zai" ||
|
|
708
|
+
provider === "zai-coding-cn" ||
|
|
709
|
+
baseUrl.includes("api.z.ai") ||
|
|
710
|
+
baseUrl.includes("open.bigmodel.cn");
|
|
711
|
+
const isTogether = provider === "together" || baseUrl.includes("api.together.ai") || baseUrl.includes("api.together.xyz");
|
|
712
|
+
const isMoonshot = provider === "moonshotai" || provider === "moonshotai-cn" || baseUrl.includes("api.moonshot.");
|
|
713
|
+
const isOpenRouter = provider === "openrouter" || baseUrl.includes("openrouter.ai");
|
|
714
|
+
const isCloudflareWorkersAI = provider === "cloudflare-workers-ai" || baseUrl.includes("api.cloudflare.com");
|
|
715
|
+
const isCloudflareAiGateway = provider === "cloudflare-ai-gateway" || baseUrl.includes("gateway.ai.cloudflare.com");
|
|
716
|
+
const isNvidia = provider === "nvidia" || baseUrl.includes("integrate.api.nvidia.com");
|
|
717
|
+
const isAntLing = provider === "ant-ling" || baseUrl.includes("api.ant-ling.com");
|
|
718
|
+
const isCerebras = provider === "cerebras" || baseUrl.includes("cerebras.ai");
|
|
719
|
+
const isDeepSeek = provider === "deepseek" || baseUrl.toLowerCase().includes("deepseek.com");
|
|
720
|
+
const isNonStandard = isNvidia ||
|
|
721
|
+
isCerebras ||
|
|
722
|
+
provider === "xai" ||
|
|
723
|
+
baseUrl.includes("api.x.ai") ||
|
|
724
|
+
isTogether ||
|
|
725
|
+
baseUrl.includes("chutes.ai") ||
|
|
726
|
+
isDeepSeek ||
|
|
727
|
+
isZai ||
|
|
728
|
+
isMoonshot ||
|
|
729
|
+
provider === "opencode" ||
|
|
730
|
+
baseUrl.includes("opencode.ai") ||
|
|
731
|
+
isCloudflareWorkersAI ||
|
|
732
|
+
isCloudflareAiGateway ||
|
|
733
|
+
isAntLing;
|
|
734
|
+
const useMaxTokens = baseUrl.includes("chutes.ai") ||
|
|
735
|
+
isDeepSeek ||
|
|
736
|
+
isMoonshot ||
|
|
737
|
+
isCloudflareAiGateway ||
|
|
738
|
+
isTogether ||
|
|
739
|
+
isNvidia ||
|
|
740
|
+
isAntLing ||
|
|
741
|
+
isZai;
|
|
742
|
+
const isGrok = provider === "xai" || baseUrl.includes("api.x.ai");
|
|
743
|
+
const isOpenRouterDeveloperRoleModel = isOpenRouter && (model.id.startsWith("anthropic/") || model.id.startsWith("openai/"));
|
|
744
|
+
const cacheControlFormat = provider === "openrouter" && /^~?anthropic\//.test(model.id) ? "anthropic" : undefined;
|
|
745
|
+
return {
|
|
746
|
+
supportsStore: !isNonStandard,
|
|
747
|
+
supportsDeveloperRole: isOpenRouterDeveloperRoleModel || (!isNonStandard && !isOpenRouter),
|
|
748
|
+
supportsReasoningEffort: !isGrok && !isZai && !isMoonshot && !isTogether && !isCloudflareAiGateway && !isNvidia && !isAntLing,
|
|
749
|
+
supportsUsageInStreaming: true,
|
|
750
|
+
supportsFinishReason: true,
|
|
751
|
+
maxTokensField: useMaxTokens ? "max_tokens" : "max_completion_tokens",
|
|
752
|
+
requiresToolResultName: false,
|
|
753
|
+
requiresAssistantAfterToolResult: false,
|
|
754
|
+
requiresThinkingAsText: false,
|
|
755
|
+
requiresReasoningContentOnAssistantMessages: isDeepSeek,
|
|
756
|
+
thinkingFormat: isDeepSeek
|
|
757
|
+
? "deepseek"
|
|
758
|
+
: isZai
|
|
759
|
+
? "zai"
|
|
760
|
+
: isTogether
|
|
761
|
+
? "together"
|
|
762
|
+
: isAntLing
|
|
763
|
+
? "ant-ling"
|
|
764
|
+
: isOpenRouter
|
|
765
|
+
? "openrouter"
|
|
766
|
+
: "openai",
|
|
767
|
+
openRouterRouting: {},
|
|
768
|
+
vercelGatewayRouting: {},
|
|
769
|
+
chatTemplateKwargs: {},
|
|
770
|
+
chatTemplateArgs: {},
|
|
771
|
+
zaiToolStream: false,
|
|
772
|
+
// Preserve built-in behavior as explicit metadata against the conservative runtime default.
|
|
773
|
+
supportsStrictMode: !isMoonshot && !isTogether && !isCloudflareAiGateway && !isNvidia && !isCerebras,
|
|
774
|
+
supportsOpenAIGrammarTools: false,
|
|
775
|
+
supportsMidConvoSystemMessages: false,
|
|
776
|
+
supportsMidConvoToolAdditions: false,
|
|
777
|
+
...(cacheControlFormat ? { cacheControlFormat } : {}),
|
|
778
|
+
sendSessionAffinityHeaders: isOpenRouter,
|
|
779
|
+
supportsLongCacheRetention: !(isTogether ||
|
|
780
|
+
isCloudflareWorkersAI ||
|
|
781
|
+
isCloudflareAiGateway ||
|
|
782
|
+
isNvidia ||
|
|
783
|
+
isAntLing),
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
export function isPlainEmptyObject(value) {
|
|
787
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
788
|
+
}
|
|
789
|
+
export function openAICompletionsCompatDelta(compat) {
|
|
790
|
+
const delta = {};
|
|
791
|
+
for (const [key, value] of Object.entries(compat)) {
|
|
792
|
+
const defaultValue = OPENAI_COMPLETIONS_DEFAULT_COMPAT[key];
|
|
793
|
+
if (isPlainEmptyObject(value) && isPlainEmptyObject(defaultValue))
|
|
794
|
+
continue;
|
|
795
|
+
if (value !== defaultValue) {
|
|
796
|
+
delta[key] = value;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
return delta;
|
|
800
|
+
}
|
|
801
|
+
export function mergeOpenAICompletionsCompat(model, compat) {
|
|
802
|
+
model.compat = { ...model.compat, ...compat };
|
|
803
|
+
}
|
|
804
|
+
export function applyOpenAICompletionsCompatMetadata(model) {
|
|
805
|
+
if (model.api !== "openai-completions")
|
|
806
|
+
return;
|
|
807
|
+
const detected = openAICompletionsCompatDelta(detectOpenAICompletionsCompat(model));
|
|
808
|
+
model.compat = { ...detected, ...model.compat };
|
|
809
|
+
if (Object.keys(model.compat).length === 0) {
|
|
810
|
+
delete model.compat;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
export function applyAnthropicMessagesCompatMetadata(model) {
|
|
814
|
+
if (model.api !== "anthropic-messages")
|
|
815
|
+
return;
|
|
816
|
+
const compat = getAnthropicMessagesCompat(model.provider, model.id);
|
|
817
|
+
if (compat) {
|
|
818
|
+
mergeAnthropicMessagesCompat(model, compat);
|
|
819
|
+
if (compat.supportsMidConvoEffort && !supportsAnthropicDisabledThinkingWithMidConvoEffort(model.id)) {
|
|
820
|
+
mergeThinkingLevelMap(model, { off: null });
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
export function isAnthropicFallbackMetadataModel(model) {
|
|
825
|
+
if (model.provider !== "anthropic" || model.api !== "anthropic-messages")
|
|
826
|
+
return false;
|
|
827
|
+
return (model.id in ANTHROPIC_ALLOWED_FALLBACK_MODELS ||
|
|
828
|
+
Object.values(ANTHROPIC_ALLOWED_FALLBACK_MODELS).some((fallbackModelIds) => fallbackModelIds.includes(model.id)));
|
|
829
|
+
}
|
|
830
|
+
export function applyAnthropicAllowedFallbackModelMetadata(models) {
|
|
831
|
+
const modelsById = new Map(models.map((model) => [model.id, model]));
|
|
832
|
+
for (const [modelId, fallbackModelIds] of Object.entries(ANTHROPIC_ALLOWED_FALLBACK_MODELS)) {
|
|
833
|
+
const model = modelsById.get(modelId);
|
|
834
|
+
if (!model)
|
|
835
|
+
continue;
|
|
836
|
+
const compatibleFallbackModelIds = model.compat?.supportsMidConvoEffort
|
|
837
|
+
? fallbackModelIds.filter(supportsAnthropicMidConvoEffort)
|
|
838
|
+
: fallbackModelIds;
|
|
839
|
+
const allowedFallbackModels = compatibleFallbackModelIds.flatMap((fallbackModelId) => {
|
|
840
|
+
const fallbackModel = modelsById.get(fallbackModelId);
|
|
841
|
+
return fallbackModel
|
|
842
|
+
? [{ provider: fallbackModel.provider, model: fallbackModel.id, cost: fallbackModel.cost }]
|
|
843
|
+
: [];
|
|
844
|
+
});
|
|
845
|
+
if (allowedFallbackModels.length > 0) {
|
|
846
|
+
mergeAnthropicMessagesCompat(model, { allowedFallbackModels });
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
// Anthropic's preserved-thinking rules: "A block that fails the model check is always dropped"
|
|
851
|
+
// before the prompt reaches the model, and callers should "Send every assistant turn exactly as
|
|
852
|
+
// you received it, thinking blocks included, and let the API decide which blocks the model can
|
|
853
|
+
// use." That makes the first-party Anthropic Messages API the authority on model binding, so its
|
|
854
|
+
// models replay another Claude model's signed thinking blocks instead of flattening them to text.
|
|
855
|
+
// Scoped to `provider === "anthropic"`: third-party Anthropic-compatible proxies are not
|
|
856
|
+
// documented to adjudicate signatures the same way.
|
|
857
|
+
// https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-thinking
|
|
858
|
+
export function applyPreservedThinkingCompatMetadata(model) {
|
|
859
|
+
if (model.provider !== "anthropic" || model.api !== "anthropic-messages")
|
|
860
|
+
return;
|
|
861
|
+
mergeAnthropicMessagesCompat(model, { delegatesThinkingModelBinding: true });
|
|
862
|
+
// Only Claude Fable 5.1 runs the *conversation* check. Claude Mythos 5.1 records the same
|
|
863
|
+
// signature but does not run it, and no earlier model records the condition at all.
|
|
864
|
+
// https://platform.claude.com/docs/en/build-with-claude/preserved-thinking
|
|
865
|
+
if (model.id.includes("fable-5-1")) {
|
|
866
|
+
mergeAnthropicMessagesCompat(model, { enforcesPreservedThinkingBinding: true });
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
// "The exceptions are Claude Fable 5.1 and Claude Mythos 5.1, which reject forced tool use on
|
|
870
|
+
// every request with a 400 error. On those models, use `tool_choice: {"type": "auto"}`."
|
|
871
|
+
// https://platform.claude.com/docs/en/build-with-claude/thinking
|
|
872
|
+
//
|
|
873
|
+
// Unlike the preserved-thinking flags above, this is a property of the *model*, not of Anthropic's
|
|
874
|
+
// first-party endpoint: every mirror routes to the same model and receives the same 400. So this
|
|
875
|
+
// rule is gated on the API that can express a forced choice, not on the provider. Mythos 5.1 is
|
|
876
|
+
// named by the docs but is invite-only and absent from the live catalog, so its id test is
|
|
877
|
+
// forward-safe rather than inventing a catalog entry.
|
|
878
|
+
//
|
|
879
|
+
// Deliberately version-scoped, unlike the Fable-family match used for `temperature` below. The
|
|
880
|
+
// two restrictions are not symmetric: the sampling sentence names Claude Fable 5 alongside
|
|
881
|
+
// Claude Fable 5.1, but this one names Fable 5.1 and Mythos 5.1 as *exceptions* to behavior that
|
|
882
|
+
// otherwise works. OpenRouter's live metadata agrees — `anthropic/claude-fable-5` lists
|
|
883
|
+
// `tool_choice` in `supported_parameters` while `anthropic/claude-fable-5.1` does not. Widening
|
|
884
|
+
// this to the family would assert a restriction on Fable 5 that both sources contradict.
|
|
885
|
+
//
|
|
886
|
+
// The same reasoning leaves `~anthropic/claude-fable-latest` uncovered: an id naming no version
|
|
887
|
+
// cannot keep such a claim true if the alias re-points at a model that accepts forced tool use.
|
|
888
|
+
export function applyForcedToolChoiceCompatMetadata(model) {
|
|
889
|
+
if (!/fable-5[-.]1|mythos-5[-.]1/.test(model.id))
|
|
890
|
+
return;
|
|
891
|
+
if (model.api === "anthropic-messages") {
|
|
892
|
+
mergeAnthropicMessagesCompat(model, { supportsForcedToolChoice: false });
|
|
893
|
+
}
|
|
894
|
+
else if (model.api === "bedrock-converse-stream") {
|
|
895
|
+
model.compat = { ...model.compat, supportsForcedToolChoice: false };
|
|
896
|
+
}
|
|
897
|
+
else if (model.api === "openai-completions") {
|
|
898
|
+
model.compat = { ...model.compat, supportsForcedToolChoice: false };
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
// Claude Fable 5.1 rejects non-default `temperature`, `top_p`, and `top_k` on every request, and
|
|
902
|
+
// OpenRouter's own `supported_parameters` for `anthropic/claude-fable-5.1` omits `temperature`.
|
|
903
|
+
// The Anthropic Messages path already suppresses it via `isAnthropicTemperatureUnsupportedModel`,
|
|
904
|
+
// which matches the whole Fable family; the Bedrock Converse and OpenAI-completions paths emitted
|
|
905
|
+
// it unconditionally. https://platform.claude.com/docs/en/build-with-claude/thinking
|
|
906
|
+
//
|
|
907
|
+
// Matched on the Fable family rather than on Fable 5.1 alone, for three reasons: the same doc
|
|
908
|
+
// sentence names Claude Fable 5 alongside Claude Fable 5.1; the Anthropic Messages path already
|
|
909
|
+
// covers both, so a narrower rule here would leave the three APIs inconsistent; and a version-
|
|
910
|
+
// scoped id test cannot reach OpenRouter's `~anthropic/claude-fable-latest` alias, which names no
|
|
911
|
+
// version yet carries Fable 5.1's pricing and omits `temperature` from its own
|
|
912
|
+
// `supported_parameters`. Every matched entry is covered by that one documented sentence.
|
|
913
|
+
//
|
|
914
|
+
// Deliberately *not* driven from provider metadata: 79 of OpenRouter's 419 models omit
|
|
915
|
+
// `temperature` from `supported_parameters`, including the GPT-5 family, and OpenRouter reports it
|
|
916
|
+
// as supported for Opus 5 and Opus 4.8 in contradiction of Anthropic's own docs.
|
|
917
|
+
//
|
|
918
|
+
// OpenRouter's `~anthropic/claude-fable-latest` alias is an Anthropic Messages entry (upstream pi
|
|
919
|
+
// 44f6851b), whose id names no version, so `isAnthropicTemperatureUnsupportedModel` cannot reach it
|
|
920
|
+
// either: this family match covers it on that path too.
|
|
921
|
+
export function applyFableTemperatureCompatMetadata(model) {
|
|
922
|
+
if (!/claude-fable/.test(model.id))
|
|
923
|
+
return;
|
|
924
|
+
if (model.api === "anthropic-messages") {
|
|
925
|
+
mergeAnthropicMessagesCompat(model, { supportsTemperature: false });
|
|
926
|
+
}
|
|
927
|
+
else if (model.api === "bedrock-converse-stream") {
|
|
928
|
+
model.compat = { ...model.compat, supportsTemperature: false };
|
|
929
|
+
}
|
|
930
|
+
else if (model.api === "openai-completions") {
|
|
931
|
+
model.compat = { ...model.compat, supportsTemperature: false };
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
export function applyStrictToolCompatMetadata(model) {
|
|
935
|
+
if ((model.provider === "openai" || model.provider === "cloudflare-ai-gateway") &&
|
|
936
|
+
model.api === "openai-responses") {
|
|
937
|
+
model.compat = { ...model.compat, supportsStrictMode: true };
|
|
938
|
+
}
|
|
939
|
+
else if (model.provider === "anthropic" && model.api === "anthropic-messages") {
|
|
940
|
+
mergeAnthropicMessagesCompat(model, { supportsStrictTools: true });
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
// Responses endpoints verified (OpenAI, ChatGPT Codex backend, GitHub Copilot,
|
|
944
|
+
// opencode zen) or documented (Azure OpenAI, Cloudflare AI Gateway) to pass
|
|
945
|
+
// OpenAI custom grammar tools through. OpenAI rejects `type: "custom"` tools
|
|
946
|
+
// for pre-GPT-5 models (gpt-4.x, gpt-4o, o-series).
|
|
947
|
+
export const OPENAI_GRAMMAR_TOOL_PROVIDERS = new Set([
|
|
948
|
+
"openai",
|
|
949
|
+
"openai-codex",
|
|
950
|
+
"azure",
|
|
951
|
+
"github-copilot",
|
|
952
|
+
"opencode",
|
|
953
|
+
"cloudflare-ai-gateway",
|
|
954
|
+
]);
|
|
955
|
+
export const OPENAI_GRAMMAR_TOOL_APIS = new Set([
|
|
956
|
+
"openai-responses",
|
|
957
|
+
"azure-openai-responses",
|
|
958
|
+
"openai-codex-responses",
|
|
959
|
+
]);
|
|
960
|
+
export function applyOpenAIGrammarToolCompatMetadata(model) {
|
|
961
|
+
if (!OPENAI_GRAMMAR_TOOL_APIS.has(model.api) || !OPENAI_GRAMMAR_TOOL_PROVIDERS.has(model.provider))
|
|
962
|
+
return;
|
|
963
|
+
const match = /^gpt-(\d+)/.exec(model.id);
|
|
964
|
+
if (!match || Number(match[1]) < 5)
|
|
965
|
+
return;
|
|
966
|
+
model.compat = { ...model.compat, supportsOpenAIGrammarTools: true };
|
|
967
|
+
}
|
|
968
|
+
export function applyOpenAIToolSearchMetadata(model) {
|
|
969
|
+
const isOpenAIResponses = model.provider === "openai" && model.api === "openai-responses";
|
|
970
|
+
const isOpenAICodex = model.provider === "openai-codex" && model.api === "openai-codex-responses";
|
|
971
|
+
if (!(isOpenAIResponses || isOpenAICodex) || !OPENAI_TOOL_SEARCH_MODEL_IDS.has(model.id))
|
|
972
|
+
return;
|
|
973
|
+
const supportsAdditionalTools = (isOpenAIResponses && OPENAI_ADDITIONAL_TOOLS_MODEL_IDS.has(model.id)) ||
|
|
974
|
+
(isOpenAICodex && OPENAI_CODEX_ADDITIONAL_TOOLS_MODEL_IDS.has(model.id));
|
|
975
|
+
model.compat = {
|
|
976
|
+
...model.compat,
|
|
977
|
+
...(supportsAdditionalTools ? { supportsAdditionalTools: true } : {}),
|
|
978
|
+
supportsToolSearch: true,
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
// Moonshot Kimi K2.6/K2.7 accept system text after the conversation starts but reject
|
|
982
|
+
// tool-bearing system messages. Kimi K3 accepts both forms; Fireworks and OpenCode pass
|
|
983
|
+
// its tool-bearing form through. GitHub Copilot forwards K3 text but silently drops its
|
|
984
|
+
// tool-bearing message. DeepSeek V4 Pro and OpenAI models behind OpenRouter also accept
|
|
985
|
+
// plain system text in place. Kimi Coding sets these flags in createKimiCodingModels().
|
|
986
|
+
export function applyOpenAICompletionsTranscriptMetadata(model) {
|
|
987
|
+
if (model.api !== "openai-completions")
|
|
988
|
+
return;
|
|
989
|
+
const isKimiK3 = (model.provider.startsWith("moonshot") && isKimiK3FamilyId(model.id)) ||
|
|
990
|
+
(model.provider === "fireworks" && model.id.includes("kimi-k3")) ||
|
|
991
|
+
((model.provider === "opencode" || model.provider === "opencode-go") && isKimiK3FamilyId(model.id));
|
|
992
|
+
const isMoonshotKimiK2 = model.provider.startsWith("moonshot") &&
|
|
993
|
+
(model.id === "kimi-k2.6" || model.id === "kimi-k2.7-code" || model.id === "kimi-k2.7-code-highspeed");
|
|
994
|
+
const isTextOnly = isMoonshotKimiK2 ||
|
|
995
|
+
(model.provider === "github-copilot" && model.id === "kimi-k3") ||
|
|
996
|
+
(model.provider === "deepseek" && model.id === "deepseek-v4-pro") ||
|
|
997
|
+
(model.provider === "openrouter" &&
|
|
998
|
+
model.id.startsWith("openai/") &&
|
|
999
|
+
OPENAI_MID_CONVO_SYSTEM_MESSAGE_MODEL_IDS.has(model.id.slice("openai/".length)));
|
|
1000
|
+
if (!isKimiK3 && !isTextOnly)
|
|
1001
|
+
return;
|
|
1002
|
+
model.compat = {
|
|
1003
|
+
...model.compat,
|
|
1004
|
+
supportsMidConvoSystemMessages: true,
|
|
1005
|
+
...(isKimiK3 ? { supportsMidConvoToolAdditions: true } : {}),
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
// Newer OpenAI Responses models accept developer messages after the conversation has started.
|
|
1009
|
+
// OpenCode Zen, OpenCode Go, and GitHub Copilot pass both those messages and
|
|
1010
|
+
// `additional_tools` items through to OpenAI unchanged; tool search is not verified
|
|
1011
|
+
// through those proxies.
|
|
1012
|
+
export const OPENAI_RESPONSES_PROXY_PROVIDERS = new Set(["opencode", "opencode-go", "github-copilot"]);
|
|
1013
|
+
export function applyOpenAIResponsesTranscriptMetadata(model) {
|
|
1014
|
+
const isOpenAIResponses = model.provider === "openai" && model.api === "openai-responses";
|
|
1015
|
+
const isOpenAICodex = model.provider === "openai-codex" && model.api === "openai-codex-responses";
|
|
1016
|
+
const isProxiedResponses = OPENAI_RESPONSES_PROXY_PROVIDERS.has(model.provider) && model.api === "openai-responses";
|
|
1017
|
+
if (!(isOpenAIResponses || isOpenAICodex || isProxiedResponses) ||
|
|
1018
|
+
!OPENAI_MID_CONVO_SYSTEM_MESSAGE_MODEL_IDS.has(model.id)) {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
model.compat = {
|
|
1022
|
+
...model.compat,
|
|
1023
|
+
supportsMidConvoSystemMessages: true,
|
|
1024
|
+
...(isProxiedResponses && OPENAI_ADDITIONAL_TOOLS_MODEL_IDS.has(model.id)
|
|
1025
|
+
? { supportsAdditionalTools: true }
|
|
1026
|
+
: {}),
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
// OpenAI charges prompt-cache writes starting with the GPT-5.6 family, and exactly
|
|
1030
|
+
// those models accept `prompt_cache_options`; older models reject the parameter.
|
|
1031
|
+
// https://developers.openai.com/api/docs/guides/prompt-caching
|
|
1032
|
+
export function applyOpenAIExplicitPromptCacheMetadata(model) {
|
|
1033
|
+
if (model.provider !== "openai" || model.api !== "openai-responses")
|
|
1034
|
+
return;
|
|
1035
|
+
if (!(model.cost.cacheWrite > 0))
|
|
1036
|
+
return;
|
|
1037
|
+
model.compat = {
|
|
1038
|
+
...model.compat,
|
|
1039
|
+
supportsExplicitPromptCacheMode: true,
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
// GPT-6 models accept `configuration_update` input items that change the reasoning effort
|
|
1043
|
+
// without changing the cached prompt prefix. Not enabled for openai-codex (Codex CLI keeps it
|
|
1044
|
+
// behind a flag that is off by default) or proxies.
|
|
1045
|
+
export function applyOpenAIMidConvoEffortMetadata(model) {
|
|
1046
|
+
if (model.provider !== "openai" || model.api !== "openai-responses")
|
|
1047
|
+
return;
|
|
1048
|
+
if (!OPENAI_MID_CONVO_EFFORT_MODEL_IDS.has(model.id))
|
|
1049
|
+
return;
|
|
1050
|
+
model.compat = {
|
|
1051
|
+
...model.compat,
|
|
1052
|
+
supportsMidConvoEffort: true,
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
// Anthropic ephemeral entries have a hard five-minute lifetime; `ttl: "1h"`
|
|
1056
|
+
// extends it to one hour. Only direct Anthropic is annotated so cache warming
|
|
1057
|
+
// does not assume equivalent behavior through proxies.
|
|
1058
|
+
// https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1059
|
+
export const ANTHROPIC_PROMPT_CACHE = { short: 300, long: 3600 };
|
|
1060
|
+
export function applyPromptCacheMetadata(model) {
|
|
1061
|
+
if (model.provider === "anthropic" && model.api === "anthropic-messages") {
|
|
1062
|
+
model.promptCache = ANTHROPIC_PROMPT_CACHE;
|
|
1063
|
+
}
|
|
1064
|
+
// Do not add OpenAI lifetimes yet. Before enabling warming for explicit
|
|
1065
|
+
// OpenAI caches, re-evaluate it using observed expiry, replay, and billing
|
|
1066
|
+
// behavior; a documented TTL alone does not establish full cache loss.
|
|
1067
|
+
}
|
|
1068
|
+
export function applyImageInputMetadata(model) {
|
|
1069
|
+
if (!model.input.includes("image"))
|
|
1070
|
+
return;
|
|
1071
|
+
const providerLimits = model.provider === "anthropic"
|
|
1072
|
+
? {
|
|
1073
|
+
maxRequestBytes: 32 * 1024 * 1024,
|
|
1074
|
+
images: {
|
|
1075
|
+
maxPerRequest: model.type !== "image" && "contextWindow" in model && model.contextWindow === 200000 ? 100 : 600,
|
|
1076
|
+
},
|
|
1077
|
+
}
|
|
1078
|
+
: model.provider === "amazon-bedrock"
|
|
1079
|
+
? { images: { maxPerMessage: 20 } }
|
|
1080
|
+
: model.provider === "openai"
|
|
1081
|
+
? { maxRequestBytes: 512 * 1024 * 1024, images: { maxPerRequest: 1500 } }
|
|
1082
|
+
: model.provider === "google"
|
|
1083
|
+
? { maxRequestBytes: 20 * 1024 * 1024, images: { maxPerRequest: 3600 } }
|
|
1084
|
+
: undefined;
|
|
1085
|
+
const configuredImages = model.inputLimits?.images;
|
|
1086
|
+
model.inputLimits = {
|
|
1087
|
+
...providerLimits,
|
|
1088
|
+
...model.inputLimits,
|
|
1089
|
+
images: {
|
|
1090
|
+
...providerLimits?.images,
|
|
1091
|
+
...configuredImages,
|
|
1092
|
+
resize: { ...DEFAULT_IMAGE_RESIZE, ...configuredImages?.resize },
|
|
1093
|
+
},
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
export function isGemma4Model(modelId) {
|
|
1097
|
+
return /gemma-?4/.test(modelId.toLowerCase());
|
|
1098
|
+
}
|
|
1099
|
+
export function getGoogleThinkingLevelMap(modelId, reasoningOptions) {
|
|
1100
|
+
const effortMap = getEffortThinkingLevelMap(reasoningOptions);
|
|
1101
|
+
if (effortMap)
|
|
1102
|
+
return effortMap;
|
|
1103
|
+
if (isGemma4Model(modelId)) {
|
|
1104
|
+
return { off: null, minimal: "MINIMAL", low: null, medium: null, high: "HIGH" };
|
|
1105
|
+
}
|
|
1106
|
+
return undefined;
|
|
1107
|
+
}
|
|
1108
|
+
export function applyThinkingLevelMetadata(model) {
|
|
1109
|
+
if ((model.api === "openai-responses" || model.api === "azure-openai-responses") && model.id.startsWith("gpt-5")) {
|
|
1110
|
+
mergeThinkingLevelMap(model, { off: null });
|
|
1111
|
+
}
|
|
1112
|
+
if ((isOpenAiGpt6ModelId(model.id) &&
|
|
1113
|
+
(model.api === "openai-responses" ||
|
|
1114
|
+
model.api === "azure-openai-responses" ||
|
|
1115
|
+
model.api === "openai-codex-responses")) ||
|
|
1116
|
+
isBedrockOpenAiGpt6Model(model)) {
|
|
1117
|
+
const baseModelId = getOpenAiBaseModelId(model);
|
|
1118
|
+
mergeThinkingLevelMap(model, {
|
|
1119
|
+
// GPT-6 Astra and GPT-6.1 Sol reject reasoning.effort "none"; GPT-6.1 Terra accepts it. All reject
|
|
1120
|
+
// "minimal" (verified on Codex, October 2026).
|
|
1121
|
+
off: isOpenAiGpt6AstraModelId(baseModelId) || baseModelId === "gpt-6.1-sol" ? null : "none",
|
|
1122
|
+
minimal: null,
|
|
1123
|
+
low: "low",
|
|
1124
|
+
medium: "medium",
|
|
1125
|
+
high: "high",
|
|
1126
|
+
xhigh: "xhigh",
|
|
1127
|
+
max: "max",
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
if (model.provider === "github-copilot" && model.id.startsWith("gpt-5")) {
|
|
1131
|
+
mergeThinkingLevelMap(model, { minimal: "low" });
|
|
1132
|
+
}
|
|
1133
|
+
if (model.api === "openai-responses" &&
|
|
1134
|
+
model.provider === "openai" &&
|
|
1135
|
+
OPENAI_RESPONSES_NONE_REASONING_MODELS.has(model.id)) {
|
|
1136
|
+
mergeThinkingLevelMap(model, { off: "none" });
|
|
1137
|
+
}
|
|
1138
|
+
// xAI models without verified effort options must not send the undocumented
|
|
1139
|
+
// "none"/"minimal" efforts.
|
|
1140
|
+
if (model.provider === "xai" && model.api === "openai-responses" && model.thinkingLevelMap === undefined) {
|
|
1141
|
+
mergeThinkingLevelMap(model, { off: null, minimal: null });
|
|
1142
|
+
}
|
|
1143
|
+
if (supportsOpenAiXhigh(model.id)) {
|
|
1144
|
+
mergeThinkingLevelMap(model, { xhigh: "xhigh" });
|
|
1145
|
+
}
|
|
1146
|
+
if (supportsOpenAiMax(model)) {
|
|
1147
|
+
mergeThinkingLevelMap(model, { max: "max" });
|
|
1148
|
+
}
|
|
1149
|
+
if (model.provider === "openai" && model.id === "gpt-5.5") {
|
|
1150
|
+
mergeThinkingLevelMap(model, { minimal: null });
|
|
1151
|
+
}
|
|
1152
|
+
if (model.id.endsWith("gpt-5.5-pro")) {
|
|
1153
|
+
mergeThinkingLevelMap(model, { off: null, minimal: null, low: null });
|
|
1154
|
+
}
|
|
1155
|
+
// Anthropic adaptive-thinking effort support (per Anthropic adaptive thinking docs):
|
|
1156
|
+
// - "max" is available on all adaptive-thinking Claude models.
|
|
1157
|
+
// - "xhigh" is only available on Opus 4.7/4.8/5, Sonnet 5, Haiku 5.5, and Fable 5.
|
|
1158
|
+
if (model.id.includes("opus-4-6") ||
|
|
1159
|
+
model.id.includes("opus-4.6") ||
|
|
1160
|
+
model.id.includes("sonnet-4-6") ||
|
|
1161
|
+
model.id.includes("sonnet-4.6")) {
|
|
1162
|
+
mergeThinkingLevelMap(model, { max: "max" });
|
|
1163
|
+
}
|
|
1164
|
+
if (model.id.includes("opus-4-7") ||
|
|
1165
|
+
model.id.includes("opus-4.7") ||
|
|
1166
|
+
model.id.includes("opus-4-8") ||
|
|
1167
|
+
model.id.includes("opus-4.8") ||
|
|
1168
|
+
model.id.includes("opus-5") ||
|
|
1169
|
+
model.id.includes("opus.5") ||
|
|
1170
|
+
model.id.includes("sonnet-5") ||
|
|
1171
|
+
model.id.includes("sonnet.5") ||
|
|
1172
|
+
model.id.includes("haiku-5") ||
|
|
1173
|
+
model.id.includes("haiku.5")) {
|
|
1174
|
+
mergeThinkingLevelMap(model, { xhigh: "xhigh", max: "max" });
|
|
1175
|
+
}
|
|
1176
|
+
if (model.id.includes("fable-5")) {
|
|
1177
|
+
mergeThinkingLevelMap(model, { off: null, xhigh: "xhigh", max: "max" });
|
|
1178
|
+
}
|
|
1179
|
+
// Anthropic publishes exactly five efforts for Claude Fable 5.1 and 5.2, Claude Opus 5.5, and Claude
|
|
1180
|
+
// Sonnet 5.5 — low, medium, high, xhigh, max — and no `minimal`. `getSupportedThinkingLevels`
|
|
1181
|
+
// includes any level the map leaves undefined, so on the sparse Anthropic-side maps `minimal` was
|
|
1182
|
+
// offered as a sixth option. It is not an API error (`mapThinkingLevelToEffort` collapses it to
|
|
1183
|
+
// `low`), but it is not a level the model publishes, so deny it explicitly. The OpenRouter entries
|
|
1184
|
+
// already carry a full map with `minimal: null` from models.dev `reasoning_options`, so this is a
|
|
1185
|
+
// no-op there.
|
|
1186
|
+
// https://platform.claude.com/docs/en/models/fable-5-1/overview
|
|
1187
|
+
// https://platform.claude.com/docs/en/models/fable-5-2/whats-new-fable-5-2
|
|
1188
|
+
// https://platform.claude.com/docs/en/models/opus-5-5/overview
|
|
1189
|
+
// https://platform.claude.com/docs/en/models/sonnet-5-5/overview
|
|
1190
|
+
if (/fable-5[-.][12]|opus-5[-.]5|(?:sonnet|haiku)-5[-.]5/.test(model.id)) {
|
|
1191
|
+
mergeThinkingLevelMap(model, { minimal: null });
|
|
1192
|
+
}
|
|
1193
|
+
if (model.api === "anthropic-messages" && isAnthropicAdaptiveThinkingModel(model.id)) {
|
|
1194
|
+
mergeAnthropicMessagesCompat(model, { forceAdaptiveThinking: true });
|
|
1195
|
+
}
|
|
1196
|
+
if (model.api === "anthropic-messages" && isAnthropicTemperatureUnsupportedModel(model.id)) {
|
|
1197
|
+
mergeAnthropicMessagesCompat(model, { supportsTemperature: false });
|
|
1198
|
+
}
|
|
1199
|
+
if (model.api === "bedrock-converse-stream" && /claude-haiku-5[-.]5/.test(model.id)) {
|
|
1200
|
+
model.compat = { ...model.compat, supportsTemperature: false };
|
|
1201
|
+
}
|
|
1202
|
+
if (model.api === "openai-completions" && model.id.includes("deepseek-v4") && model.thinkingLevelMap === undefined) {
|
|
1203
|
+
mergeThinkingLevelMap(model, model.provider === "openrouter"
|
|
1204
|
+
? { ...DEEPSEEK_V4_THINKING_LEVEL_MAP, xhigh: "xhigh", max: null }
|
|
1205
|
+
: model.provider === "azure"
|
|
1206
|
+
? AZURE_DEEPSEEK_V4_THINKING_LEVEL_MAP
|
|
1207
|
+
: (model.provider === "deepseek" || model.provider === "opencode" || model.provider === "opencode-go") &&
|
|
1208
|
+
model.id.includes("deepseek-v4-flash")
|
|
1209
|
+
? DEEPSEEK_V4_FLASH_THINKING_LEVEL_MAP
|
|
1210
|
+
: DEEPSEEK_V4_THINKING_LEVEL_MAP);
|
|
1211
|
+
}
|
|
1212
|
+
// Google publishes LOW | MEDIUM | HIGH for Gemini 3.8 Flash and states outright that "MINIMAL is
|
|
1213
|
+
// unsupported for this model". `getSupportedThinkingLevels` offers any level the sparse Google
|
|
1214
|
+
// map leaves undefined, so deny it explicitly. Deliberately scoped to 3.8: Gemini 3.5 and 3.6
|
|
1215
|
+
// Flash do publish MINIMAL, so the wider Flash rule above must not gain this.
|
|
1216
|
+
// https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/guides/gemini-3-8-flash
|
|
1217
|
+
if ((model.api === "google-generative-ai" || model.api === "google-vertex") && /gemini-3\.8-flash/.test(model.id)) {
|
|
1218
|
+
mergeThinkingLevelMap(model, { minimal: null });
|
|
1219
|
+
}
|
|
1220
|
+
// Gemini 2.5 Pro cannot turn thinking off: its smallest thinking budget is 128 tokens and it rejects a zero
|
|
1221
|
+
// budget. Deny `off` so thinking `off` runs at the smallest budget instead.
|
|
1222
|
+
if ((model.api === "google-generative-ai" || model.api === "google-vertex") && /gemini-2\.5-pro/.test(model.id)) {
|
|
1223
|
+
mergeThinkingLevelMap(model, { off: null });
|
|
1224
|
+
}
|
|
1225
|
+
if (model.provider === "groq" && model.id === "qwen/qwen3.6-27b") {
|
|
1226
|
+
mergeThinkingLevelMap(model, { minimal: null, low: null, medium: null, high: "default" });
|
|
1227
|
+
}
|
|
1228
|
+
if (model.provider === "openai-codex" && supportsOpenAiXhigh(model.id) && !isOpenAiGpt6AstraModelId(model.id)) {
|
|
1229
|
+
mergeThinkingLevelMap(model, { minimal: "low" });
|
|
1230
|
+
}
|
|
1231
|
+
if ((model.provider === "moonshotai" || model.provider === "moonshotai-cn") &&
|
|
1232
|
+
(model.id === "kimi-k2.7-code" || model.id === "kimi-k2.7-code-highspeed")) {
|
|
1233
|
+
// Kimi K2.7 Code is always-thinking. Official docs say
|
|
1234
|
+
// `thinking: { type: "disabled" }` is rejected, and callers can omit
|
|
1235
|
+
// the thinking parameter to use the enabled default.
|
|
1236
|
+
mergeThinkingLevelMap(model, { off: null });
|
|
1237
|
+
}
|
|
1238
|
+
if (model.provider === "openrouter" && model.id.startsWith("inception/mercury-2")) {
|
|
1239
|
+
// Mercury 2 in instant mode (reasoning_effort: "none") disables tool calling.
|
|
1240
|
+
// Mark "off" unsupported so the openai-completions provider omits the reasoning param
|
|
1241
|
+
// instead of defaulting to {reasoning:{effort:"none"}} (see openai-completions.ts:575).
|
|
1242
|
+
// Pi's low/medium/high pass through verbatim; OpenRouter normalizes to Mercury's vocabulary.
|
|
1243
|
+
mergeThinkingLevelMap(model, { off: null });
|
|
1244
|
+
}
|
|
1245
|
+
if (model.provider === "openrouter" && model.id === "z-ai/glm-5.2") {
|
|
1246
|
+
mergeThinkingLevelMap(model, { xhigh: "xhigh" });
|
|
1247
|
+
}
|
|
1248
|
+
if (model.provider === "fireworks") {
|
|
1249
|
+
if (model.api === "anthropic-messages" &&
|
|
1250
|
+
model.compat?.forceAdaptiveThinking) {
|
|
1251
|
+
// Qwen Max currently advertises only a toggle. Prefer upstream effort
|
|
1252
|
+
// metadata once available instead of replacing it with this fallback.
|
|
1253
|
+
if (model.id === "accounts/fireworks/models/qwen3p8-max" && !model.thinkingLevelMap) {
|
|
1254
|
+
model.thinkingLevelMap = getEffortThinkingLevelMap([
|
|
1255
|
+
{ type: "effort", values: ["low", "medium", "xhigh"] },
|
|
1256
|
+
]);
|
|
1257
|
+
}
|
|
1258
|
+
const reasoningOptions = modelsDevReasoningOptions.get(getModelKey(model));
|
|
1259
|
+
if (reasoningOptions?.some((option) => option.type === "toggle") ||
|
|
1260
|
+
// The 2.4T alias omits the verified toggle in models.dev.
|
|
1261
|
+
model.id === "accounts/fireworks/models/qwen3p8-2p4t-a95b") {
|
|
1262
|
+
mergeThinkingLevelMap(model, { off: "none" });
|
|
1263
|
+
}
|
|
1264
|
+
if (model.id === "accounts/fireworks/models/deepseek-v4-pro-0813") {
|
|
1265
|
+
mergeThinkingLevelMap(model, { low: "low" });
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
if (model.id.includes("glm-5p2")) {
|
|
1269
|
+
// GLM 5.2 and its fast router support off/high/max. Fireworks maps low
|
|
1270
|
+
// and medium to high, so do not expose those aliases as distinct levels.
|
|
1271
|
+
mergeThinkingLevelMap(model, { off: "none", minimal: null, low: null, medium: null, max: "max" });
|
|
1272
|
+
}
|
|
1273
|
+
if (model.id.includes("kimi-k3")) {
|
|
1274
|
+
// Fireworks maps medium to high on both APIs; do not expose it as a distinct level.
|
|
1275
|
+
mergeThinkingLevelMap(model, { medium: null });
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
if (model.provider === "opencode-go" && model.id === "glm-5.2") {
|
|
1279
|
+
mergeThinkingLevelMap(model, OPENCODE_GO_GLM52_THINKING_LEVEL_MAP);
|
|
1280
|
+
}
|
|
1281
|
+
if (model.provider === "opencode" && model.id === "grok-build-0.1") {
|
|
1282
|
+
// OpenCode Zen Grok Build reasons by default but rejects explicit reasoningEffort.
|
|
1283
|
+
mergeThinkingLevelMap(model, { off: null, minimal: null, low: null, medium: null });
|
|
1284
|
+
}
|
|
1285
|
+
if (model.provider === "ant-ling" && model.reasoning) {
|
|
1286
|
+
// Ring reasons by default. Only high/xhigh have documented explicit effort controls.
|
|
1287
|
+
mergeThinkingLevelMap(model, ANT_LING_RING_THINKING_LEVEL_MAP);
|
|
1288
|
+
}
|
|
1289
|
+
if (model.provider === "github-copilot") {
|
|
1290
|
+
const override = GITHUB_COPILOT_THINKING_LEVEL_OVERRIDES[model.id];
|
|
1291
|
+
if (override) {
|
|
1292
|
+
mergeThinkingLevelMap(model, override);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
export function getAnthropicMessagesCompat(provider, modelId) {
|
|
1297
|
+
const compat = {};
|
|
1298
|
+
if (VERIFIED_ANTHROPIC_MID_CONVO_EFFORT_PROVIDERS.has(provider) &&
|
|
1299
|
+
supportsAnthropicMidConvoEffort(modelId) &&
|
|
1300
|
+
!MID_CONVO_EFFORT_UNSUPPORTED_ANTHROPIC_MODELS.has(`${provider}:${modelId}`)) {
|
|
1301
|
+
compat.supportsMidConvoEffort = true;
|
|
1302
|
+
}
|
|
1303
|
+
if (provider === "anthropic" && supportsAnthropicMidConvoSystemMessages(modelId)) {
|
|
1304
|
+
compat.supportsMidConvoSystemMessages = true;
|
|
1305
|
+
compat.supportsMidConvoToolChanges = true;
|
|
1306
|
+
}
|
|
1307
|
+
// OpenCode Zen and GitHub Copilot forward mid-conversation system messages but reject
|
|
1308
|
+
// `tool_addition`/`tool_removal` blocks, so tool changes stay top-level there.
|
|
1309
|
+
if ((provider === "opencode" || provider === "github-copilot") && supportsAnthropicMidConvoSystemMessages(modelId)) {
|
|
1310
|
+
compat.supportsMidConvoSystemMessages = true;
|
|
1311
|
+
}
|
|
1312
|
+
if (EAGER_TOOL_INPUT_STREAMING_UNSUPPORTED_ANTHROPIC_MODELS.has(`${provider}:${modelId}`)) {
|
|
1313
|
+
compat.supportsEagerToolInputStreaming = false;
|
|
1314
|
+
}
|
|
1315
|
+
if (provider === "xiaomi" || provider.startsWith("xiaomi-token-plan-")) {
|
|
1316
|
+
compat.allowEmptySignature = true;
|
|
1317
|
+
}
|
|
1318
|
+
// OpenCode Qwen 3.8 Flash emits and accepts thinking blocks with empty signatures.
|
|
1319
|
+
if ((provider === "opencode" || provider === "opencode-go") && modelId === "qwen3.8-flash") {
|
|
1320
|
+
compat.allowEmptySignature = true;
|
|
1321
|
+
}
|
|
1322
|
+
return Object.keys(compat).length > 0 ? compat : undefined;
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Input modalities for the two runtimes that can serialize a document block: the Anthropic
|
|
1326
|
+
* Messages path and the Amazon Bedrock Converse path.
|
|
1327
|
+
*
|
|
1328
|
+
* PDF is a platform capability rather than a per-model one — "All active models support PDF
|
|
1329
|
+
* processing" — so upstream metadata publishes it for every Claude entry. Gating on the *API*
|
|
1330
|
+
* rather than the model is what keeps that honest: a provider that advertises PDF but has no
|
|
1331
|
+
* document serializer here keeps `["text", "image"]`, so `Model.input` continues to describe what
|
|
1332
|
+
* Atomic can actually send rather than what the upstream model would accept.
|
|
1333
|
+
* https://platform.claude.com/docs/en/build-with-claude/pdf-support
|
|
1334
|
+
*/
|
|
1335
|
+
export function resolveDocumentCapableInput(m) {
|
|
1336
|
+
const modalities = m.modalities?.input;
|
|
1337
|
+
if (!modalities?.includes("image"))
|
|
1338
|
+
return ["text"];
|
|
1339
|
+
return modalities.includes("pdf") ? ["text", "image", "pdf"] : ["text", "image"];
|
|
1340
|
+
}
|
|
1341
|
+
export function getBedrockBaseUrl(modelId) {
|
|
1342
|
+
return modelId.startsWith("eu.")
|
|
1343
|
+
? "https://bedrock-runtime.eu-central-1.amazonaws.com"
|
|
1344
|
+
: "https://bedrock-runtime.us-east-1.amazonaws.com";
|
|
1345
|
+
}
|
|
1346
|
+
export function normalizeNvidiaModelId(modelId) {
|
|
1347
|
+
return modelId.toLowerCase().replaceAll("_", ".");
|
|
1348
|
+
}
|
|
1349
|
+
export function roundCost(value) {
|
|
1350
|
+
return Number(value.toFixed(6));
|
|
1351
|
+
}
|
|
1352
|
+
export function getModelsDevCost(cost) {
|
|
1353
|
+
const base = {
|
|
1354
|
+
input: cost?.input || 0,
|
|
1355
|
+
output: cost?.output || 0,
|
|
1356
|
+
cacheRead: cost?.cache_read || 0,
|
|
1357
|
+
cacheWrite: cost?.cache_write || 0,
|
|
1358
|
+
};
|
|
1359
|
+
const tiers = cost?.tiers?.flatMap((tier) => {
|
|
1360
|
+
const context = tier.tier;
|
|
1361
|
+
if (context?.type !== "context" || context.size === undefined)
|
|
1362
|
+
return [];
|
|
1363
|
+
return [
|
|
1364
|
+
{
|
|
1365
|
+
inputTokensAbove: context.size,
|
|
1366
|
+
input: tier.input ?? base.input,
|
|
1367
|
+
output: tier.output ?? base.output,
|
|
1368
|
+
cacheRead: tier.cache_read ?? base.cacheRead,
|
|
1369
|
+
cacheWrite: tier.cache_write ?? base.cacheWrite,
|
|
1370
|
+
},
|
|
1371
|
+
];
|
|
1372
|
+
});
|
|
1373
|
+
return tiers && tiers.length > 0 ? { ...base, tiers } : base;
|
|
1374
|
+
}
|
|
1375
|
+
export function processZaiModels(data) {
|
|
1376
|
+
const variants = [
|
|
1377
|
+
{
|
|
1378
|
+
source: "zai-coding-plan",
|
|
1379
|
+
provider: "zai",
|
|
1380
|
+
baseUrl: "https://api.z.ai/api/coding/paas/v4",
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
source: "zhipuai-coding-plan",
|
|
1384
|
+
provider: "zai-coding-cn",
|
|
1385
|
+
baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4",
|
|
1386
|
+
},
|
|
1387
|
+
];
|
|
1388
|
+
const models = [];
|
|
1389
|
+
for (const { source, provider, baseUrl } of variants) {
|
|
1390
|
+
for (const [modelId, model] of Object.entries(data[source]?.models ?? {})) {
|
|
1391
|
+
const m = model;
|
|
1392
|
+
if (m.tool_call !== true)
|
|
1393
|
+
continue;
|
|
1394
|
+
const supportsImage = m.modalities?.input?.includes("image");
|
|
1395
|
+
const thinkingLevelMap = getEffortThinkingLevelMap(m.reasoning_options ?? []);
|
|
1396
|
+
const isGlm52 = modelId === "glm-5.2" || modelId === "glm-5.2-highspeed";
|
|
1397
|
+
if (thinkingLevelMap && isGlm52) {
|
|
1398
|
+
thinkingLevelMap.off = "none";
|
|
1399
|
+
}
|
|
1400
|
+
const supportsReasoningEffort = thinkingLevelMap !== undefined;
|
|
1401
|
+
const referenceCost = data.zai?.models?.[modelId]?.cost ?? m.cost;
|
|
1402
|
+
models.push({
|
|
1403
|
+
id: modelId,
|
|
1404
|
+
name: m.name || modelId,
|
|
1405
|
+
api: "openai-completions",
|
|
1406
|
+
provider,
|
|
1407
|
+
baseUrl,
|
|
1408
|
+
reasoning: m.reasoning === true,
|
|
1409
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
1410
|
+
input: supportsImage ? ["text", "image"] : ["text"],
|
|
1411
|
+
cost: getModelsDevCost(referenceCost),
|
|
1412
|
+
compat: {
|
|
1413
|
+
supportsDeveloperRole: false,
|
|
1414
|
+
thinkingFormat: "zai",
|
|
1415
|
+
...(supportsReasoningEffort ? { supportsReasoningEffort: true } : {}),
|
|
1416
|
+
...(!ZAI_TOOL_STREAM_UNSUPPORTED_MODELS.has(modelId) ? { zaiToolStream: true } : {}),
|
|
1417
|
+
},
|
|
1418
|
+
contextWindow: m.limit?.context || 4096,
|
|
1419
|
+
maxTokens: m.limit?.output || 4096,
|
|
1420
|
+
});
|
|
1421
|
+
recordModelsDevReasoningOptions(provider, modelId, m);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
return models;
|
|
1425
|
+
}
|
|
1426
|
+
export function processBasetenModels(provider) {
|
|
1427
|
+
if (!provider?.models)
|
|
1428
|
+
return [];
|
|
1429
|
+
const baseUrl = "https://inference.baseten.co/v1";
|
|
1430
|
+
const baseCompat = {
|
|
1431
|
+
supportsStore: false,
|
|
1432
|
+
supportsDeveloperRole: false,
|
|
1433
|
+
supportsReasoningEffort: false,
|
|
1434
|
+
supportsUsageInStreaming: true,
|
|
1435
|
+
maxTokensField: "max_tokens",
|
|
1436
|
+
supportsStrictMode: true,
|
|
1437
|
+
// Baseten automatic prompt caching needs related requests on the same replica.
|
|
1438
|
+
// https://docs.baseten.co/inference/model-apis/pricing-and-limits
|
|
1439
|
+
sendSessionAffinityHeaders: true,
|
|
1440
|
+
supportsLongCacheRetention: false,
|
|
1441
|
+
};
|
|
1442
|
+
const reasoningEffortCompat = {
|
|
1443
|
+
...baseCompat,
|
|
1444
|
+
supportsReasoningEffort: true,
|
|
1445
|
+
thinkingFormat: "openai",
|
|
1446
|
+
};
|
|
1447
|
+
const toggleReasoningCompat = {
|
|
1448
|
+
...baseCompat,
|
|
1449
|
+
thinkingFormat: "baseten",
|
|
1450
|
+
chatTemplateArgs: { enable_thinking: { $var: "thinking.enabled" } },
|
|
1451
|
+
};
|
|
1452
|
+
const toggleReasoningEffortCompat = {
|
|
1453
|
+
...reasoningEffortCompat,
|
|
1454
|
+
thinkingFormat: "baseten",
|
|
1455
|
+
chatTemplateArgs: { enable_thinking: { $var: "thinking.enabled" } },
|
|
1456
|
+
};
|
|
1457
|
+
const toggleThinkingLevelMap = {
|
|
1458
|
+
off: "off",
|
|
1459
|
+
minimal: null,
|
|
1460
|
+
low: null,
|
|
1461
|
+
medium: null,
|
|
1462
|
+
high: "high",
|
|
1463
|
+
xhigh: null,
|
|
1464
|
+
max: null,
|
|
1465
|
+
};
|
|
1466
|
+
const glm52ThinkingLevelMap = {
|
|
1467
|
+
off: "none",
|
|
1468
|
+
minimal: null,
|
|
1469
|
+
low: null,
|
|
1470
|
+
medium: null,
|
|
1471
|
+
high: "high",
|
|
1472
|
+
xhigh: null,
|
|
1473
|
+
max: "max",
|
|
1474
|
+
};
|
|
1475
|
+
const models = [];
|
|
1476
|
+
for (const [modelId, model] of Object.entries(provider.models)) {
|
|
1477
|
+
if (model.status === "deprecated")
|
|
1478
|
+
continue;
|
|
1479
|
+
const reasoning = model.reasoning === true;
|
|
1480
|
+
const reasoningOptions = model.reasoning_options ?? [];
|
|
1481
|
+
const isGlm52 = modelId === "zai-org/GLM-5.2" || modelId === "zai-org/GLM-5.2-Fast";
|
|
1482
|
+
const supportsToggle = reasoningOptions.some((option) => option.type === "toggle") || isGlm52;
|
|
1483
|
+
const supportsEffort = reasoningOptions.some((option) => option.type === "effort") || isGlm52;
|
|
1484
|
+
const compat = supportsToggle && supportsEffort
|
|
1485
|
+
? toggleReasoningEffortCompat
|
|
1486
|
+
: supportsToggle
|
|
1487
|
+
? toggleReasoningCompat
|
|
1488
|
+
: supportsEffort
|
|
1489
|
+
? reasoningEffortCompat
|
|
1490
|
+
: baseCompat;
|
|
1491
|
+
const thinkingLevelMap = isGlm52
|
|
1492
|
+
? glm52ThinkingLevelMap
|
|
1493
|
+
: supportsToggle
|
|
1494
|
+
? toggleThinkingLevelMap
|
|
1495
|
+
: getEffortThinkingLevelMap(reasoningOptions);
|
|
1496
|
+
// Baseten's GLM-5.2 endpoints are text-only despite models.dev reporting image input.
|
|
1497
|
+
const supportsImageInput = !isGlm52 && model.modalities?.input?.includes("image");
|
|
1498
|
+
models.push({
|
|
1499
|
+
id: modelId,
|
|
1500
|
+
name: model.name || modelId,
|
|
1501
|
+
api: "openai-completions",
|
|
1502
|
+
provider: "baseten",
|
|
1503
|
+
baseUrl,
|
|
1504
|
+
reasoning,
|
|
1505
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
1506
|
+
input: supportsImageInput ? ["text", "image"] : ["text"],
|
|
1507
|
+
cost: getModelsDevCost(model.cost),
|
|
1508
|
+
compat,
|
|
1509
|
+
contextWindow: model.limit?.context || 4096,
|
|
1510
|
+
maxTokens: model.limit?.output || 4096,
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
return models;
|
|
1514
|
+
}
|
|
1515
|
+
export function processGoogleModels(data) {
|
|
1516
|
+
const models = [];
|
|
1517
|
+
const googleModels = data.google?.models;
|
|
1518
|
+
if (googleModels) {
|
|
1519
|
+
for (const [modelId, model] of Object.entries(googleModels)) {
|
|
1520
|
+
if (model.tool_call !== true)
|
|
1521
|
+
continue;
|
|
1522
|
+
const source = modelId === "gemini-flash-latest"
|
|
1523
|
+
? (googleModels["gemini-3.5-flash"] ?? model)
|
|
1524
|
+
: modelId === "gemini-flash-lite-latest"
|
|
1525
|
+
? (googleModels["gemini-3.1-flash-lite"] ?? model)
|
|
1526
|
+
: model;
|
|
1527
|
+
const thinkingLevelMap = getGoogleThinkingLevelMap(modelId, source.reasoning_options ?? []);
|
|
1528
|
+
models.push({
|
|
1529
|
+
id: modelId,
|
|
1530
|
+
name: model.name || modelId,
|
|
1531
|
+
api: "google-generative-ai",
|
|
1532
|
+
provider: "google",
|
|
1533
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
|
1534
|
+
reasoning: source.reasoning === true,
|
|
1535
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
1536
|
+
input: source.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1537
|
+
cost: getModelsDevCost(source.cost),
|
|
1538
|
+
contextWindow: source.limit?.context || 4096,
|
|
1539
|
+
maxTokens: source.limit?.output || 4096,
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
// The google-vertex models.dev catalog also includes Claude, OpenAI, and other
|
|
1544
|
+
// MaaS models that do not use the @google/genai Gemini streaming path.
|
|
1545
|
+
const vertexModels = data["google-vertex"]?.models;
|
|
1546
|
+
if (vertexModels) {
|
|
1547
|
+
for (const [modelId, model] of Object.entries(vertexModels)) {
|
|
1548
|
+
if (model.tool_call !== true || !modelId.startsWith("gemini-"))
|
|
1549
|
+
continue;
|
|
1550
|
+
if (modelId === "gemini-3.1-flash-lite-preview")
|
|
1551
|
+
continue;
|
|
1552
|
+
const source = modelId === "gemini-flash-latest"
|
|
1553
|
+
? (vertexModels["gemini-3.5-flash"] ?? model)
|
|
1554
|
+
: modelId === "gemini-flash-lite-latest"
|
|
1555
|
+
? (vertexModels["gemini-3.1-flash-lite"] ?? model)
|
|
1556
|
+
: model;
|
|
1557
|
+
const thinkingLevelMap = getGoogleThinkingLevelMap(modelId, source.reasoning_options ?? []);
|
|
1558
|
+
// models.dev reports Vertex cache_read/cache_write values for Gemini 2.5 Flash that
|
|
1559
|
+
// do not match the official Gemini API standard pricing table. pi only accounts
|
|
1560
|
+
// cachedContentTokenCount as cacheRead.
|
|
1561
|
+
const cacheRead = modelId === "gemini-2.5-flash" ? 0.03 : source.cost?.cache_read || 0;
|
|
1562
|
+
models.push({
|
|
1563
|
+
id: modelId,
|
|
1564
|
+
name: model.name || modelId,
|
|
1565
|
+
api: "google-vertex",
|
|
1566
|
+
provider: "google-vertex",
|
|
1567
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1568
|
+
reasoning: source.reasoning === true,
|
|
1569
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
1570
|
+
input: source.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1571
|
+
cost: {
|
|
1572
|
+
input: source.cost?.input || 0,
|
|
1573
|
+
output: source.cost?.output || 0,
|
|
1574
|
+
cacheRead,
|
|
1575
|
+
cacheWrite: 0,
|
|
1576
|
+
},
|
|
1577
|
+
contextWindow: source.limit?.context || 4096,
|
|
1578
|
+
maxTokens: source.limit?.output || 4096,
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
return models;
|
|
1583
|
+
}
|
|
1584
|
+
export function processFireworksModels(provider) {
|
|
1585
|
+
if (!provider?.models)
|
|
1586
|
+
return [];
|
|
1587
|
+
const anthropicCompat = {
|
|
1588
|
+
allowEmptySignature: true,
|
|
1589
|
+
sendSessionAffinityHeaders: true,
|
|
1590
|
+
supportsEagerToolInputStreaming: false,
|
|
1591
|
+
supportsCacheControlOnTools: false,
|
|
1592
|
+
supportsLongCacheRetention: false,
|
|
1593
|
+
};
|
|
1594
|
+
const openAICompat = {
|
|
1595
|
+
supportsStore: false,
|
|
1596
|
+
supportsDeveloperRole: false,
|
|
1597
|
+
sendSessionAffinityHeaders: true,
|
|
1598
|
+
supportsLongCacheRetention: false,
|
|
1599
|
+
};
|
|
1600
|
+
const kimiK3Compat = {
|
|
1601
|
+
...openAICompat,
|
|
1602
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
1603
|
+
thinkingFormat: "openai",
|
|
1604
|
+
};
|
|
1605
|
+
const models = [];
|
|
1606
|
+
for (const [modelId, model] of Object.entries(provider.models)) {
|
|
1607
|
+
if (model.tool_call !== true)
|
|
1608
|
+
continue;
|
|
1609
|
+
const input = model.modalities?.input?.includes("image") ? ["text", "image"] : ["text"];
|
|
1610
|
+
const common = {
|
|
1611
|
+
id: modelId,
|
|
1612
|
+
name: model.name || modelId,
|
|
1613
|
+
provider: "fireworks",
|
|
1614
|
+
reasoning: model.reasoning === true,
|
|
1615
|
+
input,
|
|
1616
|
+
cost: getModelsDevCost(model.cost),
|
|
1617
|
+
contextWindow: model.limit?.context || 4096,
|
|
1618
|
+
maxTokens: model.limit?.output || 4096,
|
|
1619
|
+
};
|
|
1620
|
+
if (modelId.includes("glm-")) {
|
|
1621
|
+
models.push({
|
|
1622
|
+
...common,
|
|
1623
|
+
api: "openai-completions",
|
|
1624
|
+
baseUrl: "https://api.fireworks.ai/inference/v1",
|
|
1625
|
+
compat: openAICompat,
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
else if (modelId.includes("kimi-k3")) {
|
|
1629
|
+
models.push({
|
|
1630
|
+
...common,
|
|
1631
|
+
api: "openai-completions",
|
|
1632
|
+
baseUrl: "https://api.fireworks.ai/inference/v1",
|
|
1633
|
+
compat: kimiK3Compat,
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
else {
|
|
1637
|
+
models.push({
|
|
1638
|
+
...common,
|
|
1639
|
+
api: "anthropic-messages",
|
|
1640
|
+
// Fireworks Anthropic-compatible API - SDK appends /v1/messages.
|
|
1641
|
+
baseUrl: "https://api.fireworks.ai/inference",
|
|
1642
|
+
// Fireworks prompt caching uses automatic prefix matching + session affinity.
|
|
1643
|
+
// x-session-affinity routes requests to the same replica for cache hits.
|
|
1644
|
+
// cache_control on tools and eager_input_streaming are not supported.
|
|
1645
|
+
// See: https://docs.fireworks.ai/tools-sdks/anthropic-compatibility
|
|
1646
|
+
// Use adaptive thinking for cataloged effort controls, with verified
|
|
1647
|
+
// fallbacks where models.dev is incomplete. New models need no allowlist entry.
|
|
1648
|
+
compat: {
|
|
1649
|
+
...anthropicCompat,
|
|
1650
|
+
...(model.reasoning_options?.some((option) => option.type === "effort") ||
|
|
1651
|
+
FIREWORKS_ADAPTIVE_THINKING_FALLBACK_MODELS.has(modelId)
|
|
1652
|
+
? { forceAdaptiveThinking: true }
|
|
1653
|
+
: {}),
|
|
1654
|
+
},
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
recordModelsDevReasoningOptions("fireworks", modelId, model);
|
|
1658
|
+
}
|
|
1659
|
+
return models;
|
|
1660
|
+
}
|
|
1661
|
+
// Kimi Coding is subscription-backed, so models.dev reports zero cost. Use the
|
|
1662
|
+
// equivalent Moonshot API rates to estimate the value of subscription usage.
|
|
1663
|
+
export const KIMI_CODING_IMPLIED_COSTS = {
|
|
1664
|
+
k3: KIMI_K3_COST,
|
|
1665
|
+
"k3-256k": KIMI_K3_COST,
|
|
1666
|
+
"k3.1-pro": { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 0 },
|
|
1667
|
+
"k3.1-pro-highspeed": { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 0 },
|
|
1668
|
+
"kimi-for-coding": { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 },
|
|
1669
|
+
"kimi-for-coding-highspeed": { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 },
|
|
1670
|
+
};
|
|
1671
|
+
// Kimi Coding uses Chat Completions, the same protocol as the official Kimi Code client.
|
|
1672
|
+
export function createKimiCodingModels(kimiModels) {
|
|
1673
|
+
const models = [];
|
|
1674
|
+
for (const [modelId, m] of Object.entries(kimiModels)) {
|
|
1675
|
+
if (m.tool_call !== true)
|
|
1676
|
+
continue;
|
|
1677
|
+
// K3-style models report effort levels and dynamic tool loading (tools declared in
|
|
1678
|
+
// later system messages) in https://api.kimi.com/coding/v1/models; models.dev mirrors
|
|
1679
|
+
// the effort levels. kimi-for-coding-highspeed reports neither and rejects
|
|
1680
|
+
// tool-bearing system messages with a 400.
|
|
1681
|
+
const isK3Style = m.reasoning_options?.some((option) => option.type === "effort") === true;
|
|
1682
|
+
const impliedCost = KIMI_CODING_IMPLIED_COSTS[modelId];
|
|
1683
|
+
// K3-style models send reasoning_effort, so expose the effort values models.dev lists.
|
|
1684
|
+
const effortLevels = isK3Style && m.reasoning_options ? getEffortThinkingLevelMap(m.reasoning_options) : undefined;
|
|
1685
|
+
models.push({
|
|
1686
|
+
id: modelId,
|
|
1687
|
+
name: m.name || modelId,
|
|
1688
|
+
api: "openai-completions",
|
|
1689
|
+
provider: "kimi-coding",
|
|
1690
|
+
baseUrl: "https://api.kimi.com/coding/v1",
|
|
1691
|
+
compat: {
|
|
1692
|
+
...(isK3Style ? KIMI_K3_OPENAI_COMPAT : KIMI_OPENAI_COMPAT),
|
|
1693
|
+
// All models accept system text after the conversation starts.
|
|
1694
|
+
supportsMidConvoSystemMessages: true,
|
|
1695
|
+
...(isK3Style ? { supportsMidConvoToolAdditions: true } : {}),
|
|
1696
|
+
},
|
|
1697
|
+
reasoning: m.reasoning === true,
|
|
1698
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1699
|
+
cost: {
|
|
1700
|
+
input: m.cost?.input || impliedCost?.input || 0,
|
|
1701
|
+
output: m.cost?.output || impliedCost?.output || 0,
|
|
1702
|
+
cacheRead: m.cost?.cache_read || impliedCost?.cacheRead || 0,
|
|
1703
|
+
cacheWrite: m.cost?.cache_write || impliedCost?.cacheWrite || 0,
|
|
1704
|
+
},
|
|
1705
|
+
contextWindow: m.limit?.context || 4096,
|
|
1706
|
+
maxTokens: m.limit?.output || 4096,
|
|
1707
|
+
// Kimi Code reports every model as always-thinking.
|
|
1708
|
+
thinkingLevelMap: { ...effortLevels, off: null },
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
return models;
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* The chat models Atomic derives from a models.dev `api.json` catalog: the build-time catalog generator and the
|
|
1715
|
+
* runtime catalog refresh both call this, so a refreshed catalog has the same shape as the bundled one.
|
|
1716
|
+
*/
|
|
1717
|
+
export function buildModelsDevChatModels(data, options = {}) {
|
|
1718
|
+
modelsDevReasoningOptions.clear();
|
|
1719
|
+
const strict = options.strict === true;
|
|
1720
|
+
const nvidiaNimModelIds = options.nvidiaNimModelIds ?? new Map();
|
|
1721
|
+
{
|
|
1722
|
+
const models = [];
|
|
1723
|
+
// Process Amazon Bedrock models
|
|
1724
|
+
if (data["amazon-bedrock"]?.models) {
|
|
1725
|
+
for (const [modelId, model] of Object.entries(data["amazon-bedrock"].models)) {
|
|
1726
|
+
const m = model;
|
|
1727
|
+
if (m.tool_call !== true)
|
|
1728
|
+
continue;
|
|
1729
|
+
if (BEDROCK_INFERENCE_PROFILE_ONLY_MODEL_IDS.has(modelId))
|
|
1730
|
+
continue;
|
|
1731
|
+
const id = modelId;
|
|
1732
|
+
if (id.startsWith("ai21.jamba")) {
|
|
1733
|
+
// These models doesn't support tool use in streaming mode
|
|
1734
|
+
continue;
|
|
1735
|
+
}
|
|
1736
|
+
if (id.startsWith("mistral.mistral-7b-instruct-v0")) {
|
|
1737
|
+
// These models doesn't support system messages
|
|
1738
|
+
continue;
|
|
1739
|
+
}
|
|
1740
|
+
models.push({
|
|
1741
|
+
id,
|
|
1742
|
+
name: m.name || id,
|
|
1743
|
+
api: "bedrock-converse-stream",
|
|
1744
|
+
provider: "amazon-bedrock",
|
|
1745
|
+
baseUrl: getBedrockBaseUrl(id),
|
|
1746
|
+
reasoning: m.reasoning === true,
|
|
1747
|
+
input: resolveDocumentCapableInput(m),
|
|
1748
|
+
// Includes models.dev pricing tiers, e.g. the long-context tier for OpenAI models.
|
|
1749
|
+
cost: getModelsDevCost(m.cost),
|
|
1750
|
+
contextWindow: m.limit?.context || 4096,
|
|
1751
|
+
maxTokens: m.limit?.output || 4096,
|
|
1752
|
+
...(m.structured_output === true && { compat: { supportsStrictMode: true } }),
|
|
1753
|
+
});
|
|
1754
|
+
recordModelsDevReasoningOptions("amazon-bedrock", id, m);
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
// Process Anthropic models
|
|
1758
|
+
if (data.anthropic?.models) {
|
|
1759
|
+
for (const [modelId, model] of Object.entries(data.anthropic.models)) {
|
|
1760
|
+
const m = model;
|
|
1761
|
+
if (m.tool_call !== true)
|
|
1762
|
+
continue;
|
|
1763
|
+
models.push({
|
|
1764
|
+
id: modelId,
|
|
1765
|
+
name: m.name || modelId,
|
|
1766
|
+
api: "anthropic-messages",
|
|
1767
|
+
provider: "anthropic",
|
|
1768
|
+
baseUrl: "https://api.anthropic.com",
|
|
1769
|
+
reasoning: m.reasoning === true,
|
|
1770
|
+
input: resolveDocumentCapableInput(m),
|
|
1771
|
+
cost: getModelsDevCost(m.cost),
|
|
1772
|
+
contextWindow: m.limit?.context || 4096,
|
|
1773
|
+
maxTokens: m.limit?.output || 4096,
|
|
1774
|
+
});
|
|
1775
|
+
recordModelsDevReasoningOptions("anthropic", modelId, m);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
models.push(...processGoogleModels(data));
|
|
1779
|
+
// Process OpenAI models
|
|
1780
|
+
if (data.openai?.models) {
|
|
1781
|
+
for (const [modelId, model] of Object.entries(data.openai.models)) {
|
|
1782
|
+
const m = model;
|
|
1783
|
+
if (m.tool_call !== true)
|
|
1784
|
+
continue;
|
|
1785
|
+
// models.dev lists this alias, but it is not accepted by OpenAI APIs.
|
|
1786
|
+
if (MODELS_DEV_OPENAI_UNSUPPORTED_MODEL_IDS.has(modelId))
|
|
1787
|
+
continue;
|
|
1788
|
+
models.push({
|
|
1789
|
+
id: modelId,
|
|
1790
|
+
name: m.name || modelId,
|
|
1791
|
+
api: "openai-responses",
|
|
1792
|
+
provider: "openai",
|
|
1793
|
+
baseUrl: "https://api.openai.com/v1",
|
|
1794
|
+
reasoning: m.reasoning === true,
|
|
1795
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1796
|
+
cost: getModelsDevCost(m.cost),
|
|
1797
|
+
contextWindow: m.limit?.context || 4096,
|
|
1798
|
+
maxTokens: m.limit?.output || 4096,
|
|
1799
|
+
});
|
|
1800
|
+
recordModelsDevReasoningOptions("openai", modelId, m);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
// Process Groq models
|
|
1804
|
+
if (data.groq?.models) {
|
|
1805
|
+
for (const [modelId, model] of Object.entries(data.groq.models)) {
|
|
1806
|
+
const m = model;
|
|
1807
|
+
if (m.tool_call !== true)
|
|
1808
|
+
continue;
|
|
1809
|
+
models.push({
|
|
1810
|
+
id: modelId,
|
|
1811
|
+
name: m.name || modelId,
|
|
1812
|
+
api: "openai-completions",
|
|
1813
|
+
provider: "groq",
|
|
1814
|
+
baseUrl: "https://api.groq.com/openai/v1",
|
|
1815
|
+
reasoning: m.reasoning === true,
|
|
1816
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1817
|
+
cost: getModelsDevCost(m.cost),
|
|
1818
|
+
contextWindow: m.limit?.context || 4096,
|
|
1819
|
+
maxTokens: m.limit?.output || 4096,
|
|
1820
|
+
});
|
|
1821
|
+
recordModelsDevReasoningOptions("groq", modelId, m);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
// Process Cerebras models
|
|
1825
|
+
if (data.cerebras?.models) {
|
|
1826
|
+
for (const [modelId, model] of Object.entries(data.cerebras.models)) {
|
|
1827
|
+
const m = model;
|
|
1828
|
+
if (m.tool_call !== true)
|
|
1829
|
+
continue;
|
|
1830
|
+
models.push({
|
|
1831
|
+
id: modelId,
|
|
1832
|
+
name: m.name || modelId,
|
|
1833
|
+
api: "openai-completions",
|
|
1834
|
+
provider: "cerebras",
|
|
1835
|
+
baseUrl: "https://api.cerebras.ai/v1",
|
|
1836
|
+
reasoning: m.reasoning === true,
|
|
1837
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1838
|
+
cost: getModelsDevCost(m.cost),
|
|
1839
|
+
contextWindow: m.limit?.context || 4096,
|
|
1840
|
+
maxTokens: m.limit?.output || 4096,
|
|
1841
|
+
});
|
|
1842
|
+
recordModelsDevReasoningOptions("cerebras", modelId, m);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
// This is the built-in default for both Cloudflare providers. Keep its known
|
|
1846
|
+
// Workers AI metadata when models.dev temporarily omits or mis-tags it.
|
|
1847
|
+
data["cloudflare-workers-ai"] ??= {};
|
|
1848
|
+
const cloudflareWorkersAiProvider = data["cloudflare-workers-ai"];
|
|
1849
|
+
cloudflareWorkersAiProvider.models ??= {};
|
|
1850
|
+
const cloudflareWorkersAiModels = cloudflareWorkersAiProvider.models;
|
|
1851
|
+
cloudflareWorkersAiModels[CLOUDFLARE_DEFAULT_WORKERS_AI_MODEL_ID] = {
|
|
1852
|
+
...CLOUDFLARE_DEFAULT_WORKERS_AI_MODEL,
|
|
1853
|
+
...cloudflareWorkersAiModels[CLOUDFLARE_DEFAULT_WORKERS_AI_MODEL_ID],
|
|
1854
|
+
tool_call: true,
|
|
1855
|
+
};
|
|
1856
|
+
// Process Cloudflare Workers AI models
|
|
1857
|
+
if (data["cloudflare-workers-ai"]?.models) {
|
|
1858
|
+
for (const [modelId, model] of Object.entries(data["cloudflare-workers-ai"].models)) {
|
|
1859
|
+
const m = model;
|
|
1860
|
+
if (m.tool_call !== true)
|
|
1861
|
+
continue;
|
|
1862
|
+
models.push({
|
|
1863
|
+
id: modelId,
|
|
1864
|
+
name: m.name || modelId,
|
|
1865
|
+
api: "openai-completions",
|
|
1866
|
+
provider: "cloudflare-workers-ai",
|
|
1867
|
+
baseUrl: CLOUDFLARE_WORKERS_AI_BASE_URL,
|
|
1868
|
+
reasoning: m.reasoning === true,
|
|
1869
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1870
|
+
cost: getModelsDevCost(m.cost),
|
|
1871
|
+
contextWindow: m.limit?.context || 4096,
|
|
1872
|
+
maxTokens: m.limit?.output || 4096,
|
|
1873
|
+
compat: { sendSessionAffinityHeaders: true },
|
|
1874
|
+
});
|
|
1875
|
+
recordModelsDevReasoningOptions("cloudflare-workers-ai", modelId, m);
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
// Process Cloudflare AI Gateway models
|
|
1879
|
+
const cloudflareAIGatewayModelIds = new Set();
|
|
1880
|
+
if (data["cloudflare-ai-gateway"]?.models) {
|
|
1881
|
+
for (const [prefixedId, model] of Object.entries(data["cloudflare-ai-gateway"].models)) {
|
|
1882
|
+
const m = model;
|
|
1883
|
+
if (m.tool_call !== true)
|
|
1884
|
+
continue;
|
|
1885
|
+
const slashIdx = prefixedId.indexOf("/");
|
|
1886
|
+
if (slashIdx === -1)
|
|
1887
|
+
continue;
|
|
1888
|
+
const upstream = prefixedId.slice(0, slashIdx);
|
|
1889
|
+
const nativeId = prefixedId.slice(slashIdx + 1);
|
|
1890
|
+
let api;
|
|
1891
|
+
let baseUrl;
|
|
1892
|
+
let id;
|
|
1893
|
+
if (upstream === "openai") {
|
|
1894
|
+
api = "openai-responses";
|
|
1895
|
+
baseUrl = CLOUDFLARE_AI_GATEWAY_OPENAI_BASE_URL;
|
|
1896
|
+
id = nativeId;
|
|
1897
|
+
}
|
|
1898
|
+
else if (upstream === "anthropic") {
|
|
1899
|
+
api = "anthropic-messages";
|
|
1900
|
+
baseUrl = CLOUDFLARE_AI_GATEWAY_ANTHROPIC_BASE_URL;
|
|
1901
|
+
id = nativeId.replaceAll(".", "-");
|
|
1902
|
+
}
|
|
1903
|
+
else if (upstream === "workers-ai") {
|
|
1904
|
+
api = "openai-completions";
|
|
1905
|
+
baseUrl = CLOUDFLARE_AI_GATEWAY_COMPAT_BASE_URL;
|
|
1906
|
+
id = prefixedId;
|
|
1907
|
+
}
|
|
1908
|
+
else {
|
|
1909
|
+
continue;
|
|
1910
|
+
}
|
|
1911
|
+
// Gateway passthroughs forward session affinity headers to upstreams that
|
|
1912
|
+
// use them for cache/routing affinity.
|
|
1913
|
+
const compat = upstream === "anthropic" || upstream === "workers-ai" ? { sendSessionAffinityHeaders: true } : undefined;
|
|
1914
|
+
cloudflareAIGatewayModelIds.add(id);
|
|
1915
|
+
models.push({
|
|
1916
|
+
id,
|
|
1917
|
+
name: m.name || id,
|
|
1918
|
+
api,
|
|
1919
|
+
provider: "cloudflare-ai-gateway",
|
|
1920
|
+
baseUrl,
|
|
1921
|
+
reasoning: m.reasoning === true,
|
|
1922
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1923
|
+
cost: getModelsDevCost(m.cost),
|
|
1924
|
+
contextWindow: m.limit?.context || 4096,
|
|
1925
|
+
maxTokens: m.limit?.output || 4096,
|
|
1926
|
+
...(compat ? { compat } : {}),
|
|
1927
|
+
});
|
|
1928
|
+
recordModelsDevReasoningOptions("cloudflare-ai-gateway", id, m);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
// models.dev may omit Workers AI passthroughs from the AI Gateway provider
|
|
1932
|
+
// list even though the gateway /compat endpoint supports routing to them.
|
|
1933
|
+
// Mirror the Workers AI catalog under the documented workers-ai/ prefix so
|
|
1934
|
+
// the gateway keeps its OpenAI-compatible /compat models stable.
|
|
1935
|
+
if (data["cloudflare-workers-ai"]?.models) {
|
|
1936
|
+
for (const [modelId, model] of Object.entries(data["cloudflare-workers-ai"].models)) {
|
|
1937
|
+
const m = model;
|
|
1938
|
+
if (m.tool_call !== true)
|
|
1939
|
+
continue;
|
|
1940
|
+
const id = `workers-ai/${modelId}`;
|
|
1941
|
+
if (cloudflareAIGatewayModelIds.has(id))
|
|
1942
|
+
continue;
|
|
1943
|
+
cloudflareAIGatewayModelIds.add(id);
|
|
1944
|
+
models.push({
|
|
1945
|
+
id,
|
|
1946
|
+
name: m.name || id,
|
|
1947
|
+
api: "openai-completions",
|
|
1948
|
+
provider: "cloudflare-ai-gateway",
|
|
1949
|
+
baseUrl: CLOUDFLARE_AI_GATEWAY_COMPAT_BASE_URL,
|
|
1950
|
+
reasoning: m.reasoning === true,
|
|
1951
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1952
|
+
cost: getModelsDevCost(m.cost),
|
|
1953
|
+
contextWindow: m.limit?.context || 4096,
|
|
1954
|
+
maxTokens: m.limit?.output || 4096,
|
|
1955
|
+
compat: { sendSessionAffinityHeaders: true },
|
|
1956
|
+
});
|
|
1957
|
+
recordModelsDevReasoningOptions("cloudflare-ai-gateway", id, m);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
// Process xAi models
|
|
1961
|
+
if (data.xai?.models) {
|
|
1962
|
+
for (const [modelId, model] of Object.entries(data.xai.models)) {
|
|
1963
|
+
const m = model;
|
|
1964
|
+
if (m.tool_call !== true)
|
|
1965
|
+
continue;
|
|
1966
|
+
models.push({
|
|
1967
|
+
id: modelId,
|
|
1968
|
+
name: m.name || modelId,
|
|
1969
|
+
api: "openai-responses",
|
|
1970
|
+
provider: "xai",
|
|
1971
|
+
baseUrl: "https://api.x.ai/v1",
|
|
1972
|
+
compat: { ...XAI_RESPONSES_COMPAT },
|
|
1973
|
+
reasoning: m.reasoning === true,
|
|
1974
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1975
|
+
cost: getModelsDevCost(m.cost),
|
|
1976
|
+
contextWindow: m.limit?.context || 4096,
|
|
1977
|
+
maxTokens: m.limit?.output || 4096,
|
|
1978
|
+
});
|
|
1979
|
+
recordModelsDevReasoningOptions("xai", modelId, m);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
// Process Meta models
|
|
1983
|
+
if (data.meta?.models) {
|
|
1984
|
+
for (const [modelId, model] of Object.entries(data.meta.models)) {
|
|
1985
|
+
const m = model;
|
|
1986
|
+
if (m.tool_call !== true)
|
|
1987
|
+
continue;
|
|
1988
|
+
models.push({
|
|
1989
|
+
id: modelId,
|
|
1990
|
+
name: m.name || modelId,
|
|
1991
|
+
api: "openai-responses",
|
|
1992
|
+
provider: "meta",
|
|
1993
|
+
baseUrl: "https://api.meta.ai/v1",
|
|
1994
|
+
reasoning: m.reasoning === true,
|
|
1995
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
1996
|
+
cost: getModelsDevCost(m.cost),
|
|
1997
|
+
contextWindow: m.limit?.context || 4096,
|
|
1998
|
+
maxTokens: m.limit?.output || 4096,
|
|
1999
|
+
});
|
|
2000
|
+
recordModelsDevReasoningOptions("meta", modelId, m);
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
models.push(...processZaiModels(data));
|
|
2004
|
+
// Process Mistral models
|
|
2005
|
+
if (data.mistral?.models) {
|
|
2006
|
+
for (const [modelId, model] of Object.entries(data.mistral.models)) {
|
|
2007
|
+
const m = model;
|
|
2008
|
+
if (m.tool_call !== true)
|
|
2009
|
+
continue;
|
|
2010
|
+
const thinkingLevelMap = modelId.startsWith("magistral-")
|
|
2011
|
+
? undefined
|
|
2012
|
+
: getEffortThinkingLevelMap(m.reasoning_options ?? []);
|
|
2013
|
+
models.push({
|
|
2014
|
+
id: modelId,
|
|
2015
|
+
name: m.name || modelId,
|
|
2016
|
+
api: "mistral-conversations",
|
|
2017
|
+
provider: "mistral",
|
|
2018
|
+
baseUrl: "https://api.mistral.ai",
|
|
2019
|
+
reasoning: m.reasoning === true,
|
|
2020
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
2021
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2022
|
+
cost: {
|
|
2023
|
+
input: m.cost?.input || 0,
|
|
2024
|
+
output: m.cost?.output || 0,
|
|
2025
|
+
cacheRead: m.cost?.cache_read ?? (m.cost?.input ? roundCost(m.cost.input * 0.1) : 0),
|
|
2026
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
2027
|
+
},
|
|
2028
|
+
contextWindow: m.limit?.context || 4096,
|
|
2029
|
+
maxTokens: m.limit?.output || 4096,
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
// Process Hugging Face models
|
|
2034
|
+
if (data.huggingface?.models) {
|
|
2035
|
+
for (const [modelId, model] of Object.entries(data.huggingface.models)) {
|
|
2036
|
+
const m = model;
|
|
2037
|
+
if (m.tool_call !== true)
|
|
2038
|
+
continue;
|
|
2039
|
+
models.push({
|
|
2040
|
+
id: modelId,
|
|
2041
|
+
name: m.name || modelId,
|
|
2042
|
+
api: "openai-completions",
|
|
2043
|
+
provider: "huggingface",
|
|
2044
|
+
baseUrl: "https://router.huggingface.co/v1",
|
|
2045
|
+
reasoning: m.reasoning === true,
|
|
2046
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2047
|
+
cost: getModelsDevCost(m.cost),
|
|
2048
|
+
compat: {
|
|
2049
|
+
supportsDeveloperRole: false,
|
|
2050
|
+
},
|
|
2051
|
+
contextWindow: m.limit?.context || 4096,
|
|
2052
|
+
maxTokens: m.limit?.output || 4096,
|
|
2053
|
+
});
|
|
2054
|
+
recordModelsDevReasoningOptions("huggingface", modelId, m);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
models.push(...processFireworksModels(data["fireworks-ai"]));
|
|
2058
|
+
// Process NVIDIA NIM models
|
|
2059
|
+
if (data.nvidia?.models) {
|
|
2060
|
+
for (const [modelId, model] of Object.entries(data.nvidia.models)) {
|
|
2061
|
+
const m = model;
|
|
2062
|
+
if (m.tool_call !== true)
|
|
2063
|
+
continue;
|
|
2064
|
+
if (!m.modalities?.input?.includes("text"))
|
|
2065
|
+
continue;
|
|
2066
|
+
if (!m.modalities?.output?.includes("text"))
|
|
2067
|
+
continue;
|
|
2068
|
+
const liveModelId = nvidiaNimModelIds.get(modelId) ?? nvidiaNimModelIds.get(normalizeNvidiaModelId(modelId));
|
|
2069
|
+
if (!liveModelId)
|
|
2070
|
+
continue;
|
|
2071
|
+
if (NVIDIA_NIM_UNSUPPORTED_MODELS.has(liveModelId))
|
|
2072
|
+
continue;
|
|
2073
|
+
models.push({
|
|
2074
|
+
id: liveModelId,
|
|
2075
|
+
name: m.name || liveModelId,
|
|
2076
|
+
api: "openai-completions",
|
|
2077
|
+
provider: "nvidia",
|
|
2078
|
+
baseUrl: NVIDIA_BASE_URL,
|
|
2079
|
+
headers: { ...NVIDIA_HEADERS },
|
|
2080
|
+
reasoning: m.reasoning === true,
|
|
2081
|
+
input: m.modalities.input.includes("image") ? ["text", "image"] : ["text"],
|
|
2082
|
+
cost: getModelsDevCost(m.cost),
|
|
2083
|
+
compat: NVIDIA_OPENAI_COMPAT,
|
|
2084
|
+
contextWindow: m.limit?.context || 4096,
|
|
2085
|
+
maxTokens: m.limit?.output || 4096,
|
|
2086
|
+
});
|
|
2087
|
+
recordModelsDevReasoningOptions("nvidia", liveModelId, m);
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
// Process Together AI models
|
|
2091
|
+
const togetherProvider = data.together ?? data.togetherai ?? data["together-ai"];
|
|
2092
|
+
if (togetherProvider?.models) {
|
|
2093
|
+
for (const [modelId, model] of Object.entries(togetherProvider.models)) {
|
|
2094
|
+
const m = model;
|
|
2095
|
+
if (m.tool_call !== true)
|
|
2096
|
+
continue;
|
|
2097
|
+
if (m.status === "deprecated")
|
|
2098
|
+
continue;
|
|
2099
|
+
const reasoning = m.reasoning === true;
|
|
2100
|
+
const thinkingLevelMap = getTogetherThinkingLevelMap(modelId, reasoning);
|
|
2101
|
+
models.push({
|
|
2102
|
+
id: modelId,
|
|
2103
|
+
name: m.name || modelId,
|
|
2104
|
+
api: "openai-completions",
|
|
2105
|
+
provider: "together",
|
|
2106
|
+
baseUrl: TOGETHER_BASE_URL,
|
|
2107
|
+
reasoning,
|
|
2108
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
2109
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2110
|
+
cost: getModelsDevCost(m.cost),
|
|
2111
|
+
compat: getTogetherCompat(modelId, reasoning),
|
|
2112
|
+
contextWindow: m.limit?.context || 4096,
|
|
2113
|
+
maxTokens: m.limit?.output || 4096,
|
|
2114
|
+
});
|
|
2115
|
+
recordModelsDevReasoningOptions("together", modelId, m);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
models.push(...processBasetenModels(data.baseten));
|
|
2119
|
+
// Process OpenCode models (Zen and Go)
|
|
2120
|
+
// API mapping based on provider.npm field:
|
|
2121
|
+
// - @ai-sdk/openai → openai-responses
|
|
2122
|
+
// - @ai-sdk/anthropic → anthropic-messages
|
|
2123
|
+
// - @ai-sdk/google → google-generative-ai
|
|
2124
|
+
// - null/undefined/@ai-sdk/openai-compatible → openai-completions
|
|
2125
|
+
const opencodeVariants = [
|
|
2126
|
+
{ key: "opencode", provider: "opencode", basePath: "https://opencode.ai/inference" },
|
|
2127
|
+
{ key: "opencode-go", provider: "opencode-go", basePath: "https://opencode.ai/inference/go" },
|
|
2128
|
+
];
|
|
2129
|
+
for (const variant of opencodeVariants) {
|
|
2130
|
+
if (!data[variant.key]?.models)
|
|
2131
|
+
continue;
|
|
2132
|
+
for (const [modelId, model] of Object.entries(data[variant.key]?.models ?? {})) {
|
|
2133
|
+
const m = model;
|
|
2134
|
+
if (m.tool_call !== true)
|
|
2135
|
+
continue;
|
|
2136
|
+
if (m.status === "deprecated")
|
|
2137
|
+
continue;
|
|
2138
|
+
const npm = m.provider?.npm;
|
|
2139
|
+
let api;
|
|
2140
|
+
let baseUrl;
|
|
2141
|
+
let compat;
|
|
2142
|
+
if (npm === "@ai-sdk/openai") {
|
|
2143
|
+
api = "openai-responses";
|
|
2144
|
+
baseUrl = `${variant.basePath}/openai/v1`;
|
|
2145
|
+
compat = { sessionAffinityFormat: "openai-nosession" };
|
|
2146
|
+
}
|
|
2147
|
+
else if (npm === "@ai-sdk/anthropic") {
|
|
2148
|
+
api = "anthropic-messages";
|
|
2149
|
+
// Anthropic SDK appends /v1/messages to baseURL
|
|
2150
|
+
baseUrl = `${variant.basePath}/anthropic`;
|
|
2151
|
+
}
|
|
2152
|
+
else if (npm === "@ai-sdk/google") {
|
|
2153
|
+
api = "google-generative-ai";
|
|
2154
|
+
baseUrl = `${variant.basePath}/google/v1beta`;
|
|
2155
|
+
}
|
|
2156
|
+
else if (npm === "@ai-sdk/alibaba") {
|
|
2157
|
+
api = "openai-completions";
|
|
2158
|
+
baseUrl = `${variant.basePath}/openai/v1`;
|
|
2159
|
+
compat = { cacheControlFormat: "anthropic" };
|
|
2160
|
+
}
|
|
2161
|
+
else {
|
|
2162
|
+
// null, undefined, or @ai-sdk/openai-compatible
|
|
2163
|
+
api = "openai-completions";
|
|
2164
|
+
baseUrl = `${variant.basePath}/openai/v1`;
|
|
2165
|
+
}
|
|
2166
|
+
if (variant.provider === "opencode" && modelId === "grok-build-0.1") {
|
|
2167
|
+
compat = { ...(compat ?? {}), supportsReasoningEffort: false };
|
|
2168
|
+
}
|
|
2169
|
+
if (variant.provider === "opencode" && modelId === "kimi-k2.6") {
|
|
2170
|
+
// OpenCode Kimi K2.6 accepts Anthropic-style thinking objects
|
|
2171
|
+
// and rejects string thinking values or combined reasoning_effort.
|
|
2172
|
+
compat = { ...(compat ?? {}), thinkingFormat: "deepseek", supportsReasoningEffort: false };
|
|
2173
|
+
}
|
|
2174
|
+
// Fix known mismatches between models.dev npm data and actual
|
|
2175
|
+
// OpenCode Go endpoint behaviour. models.dev reports these models
|
|
2176
|
+
// as @ai-sdk/anthropic, but OpenCode Go serves them through the
|
|
2177
|
+
// OpenAI-compatible /openai/v1/chat/completions path.
|
|
2178
|
+
if (variant.provider === "opencode-go") {
|
|
2179
|
+
if (modelId === "qwen3.5-plus" || modelId === "qwen3.6-plus") {
|
|
2180
|
+
api = "openai-completions";
|
|
2181
|
+
baseUrl = `${variant.basePath}/openai/v1`;
|
|
2182
|
+
// Qwen/DashScope uses enable_thinking at the top level.
|
|
2183
|
+
compat = { ...(compat ?? {}), thinkingFormat: "qwen" };
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
if (api === "openai-completions") {
|
|
2187
|
+
compat = { ...(compat ?? {}), maxTokensField: "max_tokens" };
|
|
2188
|
+
if (OPENCODE_OPENAI_COMPLETIONS_LONG_CACHE_RETENTION_UNSUPPORTED_MODELS.has(`${variant.provider}:${modelId}`)) {
|
|
2189
|
+
compat = { ...compat, supportsLongCacheRetention: false };
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
let thinkingLevelMap;
|
|
2193
|
+
if (api === "google-generative-ai") {
|
|
2194
|
+
thinkingLevelMap = getGoogleThinkingLevelMap(modelId, m.reasoning_options ?? []);
|
|
2195
|
+
}
|
|
2196
|
+
else if (variant.provider === "opencode-go" && modelId === "deepseek-v4.1-flash") {
|
|
2197
|
+
thinkingLevelMap = getEffortThinkingLevelMap(m.reasoning_options ?? []);
|
|
2198
|
+
}
|
|
2199
|
+
models.push({
|
|
2200
|
+
id: modelId,
|
|
2201
|
+
name: m.name || modelId,
|
|
2202
|
+
api,
|
|
2203
|
+
provider: variant.provider,
|
|
2204
|
+
baseUrl,
|
|
2205
|
+
reasoning: m.reasoning === true,
|
|
2206
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
2207
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2208
|
+
cost: getModelsDevCost(m.cost),
|
|
2209
|
+
...(compat ? { compat } : {}),
|
|
2210
|
+
contextWindow: m.limit?.context || 4096,
|
|
2211
|
+
maxTokens: m.limit?.output || 4096,
|
|
2212
|
+
});
|
|
2213
|
+
recordModelsDevReasoningOptions(variant.provider, modelId, m);
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
// Keep both Claude Fable generations in the static Copilot catalog. GitHub's authenticated
|
|
2217
|
+
// picker still controls account availability; when its models.dev catalog lags a Fable release,
|
|
2218
|
+
// reuse that release's models.dev Anthropic metadata instead of maintaining a local snapshot.
|
|
2219
|
+
const githubCopilotModels = { ...data["github-copilot"]?.models };
|
|
2220
|
+
for (const modelId of GITHUB_COPILOT_CLAUDE_FABLE_MODEL_IDS) {
|
|
2221
|
+
const anthropicSource = data.anthropic?.models?.[modelId];
|
|
2222
|
+
const source = githubCopilotModels[modelId] ??
|
|
2223
|
+
(anthropicSource ? { ...anthropicSource, provider: { npm: "@ai-sdk/anthropic" } } : undefined);
|
|
2224
|
+
if (source)
|
|
2225
|
+
githubCopilotModels[modelId] = source;
|
|
2226
|
+
}
|
|
2227
|
+
for (const [modelId, fallback] of Object.entries(GITHUB_COPILOT_MODELS_DEV_FALLBACKS)) {
|
|
2228
|
+
githubCopilotModels[modelId] ??= fallback;
|
|
2229
|
+
}
|
|
2230
|
+
for (const [modelId, m] of Object.entries(githubCopilotModels)) {
|
|
2231
|
+
if (m.tool_call !== true)
|
|
2232
|
+
continue;
|
|
2233
|
+
if (m.status === "deprecated")
|
|
2234
|
+
continue;
|
|
2235
|
+
// The model's own metadata picks the Copilot API, as for OpenCode: models.dev's
|
|
2236
|
+
// per-model SDK names the endpoint Copilot serves it on, never the model ID.
|
|
2237
|
+
const api = githubCopilotApiForSdk(m.provider?.npm);
|
|
2238
|
+
const anthropicCompat = api === "anthropic-messages" ? getAnthropicMessagesCompat("github-copilot", modelId) : undefined;
|
|
2239
|
+
const copilotModel = {
|
|
2240
|
+
id: modelId,
|
|
2241
|
+
name: m.name || modelId,
|
|
2242
|
+
api,
|
|
2243
|
+
provider: "github-copilot",
|
|
2244
|
+
baseUrl: "https://api.individual.githubcopilot.com",
|
|
2245
|
+
reasoning: m.reasoning === true,
|
|
2246
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2247
|
+
cost: getModelsDevCost(m.cost),
|
|
2248
|
+
contextWindow: m.limit?.context || 128000,
|
|
2249
|
+
maxTokens: m.limit?.output || 8192,
|
|
2250
|
+
headers: { ...COPILOT_STATIC_HEADERS },
|
|
2251
|
+
...(anthropicCompat ? { compat: anthropicCompat } : {}),
|
|
2252
|
+
// compat only applies to openai-completions
|
|
2253
|
+
...(api === "openai-completions"
|
|
2254
|
+
? {
|
|
2255
|
+
compat: {
|
|
2256
|
+
supportsStore: false,
|
|
2257
|
+
supportsDeveloperRole: false,
|
|
2258
|
+
supportsReasoningEffort: m.reasoning_options?.some((option) => option.type === "effort") ?? false,
|
|
2259
|
+
},
|
|
2260
|
+
}
|
|
2261
|
+
: {}),
|
|
2262
|
+
};
|
|
2263
|
+
models.push(copilotModel);
|
|
2264
|
+
recordModelsDevReasoningOptions("github-copilot", modelId, m);
|
|
2265
|
+
}
|
|
2266
|
+
// Process MiniMax models
|
|
2267
|
+
const minimaxVariants = [
|
|
2268
|
+
{ key: "minimax", provider: "minimax", baseUrl: "https://api.minimax.io/anthropic" },
|
|
2269
|
+
{ key: "minimax-cn", provider: "minimax-cn", baseUrl: "https://api.minimaxi.com/anthropic" },
|
|
2270
|
+
];
|
|
2271
|
+
// MiniMax asked to hide older models from its direct providers (#2596).
|
|
2272
|
+
const minimaxHiddenIds = new Set(["MiniMax-M2", "MiniMax-M2.1", "MiniMax-M2.5", "MiniMax-M2.5-highspeed"]);
|
|
2273
|
+
for (const { key, provider, baseUrl } of minimaxVariants) {
|
|
2274
|
+
if (data[key]?.models) {
|
|
2275
|
+
for (const [modelId, model] of Object.entries(data[key].models)) {
|
|
2276
|
+
const m = model;
|
|
2277
|
+
if (m.tool_call !== true || minimaxHiddenIds.has(modelId))
|
|
2278
|
+
continue;
|
|
2279
|
+
// Models with effort levels (e.g. MiniMax-M3.1-Flash) take adaptive thinking with
|
|
2280
|
+
// output_config.effort and reject thinking.type="disabled" (no "none" effort, so off is null).
|
|
2281
|
+
const thinkingLevelMap = getEffortThinkingLevelMap(m.reasoning_options ?? []);
|
|
2282
|
+
models.push({
|
|
2283
|
+
id: modelId,
|
|
2284
|
+
name: m.name || modelId,
|
|
2285
|
+
api: "anthropic-messages",
|
|
2286
|
+
provider,
|
|
2287
|
+
// MiniMax's Anthropic-compatible API - SDK appends /v1/messages
|
|
2288
|
+
baseUrl,
|
|
2289
|
+
reasoning: m.reasoning === true,
|
|
2290
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2291
|
+
cost: getModelsDevCost(m.cost),
|
|
2292
|
+
contextWindow: m.limit?.context || 4096,
|
|
2293
|
+
maxTokens: m.limit?.output || 4096,
|
|
2294
|
+
...(thinkingLevelMap ? { thinkingLevelMap, compat: { forceAdaptiveThinking: true } } : {}),
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
// models.dev renamed the global coding plan; keep the older sources as fallbacks.
|
|
2300
|
+
const kimiModels = data["kimi-code-plan-global"]?.models ?? data["kimi-code-plan-cn"]?.models ?? data["kimi-for-coding"]?.models;
|
|
2301
|
+
if (kimiModels) {
|
|
2302
|
+
models.push(...createKimiCodingModels(kimiModels));
|
|
2303
|
+
}
|
|
2304
|
+
// Process Moonshot AI models
|
|
2305
|
+
const moonshotVariants = [
|
|
2306
|
+
{ key: "moonshotai", provider: "moonshotai", baseUrl: "https://api.moonshot.ai/v1" },
|
|
2307
|
+
{ key: "moonshotai-cn", provider: "moonshotai-cn", baseUrl: "https://api.moonshot.cn/v1" },
|
|
2308
|
+
];
|
|
2309
|
+
const getMoonshotProviderModels = (key) => {
|
|
2310
|
+
const providerModels = data[key]?.models;
|
|
2311
|
+
return providerModels ? { ...providerModels } : {};
|
|
2312
|
+
};
|
|
2313
|
+
const moonshotModels = {
|
|
2314
|
+
moonshotai: getMoonshotProviderModels("moonshotai"),
|
|
2315
|
+
"moonshotai-cn": getMoonshotProviderModels("moonshotai-cn"),
|
|
2316
|
+
};
|
|
2317
|
+
for (const { key, provider, baseUrl } of moonshotVariants) {
|
|
2318
|
+
for (const [modelId, m] of Object.entries(moonshotModels[key])) {
|
|
2319
|
+
if (m.tool_call !== true)
|
|
2320
|
+
continue;
|
|
2321
|
+
const isKimiK3 = isKimiK3FamilyId(modelId);
|
|
2322
|
+
const compat = { ...(isKimiK3 ? KIMI_K3_OPENAI_COMPAT : KIMI_OPENAI_COMPAT) };
|
|
2323
|
+
models.push({
|
|
2324
|
+
id: modelId,
|
|
2325
|
+
name: m.name || modelId,
|
|
2326
|
+
api: "openai-completions",
|
|
2327
|
+
provider,
|
|
2328
|
+
baseUrl,
|
|
2329
|
+
reasoning: isKimiK3 || m.reasoning === true,
|
|
2330
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2331
|
+
// Moonshot does not bill cache writes; models.dev lists the input rate as cache_write for Kimi K3.
|
|
2332
|
+
cost: modelId === "kimi-k3"
|
|
2333
|
+
? { ...KIMI_K3_COST }
|
|
2334
|
+
: {
|
|
2335
|
+
input: m.cost?.input || 0,
|
|
2336
|
+
output: m.cost?.output || 0,
|
|
2337
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
2338
|
+
cacheWrite: isKimiK3 ? 0 : m.cost?.cache_write || 0,
|
|
2339
|
+
},
|
|
2340
|
+
contextWindow: m.limit?.context || 4096,
|
|
2341
|
+
maxTokens: m.limit?.output || 4096,
|
|
2342
|
+
compat,
|
|
2343
|
+
});
|
|
2344
|
+
recordModelsDevReasoningOptions(provider, modelId, m);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
// Process Xiaomi MiMo models
|
|
2348
|
+
// Built-in `xiaomi` targets the API billing endpoint (single stable URL,
|
|
2349
|
+
// keys from platform.xiaomimimo.com). The three `xiaomi-token-plan-*`
|
|
2350
|
+
// providers cover prepaid Token Plan endpoints in cn / ams / sgp.
|
|
2351
|
+
const xiaomiCompat = {
|
|
2352
|
+
supportsReasoningEffort: false,
|
|
2353
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
2354
|
+
thinkingFormat: "deepseek",
|
|
2355
|
+
};
|
|
2356
|
+
const xiaomiThinkingLevelMap = {
|
|
2357
|
+
off: "off",
|
|
2358
|
+
minimal: null,
|
|
2359
|
+
low: null,
|
|
2360
|
+
medium: null,
|
|
2361
|
+
high: "high",
|
|
2362
|
+
xhigh: null,
|
|
2363
|
+
max: null,
|
|
2364
|
+
};
|
|
2365
|
+
const xiaomiVariants = [
|
|
2366
|
+
{ source: "xiaomi", provider: "xiaomi", baseUrl: "https://api.xiaomimimo.com/v1" },
|
|
2367
|
+
{
|
|
2368
|
+
source: "xiaomi-token-plan-cn",
|
|
2369
|
+
provider: "xiaomi-token-plan-cn",
|
|
2370
|
+
baseUrl: "https://token-plan-cn.xiaomimimo.com/v1",
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
source: "xiaomi-token-plan-ams",
|
|
2374
|
+
provider: "xiaomi-token-plan-ams",
|
|
2375
|
+
baseUrl: "https://token-plan-ams.xiaomimimo.com/v1",
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
source: "xiaomi-token-plan-sgp",
|
|
2379
|
+
provider: "xiaomi-token-plan-sgp",
|
|
2380
|
+
baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
2381
|
+
},
|
|
2382
|
+
];
|
|
2383
|
+
for (const { source, provider, baseUrl } of xiaomiVariants) {
|
|
2384
|
+
const providerModels = data[source]?.models;
|
|
2385
|
+
if (!providerModels)
|
|
2386
|
+
continue;
|
|
2387
|
+
for (const [modelId, model] of Object.entries(providerModels)) {
|
|
2388
|
+
const m = model;
|
|
2389
|
+
if (m.tool_call !== true)
|
|
2390
|
+
continue;
|
|
2391
|
+
if (m.status === "deprecated")
|
|
2392
|
+
continue;
|
|
2393
|
+
models.push({
|
|
2394
|
+
id: modelId,
|
|
2395
|
+
name: m.name || modelId,
|
|
2396
|
+
api: "openai-completions",
|
|
2397
|
+
provider,
|
|
2398
|
+
baseUrl,
|
|
2399
|
+
compat: xiaomiCompat,
|
|
2400
|
+
reasoning: m.reasoning === true,
|
|
2401
|
+
...(m.reasoning === true ? { thinkingLevelMap: xiaomiThinkingLevelMap } : {}),
|
|
2402
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2403
|
+
cost: getModelsDevCost(m.cost),
|
|
2404
|
+
contextWindow: m.limit?.context || 4096,
|
|
2405
|
+
maxTokens: m.limit?.output || 4096,
|
|
2406
|
+
});
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
// Process Alibaba Cloud Model Studio Token Plan models. International and
|
|
2410
|
+
// China use separate endpoints and API keys (sk-sp- prefix). The Individual
|
|
2411
|
+
// providers reuse each region's source and endpoint with a narrower catalog.
|
|
2412
|
+
// models.dev keys are "alibaba-token-plan[-cn]"; pi exposes them as
|
|
2413
|
+
// "qwen-token-plan[-cn]" plus the "qwen-token-plan-individual[-cn]" catalog views.
|
|
2414
|
+
const qwenTokenPlanCompat = {
|
|
2415
|
+
thinkingFormat: "qwen",
|
|
2416
|
+
supportsDeveloperRole: false,
|
|
2417
|
+
supportsStore: false,
|
|
2418
|
+
supportsReasoningEffort: true,
|
|
2419
|
+
};
|
|
2420
|
+
const qwenTokenPlanVariants = [
|
|
2421
|
+
{
|
|
2422
|
+
source: "alibaba-token-plan",
|
|
2423
|
+
provider: "qwen-token-plan",
|
|
2424
|
+
baseUrl: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
|
|
2425
|
+
modelIds: undefined,
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
source: "alibaba-token-plan",
|
|
2429
|
+
provider: "qwen-token-plan-individual",
|
|
2430
|
+
baseUrl: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
|
|
2431
|
+
modelIds: QWEN_TOKEN_PLAN_INDIVIDUAL_MODEL_IDS,
|
|
2432
|
+
},
|
|
2433
|
+
{
|
|
2434
|
+
source: "alibaba-token-plan-cn",
|
|
2435
|
+
provider: "qwen-token-plan-cn",
|
|
2436
|
+
baseUrl: "https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1",
|
|
2437
|
+
modelIds: undefined,
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
source: "alibaba-token-plan-cn",
|
|
2441
|
+
provider: "qwen-token-plan-individual-cn",
|
|
2442
|
+
baseUrl: "https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1",
|
|
2443
|
+
modelIds: QWEN_TOKEN_PLAN_INDIVIDUAL_MODEL_IDS,
|
|
2444
|
+
},
|
|
2445
|
+
];
|
|
2446
|
+
for (const { source, provider, baseUrl, modelIds } of qwenTokenPlanVariants) {
|
|
2447
|
+
const providerModels = data[source]?.models;
|
|
2448
|
+
const emittedModelIds = modelIds ? new Set() : undefined;
|
|
2449
|
+
for (const [modelId, model] of Object.entries(providerModels ?? {})) {
|
|
2450
|
+
const m = model;
|
|
2451
|
+
if (m.tool_call !== true)
|
|
2452
|
+
continue;
|
|
2453
|
+
if (m.status === "deprecated")
|
|
2454
|
+
continue;
|
|
2455
|
+
if (modelIds && !modelIds.has(modelId))
|
|
2456
|
+
continue;
|
|
2457
|
+
const thinkingLevelMap = getEffortThinkingLevelMap(m.reasoning_options ?? []) ??
|
|
2458
|
+
(QWEN_TOKEN_PLAN_REASONING_EFFORT_FALLBACK_MODEL_IDS.has(modelId)
|
|
2459
|
+
? QWEN_TOKEN_PLAN_FALLBACK_THINKING_LEVEL_MAP
|
|
2460
|
+
: undefined);
|
|
2461
|
+
models.push({
|
|
2462
|
+
id: modelId,
|
|
2463
|
+
name: m.name || modelId,
|
|
2464
|
+
api: "openai-completions",
|
|
2465
|
+
provider,
|
|
2466
|
+
baseUrl,
|
|
2467
|
+
compat: thinkingLevelMap
|
|
2468
|
+
? qwenTokenPlanCompat
|
|
2469
|
+
: { ...qwenTokenPlanCompat, supportsReasoningEffort: false },
|
|
2470
|
+
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
2471
|
+
reasoning: m.reasoning === true,
|
|
2472
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
2473
|
+
cost: getModelsDevCost(m.cost),
|
|
2474
|
+
contextWindow: m.limit?.context || 4096,
|
|
2475
|
+
maxTokens: m.limit?.output || 4096,
|
|
2476
|
+
});
|
|
2477
|
+
emittedModelIds?.add(modelId);
|
|
2478
|
+
}
|
|
2479
|
+
if (modelIds && emittedModelIds && strict) {
|
|
2480
|
+
assertExactModelIds(provider, modelIds, emittedModelIds);
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
return models;
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
/**
|
|
2487
|
+
* Applies Atomic's corrections, additions and metadata to the combined chat models of its catalog sources, models.dev
|
|
2488
|
+
* first. The build-time generator and the runtime catalog refresh both call this.
|
|
2489
|
+
*/
|
|
2490
|
+
export function finalizeChatModels(sourceModels) {
|
|
2491
|
+
const allModels = sourceModels.filter((model) => !(model.provider === "xai" && XAI_BUILTIN_EXCLUDED_MODEL_IDS.has(model.id)) &&
|
|
2492
|
+
!((model.provider === "opencode" || model.provider === "opencode-go") && model.id === "gpt-5.3-codex-spark"));
|
|
2493
|
+
// The authenticated Copilot catalog advertised these models on 2026-09-22,
|
|
2494
|
+
// but models.dev did not include them yet.
|
|
2495
|
+
const missingCopilotModels = [
|
|
2496
|
+
{
|
|
2497
|
+
id: "claude-opus-5.5",
|
|
2498
|
+
name: "Claude Opus 5.5",
|
|
2499
|
+
api: "anthropic-messages",
|
|
2500
|
+
provider: "github-copilot",
|
|
2501
|
+
baseUrl: "https://api.individual.githubcopilot.com",
|
|
2502
|
+
reasoning: true,
|
|
2503
|
+
thinkingLevelMap: {
|
|
2504
|
+
off: null,
|
|
2505
|
+
minimal: null,
|
|
2506
|
+
low: "low",
|
|
2507
|
+
medium: "medium",
|
|
2508
|
+
high: "high",
|
|
2509
|
+
xhigh: "xhigh",
|
|
2510
|
+
max: "max",
|
|
2511
|
+
},
|
|
2512
|
+
input: ["text", "image"],
|
|
2513
|
+
cost: { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 5 },
|
|
2514
|
+
contextWindow: 1000000,
|
|
2515
|
+
maxTokens: 128000,
|
|
2516
|
+
headers: { ...COPILOT_STATIC_HEADERS },
|
|
2517
|
+
},
|
|
2518
|
+
...["gpt-6-sol", "gpt-6-luna"].map((id) => ({
|
|
2519
|
+
id,
|
|
2520
|
+
name: id === "gpt-6-sol" ? "GPT-6 Sol" : "GPT-6 Luna",
|
|
2521
|
+
api: "openai-responses",
|
|
2522
|
+
provider: "github-copilot",
|
|
2523
|
+
baseUrl: "https://api.individual.githubcopilot.com",
|
|
2524
|
+
reasoning: true,
|
|
2525
|
+
input: ["text", "image"],
|
|
2526
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS[id]),
|
|
2527
|
+
contextWindow: 1000000,
|
|
2528
|
+
maxTokens: 128000,
|
|
2529
|
+
headers: { ...COPILOT_STATIC_HEADERS },
|
|
2530
|
+
})),
|
|
2531
|
+
];
|
|
2532
|
+
for (const model of missingCopilotModels) {
|
|
2533
|
+
if (!allModels.some((candidate) => candidate.provider === model.provider && candidate.id === model.id)) {
|
|
2534
|
+
allModels.push(model);
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
// Temporary overrides until upstream model metadata is corrected.
|
|
2538
|
+
for (const candidate of allModels) {
|
|
2539
|
+
if (candidate.provider === "github-copilot" && GITHUB_COPILOT_EXTENDED_CONTEXT_MODELS.has(candidate.id)) {
|
|
2540
|
+
candidate.contextWindow = 1000000;
|
|
2541
|
+
}
|
|
2542
|
+
// models.dev may list Opus 5.5 and Sonnet 5.5 before their effort metadata is complete.
|
|
2543
|
+
if ((candidate.provider === "anthropic" &&
|
|
2544
|
+
(candidate.id === "claude-opus-5-5" || candidate.id === "claude-sonnet-5-5")) ||
|
|
2545
|
+
(candidate.provider === "github-copilot" && candidate.id === "claude-opus-5.5")) {
|
|
2546
|
+
mergeThinkingLevelMap(candidate, {
|
|
2547
|
+
off: null,
|
|
2548
|
+
minimal: null,
|
|
2549
|
+
low: "low",
|
|
2550
|
+
medium: "medium",
|
|
2551
|
+
high: "high",
|
|
2552
|
+
xhigh: "xhigh",
|
|
2553
|
+
max: "max",
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
if ((candidate.provider === "anthropic" ||
|
|
2557
|
+
candidate.provider === "opencode" ||
|
|
2558
|
+
candidate.provider === "opencode-go") &&
|
|
2559
|
+
(candidate.id === "claude-opus-4-6" ||
|
|
2560
|
+
candidate.id === "claude-sonnet-4-6" ||
|
|
2561
|
+
candidate.id === "claude-opus-4.6" ||
|
|
2562
|
+
candidate.id === "claude-sonnet-4.6")) {
|
|
2563
|
+
candidate.contextWindow = 1000000;
|
|
2564
|
+
}
|
|
2565
|
+
// OpenCode variants list Claude Sonnet 4/4.5 with 1M context, actual limit is 200K
|
|
2566
|
+
if ((candidate.provider === "opencode" || candidate.provider === "opencode-go") &&
|
|
2567
|
+
(candidate.id === "claude-sonnet-4-5" || candidate.id === "claude-sonnet-4")) {
|
|
2568
|
+
candidate.contextWindow = 200000;
|
|
2569
|
+
}
|
|
2570
|
+
if ((candidate.provider === "opencode" || candidate.provider === "opencode-go") && candidate.id === "gpt-5.4") {
|
|
2571
|
+
candidate.contextWindow = 272000;
|
|
2572
|
+
candidate.maxTokens = 128000;
|
|
2573
|
+
}
|
|
2574
|
+
// Keep direct OpenAI requests in the short-context pricing tier by default. Users can opt into the
|
|
2575
|
+
// larger context through model overrides, so retain long-context cost metadata on the capped models.
|
|
2576
|
+
if (candidate.provider === "openai" && OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS.has(candidate.id)) {
|
|
2577
|
+
candidate.contextWindow = OPENAI_LONG_CONTEXT_INPUT_THRESHOLD;
|
|
2578
|
+
candidate.maxTokens = 128000;
|
|
2579
|
+
}
|
|
2580
|
+
if (candidate.provider === "openai" && OPENAI_LONG_CONTEXT_PRICING_MODEL_IDS.has(candidate.id)) {
|
|
2581
|
+
const standardCost = OPENAI_STANDARD_COSTS[candidate.id];
|
|
2582
|
+
candidate.cost = withOpenAiLongContextPricing(standardCost ?? candidate.cost);
|
|
2583
|
+
}
|
|
2584
|
+
// Cloudflare AI Gateway passes OpenAI usage through at OpenAI list prices.
|
|
2585
|
+
if (candidate.provider === "cloudflare-ai-gateway") {
|
|
2586
|
+
const standardCost = OPENAI_STANDARD_COSTS[candidate.id];
|
|
2587
|
+
if (standardCost)
|
|
2588
|
+
candidate.cost = withOpenAiLongContextPricing(standardCost);
|
|
2589
|
+
}
|
|
2590
|
+
// models.dev reports gpt-5-pro output as 272000 (a duplicate of the input sub-limit);
|
|
2591
|
+
// the actual max output is 128000. Also propagates to the derived Azure clone.
|
|
2592
|
+
if (candidate.provider === "openai" && candidate.id === "gpt-5-pro") {
|
|
2593
|
+
candidate.maxTokens = 128000;
|
|
2594
|
+
}
|
|
2595
|
+
// Keep Kimi K3's canonical output limit when gateway metadata is missing or incorrect.
|
|
2596
|
+
if ((candidate.provider === "openrouter" && candidate.id === "~moonshotai/kimi-latest") ||
|
|
2597
|
+
((candidate.provider === "openrouter" || candidate.provider === "vercel-ai-gateway") &&
|
|
2598
|
+
candidate.id.startsWith("moonshotai/") &&
|
|
2599
|
+
isKimiK3FamilyId(candidate.id.slice("moonshotai/".length)))) {
|
|
2600
|
+
candidate.maxTokens = KIMI_K3_MAX_TOKENS;
|
|
2601
|
+
}
|
|
2602
|
+
// Keep selected OpenRouter model metadata stable until upstream settles.
|
|
2603
|
+
if (candidate.provider === "openrouter" && candidate.id === "moonshotai/kimi-k2.5") {
|
|
2604
|
+
candidate.cost.input = 0.41;
|
|
2605
|
+
candidate.cost.output = 2.06;
|
|
2606
|
+
candidate.cost.cacheRead = 0.07;
|
|
2607
|
+
candidate.maxTokens = 4096;
|
|
2608
|
+
}
|
|
2609
|
+
if (candidate.provider === "openrouter" && candidate.id.startsWith("moonshotai/kimi-k2.6")) {
|
|
2610
|
+
candidate.compat = {
|
|
2611
|
+
...candidate.compat,
|
|
2612
|
+
supportsDeveloperRole: false,
|
|
2613
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
2614
|
+
};
|
|
2615
|
+
}
|
|
2616
|
+
if (candidate.provider === "openrouter" && candidate.id === "z-ai/glm-5") {
|
|
2617
|
+
candidate.cost.input = 0.6;
|
|
2618
|
+
candidate.cost.output = 1.9;
|
|
2619
|
+
candidate.cost.cacheRead = 0.119;
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
// Add missing gpt models
|
|
2623
|
+
const gpt6AstraOpenAiModel = {
|
|
2624
|
+
id: "gpt-6-astra",
|
|
2625
|
+
name: "GPT-6 Astra",
|
|
2626
|
+
api: "openai-responses",
|
|
2627
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2628
|
+
provider: "openai",
|
|
2629
|
+
reasoning: true,
|
|
2630
|
+
input: ["text", "image"],
|
|
2631
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6-astra"]),
|
|
2632
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2633
|
+
maxTokens: 128000,
|
|
2634
|
+
};
|
|
2635
|
+
// Provisional Copilot entry requested before its public catalog lists Astra. Reuse the
|
|
2636
|
+
// known model capabilities, not OpenAI billing rates. Copilot's authenticated picker
|
|
2637
|
+
// controls availability and fast entitlement; a provider-published row takes precedence.
|
|
2638
|
+
if (!allModels.some((model) => model.provider === "github-copilot" && model.id === "gpt-6-astra")) {
|
|
2639
|
+
allModels.push({
|
|
2640
|
+
...gpt6AstraOpenAiModel,
|
|
2641
|
+
provider: "github-copilot",
|
|
2642
|
+
baseUrl: "https://api.individual.githubcopilot.com",
|
|
2643
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
2644
|
+
headers: { ...COPILOT_STATIC_HEADERS },
|
|
2645
|
+
});
|
|
2646
|
+
}
|
|
2647
|
+
const missingOpenAiModels = [
|
|
2648
|
+
gpt6AstraOpenAiModel,
|
|
2649
|
+
{
|
|
2650
|
+
id: "gpt-6.1-sol",
|
|
2651
|
+
name: "GPT-6.1 Sol",
|
|
2652
|
+
api: "openai-responses",
|
|
2653
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2654
|
+
provider: "openai",
|
|
2655
|
+
reasoning: true,
|
|
2656
|
+
input: ["text", "image"],
|
|
2657
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6.1-sol"]),
|
|
2658
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2659
|
+
maxTokens: 128000,
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
id: "gpt-6.1-terra",
|
|
2663
|
+
name: "GPT-6.1 Terra",
|
|
2664
|
+
api: "openai-responses",
|
|
2665
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2666
|
+
provider: "openai",
|
|
2667
|
+
reasoning: true,
|
|
2668
|
+
input: ["text", "image"],
|
|
2669
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6.1-terra"]),
|
|
2670
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2671
|
+
maxTokens: 128000,
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
id: "gpt-6-sol",
|
|
2675
|
+
name: "GPT-6 Sol",
|
|
2676
|
+
api: "openai-responses",
|
|
2677
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2678
|
+
provider: "openai",
|
|
2679
|
+
reasoning: true,
|
|
2680
|
+
input: ["text", "image"],
|
|
2681
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6-sol"]),
|
|
2682
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2683
|
+
maxTokens: 128000,
|
|
2684
|
+
},
|
|
2685
|
+
{
|
|
2686
|
+
id: "gpt-6-luna",
|
|
2687
|
+
name: "GPT-6 Luna",
|
|
2688
|
+
api: "openai-responses",
|
|
2689
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2690
|
+
provider: "openai",
|
|
2691
|
+
reasoning: true,
|
|
2692
|
+
input: ["text", "image"],
|
|
2693
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6-luna"]),
|
|
2694
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2695
|
+
maxTokens: 128000,
|
|
2696
|
+
},
|
|
2697
|
+
{
|
|
2698
|
+
id: "gpt-5.6-sol",
|
|
2699
|
+
name: "GPT-5.6 Sol",
|
|
2700
|
+
api: "openai-responses",
|
|
2701
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2702
|
+
provider: "openai",
|
|
2703
|
+
reasoning: true,
|
|
2704
|
+
input: ["text", "image"],
|
|
2705
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-5.6-sol"]),
|
|
2706
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2707
|
+
maxTokens: 128000,
|
|
2708
|
+
},
|
|
2709
|
+
{
|
|
2710
|
+
id: "gpt-5.6-terra",
|
|
2711
|
+
name: "GPT-5.6 Terra",
|
|
2712
|
+
api: "openai-responses",
|
|
2713
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2714
|
+
provider: "openai",
|
|
2715
|
+
reasoning: true,
|
|
2716
|
+
input: ["text", "image"],
|
|
2717
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-5.6-terra"]),
|
|
2718
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2719
|
+
maxTokens: 128000,
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
id: "gpt-5.6-luna",
|
|
2723
|
+
name: "GPT-5.6 Luna",
|
|
2724
|
+
api: "openai-responses",
|
|
2725
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2726
|
+
provider: "openai",
|
|
2727
|
+
reasoning: true,
|
|
2728
|
+
input: ["text", "image"],
|
|
2729
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-5.6-luna"]),
|
|
2730
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2731
|
+
maxTokens: 128000,
|
|
2732
|
+
},
|
|
2733
|
+
{
|
|
2734
|
+
id: "gpt-5-chat-latest",
|
|
2735
|
+
name: "GPT-5 Chat Latest",
|
|
2736
|
+
api: "openai-responses",
|
|
2737
|
+
baseUrl: "https://api.openai.com/v1",
|
|
2738
|
+
provider: "openai",
|
|
2739
|
+
reasoning: false,
|
|
2740
|
+
input: ["text", "image"],
|
|
2741
|
+
cost: {
|
|
2742
|
+
input: 1.25,
|
|
2743
|
+
output: 10,
|
|
2744
|
+
cacheRead: 0.125,
|
|
2745
|
+
cacheWrite: 0,
|
|
2746
|
+
},
|
|
2747
|
+
contextWindow: 128000,
|
|
2748
|
+
maxTokens: 16384,
|
|
2749
|
+
},
|
|
2750
|
+
];
|
|
2751
|
+
for (const model of missingOpenAiModels) {
|
|
2752
|
+
if (!allModels.some((m) => m.provider === model.provider && m.id === model.id)) {
|
|
2753
|
+
allModels.push(model);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
// Codex 0.153.3 advertises these exact Bedrock Mantle and Runtime IDs while AWS's public
|
|
2757
|
+
// catalog and pricing pages have not published Astra yet. Keep the established zero-cost
|
|
2758
|
+
// convention until AWS provides authoritative rates; a future models.dev row with the same ID wins.
|
|
2759
|
+
// https://github.com/openai/codex/blob/83b62a02fab5c0fc797cbc9896c332148f1fd9d0/codex-rs/model-provider/src/amazon_bedrock/catalog.rs
|
|
2760
|
+
// https://github.com/openai/codex/blob/83b62a02fab5c0fc797cbc9896c332148f1fd9d0/codex-rs/model-provider/src/amazon_bedrock/runtime_catalog.rs
|
|
2761
|
+
const missingBedrockAstraModels = [
|
|
2762
|
+
["openai.gpt-6-astra", "GPT-6-Astra"],
|
|
2763
|
+
["global.openai.gpt-6-astra", "GPT-6-Astra (Global)"],
|
|
2764
|
+
["us.openai.gpt-6-astra", "GPT-6-Astra (US cross-region)"],
|
|
2765
|
+
].map(([id, name]) => ({
|
|
2766
|
+
id,
|
|
2767
|
+
name,
|
|
2768
|
+
api: "bedrock-converse-stream",
|
|
2769
|
+
provider: "amazon-bedrock",
|
|
2770
|
+
baseUrl: getBedrockBaseUrl(id),
|
|
2771
|
+
reasoning: true,
|
|
2772
|
+
input: ["text", "image"],
|
|
2773
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
2774
|
+
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
|
2775
|
+
maxTokens: 128000,
|
|
2776
|
+
}));
|
|
2777
|
+
for (const model of missingBedrockAstraModels) {
|
|
2778
|
+
if (!allModels.some((candidate) => candidate.provider === model.provider && candidate.id === model.id)) {
|
|
2779
|
+
allModels.push(model);
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
// Released 2026-11-09; models.dev does not list it for Anthropic yet. A future models.dev row
|
|
2783
|
+
// with the same ID wins.
|
|
2784
|
+
// https://platform.claude.com/docs/en/models/fable-5-2/whats-new-fable-5-2
|
|
2785
|
+
const missingAnthropicModels = [
|
|
2786
|
+
{
|
|
2787
|
+
id: "claude-fable-5-2",
|
|
2788
|
+
name: "Claude Fable 5.2",
|
|
2789
|
+
api: "anthropic-messages",
|
|
2790
|
+
baseUrl: "https://api.anthropic.com",
|
|
2791
|
+
provider: "anthropic",
|
|
2792
|
+
reasoning: true,
|
|
2793
|
+
input: ["text", "image"],
|
|
2794
|
+
cost: { input: 8, output: 40, cacheRead: 0.2, cacheWrite: 10 },
|
|
2795
|
+
contextWindow: 1000000,
|
|
2796
|
+
maxTokens: 128000,
|
|
2797
|
+
},
|
|
2798
|
+
];
|
|
2799
|
+
for (const model of missingAnthropicModels) {
|
|
2800
|
+
if (!allModels.some((candidate) => candidate.provider === model.provider && candidate.id === model.id)) {
|
|
2801
|
+
allModels.push(model);
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
const deepseekCompat = {
|
|
2805
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
2806
|
+
thinkingFormat: "deepseek",
|
|
2807
|
+
};
|
|
2808
|
+
const deepseekModels = [
|
|
2809
|
+
{
|
|
2810
|
+
id: "deepseek-flash",
|
|
2811
|
+
name: "DeepSeek V4.1 Flash",
|
|
2812
|
+
api: "openai-completions",
|
|
2813
|
+
baseUrl: "https://api.deepseek.com",
|
|
2814
|
+
provider: "deepseek",
|
|
2815
|
+
reasoning: true,
|
|
2816
|
+
thinkingLevelMap: DEEPSEEK_V4_FLASH_THINKING_LEVEL_MAP,
|
|
2817
|
+
input: ["text", "image"],
|
|
2818
|
+
cost: {
|
|
2819
|
+
// DeepSeek also offers time-based off-peak rates, which the cost schema cannot represent yet.
|
|
2820
|
+
input: 0.3,
|
|
2821
|
+
output: 1.2,
|
|
2822
|
+
cacheRead: 0.006,
|
|
2823
|
+
cacheWrite: 0,
|
|
2824
|
+
},
|
|
2825
|
+
contextWindow: 1000000,
|
|
2826
|
+
maxTokens: 384000,
|
|
2827
|
+
compat: deepseekCompat,
|
|
2828
|
+
},
|
|
2829
|
+
{
|
|
2830
|
+
id: "deepseek-v4-pro",
|
|
2831
|
+
name: "DeepSeek V4 Pro",
|
|
2832
|
+
api: "openai-completions",
|
|
2833
|
+
baseUrl: "https://api.deepseek.com",
|
|
2834
|
+
provider: "deepseek",
|
|
2835
|
+
reasoning: true,
|
|
2836
|
+
input: ["text"],
|
|
2837
|
+
cost: {
|
|
2838
|
+
// DeepSeek also offers time-based off-peak rates, which the cost schema cannot represent yet.
|
|
2839
|
+
input: 1.32,
|
|
2840
|
+
output: 3.96,
|
|
2841
|
+
cacheRead: 0.044,
|
|
2842
|
+
cacheWrite: 0,
|
|
2843
|
+
},
|
|
2844
|
+
contextWindow: 1000000,
|
|
2845
|
+
maxTokens: 384000,
|
|
2846
|
+
compat: deepseekCompat,
|
|
2847
|
+
},
|
|
2848
|
+
];
|
|
2849
|
+
allModels.push(...deepseekModels);
|
|
2850
|
+
const antLingCompat = {
|
|
2851
|
+
supportsStore: false,
|
|
2852
|
+
supportsDeveloperRole: false,
|
|
2853
|
+
supportsReasoningEffort: false,
|
|
2854
|
+
maxTokensField: "max_tokens",
|
|
2855
|
+
supportsLongCacheRetention: false,
|
|
2856
|
+
};
|
|
2857
|
+
const antLingModels = [
|
|
2858
|
+
{
|
|
2859
|
+
id: "Ling-2.6-flash",
|
|
2860
|
+
name: "Ling 2.6 Flash",
|
|
2861
|
+
api: "openai-completions",
|
|
2862
|
+
baseUrl: "https://api.ant-ling.com/v1",
|
|
2863
|
+
provider: "ant-ling",
|
|
2864
|
+
reasoning: false,
|
|
2865
|
+
input: ["text"],
|
|
2866
|
+
cost: { input: 0.01, output: 0.02, cacheRead: 0, cacheWrite: 0 },
|
|
2867
|
+
contextWindow: 262144,
|
|
2868
|
+
maxTokens: 65536,
|
|
2869
|
+
compat: antLingCompat,
|
|
2870
|
+
},
|
|
2871
|
+
{
|
|
2872
|
+
id: "Ling-2.6-1T",
|
|
2873
|
+
name: "Ling 2.6 1T",
|
|
2874
|
+
api: "openai-completions",
|
|
2875
|
+
baseUrl: "https://api.ant-ling.com/v1",
|
|
2876
|
+
provider: "ant-ling",
|
|
2877
|
+
reasoning: false,
|
|
2878
|
+
input: ["text"],
|
|
2879
|
+
cost: { input: 0.06, output: 0.25, cacheRead: 0, cacheWrite: 0 },
|
|
2880
|
+
contextWindow: 262144,
|
|
2881
|
+
maxTokens: 65536,
|
|
2882
|
+
compat: antLingCompat,
|
|
2883
|
+
},
|
|
2884
|
+
{
|
|
2885
|
+
id: "Ring-2.6-1T",
|
|
2886
|
+
name: "Ring 2.6 1T",
|
|
2887
|
+
api: "openai-completions",
|
|
2888
|
+
baseUrl: "https://api.ant-ling.com/v1",
|
|
2889
|
+
provider: "ant-ling",
|
|
2890
|
+
reasoning: true,
|
|
2891
|
+
input: ["text"],
|
|
2892
|
+
cost: { input: 0.06, output: 0.25, cacheRead: 0, cacheWrite: 0 },
|
|
2893
|
+
contextWindow: 262144,
|
|
2894
|
+
maxTokens: 65536,
|
|
2895
|
+
compat: { ...antLingCompat, thinkingFormat: "ant-ling" },
|
|
2896
|
+
},
|
|
2897
|
+
];
|
|
2898
|
+
allModels.push(...antLingModels);
|
|
2899
|
+
for (const candidate of allModels) {
|
|
2900
|
+
if (candidate.api === "openai-completions" &&
|
|
2901
|
+
candidate.id.includes("deepseek-v4") &&
|
|
2902
|
+
!QWEN_TOKEN_PLAN_PROVIDER_IDS.has(candidate.provider)) {
|
|
2903
|
+
const preservesNativeReasoningEffort = candidate.provider === "openrouter" || candidate.provider === "opencode";
|
|
2904
|
+
candidate.compat = {
|
|
2905
|
+
...candidate.compat,
|
|
2906
|
+
...(preservesNativeReasoningEffort
|
|
2907
|
+
? {
|
|
2908
|
+
requiresReasoningContentOnAssistantMessages: deepseekCompat.requiresReasoningContentOnAssistantMessages,
|
|
2909
|
+
}
|
|
2910
|
+
: deepseekCompat),
|
|
2911
|
+
};
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
// OpenAI Codex (ChatGPT OAuth) models
|
|
2915
|
+
// NOTE: These are not fetched from models.dev; we keep a small, explicit list to avoid aliases.
|
|
2916
|
+
// Only list models the Codex backend accepts for ChatGPT accounts. GPT-5.5 and GPT-5.3 Codex Spark are rejected
|
|
2917
|
+
// with "not supported when using Codex with a ChatGPT account".
|
|
2918
|
+
// GPT-5.6 and GPT-6 use Codex's 272k default catalog limit.
|
|
2919
|
+
const CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
2920
|
+
const CODEX_CONTEXT = 272000;
|
|
2921
|
+
const CODEX_GPT_56_CONTEXT = 272000;
|
|
2922
|
+
// Codex and Work raised GPT-6.1 Sol's default context to 500k (up from 272k) for ChatGPT subscriptions only, and
|
|
2923
|
+
// OpenAI does not charge long-context fees for it when usage draws from the subscription. The API model
|
|
2924
|
+
// (`openai` and `openai-api`) keeps the 272k cap and the whole-request long-context tier. Codex also serves
|
|
2925
|
+
// GPT-6.1 Terra with a 500k context, but OpenAI has not waived its long-context fee.
|
|
2926
|
+
const CODEX_GPT_61_CONTEXT = 500000;
|
|
2927
|
+
const CODEX_MAX_TOKENS = 128000;
|
|
2928
|
+
const codexModels = [
|
|
2929
|
+
{
|
|
2930
|
+
id: "gpt-5.6-luna",
|
|
2931
|
+
name: "GPT-5.6 Luna",
|
|
2932
|
+
api: "openai-codex-responses",
|
|
2933
|
+
provider: "openai-codex",
|
|
2934
|
+
baseUrl: CODEX_BASE_URL,
|
|
2935
|
+
reasoning: true,
|
|
2936
|
+
input: ["text", "image"],
|
|
2937
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-5.6-luna"]),
|
|
2938
|
+
contextWindow: CODEX_GPT_56_CONTEXT,
|
|
2939
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
2940
|
+
},
|
|
2941
|
+
{
|
|
2942
|
+
id: "gpt-5.6-sol",
|
|
2943
|
+
name: "GPT-5.6 Sol",
|
|
2944
|
+
api: "openai-codex-responses",
|
|
2945
|
+
provider: "openai-codex",
|
|
2946
|
+
baseUrl: CODEX_BASE_URL,
|
|
2947
|
+
reasoning: true,
|
|
2948
|
+
input: ["text", "image"],
|
|
2949
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-5.6-sol"]),
|
|
2950
|
+
contextWindow: CODEX_GPT_56_CONTEXT,
|
|
2951
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
2952
|
+
},
|
|
2953
|
+
{
|
|
2954
|
+
id: "gpt-5.6-terra",
|
|
2955
|
+
name: "GPT-5.6 Terra",
|
|
2956
|
+
api: "openai-codex-responses",
|
|
2957
|
+
provider: "openai-codex",
|
|
2958
|
+
baseUrl: CODEX_BASE_URL,
|
|
2959
|
+
reasoning: true,
|
|
2960
|
+
input: ["text", "image"],
|
|
2961
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-5.6-terra"]),
|
|
2962
|
+
contextWindow: CODEX_GPT_56_CONTEXT,
|
|
2963
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
2964
|
+
},
|
|
2965
|
+
{
|
|
2966
|
+
id: "gpt-6-astra",
|
|
2967
|
+
name: "GPT-6-Astra",
|
|
2968
|
+
api: "openai-codex-responses",
|
|
2969
|
+
provider: "openai-codex",
|
|
2970
|
+
baseUrl: CODEX_BASE_URL,
|
|
2971
|
+
reasoning: true,
|
|
2972
|
+
input: ["text", "image"],
|
|
2973
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6-astra"]),
|
|
2974
|
+
contextWindow: CODEX_GPT_56_CONTEXT,
|
|
2975
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
2976
|
+
},
|
|
2977
|
+
{
|
|
2978
|
+
id: "gpt-6.1-sol",
|
|
2979
|
+
name: "GPT-6.1 Sol",
|
|
2980
|
+
api: "openai-codex-responses",
|
|
2981
|
+
provider: "openai-codex",
|
|
2982
|
+
baseUrl: CODEX_BASE_URL,
|
|
2983
|
+
reasoning: true,
|
|
2984
|
+
input: ["text", "image"],
|
|
2985
|
+
cost: OPENAI_STANDARD_COSTS["gpt-6.1-sol"],
|
|
2986
|
+
contextWindow: CODEX_GPT_61_CONTEXT,
|
|
2987
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
2988
|
+
},
|
|
2989
|
+
{
|
|
2990
|
+
id: "gpt-6.1-terra",
|
|
2991
|
+
name: "GPT-6.1 Terra",
|
|
2992
|
+
api: "openai-codex-responses",
|
|
2993
|
+
provider: "openai-codex",
|
|
2994
|
+
baseUrl: CODEX_BASE_URL,
|
|
2995
|
+
reasoning: true,
|
|
2996
|
+
input: ["text", "image"],
|
|
2997
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6.1-terra"]),
|
|
2998
|
+
contextWindow: CODEX_GPT_61_CONTEXT,
|
|
2999
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
3000
|
+
},
|
|
3001
|
+
{
|
|
3002
|
+
id: "gpt-6-sol",
|
|
3003
|
+
name: "GPT-6 Sol",
|
|
3004
|
+
api: "openai-codex-responses",
|
|
3005
|
+
provider: "openai-codex",
|
|
3006
|
+
baseUrl: CODEX_BASE_URL,
|
|
3007
|
+
reasoning: true,
|
|
3008
|
+
input: ["text", "image"],
|
|
3009
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6-sol"]),
|
|
3010
|
+
contextWindow: CODEX_CONTEXT,
|
|
3011
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
3012
|
+
},
|
|
3013
|
+
{
|
|
3014
|
+
id: "gpt-6-luna",
|
|
3015
|
+
name: "GPT-6 Luna",
|
|
3016
|
+
api: "openai-codex-responses",
|
|
3017
|
+
provider: "openai-codex",
|
|
3018
|
+
baseUrl: CODEX_BASE_URL,
|
|
3019
|
+
reasoning: true,
|
|
3020
|
+
input: ["text", "image"],
|
|
3021
|
+
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6-luna"]),
|
|
3022
|
+
contextWindow: CODEX_CONTEXT,
|
|
3023
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
3024
|
+
},
|
|
3025
|
+
];
|
|
3026
|
+
for (const model of codexModels) {
|
|
3027
|
+
model.serviceTiers = codexServiceTiers(model.id);
|
|
3028
|
+
}
|
|
3029
|
+
allModels.push(...codexModels);
|
|
3030
|
+
// Add missing Mistral Medium 3.5 model until models.dev includes it
|
|
3031
|
+
if (!allModels.some((m) => m.provider === "mistral" && m.id === "mistral-medium-3.5")) {
|
|
3032
|
+
allModels.push({
|
|
3033
|
+
id: "mistral-medium-3.5",
|
|
3034
|
+
name: "Mistral Medium 3.5",
|
|
3035
|
+
api: "mistral-conversations",
|
|
3036
|
+
provider: "mistral",
|
|
3037
|
+
baseUrl: "https://api.mistral.ai",
|
|
3038
|
+
reasoning: true,
|
|
3039
|
+
thinkingLevelMap: getEffortThinkingLevelMap([{ type: "effort", values: ["none", "high"] }]),
|
|
3040
|
+
input: ["text", "image"],
|
|
3041
|
+
cost: {
|
|
3042
|
+
input: 1.5,
|
|
3043
|
+
output: 7.5,
|
|
3044
|
+
cacheRead: 0,
|
|
3045
|
+
cacheWrite: 0,
|
|
3046
|
+
},
|
|
3047
|
+
contextWindow: 262144, // 256k tokens
|
|
3048
|
+
maxTokens: 262144,
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
// Add "auto" alias for openrouter/auto
|
|
3052
|
+
if (!allModels.some((m) => m.provider === "openrouter" && m.id === "auto")) {
|
|
3053
|
+
allModels.push({
|
|
3054
|
+
id: "auto",
|
|
3055
|
+
name: "Auto",
|
|
3056
|
+
api: "openai-completions",
|
|
3057
|
+
provider: "openrouter",
|
|
3058
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
3059
|
+
reasoning: true,
|
|
3060
|
+
input: ["text", "image"],
|
|
3061
|
+
cost: {
|
|
3062
|
+
// we dont know about the costs because OpenRouter auto routes to different models
|
|
3063
|
+
// and then charges you for the underlying used model
|
|
3064
|
+
input: 0,
|
|
3065
|
+
output: 0,
|
|
3066
|
+
cacheRead: 0,
|
|
3067
|
+
cacheWrite: 0,
|
|
3068
|
+
},
|
|
3069
|
+
contextWindow: 2000000,
|
|
3070
|
+
maxTokens: 30000,
|
|
3071
|
+
});
|
|
3072
|
+
}
|
|
3073
|
+
// Add "fusion" alias for openrouter/fusion. OpenRouter exposes Fusion as a
|
|
3074
|
+
// router alias/plugin entry point; its model metadata does not advertise
|
|
3075
|
+
// tools, but the alias resolves to a concrete model that can invoke caller
|
|
3076
|
+
// tools and has the openrouter:fusion server tool auto-injected.
|
|
3077
|
+
if (!allModels.some((m) => m.provider === "openrouter" && m.id === "openrouter/fusion")) {
|
|
3078
|
+
allModels.push({
|
|
3079
|
+
id: "openrouter/fusion",
|
|
3080
|
+
name: "OpenRouter: Fusion",
|
|
3081
|
+
api: "openai-completions",
|
|
3082
|
+
provider: "openrouter",
|
|
3083
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
3084
|
+
reasoning: true,
|
|
3085
|
+
input: ["text"],
|
|
3086
|
+
cost: {
|
|
3087
|
+
// we dont know about the costs because Fusion routes to multiple models
|
|
3088
|
+
// and then charges you for the underlying used models
|
|
3089
|
+
input: 0,
|
|
3090
|
+
output: 0,
|
|
3091
|
+
cacheRead: 0,
|
|
3092
|
+
cacheWrite: 0,
|
|
3093
|
+
},
|
|
3094
|
+
contextWindow: 1000000,
|
|
3095
|
+
maxTokens: 30000,
|
|
3096
|
+
});
|
|
3097
|
+
}
|
|
3098
|
+
// Azure Foundry deploys these with larger context windows than OpenAI's own short-tier defaults.
|
|
3099
|
+
// See models-sold-directly-by-azure docs.
|
|
3100
|
+
const AZURE_CONTEXT_WINDOW_OVERRIDES = {
|
|
3101
|
+
"gpt-5.4": 1050000,
|
|
3102
|
+
"gpt-5.5": 1050000,
|
|
3103
|
+
"gpt-5.6-luna": 1050000,
|
|
3104
|
+
"gpt-5.6-sol": 1050000,
|
|
3105
|
+
"gpt-5.6-terra": 1050000,
|
|
3106
|
+
"gpt-6-luna": 1050000,
|
|
3107
|
+
"gpt-6-sol": 1050000,
|
|
3108
|
+
"gpt-6.1-sol": 1050000,
|
|
3109
|
+
"gpt-6.1-terra": 1050000,
|
|
3110
|
+
};
|
|
3111
|
+
const azureOpenAiModels = allModels
|
|
3112
|
+
.filter((model) => model.provider === "openai" && model.api === "openai-responses" && model.id !== "gpt-6-astra")
|
|
3113
|
+
.map((model) => ({
|
|
3114
|
+
...model,
|
|
3115
|
+
api: "azure-openai-responses",
|
|
3116
|
+
provider: "azure",
|
|
3117
|
+
baseUrl: "",
|
|
3118
|
+
contextWindow: AZURE_CONTEXT_WINDOW_OVERRIDES[model.id] ?? model.contextWindow,
|
|
3119
|
+
}));
|
|
3120
|
+
allModels.push(...azureOpenAiModels);
|
|
3121
|
+
const azureDeepSeekModels = allModels
|
|
3122
|
+
.filter((model) => model.provider === "deepseek" && model.id === "deepseek-v4-pro")
|
|
3123
|
+
.map((model) => ({
|
|
3124
|
+
...model,
|
|
3125
|
+
provider: "azure",
|
|
3126
|
+
baseUrl: "",
|
|
3127
|
+
cost: { input: 1.925, output: 3.828, cacheRead: 0.165, cacheWrite: 0 },
|
|
3128
|
+
thinkingLevelMap: AZURE_DEEPSEEK_V4_THINKING_LEVEL_MAP,
|
|
3129
|
+
compat: {
|
|
3130
|
+
...model.compat,
|
|
3131
|
+
supportsDeveloperRole: false,
|
|
3132
|
+
supportsMidConvoSystemMessages: true,
|
|
3133
|
+
thinkingFormat: "openai",
|
|
3134
|
+
supportsLongCacheRetention: false,
|
|
3135
|
+
},
|
|
3136
|
+
}));
|
|
3137
|
+
allModels.push(...azureDeepSeekModels);
|
|
3138
|
+
for (const model of allModels) {
|
|
3139
|
+
if (model.provider === "openai" && model.api === "openai-responses") {
|
|
3140
|
+
model.serviceTiers = openAiServiceTiers(model.id);
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
for (const model of allModels) {
|
|
3144
|
+
applyOpenAICompletionsCompatMetadata(model);
|
|
3145
|
+
applyAnthropicMessagesCompatMetadata(model);
|
|
3146
|
+
applyModelsDevReasoningOptionMetadata(model);
|
|
3147
|
+
applyThinkingLevelMetadata(model);
|
|
3148
|
+
applyStrictToolCompatMetadata(model);
|
|
3149
|
+
applyPreservedThinkingCompatMetadata(model);
|
|
3150
|
+
applyForcedToolChoiceCompatMetadata(model);
|
|
3151
|
+
applyFableTemperatureCompatMetadata(model);
|
|
3152
|
+
applyOpenAIGrammarToolCompatMetadata(model);
|
|
3153
|
+
applyOpenAIToolSearchMetadata(model);
|
|
3154
|
+
applyOpenAICompletionsTranscriptMetadata(model);
|
|
3155
|
+
applyOpenAIResponsesTranscriptMetadata(model);
|
|
3156
|
+
applyOpenAIExplicitPromptCacheMetadata(model);
|
|
3157
|
+
applyOpenAIMidConvoEffortMetadata(model);
|
|
3158
|
+
applyPromptCacheMetadata(model);
|
|
3159
|
+
applyImageInputMetadata(model);
|
|
3160
|
+
}
|
|
3161
|
+
applyAnthropicAllowedFallbackModelMetadata(allModels.filter(isAnthropicFallbackMetadataModel));
|
|
3162
|
+
applyAzureOpenAIListedEfforts(allModels);
|
|
3163
|
+
applyAzureOpenAIThinkingOffMasks(allModels);
|
|
3164
|
+
return allModels;
|
|
3165
|
+
}
|
|
3166
|
+
//# sourceMappingURL=models-dev-catalog.js.map
|