@prometheus-ai/ai 0.5.4 → 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
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import type { Tool as OpenAITool } from "openai/resources/responses/responses";
|
|
2
1
|
import type { Model, ServiceTier, StreamFunction, StreamOptions, Tool, ToolChoice } from "../types";
|
|
3
2
|
import { type OpenAIResponsesToolChoice } from "../utils/tool-choice";
|
|
3
|
+
import type { Tool as OpenAITool } from "./openai-responses-wire";
|
|
4
4
|
export declare function normalizeOpenAIResponsesPromptCacheKey(sessionId: string | undefined): string | undefined;
|
|
5
5
|
export interface OpenAIResponsesOptions extends StreamOptions {
|
|
6
6
|
reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
7
7
|
reasoningSummary?: "auto" | "detailed" | "concise" | null;
|
|
8
8
|
serviceTier?: ServiceTier;
|
|
9
9
|
toolChoice?: ToolChoice;
|
|
10
|
+
/**
|
|
11
|
+
* Stateful turns: chain via `previous_response_id` + delta input instead of
|
|
12
|
+
* replaying the full transcript. Forces `store: true` (the platform only
|
|
13
|
+
* resolves stored responses). Defaults ON against the official OpenAI API
|
|
14
|
+
* and OFF for other Responses endpoints; `PROMETHEUS_OPENAI_STATEFUL` overrides the
|
|
15
|
+
* default, and `false` here vetoes everything. Requires `sessionId` +
|
|
16
|
+
* `providerSessionState`. Falls back to a full replay whenever history
|
|
17
|
+
* mutates or the server reports a stale id.
|
|
18
|
+
*/
|
|
19
|
+
statefulResponses?: boolean;
|
|
10
20
|
/**
|
|
11
21
|
* Enforce strict tool call/result pairing when building Responses API inputs.
|
|
12
22
|
* Azure OpenAI and GitHub Copilot Responses paths require tool results to match prior tool calls.
|
|
@@ -34,8 +44,8 @@ export interface OpenAIResponsesOptions extends StreamOptions {
|
|
|
34
44
|
*/
|
|
35
45
|
omitReasoningEffort?: boolean;
|
|
36
46
|
/**
|
|
37
|
-
* Extra request headers merged onto the
|
|
38
|
-
*
|
|
47
|
+
* Extra request headers merged onto the model/copilot defaults. Used by
|
|
48
|
+
* adapter wrappers to inject provider-specific
|
|
39
49
|
* routing or cache hints.
|
|
40
50
|
*/
|
|
41
51
|
headers?: Record<string, string>;
|
|
@@ -51,7 +61,6 @@ export interface OpenAIResponsesOptions extends StreamOptions {
|
|
|
51
61
|
*/
|
|
52
62
|
export declare const streamOpenAIResponses: StreamFunction<"openai-responses">;
|
|
53
63
|
export declare function getOpenAIResponsesCacheSessionId(options: Pick<OpenAIResponsesOptions, "cacheRetention" | "sessionId" | "promptCacheKey"> | undefined): string | undefined;
|
|
54
|
-
export declare function supportsDeveloperRole(modelOrBaseUrl: Pick<Model, "provider" | "baseUrl"> | string): boolean;
|
|
55
64
|
/**
|
|
56
65
|
* Whether this model should get the OpenAI custom-tool grammar variant
|
|
57
66
|
* for `apply_patch`. The generated model catalog sets
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { ProviderHttpError } from "../errors";
|
|
1
2
|
import type { Api, AssistantMessageEventStream as AssistantMessageEventStreamType, Context, Model, SimpleStreamOptions } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Non-2xx response from the auth-gateway `/v1/prometheus/stream` endpoint. `code`
|
|
5
|
+
* carries the gateway's error-type token (`authentication_error`,
|
|
6
|
+
* `rate_limit_error`, `upstream_error`, ...).
|
|
7
|
+
*/
|
|
8
|
+
export declare class AuthGatewayError extends ProviderHttpError {
|
|
9
|
+
constructor(message: string, status: number, headers?: Headers, code?: string);
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Stream a turn through an `prometheus auth-gateway` over the prometheus-native protocol.
|
|
4
13
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Where the OpenAI / Anthropic / Responses route modules translate foreign
|
|
5
5
|
* wire shapes through Prometheus AI's canonical {@link Context}, this module accepts
|
|
6
6
|
* the canonical shape *directly* — for clients that already speak Prometheus AI
|
|
7
|
-
* (containerized prometheus, the swarm extension,
|
|
7
|
+
* (containerized prometheus, the swarm extension, sidecar auth-gateways).
|
|
8
8
|
* Skipping the wire-format → Context → wire-format round-trip cuts
|
|
9
9
|
* per-request CPU but, more importantly, avoids the quantization that those
|
|
10
10
|
* translations impose on first-class Prometheus AI fields (service tier, cache
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* 200 JSON (stream=false): { message: AssistantMessage }
|
|
26
26
|
* 4xx/5xx: { error: { type, message } }
|
|
27
27
|
*/
|
|
28
|
+
import type { AuthGatewayStreamControl } from "../auth-gateway/types";
|
|
28
29
|
import type { AssistantMessageEventStream, Context, SimpleStreamOptions } from "../types";
|
|
29
30
|
export interface PrometheusNativeParsedRequest {
|
|
30
31
|
modelId: string;
|
|
@@ -51,12 +52,12 @@ export declare function parseRequest(body: unknown, _headers?: Headers): Prometh
|
|
|
51
52
|
* canonical event type IS the wire type. Including the rolling
|
|
52
53
|
* `partial: AssistantMessage` on every delta is quadratic in turn length
|
|
53
54
|
* on the wire, but for the loopback / sidecar topology this transport
|
|
54
|
-
* targets (containerized prometheus → host gateway,
|
|
55
|
+
* targets (containerized prometheus → host gateway, isolated slot → prometheus-auth-gateway
|
|
55
56
|
* sidecar) the bandwidth cost is negligible compared to provider latency —
|
|
56
57
|
* and the client gets to feed the events straight into its existing
|
|
57
58
|
* `AssistantMessageEventStream.push()` plumbing with zero translation.
|
|
58
59
|
*/
|
|
59
|
-
export declare function encodeStream(events: AssistantMessageEventStream): ReadableStream<Uint8Array>;
|
|
60
|
+
export declare function encodeStream(events: AssistantMessageEventStream, _requestedModelId?: string, _options?: SimpleStreamOptions, control?: AuthGatewayStreamControl): ReadableStream<Uint8Array>;
|
|
60
61
|
/**
|
|
61
62
|
* Prometheus-native error envelope:
|
|
62
63
|
* `{ error: { type, message } }`
|
|
@@ -7,6 +7,5 @@ import type { Api, AssistantMessage, Message, Model } from "../types";
|
|
|
7
7
|
* For aborted/errored turns, this function:
|
|
8
8
|
* - Preserves tool call structure (unlike converting to text summaries)
|
|
9
9
|
* - Injects synthetic "aborted" tool results
|
|
10
|
-
* - Adds a <turn-aborted> guidance marker for the model
|
|
11
10
|
*/
|
|
12
|
-
export declare function transformMessages<TApi extends Api>(messages: Message[], model: Model<TApi>, normalizeToolCallId?: (id: string, model: Model<TApi>, source: AssistantMessage) => string): Message[];
|
|
11
|
+
export declare function transformMessages<TApi extends Api>(messages: Message[], model: Model<TApi>, normalizeToolCallId?: (id: string, model: Model<TApi>, source: AssistantMessage) => string, maxNormalizedToolCallIdLength?: number, duplicateToolCallIdSuffixPrefix?: string): Message[];
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
export type RateLimitReason = "QUOTA_EXHAUSTED" | "RATE_LIMIT_EXCEEDED" | "MODEL_CAPACITY_EXHAUSTED" | "SERVER_ERROR" | "UNKNOWN";
|
|
6
6
|
/**
|
|
7
7
|
* Classify a rate-limit error message into a reason category.
|
|
8
|
-
* Priority order:
|
|
8
|
+
* Priority order: QUOTA (Antigravity "quota will reset") > MODEL_CAPACITY > QUOTA (account) >
|
|
9
|
+
* RATE_LIMIT > QUOTA (generic) > SERVER_ERROR > UNKNOWN.
|
|
9
10
|
*
|
|
10
11
|
* "resource exhausted" maps to MODEL_CAPACITY (transient, short wait)
|
|
11
|
-
* "quota exceeded" maps to QUOTA_EXHAUSTED (long wait, switch account)
|
|
12
|
+
* "quota exceeded" / "quota will reset" maps to QUOTA_EXHAUSTED (long wait, switch account)
|
|
12
13
|
*/
|
|
13
14
|
export declare function parseRateLimitReason(errorMessage: string): RateLimitReason;
|
|
14
15
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare function loginAlibabaCodingPlan(options: OAuthController): Promise<string>;
|
|
3
|
+
export declare const alibabaCodingPlanProvider: {
|
|
4
|
+
readonly id: "alibaba-coding-plan";
|
|
5
|
+
readonly name: "Alibaba Coding Plan";
|
|
6
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const anthropicProvider: {
|
|
3
|
+
readonly id: "anthropic";
|
|
4
|
+
readonly name: "Anthropic (Claude Pro/Max)";
|
|
5
|
+
readonly envKeys: () => string | undefined;
|
|
6
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<OAuthCredentials>;
|
|
7
|
+
readonly refreshToken: (credentials: OAuthCredentials) => Promise<OAuthCredentials>;
|
|
8
|
+
readonly callbackPort: 54545;
|
|
9
|
+
readonly pasteCodeFlow: true;
|
|
10
|
+
};
|
|
@@ -5,13 +5,19 @@
|
|
|
5
5
|
* don't actually implement OAuth — they just ask the user to paste an API key,
|
|
6
6
|
* optionally validate it, and return the trimmed key.
|
|
7
7
|
*/
|
|
8
|
-
import type { OAuthController } from "./types";
|
|
8
|
+
import type { OAuthController } from "./oauth/types";
|
|
9
9
|
type ChatCompletionsValidation = {
|
|
10
10
|
kind: "chat-completions";
|
|
11
11
|
provider: string;
|
|
12
12
|
baseUrl: string;
|
|
13
13
|
model: string;
|
|
14
14
|
};
|
|
15
|
+
type AnthropicMessagesValidation = {
|
|
16
|
+
kind: "anthropic-messages";
|
|
17
|
+
provider: string;
|
|
18
|
+
baseUrl: string;
|
|
19
|
+
model: string;
|
|
20
|
+
};
|
|
15
21
|
type ModelsEndpointValidation = {
|
|
16
22
|
kind: "models-endpoint";
|
|
17
23
|
provider: string;
|
|
@@ -29,7 +35,7 @@ export type ApiKeyLoginConfig = {
|
|
|
29
35
|
/** Placeholder string for the prompt (e.g. "sk-...", "csk-..."). */
|
|
30
36
|
placeholder: string;
|
|
31
37
|
/** Validation strategy, or `null` to skip validation. */
|
|
32
|
-
validation: ChatCompletionsValidation | ModelsEndpointValidation | null;
|
|
38
|
+
validation: ChatCompletionsValidation | AnthropicMessagesValidation | ModelsEndpointValidation | null;
|
|
33
39
|
};
|
|
34
40
|
export declare function createApiKeyLogin(config: ApiKeyLoginConfig): (options: OAuthController) => Promise<string>;
|
|
35
41
|
export {};
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
+
import type { FetchImpl } from "../types";
|
|
1
2
|
type OpenAICompatibleValidationOptions = {
|
|
2
3
|
provider: string;
|
|
3
4
|
apiKey: string;
|
|
4
5
|
baseUrl: string;
|
|
5
6
|
model: string;
|
|
6
7
|
signal?: AbortSignal;
|
|
8
|
+
fetch?: FetchImpl;
|
|
9
|
+
};
|
|
10
|
+
type AnthropicCompatibleValidationOptions = {
|
|
11
|
+
provider: string;
|
|
12
|
+
apiKey: string;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
model: string;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
fetch?: FetchImpl;
|
|
7
17
|
};
|
|
8
18
|
type ModelListValidationOptions = {
|
|
9
19
|
provider: string;
|
|
10
20
|
apiKey: string;
|
|
11
21
|
modelsUrl: string;
|
|
12
22
|
signal?: AbortSignal;
|
|
23
|
+
fetch?: FetchImpl;
|
|
13
24
|
};
|
|
14
25
|
/**
|
|
15
26
|
* Validate an API key against an OpenAI-compatible chat completions endpoint.
|
|
@@ -17,6 +28,10 @@ type ModelListValidationOptions = {
|
|
|
17
28
|
* Performs a minimal request to verify credentials and endpoint access.
|
|
18
29
|
*/
|
|
19
30
|
export declare function validateOpenAICompatibleApiKey(options: OpenAICompatibleValidationOptions): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Validate an API key against an Anthropic-compatible messages endpoint.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateAnthropicCompatibleApiKey(options: AnthropicCompatibleValidationOptions): Promise<void>;
|
|
20
35
|
/**
|
|
21
36
|
* Validate an API key against a provider models endpoint.
|
|
22
37
|
*
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const loginCerebras: (options: import("./oauth").OAuthController) => Promise<string>;
|
|
3
|
+
export declare const cerebrasProvider: {
|
|
4
|
+
readonly id: "cerebras";
|
|
5
|
+
readonly name: "Cerebras";
|
|
6
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
/**
|
|
3
|
+
* Login to Cloudflare AI Gateway.
|
|
4
|
+
*
|
|
5
|
+
* Opens browser to Cloudflare AI Gateway authentication docs and prompts for a gateway token/API key.
|
|
6
|
+
* Returns the API key directly (not OAuthCredentials - this isn't OAuth).
|
|
7
|
+
*/
|
|
8
|
+
export declare function loginCloudflareAiGateway(options: OAuthController): Promise<string>;
|
|
9
|
+
export declare const cloudflareAiGatewayProvider: {
|
|
10
|
+
readonly id: "cloudflare-ai-gateway";
|
|
11
|
+
readonly name: "Cloudflare AI Gateway";
|
|
12
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const cursorProvider: {
|
|
3
|
+
readonly id: "cursor";
|
|
4
|
+
readonly name: "Cursor (Claude, GPT, etc.)";
|
|
5
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<OAuthCredentials>;
|
|
6
|
+
readonly refreshToken: (credentials: OAuthCredentials) => Promise<OAuthCredentials>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare function normalizeDeepSeekApiKey(raw: string): string;
|
|
3
|
+
export declare const loginDeepSeek: (options: OAuthController) => Promise<string>;
|
|
4
|
+
export declare const deepseekProvider: {
|
|
5
|
+
readonly id: "deepseek";
|
|
6
|
+
readonly name: "DeepSeek";
|
|
7
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
/**
|
|
3
|
+
* Fire Pass login flow.
|
|
4
|
+
*
|
|
5
|
+
* Fire Pass is a Fireworks subscription product whose dedicated `fpk_…` API
|
|
6
|
+
* keys are scoped to the `accounts/fireworks/routers/kimi-k2p6-turbo` router
|
|
7
|
+
* (Kimi K2.6 Turbo). The key does NOT authorize `/v1/models`, so validation
|
|
8
|
+
* pings the chat completions endpoint with the router id directly.
|
|
9
|
+
* See https://docs.fireworks.ai/firepass.
|
|
10
|
+
*/
|
|
11
|
+
export declare const loginFirepass: (options: import("./oauth").OAuthController) => Promise<string>;
|
|
12
|
+
export declare const firepassProvider: {
|
|
13
|
+
readonly id: "firepass";
|
|
14
|
+
readonly name: "Fire Pass (Fireworks Kimi K2.6 Turbo subscription)";
|
|
15
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const loginFireworks: (options: import("./oauth").OAuthController) => Promise<string>;
|
|
3
|
+
export declare const fireworksProvider: {
|
|
4
|
+
readonly id: "fireworks";
|
|
5
|
+
readonly name: "Fireworks";
|
|
6
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const githubCopilotProvider: {
|
|
3
|
+
readonly id: "github-copilot";
|
|
4
|
+
readonly name: "GitHub Copilot";
|
|
5
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<OAuthCredentials>;
|
|
6
|
+
readonly refreshToken: (credentials: OAuthCredentials) => Promise<OAuthCredentials>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const gitlabDuoProvider: {
|
|
3
|
+
readonly id: "gitlab-duo";
|
|
4
|
+
readonly name: "GitLab Duo";
|
|
5
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<OAuthCredentials>;
|
|
6
|
+
readonly refreshToken: (credentials: OAuthCredentials) => Promise<OAuthCredentials>;
|
|
7
|
+
readonly callbackPort: 8080;
|
|
8
|
+
readonly pasteCodeFlow: true;
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const googleAntigravityProvider: {
|
|
3
|
+
readonly id: "google-antigravity";
|
|
4
|
+
readonly name: "Antigravity (Gemini 3, Claude, GPT-OSS)";
|
|
5
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<OAuthCredentials>;
|
|
6
|
+
readonly refreshToken: (credentials: OAuthCredentials) => Promise<OAuthCredentials>;
|
|
7
|
+
readonly callbackPort: 51121;
|
|
8
|
+
readonly pasteCodeFlow: true;
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const googleGeminiCliProvider: {
|
|
3
|
+
readonly id: "google-gemini-cli";
|
|
4
|
+
readonly name: "Google Cloud Code Assist (Gemini CLI)";
|
|
5
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<OAuthCredentials>;
|
|
6
|
+
readonly refreshToken: (credentials: OAuthCredentials) => Promise<OAuthCredentials>;
|
|
7
|
+
readonly callbackPort: 8085;
|
|
8
|
+
readonly pasteCodeFlow: true;
|
|
9
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare function loginHuggingface(options: OAuthController): Promise<string>;
|
|
3
|
+
export declare const huggingfaceProvider: {
|
|
4
|
+
readonly id: "huggingface";
|
|
5
|
+
readonly name: "Hugging Face Inference";
|
|
6
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
/**
|
|
3
|
+
* Login to Kagi.
|
|
4
|
+
*
|
|
5
|
+
* Opens browser to API settings and prompts user to paste their API key.
|
|
6
|
+
* Returns the API key directly (not OAuthCredentials - this isn't OAuth).
|
|
7
|
+
*/
|
|
8
|
+
export declare function loginKagi(options: OAuthController): Promise<string>;
|
|
9
|
+
export declare const kagiProvider: {
|
|
10
|
+
readonly id: "kagi";
|
|
11
|
+
readonly name: "Kagi";
|
|
12
|
+
readonly envKeys: "KAGI_API_KEY";
|
|
13
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthController, OAuthCredentials } from "./oauth/types";
|
|
2
|
+
export declare function loginKilo(callbacks: OAuthController): Promise<OAuthCredentials>;
|
|
3
|
+
export declare const kiloProvider: {
|
|
4
|
+
readonly id: "kilo";
|
|
5
|
+
readonly name: "Kilo Gateway";
|
|
6
|
+
readonly login: typeof loginKilo;
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const kimiCodeProvider: {
|
|
3
|
+
readonly id: "kimi-code";
|
|
4
|
+
readonly name: "Kimi Code";
|
|
5
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<OAuthCredentials>;
|
|
6
|
+
readonly refreshToken: (credentials: OAuthCredentials) => Promise<OAuthCredentials>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
/**
|
|
3
|
+
* Login to LiteLLM.
|
|
4
|
+
*
|
|
5
|
+
* Opens browser to LiteLLM setup docs, prompts user to paste their API key.
|
|
6
|
+
* Returns the API key directly (not OAuthCredentials - this isn't OAuth).
|
|
7
|
+
*/
|
|
8
|
+
export declare function loginLiteLLM(options: OAuthController): Promise<string>;
|
|
9
|
+
export declare const litellmProvider: {
|
|
10
|
+
readonly id: "litellm";
|
|
11
|
+
readonly name: "LiteLLM";
|
|
12
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const DEFAULT_LOCAL_TOKEN = "lm-studio-local";
|
|
3
|
+
export declare function loginLmStudio(options: OAuthController): Promise<string>;
|
|
4
|
+
export declare const lmStudioProvider: {
|
|
5
|
+
readonly id: "lm-studio";
|
|
6
|
+
readonly name: "LM Studio (Local OpenAI-compatible)";
|
|
7
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const loginMoonshot: (options: import("./oauth").OAuthController) => Promise<string>;
|
|
3
|
+
export declare const moonshotProvider: {
|
|
4
|
+
readonly id: "moonshot";
|
|
5
|
+
readonly name: "Moonshot (Kimi API)";
|
|
6
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare const loginNanoGPT: (options: import("./oauth").OAuthController) => Promise<string>;
|
|
3
|
+
export declare const nanogptProvider: {
|
|
4
|
+
readonly id: "nanogpt";
|
|
5
|
+
readonly name: "NanoGPT";
|
|
6
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OAuthController, OAuthLoginCallbacks } from "./oauth/types";
|
|
2
|
+
export declare function loginNvidia(options: OAuthController): Promise<string>;
|
|
3
|
+
export declare const nvidiaProvider: {
|
|
4
|
+
readonly id: "nvidia";
|
|
5
|
+
readonly name: "NVIDIA";
|
|
6
|
+
readonly login: (cb: OAuthLoginCallbacks) => Promise<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anthropic OAuth flow (Claude Pro/Max)
|
|
3
3
|
*/
|
|
4
|
+
import type { FetchImpl } from "../../types";
|
|
4
5
|
import { OAuthCallbackFlow } from "./callback-server";
|
|
5
6
|
import type { OAuthController, OAuthCredentials } from "./types";
|
|
6
7
|
export declare class AnthropicOAuthFlow extends OAuthCallbackFlow {
|
|
@@ -19,4 +20,4 @@ export declare function loginAnthropic(ctrl: OAuthController): Promise<OAuthCred
|
|
|
19
20
|
/**
|
|
20
21
|
* Refresh Anthropic OAuth token
|
|
21
22
|
*/
|
|
22
|
-
export declare function refreshAnthropicToken(refreshToken: string): Promise<OAuthCredentials>;
|
|
23
|
+
export declare function refreshAnthropicToken(refreshToken: string, fetchOverride?: FetchImpl): Promise<OAuthCredentials>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import type { FetchImpl } from "../../types";
|
|
1
2
|
import type { OAuthCredentials } from "./types";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
type GitHubCopilotLoginOptions = {
|
|
4
|
+
onAuth: (url: string, instructions?: string) => void;
|
|
5
|
+
onPrompt: (prompt: {
|
|
6
|
+
message: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
allowEmpty?: boolean;
|
|
9
|
+
}) => Promise<string>;
|
|
10
|
+
onProgress?: (message: string) => void;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
pollIntervalFloorMs?: number;
|
|
13
|
+
pollIntervalScaleMs?: number;
|
|
14
|
+
fetch?: FetchImpl;
|
|
9
15
|
};
|
|
10
|
-
export declare function normalizeGitHubCopilotEnterpriseDomain(input: string | undefined): string | undefined;
|
|
11
|
-
export declare function parseGitHubCopilotApiKey(apiKeyRaw: string): ParsedGitHubCopilotApiKey;
|
|
12
|
-
export declare function normalizeDomain(input: string): string | null;
|
|
13
|
-
export declare function getGitHubCopilotBaseUrl(enterpriseDomain?: string): string;
|
|
14
16
|
/**
|
|
15
17
|
* Refresh GitHub Copilot token.
|
|
16
18
|
* With the opencode OAuth flow, the GitHub token is used directly — no JWT exchange needed.
|
|
@@ -24,15 +26,5 @@ export declare function refreshGitHubCopilotToken(refreshToken: string, enterpri
|
|
|
24
26
|
* @param options.onProgress - Optional progress callback
|
|
25
27
|
* @param options.signal - Optional AbortSignal for cancellation
|
|
26
28
|
*/
|
|
27
|
-
export declare function loginGitHubCopilot(options:
|
|
28
|
-
|
|
29
|
-
onPrompt: (prompt: {
|
|
30
|
-
message: string;
|
|
31
|
-
placeholder?: string;
|
|
32
|
-
allowEmpty?: boolean;
|
|
33
|
-
}) => Promise<string>;
|
|
34
|
-
onProgress?: (message: string) => void;
|
|
35
|
-
signal?: AbortSignal;
|
|
36
|
-
pollIntervalFloorMs?: number;
|
|
37
|
-
pollIntervalScaleMs?: number;
|
|
38
|
-
}): Promise<OAuthCredentials>;
|
|
29
|
+
export declare function loginGitHubCopilot(options: GitHubCopilotLoginOptions): Promise<OAuthCredentials>;
|
|
30
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MiniMax
|
|
2
|
+
* MiniMax Token Plan login flow.
|
|
3
3
|
*
|
|
4
|
-
* MiniMax
|
|
5
|
-
* MiniMax models (M2
|
|
4
|
+
* MiniMax Token Plan is a subscription service that provides access to
|
|
5
|
+
* MiniMax models (M2 and newer) through an OpenAI-compatible API.
|
|
6
6
|
*
|
|
7
7
|
* This is not OAuth - it's a simple API key flow:
|
|
8
8
|
* 1. Open browser to the matching regional MiniMax subscription page
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { OAuthController } from "./types";
|
|
16
16
|
/**
|
|
17
|
-
* Login to MiniMax
|
|
17
|
+
* Login to MiniMax Token Plan (international).
|
|
18
18
|
*
|
|
19
19
|
* Opens browser to subscription page, prompts user to paste their API key.
|
|
20
20
|
* Returns the API key directly (not OAuthCredentials - this isn't OAuth).
|
|
21
21
|
*/
|
|
22
22
|
export declare function loginMiniMaxCode(options: OAuthController): Promise<string>;
|
|
23
23
|
/**
|
|
24
|
-
* Login to MiniMax
|
|
24
|
+
* Login to MiniMax Token Plan (China).
|
|
25
25
|
*
|
|
26
26
|
* Same flow as international but uses China endpoint.
|
|
27
27
|
*/
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { FetchImpl } from "../../types";
|
|
2
|
+
import type { OAuthProviderUnion } from "../registry";
|
|
1
3
|
export type OAuthCredentials = {
|
|
2
4
|
refresh: string;
|
|
3
5
|
access: string;
|
|
@@ -7,7 +9,7 @@ export type OAuthCredentials = {
|
|
|
7
9
|
email?: string;
|
|
8
10
|
accountId?: string;
|
|
9
11
|
};
|
|
10
|
-
export type OAuthProvider =
|
|
12
|
+
export type OAuthProvider = OAuthProviderUnion;
|
|
11
13
|
export type OAuthProviderId = OAuthProvider | (string & {});
|
|
12
14
|
export type OAuthPrompt = {
|
|
13
15
|
message: string;
|
|
@@ -29,6 +31,7 @@ export interface OAuthController {
|
|
|
29
31
|
onManualCodeInput?(): Promise<string>;
|
|
30
32
|
onPrompt?(prompt: OAuthPrompt): Promise<string>;
|
|
31
33
|
signal?: AbortSignal;
|
|
34
|
+
fetch?: FetchImpl;
|
|
32
35
|
}
|
|
33
36
|
export interface OAuthLoginCallbacks extends OAuthController {
|
|
34
37
|
onAuth: (info: OAuthAuthInfo) => void;
|
|
@@ -41,4 +44,6 @@ export interface OAuthProviderInterface {
|
|
|
41
44
|
login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials | string>;
|
|
42
45
|
refreshToken?(credentials: OAuthCredentials): Promise<OAuthCredentials>;
|
|
43
46
|
getApiKey?(credentials: OAuthCredentials): string;
|
|
47
|
+
/** Store resulting OAuth credentials under a different provider id. */
|
|
48
|
+
readonly storeCredentialsAs?: string;
|
|
44
49
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* {@link validateXAIEndpoint}: any non-HTTPS or non-`x.ai`/`*.x.ai` host is
|
|
8
8
|
* rejected on every call site, not just the first.
|
|
9
9
|
*/
|
|
10
|
+
import type { FetchImpl } from "../../types";
|
|
10
11
|
import { OAuthCallbackFlow } from "./callback-server";
|
|
11
12
|
import type { OAuthController, OAuthCredentials } from "./types";
|
|
12
13
|
/**
|
|
@@ -57,4 +58,4 @@ export declare function loginXAIOAuth(ctrl: OAuthController): Promise<OAuthCrede
|
|
|
57
58
|
* re-validates the cached `token_endpoint` on the refresh hot path so a
|
|
58
59
|
* cached-but-poisoned endpoint cannot silently leak a refresh_token.
|
|
59
60
|
*/
|
|
60
|
-
export declare function refreshXAIOAuthToken(refreshToken: string): Promise<OAuthCredentials>;
|
|
61
|
+
export declare function refreshXAIOAuthToken(refreshToken: string, fetchOverride?: FetchImpl): Promise<OAuthCredentials>;
|