@prometheus-ai/ai 0.5.3 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/auth-broker/remote-store.d.ts +2 -1
- package/dist/types/auth-broker/wire-schemas.d.ts +4 -1
- package/dist/types/auth-gateway/server.d.ts +19 -0
- package/dist/types/auth-gateway/types.d.ts +9 -3
- package/dist/types/auth-retry.d.ts +119 -0
- package/dist/types/auth-storage.d.ts +217 -8
- package/dist/types/errors.d.ts +24 -0
- package/dist/types/index.d.ts +5 -9
- package/dist/types/provider-details.d.ts +1 -1
- package/dist/types/providers/amazon-bedrock.d.ts +12 -6
- package/dist/types/providers/anthropic-client.d.ts +10 -3
- package/dist/types/providers/anthropic-messages-server-schema.d.ts +2 -2
- package/dist/types/providers/anthropic-messages-server.d.ts +3 -3
- package/dist/types/providers/anthropic-wire.d.ts +3 -3
- package/dist/types/providers/anthropic.d.ts +41 -34
- package/dist/types/providers/aws-credentials.d.ts +8 -0
- package/dist/types/providers/azure-openai-responses.d.ts +1 -0
- package/dist/types/providers/google-gemini-cli.d.ts +22 -1
- package/dist/types/providers/google-shared.d.ts +22 -0
- package/dist/types/providers/google-types.d.ts +13 -1
- package/dist/types/providers/mock.d.ts +8 -3
- package/dist/types/providers/ollama.d.ts +6 -0
- package/dist/types/providers/openai-chat-server-schema.d.ts +6 -3
- package/dist/types/providers/openai-chat-server.d.ts +3 -3
- package/dist/types/providers/openai-chat-wire.d.ts +644 -0
- package/dist/types/providers/openai-codex/request-transformer.d.ts +8 -0
- package/dist/types/providers/openai-codex/response-handler.d.ts +9 -0
- package/dist/types/providers/openai-codex-responses.d.ts +31 -2
- package/dist/types/providers/openai-completions-compat.d.ts +2 -25
- package/dist/types/providers/openai-completions.d.ts +2 -10
- package/dist/types/providers/openai-responses-server-schema.d.ts +4 -4
- package/dist/types/providers/openai-responses-server.d.ts +2 -2
- package/dist/types/providers/openai-responses-shared.d.ts +49 -9
- package/dist/types/providers/openai-responses-wire.d.ts +6065 -0
- package/dist/types/providers/openai-responses.d.ts +13 -4
- package/dist/types/providers/prometheus-native-client.d.ts +9 -0
- package/dist/types/providers/prometheus-native-server.d.ts +4 -3
- package/dist/types/providers/transform-messages.d.ts +1 -2
- package/dist/types/rate-limit-utils.d.ts +3 -2
- package/dist/types/registry/aimlapi.d.ts +4 -0
- package/dist/types/registry/alibaba-coding-plan.d.ts +7 -0
- package/dist/types/registry/amazon-bedrock.d.ts +5 -0
- package/dist/types/registry/anthropic.d.ts +10 -0
- package/dist/types/{utils/oauth → registry}/api-key-login.d.ts +8 -2
- package/dist/types/{utils/oauth → registry}/api-key-validation.d.ts +15 -0
- package/dist/types/registry/cerebras.d.ts +7 -0
- package/dist/types/registry/cloudflare-ai-gateway.d.ts +13 -0
- package/dist/types/registry/cursor.d.ts +7 -0
- package/dist/types/registry/deepseek.d.ts +8 -0
- package/dist/types/registry/derived.d.ts +5 -0
- package/dist/types/registry/firepass.d.ts +16 -0
- package/dist/types/registry/fireworks.d.ts +7 -0
- package/dist/types/registry/github-copilot.d.ts +7 -0
- package/dist/types/registry/gitlab-duo.d.ts +9 -0
- package/dist/types/registry/google-antigravity.d.ts +9 -0
- package/dist/types/registry/google-gemini-cli.d.ts +9 -0
- package/dist/types/registry/google-vertex.d.ts +5 -0
- package/dist/types/registry/google.d.ts +4 -0
- package/dist/types/registry/groq.d.ts +4 -0
- package/dist/types/registry/huggingface.d.ts +7 -0
- package/dist/types/registry/index.d.ts +4 -0
- package/dist/types/registry/kagi.d.ts +14 -0
- package/dist/types/registry/kilo.d.ts +7 -0
- package/dist/types/registry/kimi-code.d.ts +7 -0
- package/dist/types/registry/litellm.d.ts +13 -0
- package/dist/types/registry/lm-studio.d.ts +8 -0
- package/dist/types/registry/minimax-code-cn.d.ts +6 -0
- package/dist/types/registry/minimax-code.d.ts +6 -0
- package/dist/types/registry/minimax.d.ts +4 -0
- package/dist/types/registry/mistral.d.ts +4 -0
- package/dist/types/registry/moonshot.d.ts +7 -0
- package/dist/types/registry/nanogpt.d.ts +7 -0
- package/dist/types/registry/nvidia.d.ts +7 -0
- package/dist/types/registry/oauth/__tests__/xai-oauth.test.d.ts +1 -0
- package/dist/types/{utils → registry}/oauth/anthropic.d.ts +2 -1
- package/dist/types/{utils → registry}/oauth/github-copilot.d.ts +15 -23
- package/dist/types/{utils → registry}/oauth/index.d.ts +1 -0
- package/dist/types/{utils → registry}/oauth/minimax-code.d.ts +5 -5
- package/dist/types/{utils → registry}/oauth/types.d.ts +6 -1
- package/dist/types/{utils → registry}/oauth/xai-oauth.d.ts +2 -1
- package/dist/types/registry/ollama-cloud.d.ts +7 -0
- package/dist/types/registry/ollama.d.ts +12 -0
- package/dist/types/registry/openai-codex-device.d.ts +8 -0
- package/dist/types/registry/openai-codex.d.ts +9 -0
- package/dist/types/registry/openai.d.ts +4 -0
- package/dist/types/registry/opencode-go.d.ts +6 -0
- package/dist/types/registry/opencode-zen.d.ts +6 -0
- package/dist/types/registry/openrouter.d.ts +13 -0
- package/dist/types/registry/parallel.d.ts +14 -0
- package/dist/types/registry/perplexity.d.ts +7 -0
- package/dist/types/registry/qianfan.d.ts +7 -0
- package/dist/types/registry/qwen-portal.d.ts +7 -0
- package/dist/types/registry/registry.d.ts +272 -0
- package/dist/types/registry/synthetic.d.ts +6 -0
- package/dist/types/registry/tavily.d.ts +14 -0
- package/dist/types/registry/together.d.ts +6 -0
- package/dist/types/registry/types.d.ts +51 -0
- package/dist/types/registry/venice.d.ts +13 -0
- package/dist/types/registry/vercel-ai-gateway.d.ts +7 -0
- package/dist/types/registry/vllm.d.ts +7 -0
- package/dist/types/registry/wafer-pass.d.ts +6 -0
- package/dist/types/registry/wafer-serverless.d.ts +6 -0
- package/dist/types/registry/xai-oauth.d.ts +7 -0
- package/dist/types/registry/xai.d.ts +4 -0
- package/dist/types/registry/xiaomi-token-plan-ams.d.ts +6 -0
- package/dist/types/registry/xiaomi-token-plan-cn.d.ts +6 -0
- package/dist/types/registry/xiaomi-token-plan-sgp.d.ts +6 -0
- package/dist/types/registry/xiaomi.d.ts +6 -0
- package/dist/types/registry/zai.d.ts +7 -0
- package/dist/types/registry/zenmux.d.ts +7 -0
- package/dist/types/registry/zhipu-coding-plan.d.ts +7 -0
- package/dist/types/stream.d.ts +9 -1
- package/dist/types/types.d.ts +56 -295
- package/dist/types/usage/google-antigravity.d.ts +15 -1
- package/dist/types/usage/openai-codex-reset.d.ts +79 -0
- package/dist/types/usage/openai-codex.d.ts +1 -0
- package/dist/types/usage.d.ts +77 -4
- package/dist/types/utils/abort.d.ts +6 -0
- package/dist/types/utils/event-stream.d.ts +2 -0
- package/dist/types/utils/http-inspector.d.ts +0 -1
- package/dist/types/utils/idle-iterator.d.ts +35 -0
- package/dist/types/utils/openai-http.d.ts +58 -0
- package/dist/types/utils/request-debug.d.ts +3 -0
- package/dist/types/utils/retry-after.d.ts +1 -0
- package/dist/types/utils/schema/fields.d.ts +5 -0
- package/dist/types/utils/schema/json-schema-validator.d.ts +8 -0
- package/dist/types/utils/schema/stamps.d.ts +7 -15
- package/dist/types/utils/sse-debug.d.ts +0 -5
- package/dist/types/utils/stream-markup-healing.d.ts +2 -0
- package/dist/types/utils.d.ts +1 -5
- package/package.json +17 -29
- package/src/auth-broker/remote-store.ts +10 -1
- package/src/auth-broker/snapshot-cache.ts +1 -1
- package/src/auth-broker/wire-schemas.ts +1 -1
- package/src/auth-gateway/http.ts +1 -1
- package/src/auth-gateway/server.ts +95 -30
- package/src/auth-gateway/types.ts +10 -2
- package/src/auth-retry.ts +238 -0
- package/src/auth-storage.ts +935 -430
- package/src/errors.ts +32 -0
- package/src/index.ts +9 -14
- package/src/provider-details.ts +1 -1
- package/src/providers/__tests__/google-auth.test.ts +144 -0
- package/src/providers/amazon-bedrock.ts +70 -40
- package/src/providers/anthropic-client.ts +15 -13
- package/src/providers/anthropic-messages-server-schema.ts +17 -7
- package/src/providers/anthropic-messages-server.ts +88 -20
- package/src/providers/anthropic-wire.ts +4 -3
- package/src/providers/anthropic.ts +1234 -621
- package/src/providers/aws-credentials.ts +47 -5
- package/src/providers/aws-eventstream.ts +5 -0
- package/src/providers/azure-openai-responses.ts +117 -67
- package/src/providers/cursor.ts +30 -30
- package/src/providers/github-copilot-headers.ts +1 -1
- package/src/providers/gitlab-duo.ts +36 -29
- package/src/providers/google-auth.ts +71 -8
- package/src/providers/google-gemini-cli.ts +118 -22
- package/src/providers/google-shared.ts +163 -43
- package/src/providers/google-types.ts +10 -1
- package/src/providers/kimi.ts +1 -1
- package/src/providers/mock.ts +11 -3
- package/src/providers/ollama.ts +64 -7
- package/src/providers/openai-anthropic-shim.ts +17 -8
- package/src/providers/openai-chat-server-schema.ts +9 -3
- package/src/providers/openai-chat-server.ts +82 -16
- package/src/providers/openai-chat-wire.ts +847 -0
- package/src/providers/openai-codex/request-transformer.ts +129 -34
- package/src/providers/openai-codex/response-handler.ts +22 -1
- package/src/providers/openai-codex-responses.ts +699 -247
- package/src/providers/openai-completions-compat.ts +8 -308
- package/src/providers/openai-completions.ts +416 -267
- package/src/providers/openai-responses-server-schema.ts +15 -9
- package/src/providers/openai-responses-server.ts +162 -114
- package/src/providers/openai-responses-shared.ts +320 -82
- package/src/providers/openai-responses-wire.ts +6391 -0
- package/src/providers/openai-responses.ts +382 -176
- package/src/providers/prometheus-native-client.ts +27 -11
- package/src/providers/prometheus-native-server.ts +44 -17
- package/src/providers/transform-messages.ts +311 -120
- package/src/providers/vision-guard.ts +5 -3
- package/src/rate-limit-utils.ts +13 -3
- package/src/registry/aimlapi.ts +6 -0
- package/src/{utils/oauth → registry}/alibaba-coding-plan.ts +8 -18
- package/src/registry/amazon-bedrock.ts +22 -0
- package/src/registry/anthropic.ts +26 -0
- package/src/{utils/oauth → registry}/api-key-login.ts +25 -3
- package/src/{utils/oauth → registry}/api-key-validation.ts +62 -2
- package/src/{utils/oauth → registry}/cerebras.ts +8 -1
- package/src/{utils/oauth → registry}/cloudflare-ai-gateway.ts +8 -12
- package/src/registry/cursor.ts +20 -0
- package/src/{utils/oauth → registry}/deepseek.ts +9 -17
- package/src/registry/derived.ts +9 -0
- package/src/{utils/oauth → registry}/firepass.ts +10 -2
- package/src/{utils/oauth → registry}/fireworks.ts +8 -1
- package/src/registry/github-copilot.ts +22 -0
- package/src/registry/gitlab-duo.ts +19 -0
- package/src/registry/google-antigravity.ts +21 -0
- package/src/registry/google-gemini-cli.ts +21 -0
- package/src/registry/google-vertex.ts +38 -0
- package/src/registry/google.ts +6 -0
- package/src/registry/groq.ts +6 -0
- package/src/{utils/oauth → registry}/huggingface.ts +8 -19
- package/src/registry/index.ts +4 -0
- package/src/{utils/oauth → registry}/kagi.ts +9 -11
- package/src/{utils/oauth → registry}/kilo.ts +11 -6
- package/src/registry/kimi-code.ts +17 -0
- package/src/{utils/oauth → registry}/litellm.ts +8 -12
- package/src/{utils/oauth → registry}/lm-studio.ts +9 -17
- package/src/registry/minimax-code-cn.ts +12 -0
- package/src/registry/minimax-code.ts +12 -0
- package/src/registry/minimax.ts +6 -0
- package/src/registry/mistral.ts +6 -0
- package/src/{utils/oauth → registry}/moonshot.ts +8 -9
- package/src/{utils/oauth → registry}/nanogpt.ts +8 -1
- package/src/{utils/oauth → registry}/nvidia.ts +8 -18
- package/src/{utils → registry}/oauth/__tests__/xai-oauth.test.ts +4 -7
- package/src/{utils → registry}/oauth/anthropic.ts +38 -17
- package/src/{utils → registry}/oauth/github-copilot.ts +79 -115
- package/src/registry/oauth/gitlab-duo.ts +198 -0
- package/src/{utils → registry}/oauth/google-antigravity.ts +1 -4
- package/src/{utils → registry}/oauth/google-gemini-cli.ts +1 -4
- package/src/registry/oauth/index.ts +164 -0
- package/src/{utils → registry}/oauth/minimax-code.ts +16 -14
- package/src/{utils → registry}/oauth/types.ts +7 -51
- package/src/{utils → registry}/oauth/wafer.ts +1 -1
- package/src/{utils → registry}/oauth/xai-oauth.ts +16 -8
- package/src/{utils → registry}/oauth/xiaomi.ts +9 -4
- package/src/{utils/oauth → registry}/ollama-cloud.ts +8 -1
- package/src/{utils/oauth → registry}/ollama.ts +8 -13
- package/src/registry/openai-codex-device.ts +18 -0
- package/src/registry/openai-codex.ts +19 -0
- package/src/registry/openai.ts +6 -0
- package/src/registry/opencode-go.ts +12 -0
- package/src/registry/opencode-zen.ts +12 -0
- package/src/{utils/oauth → registry}/openrouter.ts +10 -2
- package/src/{utils/oauth → registry}/parallel.ts +9 -11
- package/src/registry/perplexity.ts +13 -0
- package/src/{utils/oauth → registry}/qianfan.ts +8 -17
- package/src/{utils/oauth → registry}/qwen-portal.ts +8 -19
- package/src/registry/registry.ts +149 -0
- package/src/{utils/oauth → registry}/synthetic.ts +7 -1
- package/src/{utils/oauth → registry}/tavily.ts +10 -12
- package/src/{utils/oauth → registry}/together.ts +7 -1
- package/src/registry/types.ts +56 -0
- package/src/{utils/oauth → registry}/venice.ts +8 -12
- package/src/{utils/oauth → registry}/vercel-ai-gateway.ts +8 -18
- package/src/{utils/oauth → registry}/vllm.ts +9 -16
- package/src/registry/wafer-pass.ts +12 -0
- package/src/registry/wafer-serverless.ts +12 -0
- package/src/registry/xai-oauth.ts +17 -0
- package/src/registry/xai.ts +6 -0
- package/src/registry/xiaomi-token-plan-ams.ts +12 -0
- package/src/registry/xiaomi-token-plan-cn.ts +12 -0
- package/src/registry/xiaomi-token-plan-sgp.ts +12 -0
- package/src/registry/xiaomi.ts +12 -0
- package/src/{utils/oauth → registry}/zai.ts +10 -22
- package/src/{utils/oauth → registry}/zenmux.ts +8 -1
- package/src/{utils/oauth/zhipu.ts → registry/zhipu-coding-plan.ts} +9 -21
- package/src/stream.ts +229 -199
- package/src/types.ts +63 -384
- package/src/usage/claude.ts +4 -2
- package/src/usage/github-copilot.ts +4 -2
- package/src/usage/google-antigravity.ts +196 -28
- package/src/usage/kimi.ts +1 -1
- package/src/usage/minimax-code.ts +5 -6
- package/src/usage/openai-codex-reset.ts +174 -0
- package/src/usage/openai-codex.ts +19 -2
- package/src/usage/zai.ts +2 -1
- package/src/usage.ts +93 -4
- package/src/utils/abort.ts +14 -0
- package/src/utils/event-stream.ts +17 -0
- package/src/utils/http-inspector.ts +4 -12
- package/src/utils/idle-iterator.ts +250 -79
- package/src/utils/openai-http.ts +157 -0
- package/src/utils/request-debug.ts +67 -19
- package/src/utils/retry-after.ts +1 -1
- package/src/utils/retry.ts +23 -2
- package/src/utils/schema/CONSTRAINTS.md +4 -2
- package/src/utils/schema/fields.ts +16 -0
- package/src/utils/schema/json-schema-validator.ts +19 -1
- package/src/utils/schema/normalize.ts +80 -8
- package/src/utils/schema/stamps.ts +22 -10
- package/src/utils/schema/wire.ts +2 -2
- package/src/utils/sse-debug.ts +0 -271
- package/src/utils/stream-markup-healing.ts +50 -8
- package/src/utils/validation.ts +49 -13
- package/src/utils.ts +2 -26
- package/dist/types/model-cache.d.ts +0 -17
- package/dist/types/model-manager.d.ts +0 -64
- package/dist/types/model-thinking.d.ts +0 -100
- package/dist/types/models.d.ts +0 -12
- package/dist/types/provider-models/bundled-references.d.ts +0 -4
- package/dist/types/provider-models/descriptors.d.ts +0 -50
- package/dist/types/provider-models/google.d.ts +0 -24
- package/dist/types/provider-models/index.d.ts +0 -5
- package/dist/types/provider-models/ollama.d.ts +0 -7
- package/dist/types/provider-models/openai-compat.d.ts +0 -323
- package/dist/types/provider-models/special.d.ts +0 -16
- package/dist/types/utils/discovery/antigravity.d.ts +0 -61
- package/dist/types/utils/discovery/codex.d.ts +0 -38
- package/dist/types/utils/discovery/cursor.d.ts +0 -23
- package/dist/types/utils/discovery/gemini.d.ts +0 -25
- package/dist/types/utils/discovery/index.d.ts +0 -4
- package/dist/types/utils/discovery/openai-compatible.d.ts +0 -72
- package/dist/types/utils/oauth/alibaba-coding-plan.d.ts +0 -18
- package/dist/types/utils/oauth/cerebras.d.ts +0 -1
- package/dist/types/utils/oauth/cloudflare-ai-gateway.d.ts +0 -18
- package/dist/types/utils/oauth/deepseek.d.ts +0 -10
- package/dist/types/utils/oauth/firepass.d.ts +0 -1
- package/dist/types/utils/oauth/fireworks.d.ts +0 -1
- package/dist/types/utils/oauth/huggingface.d.ts +0 -19
- package/dist/types/utils/oauth/kagi.d.ts +0 -17
- package/dist/types/utils/oauth/kilo.d.ts +0 -5
- package/dist/types/utils/oauth/litellm.d.ts +0 -18
- package/dist/types/utils/oauth/lm-studio.d.ts +0 -17
- package/dist/types/utils/oauth/moonshot.d.ts +0 -1
- package/dist/types/utils/oauth/nanogpt.d.ts +0 -1
- package/dist/types/utils/oauth/nvidia.d.ts +0 -18
- package/dist/types/utils/oauth/ollama-cloud.d.ts +0 -2
- package/dist/types/utils/oauth/ollama.d.ts +0 -18
- package/dist/types/utils/oauth/openrouter.d.ts +0 -1
- package/dist/types/utils/oauth/parallel.d.ts +0 -17
- package/dist/types/utils/oauth/qianfan.d.ts +0 -17
- package/dist/types/utils/oauth/qwen-portal.d.ts +0 -19
- package/dist/types/utils/oauth/synthetic.d.ts +0 -1
- package/dist/types/utils/oauth/tavily.d.ts +0 -17
- package/dist/types/utils/oauth/together.d.ts +0 -1
- package/dist/types/utils/oauth/venice.d.ts +0 -18
- package/dist/types/utils/oauth/vercel-ai-gateway.d.ts +0 -18
- package/dist/types/utils/oauth/vllm.d.ts +0 -16
- package/dist/types/utils/oauth/zai.d.ts +0 -18
- package/dist/types/utils/oauth/zenmux.d.ts +0 -1
- package/dist/types/utils/oauth/zhipu.d.ts +0 -18
- package/src/model-cache.ts +0 -129
- package/src/model-manager.ts +0 -469
- package/src/model-thinking.ts +0 -756
- package/src/models.json +0 -60287
- package/src/models.json.d.ts +0 -9
- package/src/models.ts +0 -56
- package/src/provider-models/bundled-references.ts +0 -38
- package/src/provider-models/descriptors.ts +0 -364
- package/src/provider-models/google.ts +0 -88
- package/src/provider-models/index.ts +0 -5
- package/src/provider-models/ollama.ts +0 -153
- package/src/provider-models/openai-compat.ts +0 -2904
- package/src/provider-models/special.ts +0 -67
- package/src/utils/discovery/antigravity.ts +0 -261
- package/src/utils/discovery/codex.ts +0 -371
- package/src/utils/discovery/cursor.ts +0 -306
- package/src/utils/discovery/gemini.ts +0 -248
- package/src/utils/discovery/index.ts +0 -4
- package/src/utils/discovery/openai-compatible.ts +0 -224
- package/src/utils/oauth/gitlab-duo.ts +0 -123
- package/src/utils/oauth/index.ts +0 -502
- /package/dist/types/{utils/oauth/__tests__/xai-oauth.test.d.ts → providers/__tests__/google-auth.test.d.ts} +0 -0
- /package/dist/types/{utils → registry}/oauth/callback-server.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/cursor.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/gitlab-duo.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/google-antigravity.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/google-gemini-cli.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/google-oauth-shared.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/kimi.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/openai-codex.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/opencode.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/perplexity.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/pkce.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/wafer.d.ts +0 -0
- /package/dist/types/{utils → registry}/oauth/xiaomi.d.ts +0 -0
- /package/src/{utils → registry}/oauth/callback-server.ts +0 -0
- /package/src/{utils → registry}/oauth/cursor.ts +0 -0
- /package/src/{utils → registry}/oauth/google-oauth-shared.ts +0 -0
- /package/src/{utils → registry}/oauth/kimi.ts +0 -0
- /package/src/{utils → registry}/oauth/oauth.html +0 -0
- /package/src/{utils → registry}/oauth/openai-codex.ts +0 -0
- /package/src/{utils → registry}/oauth/opencode.ts +0 -0
- /package/src/{utils → registry}/oauth/perplexity.ts +0 -0
- /package/src/{utils → registry}/oauth/pkce.ts +0 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { KnownProvider } from "@prometheus-ai/catalog";
|
|
2
|
+
import { aimlApiProvider } from "./aimlapi";
|
|
3
|
+
import { alibabaCodingPlanProvider } from "./alibaba-coding-plan";
|
|
4
|
+
import { amazonBedrockProvider } from "./amazon-bedrock";
|
|
5
|
+
import { anthropicProvider } from "./anthropic";
|
|
6
|
+
import { cerebrasProvider } from "./cerebras";
|
|
7
|
+
import { cloudflareAiGatewayProvider } from "./cloudflare-ai-gateway";
|
|
8
|
+
import { cursorProvider } from "./cursor";
|
|
9
|
+
import { deepseekProvider } from "./deepseek";
|
|
10
|
+
import { firepassProvider } from "./firepass";
|
|
11
|
+
import { fireworksProvider } from "./fireworks";
|
|
12
|
+
import { githubCopilotProvider } from "./github-copilot";
|
|
13
|
+
import { gitlabDuoProvider } from "./gitlab-duo";
|
|
14
|
+
import { googleProvider } from "./google";
|
|
15
|
+
import { googleAntigravityProvider } from "./google-antigravity";
|
|
16
|
+
import { googleGeminiCliProvider } from "./google-gemini-cli";
|
|
17
|
+
import { googleVertexProvider } from "./google-vertex";
|
|
18
|
+
import { groqProvider } from "./groq";
|
|
19
|
+
import { huggingfaceProvider } from "./huggingface";
|
|
20
|
+
import { kagiProvider } from "./kagi";
|
|
21
|
+
import { kiloProvider } from "./kilo";
|
|
22
|
+
import { kimiCodeProvider } from "./kimi-code";
|
|
23
|
+
import { litellmProvider } from "./litellm";
|
|
24
|
+
import { lmStudioProvider } from "./lm-studio";
|
|
25
|
+
import { minimaxProvider } from "./minimax";
|
|
26
|
+
import { minimaxCodeProvider } from "./minimax-code";
|
|
27
|
+
import { minimaxCodeCnProvider } from "./minimax-code-cn";
|
|
28
|
+
import { mistralProvider } from "./mistral";
|
|
29
|
+
import { moonshotProvider } from "./moonshot";
|
|
30
|
+
import { nanogptProvider } from "./nanogpt";
|
|
31
|
+
import { nvidiaProvider } from "./nvidia";
|
|
32
|
+
import { ollamaProvider } from "./ollama";
|
|
33
|
+
import { ollamaCloudProvider } from "./ollama-cloud";
|
|
34
|
+
import { openaiProvider } from "./openai";
|
|
35
|
+
import { openaiCodexProvider } from "./openai-codex";
|
|
36
|
+
import { openaiCodexDeviceProvider } from "./openai-codex-device";
|
|
37
|
+
import { opencodeGoProvider } from "./opencode-go";
|
|
38
|
+
import { opencodeZenProvider } from "./opencode-zen";
|
|
39
|
+
import { openrouterProvider } from "./openrouter";
|
|
40
|
+
import { parallelProvider } from "./parallel";
|
|
41
|
+
import { perplexityProvider } from "./perplexity";
|
|
42
|
+
import { qianfanProvider } from "./qianfan";
|
|
43
|
+
import { qwenPortalProvider } from "./qwen-portal";
|
|
44
|
+
import { syntheticProvider } from "./synthetic";
|
|
45
|
+
import { tavilyProvider } from "./tavily";
|
|
46
|
+
import { togetherProvider } from "./together";
|
|
47
|
+
import type { ProviderDefinition } from "./types";
|
|
48
|
+
import { veniceProvider } from "./venice";
|
|
49
|
+
import { vercelAiGatewayProvider } from "./vercel-ai-gateway";
|
|
50
|
+
import { vllmProvider } from "./vllm";
|
|
51
|
+
import { waferPassProvider } from "./wafer-pass";
|
|
52
|
+
import { waferServerlessProvider } from "./wafer-serverless";
|
|
53
|
+
import { xaiProvider } from "./xai";
|
|
54
|
+
import { xaiOauthProvider } from "./xai-oauth";
|
|
55
|
+
import { xiaomiProvider } from "./xiaomi";
|
|
56
|
+
import { xiaomiTokenPlanAmsProvider } from "./xiaomi-token-plan-ams";
|
|
57
|
+
import { xiaomiTokenPlanCnProvider } from "./xiaomi-token-plan-cn";
|
|
58
|
+
import { xiaomiTokenPlanSgpProvider } from "./xiaomi-token-plan-sgp";
|
|
59
|
+
import { zaiProvider } from "./zai";
|
|
60
|
+
import { zenmuxProvider } from "./zenmux";
|
|
61
|
+
import { zhipuCodingPlanProvider } from "./zhipu-coding-plan";
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The single per-provider list. Adding a provider = create `./providers/<id>.ts`
|
|
65
|
+
* and add its export here. Every legacy structure (`KnownProvider`/`OAuthProvider`
|
|
66
|
+
* unions, descriptors, env map, login list, refresh/login dispatch, CLI callback
|
|
67
|
+
* maps) is derived from this registry. Order matches the interactive `/login`
|
|
68
|
+
* list for the loginable providers; non-login model providers are appended.
|
|
69
|
+
*/
|
|
70
|
+
const ALL = [
|
|
71
|
+
openaiCodexProvider,
|
|
72
|
+
anthropicProvider,
|
|
73
|
+
zaiProvider,
|
|
74
|
+
kimiCodeProvider,
|
|
75
|
+
openrouterProvider,
|
|
76
|
+
githubCopilotProvider,
|
|
77
|
+
cursorProvider,
|
|
78
|
+
googleAntigravityProvider,
|
|
79
|
+
googleGeminiCliProvider,
|
|
80
|
+
openaiCodexDeviceProvider,
|
|
81
|
+
xaiOauthProvider,
|
|
82
|
+
gitlabDuoProvider,
|
|
83
|
+
alibabaCodingPlanProvider,
|
|
84
|
+
aimlApiProvider,
|
|
85
|
+
zhipuCodingPlanProvider,
|
|
86
|
+
qwenPortalProvider,
|
|
87
|
+
minimaxCodeProvider,
|
|
88
|
+
minimaxCodeCnProvider,
|
|
89
|
+
xiaomiProvider,
|
|
90
|
+
xiaomiTokenPlanSgpProvider,
|
|
91
|
+
xiaomiTokenPlanAmsProvider,
|
|
92
|
+
xiaomiTokenPlanCnProvider,
|
|
93
|
+
firepassProvider,
|
|
94
|
+
waferPassProvider,
|
|
95
|
+
deepseekProvider,
|
|
96
|
+
moonshotProvider,
|
|
97
|
+
cerebrasProvider,
|
|
98
|
+
fireworksProvider,
|
|
99
|
+
togetherProvider,
|
|
100
|
+
nvidiaProvider,
|
|
101
|
+
huggingfaceProvider,
|
|
102
|
+
perplexityProvider,
|
|
103
|
+
qianfanProvider,
|
|
104
|
+
veniceProvider,
|
|
105
|
+
syntheticProvider,
|
|
106
|
+
nanogptProvider,
|
|
107
|
+
waferServerlessProvider,
|
|
108
|
+
vercelAiGatewayProvider,
|
|
109
|
+
cloudflareAiGatewayProvider,
|
|
110
|
+
litellmProvider,
|
|
111
|
+
kiloProvider,
|
|
112
|
+
zenmuxProvider,
|
|
113
|
+
opencodeZenProvider,
|
|
114
|
+
opencodeGoProvider,
|
|
115
|
+
tavilyProvider,
|
|
116
|
+
kagiProvider,
|
|
117
|
+
parallelProvider,
|
|
118
|
+
ollamaProvider,
|
|
119
|
+
ollamaCloudProvider,
|
|
120
|
+
lmStudioProvider,
|
|
121
|
+
vllmProvider,
|
|
122
|
+
openaiProvider,
|
|
123
|
+
googleProvider,
|
|
124
|
+
googleVertexProvider,
|
|
125
|
+
xaiProvider,
|
|
126
|
+
groqProvider,
|
|
127
|
+
mistralProvider,
|
|
128
|
+
minimaxProvider,
|
|
129
|
+
amazonBedrockProvider,
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
export type RegistryDef = (typeof ALL)[number];
|
|
133
|
+
export const PROVIDER_REGISTRY: readonly ProviderDefinition[] = ALL;
|
|
134
|
+
|
|
135
|
+
const BY_ID = new Map<string, ProviderDefinition>(ALL.map(p => [p.id, p] as [string, ProviderDefinition]));
|
|
136
|
+
|
|
137
|
+
export function getProviderDefinition(id: string): ProviderDefinition | undefined {
|
|
138
|
+
return BY_ID.get(id);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Compile-time completeness: every catalog chat-model provider must have a registry definition. */
|
|
142
|
+
type _MissingCatalogProviders = Exclude<KnownProvider, RegistryDef["id"]>;
|
|
143
|
+
type _CheckRegistryComplete = _MissingCatalogProviders extends never
|
|
144
|
+
? true
|
|
145
|
+
: ["registry is missing catalog providers", _MissingCatalogProviders];
|
|
146
|
+
true satisfies _CheckRegistryComplete;
|
|
147
|
+
|
|
148
|
+
/** Loginable providers (those carrying a `login` flow). */
|
|
149
|
+
export type OAuthProviderUnion = Extract<RegistryDef, { login: object }>["id"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** Synthetic login flow (API key paste against https://api.synthetic.new/openai/v1). */
|
|
2
1
|
import { createApiKeyLogin } from "./api-key-login";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
3
|
|
|
4
4
|
export const loginSynthetic = createApiKeyLogin({
|
|
5
5
|
providerLabel: "Synthetic",
|
|
@@ -13,3 +13,9 @@ export const loginSynthetic = createApiKeyLogin({
|
|
|
13
13
|
modelsUrl: "https://api.synthetic.new/openai/v1/models",
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
|
+
|
|
17
|
+
export const syntheticProvider = {
|
|
18
|
+
id: "synthetic",
|
|
19
|
+
name: "Synthetic",
|
|
20
|
+
login: loginSynthetic,
|
|
21
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Tavily web search uses an API key from the account settings page.
|
|
5
|
-
* This is an API key flow:
|
|
6
|
-
* 1. Open browser to Tavily settings
|
|
7
|
-
* 2. User copies API key
|
|
8
|
-
* 3. User pastes key into CLI
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type { OAuthController } from "./types";
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
12
3
|
|
|
13
4
|
const AUTH_URL = "https://app.tavily.com/home";
|
|
14
5
|
|
|
@@ -18,7 +9,7 @@ const AUTH_URL = "https://app.tavily.com/home";
|
|
|
18
9
|
* Opens browser to API keys page and prompts user to paste their API key.
|
|
19
10
|
* Returns the API key directly (not OAuthCredentials - this isn't OAuth).
|
|
20
11
|
*/
|
|
21
|
-
export async function loginTavily(options:
|
|
12
|
+
export async function loginTavily(options: OAuthLoginCallbacks): Promise<string> {
|
|
22
13
|
if (!options.onPrompt) {
|
|
23
14
|
throw new Error("Tavily login requires onPrompt callback");
|
|
24
15
|
}
|
|
@@ -44,3 +35,10 @@ export async function loginTavily(options: OAuthController): Promise<string> {
|
|
|
44
35
|
|
|
45
36
|
return trimmed;
|
|
46
37
|
}
|
|
38
|
+
|
|
39
|
+
export const tavilyProvider = {
|
|
40
|
+
id: "tavily",
|
|
41
|
+
name: "Tavily",
|
|
42
|
+
envKeys: "TAVILY_API_KEY",
|
|
43
|
+
login: (cb: OAuthLoginCallbacks) => loginTavily(cb),
|
|
44
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** Together login flow (API key paste against https://api.together.xyz/v1). */
|
|
2
1
|
import { createApiKeyLogin } from "./api-key-login";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
3
|
|
|
4
4
|
export const loginTogether = createApiKeyLogin({
|
|
5
5
|
providerLabel: "Together",
|
|
@@ -14,3 +14,9 @@ export const loginTogether = createApiKeyLogin({
|
|
|
14
14
|
model: "moonshotai/Kimi-K2.5",
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
|
+
|
|
18
|
+
export const togetherProvider = {
|
|
19
|
+
id: "together",
|
|
20
|
+
name: "Together",
|
|
21
|
+
login: (cb: Parameters<typeof loginTogether>[0]) => loginTogether(cb),
|
|
22
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single-source provider auth model. Every provider — model providers,
|
|
3
|
+
* gateways, search/tool credentials, and login-only flows — is described by
|
|
4
|
+
* one {@link ProviderDefinition}. The legacy scattered structures (the
|
|
5
|
+
* `OAuthProvider` union, `serviceProviderMap`, `builtInOAuthProviders`, the
|
|
6
|
+
* refresh/login switches, and the CLI callback maps) are all *derived* from
|
|
7
|
+
* the registry of these definitions. Adding a provider is one new file in
|
|
8
|
+
* `./providers/` plus one line in `./registry.ts`. Model-catalog metadata
|
|
9
|
+
* (default model, model-manager factory, catalog discovery) lives in
|
|
10
|
+
* `@prometheus-ai/catalog`'s descriptor table.
|
|
11
|
+
*/
|
|
12
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* API-key environment fallback: either a single env var name (e.g.
|
|
16
|
+
* `"OPENAI_API_KEY"`) or a resolver that inspects several env vars / probes
|
|
17
|
+
* the host (Vertex ADC, Bedrock credential chains, …).
|
|
18
|
+
*/
|
|
19
|
+
export type KeyResolver = string | (() => string | undefined);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Declarative description of a single provider's auth/login wiring. All
|
|
23
|
+
* fields are optional except `id`/`name`; presence of a field opts the
|
|
24
|
+
* provider into a derived structure:
|
|
25
|
+
*
|
|
26
|
+
* - `envKeys` present ⇒ env-var fallback in `getEnvApiKey`, overriding the
|
|
27
|
+
* catalog table's `envVars` for that provider.
|
|
28
|
+
* - `login` present ⇒ member of `OAuthProvider`, shown in the `/login` list
|
|
29
|
+
* (unless `showInLoginList === false`) and dispatchable via `AuthStorage.login`.
|
|
30
|
+
* - `callbackPort` present ⇒ entry in the auth-broker `CALLBACK_PORTS` map.
|
|
31
|
+
* - `pasteCodeFlow` ⇒ member of `PASTE_CODE_LOGIN_PROVIDERS`.
|
|
32
|
+
*
|
|
33
|
+
* Heavy OAuth flow modules MUST be reached through dynamic-import thunks in
|
|
34
|
+
* `login`/`refreshToken` so they stay out of the eager startup graph.
|
|
35
|
+
*/
|
|
36
|
+
export interface ProviderDefinition {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly name: string;
|
|
39
|
+
/** Login-list availability flag. Defaults to true when shown. */
|
|
40
|
+
readonly available?: boolean;
|
|
41
|
+
/** Whether to surface in the interactive login list. Defaults to true when `login` is present. */
|
|
42
|
+
readonly showInLoginList?: boolean;
|
|
43
|
+
// --- env-var fallback (the catalog table's `envVars` supplies plain names; set this only for computed resolvers) ---
|
|
44
|
+
readonly envKeys?: KeyResolver;
|
|
45
|
+
// --- interactive login (OAuthProviderInterface-compatible) ---
|
|
46
|
+
readonly login?: (callbacks: OAuthLoginCallbacks) => Promise<OAuthCredentials | string>;
|
|
47
|
+
readonly refreshToken?: (credentials: OAuthCredentials) => Promise<OAuthCredentials>;
|
|
48
|
+
readonly getApiKey?: (credentials: OAuthCredentials) => string;
|
|
49
|
+
/** Store OAuth credentials under a different provider id (e.g. `openai-codex-device` ⇒ `openai-codex`). */
|
|
50
|
+
readonly storeCredentialsAs?: string;
|
|
51
|
+
// --- coding-agent login UX ---
|
|
52
|
+
/** Auth-broker local callback-server port. Presence ⇒ entry in `CALLBACK_PORTS`. */
|
|
53
|
+
readonly callbackPort?: number;
|
|
54
|
+
/** OAuth flow needs a pasted code/redirect URL rather than a callback server. */
|
|
55
|
+
readonly pasteCodeFlow?: boolean;
|
|
56
|
+
}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Venice login flow.
|
|
3
|
-
*
|
|
4
|
-
* Venice provides OpenAI-compatible models via https://api.venice.ai/api/v1.
|
|
5
|
-
*
|
|
6
|
-
* This is not OAuth - it's a simple API key flow:
|
|
7
|
-
* 1. Open browser to Venice API key settings
|
|
8
|
-
* 2. User copies their API key
|
|
9
|
-
* 3. User pastes the API key into the CLI
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
import { validateOpenAICompatibleApiKey } from "./api-key-validation";
|
|
13
|
-
import type { OAuthController } from "./types";
|
|
2
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
3
|
+
import type { ProviderDefinition } from "./types";
|
|
14
4
|
|
|
15
5
|
const AUTH_URL = "https://venice.ai/settings/api";
|
|
16
6
|
const API_BASE_URL = "https://api.venice.ai/api/v1";
|
|
@@ -57,3 +47,9 @@ export async function loginVenice(options: OAuthController): Promise<string> {
|
|
|
57
47
|
|
|
58
48
|
return trimmed;
|
|
59
49
|
}
|
|
50
|
+
|
|
51
|
+
export const veniceProvider = {
|
|
52
|
+
id: "venice",
|
|
53
|
+
name: "Venice",
|
|
54
|
+
login: (cb: OAuthLoginCallbacks) => loginVenice(cb),
|
|
55
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Vercel AI Gateway proxies upstream model providers through a unified endpoint.
|
|
5
|
-
*
|
|
6
|
-
* This is not OAuth - it's a simple API key flow:
|
|
7
|
-
* 1. Open Vercel AI Gateway docs
|
|
8
|
-
* 2. User copies their API key
|
|
9
|
-
* 3. User pastes the API key into the CLI
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import type { OAuthController } from "./types";
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
13
3
|
|
|
14
4
|
const AUTH_URL = "https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys&title=AI+Gateway+API+Keys";
|
|
15
5
|
|
|
16
|
-
/**
|
|
17
|
-
* Login to Vercel AI Gateway.
|
|
18
|
-
*
|
|
19
|
-
* Opens browser to Vercel AI Gateway docs and prompts for an API key.
|
|
20
|
-
* Returns the API key directly (not OAuthCredentials - this isn't OAuth).
|
|
21
|
-
*/
|
|
22
6
|
export async function loginVercelAiGateway(options: OAuthController): Promise<string> {
|
|
23
7
|
if (!options.onPrompt) {
|
|
24
8
|
throw new Error("Vercel AI Gateway login requires onPrompt callback");
|
|
@@ -45,3 +29,9 @@ export async function loginVercelAiGateway(options: OAuthController): Promise<st
|
|
|
45
29
|
|
|
46
30
|
return trimmed;
|
|
47
31
|
}
|
|
32
|
+
|
|
33
|
+
export const vercelAiGatewayProvider = {
|
|
34
|
+
id: "vercel-ai-gateway",
|
|
35
|
+
name: "Vercel AI Gateway",
|
|
36
|
+
login: (cb: OAuthLoginCallbacks) => loginVercelAiGateway(cb),
|
|
37
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* vLLM is commonly self-hosted with an OpenAI-compatible API at a local base URL.
|
|
5
|
-
* Some deployments require a bearer token, others allow unauthenticated access.
|
|
6
|
-
*
|
|
7
|
-
* This flow stores an API-key-style credential used by `/login` and auth storage.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { OAuthController, OAuthProvider } from "./types";
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks, OAuthProvider } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
11
3
|
|
|
12
4
|
const PROVIDER_ID: OAuthProvider = "vllm";
|
|
13
5
|
const AUTH_URL = "https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html";
|
|
14
6
|
const DEFAULT_LOCAL_BASE_URL = "http://127.0.0.1:8000/v1";
|
|
15
7
|
const DEFAULT_LOCAL_TOKEN = "vllm-local";
|
|
16
|
-
|
|
17
|
-
* Login to vLLM.
|
|
18
|
-
*
|
|
19
|
-
* Opens vLLM OpenAI-compatible auth docs, prompts for an optional token,
|
|
20
|
-
* and returns a stored key value.
|
|
21
|
-
*/
|
|
8
|
+
|
|
22
9
|
export async function loginVllm(options: OAuthController): Promise<string> {
|
|
23
10
|
if (!options.onPrompt) {
|
|
24
11
|
throw new Error(`${PROVIDER_ID} login requires onPrompt callback`);
|
|
@@ -38,3 +25,9 @@ export async function loginVllm(options: OAuthController): Promise<string> {
|
|
|
38
25
|
const trimmed = apiKey.trim();
|
|
39
26
|
return trimmed || DEFAULT_LOCAL_TOKEN;
|
|
40
27
|
}
|
|
28
|
+
|
|
29
|
+
export const vllmProvider = {
|
|
30
|
+
id: "vllm",
|
|
31
|
+
name: "vLLM (Local OpenAI-compatible)",
|
|
32
|
+
login: (cb: OAuthLoginCallbacks) => loginVllm(cb),
|
|
33
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
|
+
|
|
4
|
+
export const waferPassProvider = {
|
|
5
|
+
id: "wafer-pass",
|
|
6
|
+
name: "Wafer Pass (flat-rate subscription)",
|
|
7
|
+
login: async (cb: OAuthLoginCallbacks) => {
|
|
8
|
+
// Lazy import: keep heavy OAuth flow modules out of the eager registry graph.
|
|
9
|
+
const { loginWaferPass } = await import("./oauth/wafer");
|
|
10
|
+
return loginWaferPass(cb);
|
|
11
|
+
},
|
|
12
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
|
+
|
|
4
|
+
export const waferServerlessProvider = {
|
|
5
|
+
id: "wafer-serverless",
|
|
6
|
+
name: "Wafer Serverless (pay-as-you-go)",
|
|
7
|
+
login: async (cb: OAuthLoginCallbacks) => {
|
|
8
|
+
// Lazy import: keep heavy OAuth flow modules out of the eager registry graph.
|
|
9
|
+
const { loginWaferServerless } = await import("./oauth/wafer");
|
|
10
|
+
return loginWaferServerless(cb);
|
|
11
|
+
},
|
|
12
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
|
+
|
|
4
|
+
export const xaiOauthProvider = {
|
|
5
|
+
id: "xai-oauth",
|
|
6
|
+
name: "xAI Grok OAuth (SuperGrok Subscription)",
|
|
7
|
+
login: async (cb: OAuthLoginCallbacks) => {
|
|
8
|
+
// Lazy import: keep heavy OAuth flow modules out of the eager registry graph.
|
|
9
|
+
const { loginXAIOAuth } = await import("./oauth/xai-oauth");
|
|
10
|
+
return loginXAIOAuth(cb);
|
|
11
|
+
},
|
|
12
|
+
refreshToken: async (credentials: OAuthCredentials) => {
|
|
13
|
+
// Lazy import: keep heavy OAuth flow modules out of the eager registry graph.
|
|
14
|
+
const { refreshXAIOAuthToken } = await import("./oauth/xai-oauth");
|
|
15
|
+
return refreshXAIOAuthToken(credentials.refresh);
|
|
16
|
+
},
|
|
17
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
|
+
|
|
4
|
+
export const xiaomiTokenPlanAmsProvider = {
|
|
5
|
+
id: "xiaomi-token-plan-ams",
|
|
6
|
+
name: "Xiaomi Token Plan (Europe)",
|
|
7
|
+
login: async (cb: OAuthLoginCallbacks) => {
|
|
8
|
+
// Lazy import: keep heavy OAuth flow modules out of the eager registry graph.
|
|
9
|
+
const { loginXiaomiTokenPlan } = await import("./oauth/xiaomi");
|
|
10
|
+
return loginXiaomiTokenPlan(cb, "ams");
|
|
11
|
+
},
|
|
12
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
|
+
|
|
4
|
+
export const xiaomiTokenPlanCnProvider = {
|
|
5
|
+
id: "xiaomi-token-plan-cn",
|
|
6
|
+
name: "Xiaomi Token Plan (China)",
|
|
7
|
+
login: async (cb: OAuthLoginCallbacks) => {
|
|
8
|
+
// Lazy import: keep heavy OAuth flow modules out of the eager registry graph.
|
|
9
|
+
const { loginXiaomiTokenPlan } = await import("./oauth/xiaomi");
|
|
10
|
+
return loginXiaomiTokenPlan(cb, "cn");
|
|
11
|
+
},
|
|
12
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
|
+
|
|
4
|
+
export const xiaomiTokenPlanSgpProvider = {
|
|
5
|
+
id: "xiaomi-token-plan-sgp",
|
|
6
|
+
name: "Xiaomi Token Plan (Singapore)",
|
|
7
|
+
login: async (cb: OAuthLoginCallbacks) => {
|
|
8
|
+
// Lazy import: keep heavy OAuth flow modules out of the eager registry graph.
|
|
9
|
+
const { loginXiaomiTokenPlan } = await import("./oauth/xiaomi");
|
|
10
|
+
return loginXiaomiTokenPlan(cb, "sgp");
|
|
11
|
+
},
|
|
12
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
import type { ProviderDefinition } from "./types";
|
|
3
|
+
|
|
4
|
+
export const xiaomiProvider = {
|
|
5
|
+
id: "xiaomi",
|
|
6
|
+
name: "Xiaomi MiMo",
|
|
7
|
+
login: async (cb: OAuthLoginCallbacks) => {
|
|
8
|
+
// Lazy import: keep heavy OAuth flow modules out of the eager registry graph.
|
|
9
|
+
const { loginXiaomi } = await import("./oauth/xiaomi");
|
|
10
|
+
return loginXiaomi(cb);
|
|
11
|
+
},
|
|
12
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -1,39 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Z.AI login flow.
|
|
3
|
-
*
|
|
4
|
-
* Z.AI is a platform that provides access to GLM models through an OpenAI-compatible API.
|
|
5
|
-
* API docs: https://docs.z.ai/guides/overview/quick-start
|
|
6
|
-
*
|
|
7
|
-
* This is not OAuth - it's a simple API key flow:
|
|
8
|
-
* 1. User gets their API key from https://z.ai/settings/api-keys
|
|
9
|
-
* 2. User pastes the API key into the CLI
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
import { validateOpenAICompatibleApiKey } from "./api-key-validation";
|
|
13
|
-
import type { OAuthController } from "./types";
|
|
2
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
3
|
+
import type { ProviderDefinition } from "./types";
|
|
14
4
|
|
|
15
5
|
const AUTH_URL = "https://z.ai/manage-apikey/apikey-list";
|
|
16
6
|
const API_BASE_URL = "https://api.z.ai/api/coding/paas/v4";
|
|
17
|
-
const VALIDATION_MODEL = "glm-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Login to Z.AI.
|
|
21
|
-
*
|
|
22
|
-
* Opens browser to API keys page, prompts user to paste their API key.
|
|
23
|
-
* Returns the API key directly (not OAuthCredentials - this isn't OAuth).
|
|
24
|
-
*/
|
|
7
|
+
const VALIDATION_MODEL = "glm-5.2";
|
|
8
|
+
|
|
25
9
|
export async function loginZai(options: OAuthController): Promise<string> {
|
|
26
10
|
if (!options.onPrompt) {
|
|
27
11
|
throw new Error("Z.AI login requires onPrompt callback");
|
|
28
12
|
}
|
|
29
13
|
|
|
30
|
-
// Open browser to API keys page
|
|
31
14
|
options.onAuth?.({
|
|
32
15
|
url: AUTH_URL,
|
|
33
16
|
instructions: "Copy your API key from the dashboard",
|
|
34
17
|
});
|
|
35
18
|
|
|
36
|
-
// Prompt user to paste their API key
|
|
37
19
|
const apiKey = await options.onPrompt({
|
|
38
20
|
message: "Paste your Z.AI API key",
|
|
39
21
|
placeholder: "sk-...",
|
|
@@ -58,3 +40,9 @@ export async function loginZai(options: OAuthController): Promise<string> {
|
|
|
58
40
|
});
|
|
59
41
|
return trimmed;
|
|
60
42
|
}
|
|
43
|
+
|
|
44
|
+
export const zaiProvider = {
|
|
45
|
+
id: "zai",
|
|
46
|
+
name: "Z.AI (GLM Coding Plan)",
|
|
47
|
+
login: (cb: OAuthLoginCallbacks) => loginZai(cb),
|
|
48
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/** ZenMux login flow (API key paste, validated via /models). */
|
|
2
1
|
import { createApiKeyLogin } from "./api-key-login";
|
|
2
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
3
|
+
import type { ProviderDefinition } from "./types";
|
|
3
4
|
|
|
4
5
|
export const loginZenMux = createApiKeyLogin({
|
|
5
6
|
providerLabel: "ZenMux",
|
|
@@ -13,3 +14,9 @@ export const loginZenMux = createApiKeyLogin({
|
|
|
13
14
|
modelsUrl: "https://zenmux.ai/api/v1/models",
|
|
14
15
|
},
|
|
15
16
|
});
|
|
17
|
+
|
|
18
|
+
export const zenmuxProvider = {
|
|
19
|
+
id: "zenmux",
|
|
20
|
+
name: "ZenMux",
|
|
21
|
+
login: (cb: OAuthLoginCallbacks) => loginZenMux(cb),
|
|
22
|
+
} as const satisfies ProviderDefinition;
|
|
@@ -1,42 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zhipu Coding Plan login flow.
|
|
3
|
-
*
|
|
4
|
-
* GLM Coding Plan provides an OpenAI-compatible API on the dedicated coding
|
|
5
|
-
* endpoint. API docs: https://docs.bigmodel.cn/cn/coding-plan/quick-start
|
|
6
|
-
*
|
|
7
|
-
* Simple API key flow:
|
|
8
|
-
* 1. User gets a Coding Plan API key from https://bigmodel.cn/coding-plan/personal/overview
|
|
9
|
-
* 2. User pastes the API key into the CLI
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
import { validateOpenAICompatibleApiKey } from "./api-key-validation";
|
|
13
|
-
import type { OAuthController } from "./types";
|
|
2
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
3
|
+
import type { ProviderDefinition } from "./types";
|
|
14
4
|
|
|
15
5
|
const AUTH_URL = "https://bigmodel.cn/coding-plan/personal/overview";
|
|
16
6
|
const API_BASE_URL = "https://open.bigmodel.cn/api/coding/paas/v4";
|
|
17
7
|
const VALIDATION_MODEL = "glm-5.1";
|
|
18
8
|
|
|
19
|
-
/**
|
|
20
|
-
* Login to Zhipu Coding Plan.
|
|
21
|
-
*
|
|
22
|
-
* Opens browser to API keys page, prompts user to paste their API key.
|
|
23
|
-
* Returns the API key directly (not OAuthCredentials - this isn't OAuth).
|
|
24
|
-
*/
|
|
25
9
|
export async function loginZhipuCodingPlan(options: OAuthController): Promise<string> {
|
|
26
10
|
if (!options.onPrompt) {
|
|
27
11
|
throw new Error("Zhipu Coding Plan login requires onPrompt callback");
|
|
28
12
|
}
|
|
29
13
|
|
|
30
|
-
// Open browser to API keys page
|
|
31
14
|
options.onAuth?.({
|
|
32
15
|
url: AUTH_URL,
|
|
33
16
|
instructions: "Copy your API key from the Coding Plan dashboard",
|
|
34
17
|
});
|
|
35
18
|
|
|
36
|
-
// Prompt user to paste their API key
|
|
37
19
|
const apiKey = await options.onPrompt({
|
|
38
20
|
message: "Paste your Zhipu API key",
|
|
39
|
-
placeholder: "
|
|
21
|
+
placeholder: "<id>.<secret>",
|
|
40
22
|
});
|
|
41
23
|
|
|
42
24
|
if (options.signal?.aborted) {
|
|
@@ -58,3 +40,9 @@ export async function loginZhipuCodingPlan(options: OAuthController): Promise<st
|
|
|
58
40
|
});
|
|
59
41
|
return trimmed;
|
|
60
42
|
}
|
|
43
|
+
|
|
44
|
+
export const zhipuCodingPlanProvider = {
|
|
45
|
+
id: "zhipu-coding-plan",
|
|
46
|
+
name: "Zhipu Coding Plan (智谱)",
|
|
47
|
+
login: (cb: OAuthLoginCallbacks) => loginZhipuCodingPlan(cb),
|
|
48
|
+
} as const satisfies ProviderDefinition;
|