@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,847 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Chat Completions API wire types.
|
|
3
|
+
*
|
|
4
|
+
* Vendored from openai-node v6.42.0 (Apache-2.0), trimmed to the streaming
|
|
5
|
+
* wire surface Prometheus AI speaks. Field names, optionality, and union membership
|
|
6
|
+
* mirror the SDK exactly; names are identical to the SDK exports so call
|
|
7
|
+
* sites only swap import paths. Nested SDK namespaces (e.g.
|
|
8
|
+
* `ChatCompletionChunk.Choice.Delta`) are flattened into prefixed interface
|
|
9
|
+
* names (`ChatCompletionChunkChoiceDelta`).
|
|
10
|
+
*
|
|
11
|
+
* Fields marked "deprecated by OpenAI" reflect the upstream API contract;
|
|
12
|
+
* they are kept because compatible providers still emit them on the wire.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// ─── Shared types (openai/resources/shared) ─────────────────────────────────
|
|
16
|
+
|
|
17
|
+
export type ChatModel =
|
|
18
|
+
| "gpt-5.4"
|
|
19
|
+
| "gpt-5.4-mini"
|
|
20
|
+
| "gpt-5.4-nano"
|
|
21
|
+
| "gpt-5.4-mini-2026-03-17"
|
|
22
|
+
| "gpt-5.4-nano-2026-03-17"
|
|
23
|
+
| "gpt-5.3-chat-latest"
|
|
24
|
+
| "gpt-5.2"
|
|
25
|
+
| "gpt-5.2-2025-12-11"
|
|
26
|
+
| "gpt-5.2-chat-latest"
|
|
27
|
+
| "gpt-5.2-pro"
|
|
28
|
+
| "gpt-5.2-pro-2025-12-11"
|
|
29
|
+
| "gpt-5.1"
|
|
30
|
+
| "gpt-5.1-2025-11-13"
|
|
31
|
+
| "gpt-5.1-codex"
|
|
32
|
+
| "gpt-5.1-mini"
|
|
33
|
+
| "gpt-5.1-chat-latest"
|
|
34
|
+
| "gpt-5"
|
|
35
|
+
| "gpt-5-mini"
|
|
36
|
+
| "gpt-5-nano"
|
|
37
|
+
| "gpt-5-2025-08-07"
|
|
38
|
+
| "gpt-5-mini-2025-08-07"
|
|
39
|
+
| "gpt-5-nano-2025-08-07"
|
|
40
|
+
| "gpt-5-chat-latest"
|
|
41
|
+
| "gpt-4.1"
|
|
42
|
+
| "gpt-4.1-mini"
|
|
43
|
+
| "gpt-4.1-nano"
|
|
44
|
+
| "gpt-4.1-2025-04-14"
|
|
45
|
+
| "gpt-4.1-mini-2025-04-14"
|
|
46
|
+
| "gpt-4.1-nano-2025-04-14"
|
|
47
|
+
| "o4-mini"
|
|
48
|
+
| "o4-mini-2025-04-16"
|
|
49
|
+
| "o3"
|
|
50
|
+
| "o3-2025-04-16"
|
|
51
|
+
| "o3-mini"
|
|
52
|
+
| "o3-mini-2025-01-31"
|
|
53
|
+
| "o1"
|
|
54
|
+
| "o1-2024-12-17"
|
|
55
|
+
| "o1-preview"
|
|
56
|
+
| "o1-preview-2024-09-12"
|
|
57
|
+
| "o1-mini"
|
|
58
|
+
| "o1-mini-2024-09-12"
|
|
59
|
+
| "gpt-4o"
|
|
60
|
+
| "gpt-4o-2024-11-20"
|
|
61
|
+
| "gpt-4o-2024-08-06"
|
|
62
|
+
| "gpt-4o-2024-05-13"
|
|
63
|
+
| "gpt-4o-audio-preview"
|
|
64
|
+
| "gpt-4o-audio-preview-2024-10-01"
|
|
65
|
+
| "gpt-4o-audio-preview-2024-12-17"
|
|
66
|
+
| "gpt-4o-audio-preview-2025-06-03"
|
|
67
|
+
| "gpt-4o-mini-audio-preview"
|
|
68
|
+
| "gpt-4o-mini-audio-preview-2024-12-17"
|
|
69
|
+
| "gpt-4o-search-preview"
|
|
70
|
+
| "gpt-4o-mini-search-preview"
|
|
71
|
+
| "gpt-4o-search-preview-2025-03-11"
|
|
72
|
+
| "gpt-4o-mini-search-preview-2025-03-11"
|
|
73
|
+
| "chatgpt-4o-latest"
|
|
74
|
+
| "codex-mini-latest"
|
|
75
|
+
| "gpt-4o-mini"
|
|
76
|
+
| "gpt-4o-mini-2024-07-18"
|
|
77
|
+
| "gpt-4-turbo"
|
|
78
|
+
| "gpt-4-turbo-2024-04-09"
|
|
79
|
+
| "gpt-4-0125-preview"
|
|
80
|
+
| "gpt-4-turbo-preview"
|
|
81
|
+
| "gpt-4-1106-preview"
|
|
82
|
+
| "gpt-4-vision-preview"
|
|
83
|
+
| "gpt-4"
|
|
84
|
+
| "gpt-4-0314"
|
|
85
|
+
| "gpt-4-0613"
|
|
86
|
+
| "gpt-4-32k"
|
|
87
|
+
| "gpt-4-32k-0314"
|
|
88
|
+
| "gpt-4-32k-0613"
|
|
89
|
+
| "gpt-3.5-turbo"
|
|
90
|
+
| "gpt-3.5-turbo-16k"
|
|
91
|
+
| "gpt-3.5-turbo-0301"
|
|
92
|
+
| "gpt-3.5-turbo-0613"
|
|
93
|
+
| "gpt-3.5-turbo-1106"
|
|
94
|
+
| "gpt-3.5-turbo-0125"
|
|
95
|
+
| "gpt-3.5-turbo-16k-0613";
|
|
96
|
+
|
|
97
|
+
export interface FunctionDefinition {
|
|
98
|
+
/** Function name: a-z, A-Z, 0-9, underscores and dashes, max length 64. */
|
|
99
|
+
name: string;
|
|
100
|
+
/** What the function does; used by the model to choose when/how to call it. */
|
|
101
|
+
description?: string;
|
|
102
|
+
/** Parameters as a JSON Schema object. Omitting defines an empty parameter list. */
|
|
103
|
+
parameters?: FunctionParameters;
|
|
104
|
+
/** Enable strict schema adherence (Structured Outputs subset of JSON Schema). */
|
|
105
|
+
strict?: boolean | null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Function parameters described as a JSON Schema object. */
|
|
109
|
+
export type FunctionParameters = {
|
|
110
|
+
[key: string]: unknown;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** Up to 16 key-value string pairs attached to an object. Keys ≤64 chars, values ≤512. */
|
|
114
|
+
export type Metadata = {
|
|
115
|
+
[key: string]: string;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/** Constrains effort on reasoning for reasoning models. */
|
|
119
|
+
export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
|
|
120
|
+
|
|
121
|
+
/** JSON object response format (older JSON mode). */
|
|
122
|
+
export interface ResponseFormatJSONObject {
|
|
123
|
+
/** Always `json_object`. */
|
|
124
|
+
type: "json_object";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** JSON Schema response format (Structured Outputs). */
|
|
128
|
+
export interface ResponseFormatJSONSchema {
|
|
129
|
+
/** Structured Outputs configuration options, including a JSON Schema. */
|
|
130
|
+
json_schema: ResponseFormatJSONSchemaJSONSchema;
|
|
131
|
+
/** Always `json_schema`. */
|
|
132
|
+
type: "json_schema";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** SDK `ResponseFormatJSONSchema.JSONSchema`. */
|
|
136
|
+
export interface ResponseFormatJSONSchemaJSONSchema {
|
|
137
|
+
/** Response format name: a-z, A-Z, 0-9, underscores and dashes, max length 64. */
|
|
138
|
+
name: string;
|
|
139
|
+
/** What the response format is for. */
|
|
140
|
+
description?: string;
|
|
141
|
+
/** The schema for the response format, as a JSON Schema object. */
|
|
142
|
+
schema?: {
|
|
143
|
+
[key: string]: unknown;
|
|
144
|
+
};
|
|
145
|
+
/** Enable strict schema adherence when generating the output. */
|
|
146
|
+
strict?: boolean | null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Default text response format. */
|
|
150
|
+
export interface ResponseFormatText {
|
|
151
|
+
/** Always `text`. */
|
|
152
|
+
type: "text";
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ─── Usage (openai/resources/completions) ───────────────────────────────────
|
|
156
|
+
|
|
157
|
+
/** Usage statistics for the completion request. */
|
|
158
|
+
export interface CompletionUsage {
|
|
159
|
+
/** Number of tokens in the generated completion. */
|
|
160
|
+
completion_tokens: number;
|
|
161
|
+
/** Number of tokens in the prompt. */
|
|
162
|
+
prompt_tokens: number;
|
|
163
|
+
/** Total number of tokens used in the request (prompt + completion). */
|
|
164
|
+
total_tokens: number;
|
|
165
|
+
/** Breakdown of tokens used in a completion. */
|
|
166
|
+
completion_tokens_details?: CompletionUsageCompletionTokensDetails;
|
|
167
|
+
/** Breakdown of tokens used in the prompt. */
|
|
168
|
+
prompt_tokens_details?: CompletionUsagePromptTokensDetails;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** SDK `CompletionUsage.CompletionTokensDetails`. */
|
|
172
|
+
export interface CompletionUsageCompletionTokensDetails {
|
|
173
|
+
/** Predicted Outputs: prediction tokens that appeared in the completion. */
|
|
174
|
+
accepted_prediction_tokens?: number;
|
|
175
|
+
/** Audio input tokens generated by the model. */
|
|
176
|
+
audio_tokens?: number;
|
|
177
|
+
/** Tokens generated by the model for reasoning. */
|
|
178
|
+
reasoning_tokens?: number;
|
|
179
|
+
/** Predicted Outputs: prediction tokens that did not appear in the completion (still billed). */
|
|
180
|
+
rejected_prediction_tokens?: number;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** SDK `CompletionUsage.PromptTokensDetails`. */
|
|
184
|
+
export interface CompletionUsagePromptTokensDetails {
|
|
185
|
+
/** Audio input tokens present in the prompt. */
|
|
186
|
+
audio_tokens?: number;
|
|
187
|
+
/** Cached tokens present in the prompt. */
|
|
188
|
+
cached_tokens?: number;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ─── Content parts ───────────────────────────────────────────────────────────
|
|
192
|
+
|
|
193
|
+
/** Text content part. */
|
|
194
|
+
export interface ChatCompletionContentPartText {
|
|
195
|
+
/** The text content. */
|
|
196
|
+
text: string;
|
|
197
|
+
/** Always `text`. */
|
|
198
|
+
type: "text";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Image content part. */
|
|
202
|
+
export interface ChatCompletionContentPartImage {
|
|
203
|
+
image_url: ChatCompletionContentPartImageImageURL;
|
|
204
|
+
/** Always `image_url`. */
|
|
205
|
+
type: "image_url";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** SDK `ChatCompletionContentPartImage.ImageURL`. */
|
|
209
|
+
export interface ChatCompletionContentPartImageImageURL {
|
|
210
|
+
/** Either a URL of the image or the base64 encoded image data. */
|
|
211
|
+
url: string;
|
|
212
|
+
/** Detail level of the image. */
|
|
213
|
+
detail?: "auto" | "low" | "high";
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Audio content part (gpt-4o-audio). */
|
|
217
|
+
export interface ChatCompletionContentPartInputAudio {
|
|
218
|
+
input_audio: ChatCompletionContentPartInputAudioInputAudio;
|
|
219
|
+
/** Always `input_audio`. */
|
|
220
|
+
type: "input_audio";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** SDK `ChatCompletionContentPartInputAudio.InputAudio`. */
|
|
224
|
+
export interface ChatCompletionContentPartInputAudioInputAudio {
|
|
225
|
+
/** Base64 encoded audio data. */
|
|
226
|
+
data: string;
|
|
227
|
+
/** Format of the encoded audio data. */
|
|
228
|
+
format: "wav" | "mp3";
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** File content part. SDK `ChatCompletionContentPart.File`. */
|
|
232
|
+
export interface ChatCompletionContentPartFile {
|
|
233
|
+
file: ChatCompletionContentPartFileFile;
|
|
234
|
+
/** Always `file`. */
|
|
235
|
+
type: "file";
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** SDK `ChatCompletionContentPart.File.File`. */
|
|
239
|
+
export interface ChatCompletionContentPartFileFile {
|
|
240
|
+
/** Base64 encoded file data, used when passing the file to the model as a string. */
|
|
241
|
+
file_data?: string;
|
|
242
|
+
/** The ID of an uploaded file to use as input. */
|
|
243
|
+
file_id?: string;
|
|
244
|
+
/** The name of the file, used when passing the file to the model as a string. */
|
|
245
|
+
filename?: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** Assistant refusal content part. */
|
|
249
|
+
export interface ChatCompletionContentPartRefusal {
|
|
250
|
+
/** The refusal message generated by the model. */
|
|
251
|
+
refusal: string;
|
|
252
|
+
/** Always `refusal`. */
|
|
253
|
+
type: "refusal";
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** User-message content part union. */
|
|
257
|
+
export type ChatCompletionContentPart =
|
|
258
|
+
| ChatCompletionContentPartText
|
|
259
|
+
| ChatCompletionContentPartImage
|
|
260
|
+
| ChatCompletionContentPartInputAudio
|
|
261
|
+
| ChatCompletionContentPartFile;
|
|
262
|
+
|
|
263
|
+
// ─── Tool calls ──────────────────────────────────────────────────────────────
|
|
264
|
+
|
|
265
|
+
/** A call to a function tool created by the model. */
|
|
266
|
+
export interface ChatCompletionMessageFunctionToolCall {
|
|
267
|
+
/** The ID of the tool call. */
|
|
268
|
+
id: string;
|
|
269
|
+
/** The function that the model called. */
|
|
270
|
+
function: ChatCompletionMessageFunctionToolCallFunction;
|
|
271
|
+
/** Always `function`. */
|
|
272
|
+
type: "function";
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** SDK `ChatCompletionMessageFunctionToolCall.Function`. */
|
|
276
|
+
export interface ChatCompletionMessageFunctionToolCallFunction {
|
|
277
|
+
/** JSON-encoded arguments; the model may emit invalid JSON, validate before use. */
|
|
278
|
+
arguments: string;
|
|
279
|
+
/** The name of the function to call. */
|
|
280
|
+
name: string;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** A call to a custom tool created by the model. */
|
|
284
|
+
export interface ChatCompletionMessageCustomToolCall {
|
|
285
|
+
/** The ID of the tool call. */
|
|
286
|
+
id: string;
|
|
287
|
+
/** The custom tool that the model called. */
|
|
288
|
+
custom: ChatCompletionMessageCustomToolCallCustom;
|
|
289
|
+
/** Always `custom`. */
|
|
290
|
+
type: "custom";
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** SDK `ChatCompletionMessageCustomToolCall.Custom`. */
|
|
294
|
+
export interface ChatCompletionMessageCustomToolCallCustom {
|
|
295
|
+
/** The input for the custom tool call generated by the model. */
|
|
296
|
+
input: string;
|
|
297
|
+
/** The name of the custom tool to call. */
|
|
298
|
+
name: string;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Tool call union. */
|
|
302
|
+
export type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall;
|
|
303
|
+
|
|
304
|
+
// ─── Message params ──────────────────────────────────────────────────────────
|
|
305
|
+
|
|
306
|
+
/** Developer-provided instructions (o1 and newer replace `system`). */
|
|
307
|
+
export interface ChatCompletionDeveloperMessageParam {
|
|
308
|
+
/** The contents of the developer message. */
|
|
309
|
+
content: string | Array<ChatCompletionContentPartText>;
|
|
310
|
+
/** Always `developer`. */
|
|
311
|
+
role: "developer";
|
|
312
|
+
/** Optional participant name. */
|
|
313
|
+
name?: string;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** System message. */
|
|
317
|
+
export interface ChatCompletionSystemMessageParam {
|
|
318
|
+
/** The contents of the system message. */
|
|
319
|
+
content: string | Array<ChatCompletionContentPartText>;
|
|
320
|
+
/** Always `system`. */
|
|
321
|
+
role: "system";
|
|
322
|
+
/** Optional participant name. */
|
|
323
|
+
name?: string;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** User message. */
|
|
327
|
+
export interface ChatCompletionUserMessageParam {
|
|
328
|
+
/** The contents of the user message. */
|
|
329
|
+
content: string | Array<ChatCompletionContentPart>;
|
|
330
|
+
/** Always `user`. */
|
|
331
|
+
role: "user";
|
|
332
|
+
/** Optional participant name. */
|
|
333
|
+
name?: string;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** Assistant (model) message. */
|
|
337
|
+
export interface ChatCompletionAssistantMessageParam {
|
|
338
|
+
/** Always `assistant`. */
|
|
339
|
+
role: "assistant";
|
|
340
|
+
/** Data about a previous audio response from the model. */
|
|
341
|
+
audio?: ChatCompletionAssistantMessageParamAudio | null;
|
|
342
|
+
/** Message contents. Required unless `tool_calls` or `function_call` is specified. */
|
|
343
|
+
content?: string | Array<ChatCompletionContentPartText | ChatCompletionContentPartRefusal> | null;
|
|
344
|
+
/** Deprecated by OpenAI; replaced by `tool_calls`. */
|
|
345
|
+
function_call?: ChatCompletionAssistantMessageParamFunctionCall | null;
|
|
346
|
+
/** Optional participant name. */
|
|
347
|
+
name?: string;
|
|
348
|
+
/** The refusal message by the assistant. */
|
|
349
|
+
refusal?: string | null;
|
|
350
|
+
/** The tool calls generated by the model, such as function calls. */
|
|
351
|
+
tool_calls?: Array<ChatCompletionMessageToolCall>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** SDK `ChatCompletionAssistantMessageParam.Audio`. */
|
|
355
|
+
export interface ChatCompletionAssistantMessageParamAudio {
|
|
356
|
+
/** Unique identifier for a previous audio response from the model. */
|
|
357
|
+
id: string;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/** SDK `ChatCompletionAssistantMessageParam.FunctionCall`. */
|
|
361
|
+
export interface ChatCompletionAssistantMessageParamFunctionCall {
|
|
362
|
+
/** JSON-encoded arguments; the model may emit invalid JSON, validate before use. */
|
|
363
|
+
arguments: string;
|
|
364
|
+
/** The name of the function to call. */
|
|
365
|
+
name: string;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** Tool result message. */
|
|
369
|
+
export interface ChatCompletionToolMessageParam {
|
|
370
|
+
/** The contents of the tool message. */
|
|
371
|
+
content: string | Array<ChatCompletionContentPartText>;
|
|
372
|
+
/** Always `tool`. */
|
|
373
|
+
role: "tool";
|
|
374
|
+
/** Tool call that this message is responding to. */
|
|
375
|
+
tool_call_id: string;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/** Legacy `function` role message (pre-tools API). Deprecated by OpenAI. */
|
|
379
|
+
export interface ChatCompletionFunctionMessageParam {
|
|
380
|
+
/** The contents of the function message. */
|
|
381
|
+
content: string | null;
|
|
382
|
+
/** The name of the function to call. */
|
|
383
|
+
name: string;
|
|
384
|
+
/** Always `function`. */
|
|
385
|
+
role: "function";
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** Message union. */
|
|
389
|
+
export type ChatCompletionMessageParam =
|
|
390
|
+
| ChatCompletionDeveloperMessageParam
|
|
391
|
+
| ChatCompletionSystemMessageParam
|
|
392
|
+
| ChatCompletionUserMessageParam
|
|
393
|
+
| ChatCompletionAssistantMessageParam
|
|
394
|
+
| ChatCompletionToolMessageParam
|
|
395
|
+
| ChatCompletionFunctionMessageParam;
|
|
396
|
+
|
|
397
|
+
// ─── Tools ───────────────────────────────────────────────────────────────────
|
|
398
|
+
|
|
399
|
+
/** A function tool that can be used to generate a response. */
|
|
400
|
+
export interface ChatCompletionFunctionTool {
|
|
401
|
+
function: FunctionDefinition;
|
|
402
|
+
/** Always `function`. */
|
|
403
|
+
type: "function";
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** A custom tool that processes input using a specified format. */
|
|
407
|
+
export interface ChatCompletionCustomTool {
|
|
408
|
+
/** Properties of the custom tool. */
|
|
409
|
+
custom: ChatCompletionCustomToolCustom;
|
|
410
|
+
/** Always `custom`. */
|
|
411
|
+
type: "custom";
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/** SDK `ChatCompletionCustomTool.Custom`. */
|
|
415
|
+
export interface ChatCompletionCustomToolCustom {
|
|
416
|
+
/** The name of the custom tool, used to identify it in tool calls. */
|
|
417
|
+
name: string;
|
|
418
|
+
/** Optional description of the custom tool. */
|
|
419
|
+
description?: string;
|
|
420
|
+
/** The input format for the custom tool. Default is unconstrained text. */
|
|
421
|
+
format?: ChatCompletionCustomToolCustomText | ChatCompletionCustomToolCustomGrammar;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** SDK `ChatCompletionCustomTool.Custom.Text`. */
|
|
425
|
+
export interface ChatCompletionCustomToolCustomText {
|
|
426
|
+
/** Unconstrained text format. Always `text`. */
|
|
427
|
+
type: "text";
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/** SDK `ChatCompletionCustomTool.Custom.Grammar`. */
|
|
431
|
+
export interface ChatCompletionCustomToolCustomGrammar {
|
|
432
|
+
/** Your chosen grammar. */
|
|
433
|
+
grammar: ChatCompletionCustomToolCustomGrammarGrammar;
|
|
434
|
+
/** Grammar format. Always `grammar`. */
|
|
435
|
+
type: "grammar";
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** SDK `ChatCompletionCustomTool.Custom.Grammar.Grammar`. */
|
|
439
|
+
export interface ChatCompletionCustomToolCustomGrammarGrammar {
|
|
440
|
+
/** The grammar definition. */
|
|
441
|
+
definition: string;
|
|
442
|
+
/** The syntax of the grammar definition. One of `lark` or `regex`. */
|
|
443
|
+
syntax: "lark" | "regex";
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** Tool union. */
|
|
447
|
+
export type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;
|
|
448
|
+
|
|
449
|
+
// ─── Tool choice ─────────────────────────────────────────────────────────────
|
|
450
|
+
|
|
451
|
+
/** Constrains the tools available to the model to a pre-defined set. */
|
|
452
|
+
export interface ChatCompletionAllowedTools {
|
|
453
|
+
/** `auto` lets the model pick from the allowed tools; `required` forces a call. */
|
|
454
|
+
mode: "auto" | "required";
|
|
455
|
+
/** Tool definitions the model is allowed to call. */
|
|
456
|
+
tools: Array<{
|
|
457
|
+
[key: string]: unknown;
|
|
458
|
+
}>;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** Constrains the tools available to the model to a pre-defined set. */
|
|
462
|
+
export interface ChatCompletionAllowedToolChoice {
|
|
463
|
+
/** Constrains the tools available to the model to a pre-defined set. */
|
|
464
|
+
allowed_tools: ChatCompletionAllowedTools;
|
|
465
|
+
/** Always `allowed_tools`. */
|
|
466
|
+
type: "allowed_tools";
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/** Forces the model to call a specific function. */
|
|
470
|
+
export interface ChatCompletionNamedToolChoice {
|
|
471
|
+
function: ChatCompletionNamedToolChoiceFunction;
|
|
472
|
+
/** For function calling, the type is always `function`. */
|
|
473
|
+
type: "function";
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/** SDK `ChatCompletionNamedToolChoice.Function`. */
|
|
477
|
+
export interface ChatCompletionNamedToolChoiceFunction {
|
|
478
|
+
/** The name of the function to call. */
|
|
479
|
+
name: string;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/** Forces the model to call a specific custom tool. */
|
|
483
|
+
export interface ChatCompletionNamedToolChoiceCustom {
|
|
484
|
+
custom: ChatCompletionNamedToolChoiceCustomCustom;
|
|
485
|
+
/** For custom tool calling, the type is always `custom`. */
|
|
486
|
+
type: "custom";
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** SDK `ChatCompletionNamedToolChoiceCustom.Custom`. */
|
|
490
|
+
export interface ChatCompletionNamedToolChoiceCustomCustom {
|
|
491
|
+
/** The name of the custom tool to call. */
|
|
492
|
+
name: string;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/** Controls which (if any) tool is called by the model. */
|
|
496
|
+
export type ChatCompletionToolChoiceOption =
|
|
497
|
+
| "none"
|
|
498
|
+
| "auto"
|
|
499
|
+
| "required"
|
|
500
|
+
| ChatCompletionAllowedToolChoice
|
|
501
|
+
| ChatCompletionNamedToolChoice
|
|
502
|
+
| ChatCompletionNamedToolChoiceCustom;
|
|
503
|
+
|
|
504
|
+
// ─── Token logprobs ──────────────────────────────────────────────────────────
|
|
505
|
+
|
|
506
|
+
export interface ChatCompletionTokenLogprob {
|
|
507
|
+
/** The token. */
|
|
508
|
+
token: string;
|
|
509
|
+
/** UTF-8 bytes representation of the token; `null` when unavailable. */
|
|
510
|
+
bytes: Array<number> | null;
|
|
511
|
+
/** Log probability of this token; `-9999.0` when outside the top 20. */
|
|
512
|
+
logprob: number;
|
|
513
|
+
/** Most likely tokens and their log probability at this position. */
|
|
514
|
+
top_logprobs: Array<ChatCompletionTokenLogprobTopLogprob>;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** SDK `ChatCompletionTokenLogprob.TopLogprob`. */
|
|
518
|
+
export interface ChatCompletionTokenLogprobTopLogprob {
|
|
519
|
+
/** The token. */
|
|
520
|
+
token: string;
|
|
521
|
+
/** UTF-8 bytes representation of the token; `null` when unavailable. */
|
|
522
|
+
bytes: Array<number> | null;
|
|
523
|
+
/** Log probability of this token; `-9999.0` when outside the top 20. */
|
|
524
|
+
logprob: number;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// ─── Streaming chunk ─────────────────────────────────────────────────────────
|
|
528
|
+
|
|
529
|
+
/** A streamed chunk of a chat completion response. */
|
|
530
|
+
export interface ChatCompletionChunk {
|
|
531
|
+
/** Unique identifier for the chat completion. Each chunk has the same ID. */
|
|
532
|
+
id: string;
|
|
533
|
+
/** Choices; can exceed one when `n > 1`, or be empty on the final usage chunk. */
|
|
534
|
+
choices: Array<ChatCompletionChunkChoice>;
|
|
535
|
+
/** Unix timestamp (seconds) of when the chat completion was created. */
|
|
536
|
+
created: number;
|
|
537
|
+
/** The model to generate the completion. */
|
|
538
|
+
model: string;
|
|
539
|
+
/** Always `chat.completion.chunk`. */
|
|
540
|
+
object: "chat.completion.chunk";
|
|
541
|
+
/** Moderation results, present on the moderation chunk when requested. */
|
|
542
|
+
moderation?: ChatCompletionChunkModeration | null;
|
|
543
|
+
/** Processing type actually used for serving the request. */
|
|
544
|
+
service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
|
|
545
|
+
/** Deprecated by OpenAI: backend configuration fingerprint, pairs with `seed`. */
|
|
546
|
+
system_fingerprint?: string;
|
|
547
|
+
/** Only with `stream_options: {"include_usage": true}`; null except on the last chunk. */
|
|
548
|
+
usage?: CompletionUsage | null;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/** SDK-style namespace mirror so `ChatCompletionChunk.Choice` call sites keep working. */
|
|
552
|
+
export declare namespace ChatCompletionChunk {
|
|
553
|
+
export type Choice = ChatCompletionChunkChoice;
|
|
554
|
+
export type Moderation = ChatCompletionChunkModeration;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** SDK `ChatCompletionChunk.Choice`. */
|
|
558
|
+
export interface ChatCompletionChunkChoice {
|
|
559
|
+
/** A chat completion delta generated by streamed model responses. */
|
|
560
|
+
delta: ChatCompletionChunkChoiceDelta;
|
|
561
|
+
/** Why the model stopped generating tokens; null while streaming. */
|
|
562
|
+
finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call" | null;
|
|
563
|
+
/** The index of the choice in the list of choices. */
|
|
564
|
+
index: number;
|
|
565
|
+
/** Log probability information for the choice. */
|
|
566
|
+
logprobs?: ChatCompletionChunkChoiceLogprobs | null;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/** SDK `ChatCompletionChunk.Choice.Delta`. */
|
|
570
|
+
export interface ChatCompletionChunkChoiceDelta {
|
|
571
|
+
/** The contents of the chunk message. */
|
|
572
|
+
content?: string | null;
|
|
573
|
+
/** Deprecated by OpenAI; replaced by `tool_calls`. */
|
|
574
|
+
function_call?: ChatCompletionChunkChoiceDeltaFunctionCall;
|
|
575
|
+
/** The refusal message generated by the model. */
|
|
576
|
+
refusal?: string | null;
|
|
577
|
+
/** The role of the author of this message. */
|
|
578
|
+
role?: "developer" | "system" | "user" | "assistant" | "tool";
|
|
579
|
+
tool_calls?: Array<ChatCompletionChunkChoiceDeltaToolCall>;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** SDK `ChatCompletionChunk.Choice.Delta.FunctionCall`. */
|
|
583
|
+
export interface ChatCompletionChunkChoiceDeltaFunctionCall {
|
|
584
|
+
/** JSON-encoded arguments; the model may emit invalid JSON, validate before use. */
|
|
585
|
+
arguments?: string;
|
|
586
|
+
/** The name of the function to call. */
|
|
587
|
+
name?: string;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** SDK `ChatCompletionChunk.Choice.Delta.ToolCall`. */
|
|
591
|
+
export interface ChatCompletionChunkChoiceDeltaToolCall {
|
|
592
|
+
index: number;
|
|
593
|
+
/** The ID of the tool call. */
|
|
594
|
+
id?: string;
|
|
595
|
+
function?: ChatCompletionChunkChoiceDeltaToolCallFunction;
|
|
596
|
+
/** Always `function`. */
|
|
597
|
+
type?: "function";
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/** SDK `ChatCompletionChunk.Choice.Delta.ToolCall.Function`. */
|
|
601
|
+
export interface ChatCompletionChunkChoiceDeltaToolCallFunction {
|
|
602
|
+
/** JSON-encoded arguments; the model may emit invalid JSON, validate before use. */
|
|
603
|
+
arguments?: string;
|
|
604
|
+
/** The name of the function to call. */
|
|
605
|
+
name?: string;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** SDK `ChatCompletionChunk.Choice.Logprobs`. */
|
|
609
|
+
export interface ChatCompletionChunkChoiceLogprobs {
|
|
610
|
+
/** Message content tokens with log probability information. */
|
|
611
|
+
content: Array<ChatCompletionTokenLogprob> | null;
|
|
612
|
+
/** Message refusal tokens with log probability information. */
|
|
613
|
+
refusal: Array<ChatCompletionTokenLogprob> | null;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/** SDK `ChatCompletionChunk.Moderation`. */
|
|
617
|
+
export interface ChatCompletionChunkModeration {
|
|
618
|
+
/** Moderation for the request input. */
|
|
619
|
+
input: ChatCompletionChunkModerationResults | ChatCompletionChunkModerationError;
|
|
620
|
+
/** Moderation for the generated output. */
|
|
621
|
+
output: ChatCompletionChunkModerationResults | ChatCompletionChunkModerationError;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/** SDK `ChatCompletionChunk.Moderation.ModerationResults`. */
|
|
625
|
+
export interface ChatCompletionChunkModerationResults {
|
|
626
|
+
/** The moderation model used to generate the results. */
|
|
627
|
+
model: string;
|
|
628
|
+
/** A list of moderation results. */
|
|
629
|
+
results: Array<ChatCompletionChunkModerationResult>;
|
|
630
|
+
/** Always `moderation_results`. */
|
|
631
|
+
type: "moderation_results";
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/** SDK `ChatCompletionChunk.Moderation.ModerationResults.Result`. */
|
|
635
|
+
export interface ChatCompletionChunkModerationResult {
|
|
636
|
+
/** Moderation categories to booleans; true when flagged under the category. */
|
|
637
|
+
categories: {
|
|
638
|
+
[key: string]: boolean;
|
|
639
|
+
};
|
|
640
|
+
/** Input modalities reflected by the score for each category. */
|
|
641
|
+
category_applied_input_types: {
|
|
642
|
+
[key: string]: Array<"text" | "image">;
|
|
643
|
+
};
|
|
644
|
+
/** A dictionary of moderation categories to scores. */
|
|
645
|
+
category_scores: {
|
|
646
|
+
[key: string]: number;
|
|
647
|
+
};
|
|
648
|
+
/** Whether the content was flagged by any category. */
|
|
649
|
+
flagged: boolean;
|
|
650
|
+
/** The moderation model that produced this result. */
|
|
651
|
+
model: string;
|
|
652
|
+
/** Always `moderation_result`. */
|
|
653
|
+
type: "moderation_result";
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** SDK `ChatCompletionChunk.Moderation.Error`. */
|
|
657
|
+
export interface ChatCompletionChunkModerationError {
|
|
658
|
+
/** The error code. */
|
|
659
|
+
code: string;
|
|
660
|
+
/** The error message. */
|
|
661
|
+
message: string;
|
|
662
|
+
/** Always `error`. */
|
|
663
|
+
type: "error";
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// ─── Create params ───────────────────────────────────────────────────────────
|
|
667
|
+
|
|
668
|
+
/** Audio output parameters; required with `modalities: ["audio"]`. */
|
|
669
|
+
export interface ChatCompletionAudioParam {
|
|
670
|
+
/** Output audio format. */
|
|
671
|
+
format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
|
|
672
|
+
/** Built-in voice name or a custom voice object. */
|
|
673
|
+
voice:
|
|
674
|
+
| string
|
|
675
|
+
| "alloy"
|
|
676
|
+
| "ash"
|
|
677
|
+
| "ballad"
|
|
678
|
+
| "coral"
|
|
679
|
+
| "echo"
|
|
680
|
+
| "sage"
|
|
681
|
+
| "shimmer"
|
|
682
|
+
| "verse"
|
|
683
|
+
| "marin"
|
|
684
|
+
| "cedar"
|
|
685
|
+
| ChatCompletionAudioParamID;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/** SDK `ChatCompletionAudioParam.ID`: custom voice reference. */
|
|
689
|
+
export interface ChatCompletionAudioParamID {
|
|
690
|
+
/** The custom voice ID, e.g. `voice_1234`. */
|
|
691
|
+
id: string;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/** Forces the model to call a specific function via `{"name": "my_function"}`. */
|
|
695
|
+
export interface ChatCompletionFunctionCallOption {
|
|
696
|
+
/** The name of the function to call. */
|
|
697
|
+
name: string;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/** Static predicted output content, e.g. a text file being regenerated. */
|
|
701
|
+
export interface ChatCompletionPredictionContent {
|
|
702
|
+
/** Content matched when generating a model response to speed it up. */
|
|
703
|
+
content: string | Array<ChatCompletionContentPartText>;
|
|
704
|
+
/** Always `content`. */
|
|
705
|
+
type: "content";
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/** Options for streaming response. Only set with `stream: true`. */
|
|
709
|
+
export interface ChatCompletionStreamOptions {
|
|
710
|
+
/** Pad delta events with an `obfuscation` field to normalize payload sizes. */
|
|
711
|
+
include_obfuscation?: boolean;
|
|
712
|
+
/** Stream a final usage chunk before `data: [DONE]`. */
|
|
713
|
+
include_usage?: boolean;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/** SDK `ChatCompletionCreateParams.Function`. Deprecated by OpenAI in favor of tools. */
|
|
717
|
+
export interface ChatCompletionCreateParamsFunction {
|
|
718
|
+
/** Function name: a-z, A-Z, 0-9, underscores and dashes, max length 64. */
|
|
719
|
+
name: string;
|
|
720
|
+
/** What the function does; used by the model to choose when/how to call it. */
|
|
721
|
+
description?: string;
|
|
722
|
+
/** Parameters as a JSON Schema object. Omitting defines an empty parameter list. */
|
|
723
|
+
parameters?: FunctionParameters;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/** SDK `ChatCompletionCreateParams.Moderation`. */
|
|
727
|
+
export interface ChatCompletionCreateParamsModeration {
|
|
728
|
+
/** Moderation model for moderated completions, e.g. 'omni-moderation-latest'. */
|
|
729
|
+
model: string;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/** SDK `ChatCompletionCreateParams.WebSearchOptions`. */
|
|
733
|
+
export interface ChatCompletionCreateParamsWebSearchOptions {
|
|
734
|
+
/** Context window space to use for the search; `medium` is the default. */
|
|
735
|
+
search_context_size?: "low" | "medium" | "high";
|
|
736
|
+
/** Approximate location parameters for the search. */
|
|
737
|
+
user_location?: ChatCompletionCreateParamsWebSearchOptionsUserLocation | null;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/** SDK `ChatCompletionCreateParams.WebSearchOptions.UserLocation`. */
|
|
741
|
+
export interface ChatCompletionCreateParamsWebSearchOptionsUserLocation {
|
|
742
|
+
/** Approximate location parameters for the search. */
|
|
743
|
+
approximate: ChatCompletionCreateParamsWebSearchOptionsUserLocationApproximate;
|
|
744
|
+
/** Always `approximate`. */
|
|
745
|
+
type: "approximate";
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** SDK `ChatCompletionCreateParams.WebSearchOptions.UserLocation.Approximate`. */
|
|
749
|
+
export interface ChatCompletionCreateParamsWebSearchOptionsUserLocationApproximate {
|
|
750
|
+
/** Free text input for the city of the user, e.g. `San Francisco`. */
|
|
751
|
+
city?: string;
|
|
752
|
+
/** Two-letter ISO country code of the user, e.g. `US`. */
|
|
753
|
+
country?: string;
|
|
754
|
+
/** Free text input for the region of the user, e.g. `California`. */
|
|
755
|
+
region?: string;
|
|
756
|
+
/** IANA timezone of the user, e.g. `America/Los_Angeles`. */
|
|
757
|
+
timezone?: string;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
export interface ChatCompletionCreateParamsBase {
|
|
761
|
+
/** Messages comprising the conversation so far. */
|
|
762
|
+
messages: Array<ChatCompletionMessageParam>;
|
|
763
|
+
/** Model ID used to generate the response, like `gpt-4o` or `o3`. */
|
|
764
|
+
model: (string & {}) | ChatModel;
|
|
765
|
+
/** Audio output parameters; required with `modalities: ["audio"]`. */
|
|
766
|
+
audio?: ChatCompletionAudioParam | null;
|
|
767
|
+
/** Number between -2.0 and 2.0; positive values penalize token frequency. */
|
|
768
|
+
frequency_penalty?: number | null;
|
|
769
|
+
/** Deprecated by OpenAI in favor of `tool_choice`. */
|
|
770
|
+
function_call?: "none" | "auto" | ChatCompletionFunctionCallOption;
|
|
771
|
+
/** Deprecated by OpenAI in favor of `tools`. */
|
|
772
|
+
functions?: Array<ChatCompletionCreateParamsFunction>;
|
|
773
|
+
/** Map of token IDs to bias values from -100 to 100. */
|
|
774
|
+
logit_bias?: {
|
|
775
|
+
[key: string]: number;
|
|
776
|
+
} | null;
|
|
777
|
+
/** Whether to return log probabilities of the output tokens. */
|
|
778
|
+
logprobs?: boolean | null;
|
|
779
|
+
/** Upper bound for generated tokens, including visible output and reasoning tokens. */
|
|
780
|
+
max_completion_tokens?: number | null;
|
|
781
|
+
/** Deprecated by OpenAI in favor of `max_completion_tokens`. */
|
|
782
|
+
max_tokens?: number | null;
|
|
783
|
+
/** Up to 16 key-value string pairs attached to the object. */
|
|
784
|
+
metadata?: Metadata | null;
|
|
785
|
+
/** Output types the model should generate, e.g. `["text"]` or `["text", "audio"]`. */
|
|
786
|
+
modalities?: Array<"text" | "audio"> | null;
|
|
787
|
+
/** Configuration for running moderation on request input and generated output. */
|
|
788
|
+
moderation?: ChatCompletionCreateParamsModeration | null;
|
|
789
|
+
/** How many chat completion choices to generate for each input message. */
|
|
790
|
+
n?: number | null;
|
|
791
|
+
/** Whether to enable parallel function calling during tool use. */
|
|
792
|
+
parallel_tool_calls?: boolean;
|
|
793
|
+
/** Static predicted output content, e.g. a text file being regenerated. */
|
|
794
|
+
prediction?: ChatCompletionPredictionContent | null;
|
|
795
|
+
/** Number between -2.0 and 2.0; positive values penalize tokens already present. */
|
|
796
|
+
presence_penalty?: number | null;
|
|
797
|
+
/** Cache-bucketing key for similar requests; replaces the `user` field. */
|
|
798
|
+
prompt_cache_key?: string;
|
|
799
|
+
/** Retention policy for the prompt cache; `24h` enables extended caching. */
|
|
800
|
+
prompt_cache_retention?: "in_memory" | "24h" | null;
|
|
801
|
+
/** Constrains effort on reasoning for reasoning models. */
|
|
802
|
+
reasoning_effort?: ReasoningEffort | null;
|
|
803
|
+
/** Output format: text, JSON mode, or Structured Outputs JSON schema. */
|
|
804
|
+
response_format?: ResponseFormatText | ResponseFormatJSONSchema | ResponseFormatJSONObject;
|
|
805
|
+
/** Stable end-user identifier used for usage-policy enforcement. */
|
|
806
|
+
safety_identifier?: string;
|
|
807
|
+
/** Deprecated by OpenAI (Beta): best-effort deterministic sampling seed. */
|
|
808
|
+
seed?: number | null;
|
|
809
|
+
/** Processing type used for serving the request. */
|
|
810
|
+
service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
|
|
811
|
+
/** Up to 4 sequences where the API will stop generating further tokens. */
|
|
812
|
+
stop?: string | null | Array<string>;
|
|
813
|
+
/** Whether to store the output for model distillation or evals. */
|
|
814
|
+
store?: boolean | null;
|
|
815
|
+
/** Whether to stream the response as server-sent events. */
|
|
816
|
+
stream?: boolean | null;
|
|
817
|
+
/** Options for streaming response. Only set with `stream: true`. */
|
|
818
|
+
stream_options?: ChatCompletionStreamOptions | null;
|
|
819
|
+
/** Sampling temperature between 0 and 2. */
|
|
820
|
+
temperature?: number | null;
|
|
821
|
+
/** Controls which (if any) tool is called by the model. */
|
|
822
|
+
tool_choice?: ChatCompletionToolChoiceOption;
|
|
823
|
+
/** A list of tools the model may call. */
|
|
824
|
+
tools?: Array<ChatCompletionTool>;
|
|
825
|
+
/** 0-20: number of most likely tokens to return at each position; needs `logprobs`. */
|
|
826
|
+
top_logprobs?: number | null;
|
|
827
|
+
/** Nucleus sampling: consider only tokens within `top_p` probability mass. */
|
|
828
|
+
top_p?: number | null;
|
|
829
|
+
/** Deprecated by OpenAI; replaced by `safety_identifier` and `prompt_cache_key`. */
|
|
830
|
+
user?: string;
|
|
831
|
+
/** Constrains the verbosity of the model's response. */
|
|
832
|
+
verbosity?: "low" | "medium" | "high" | null;
|
|
833
|
+
/** Web search tool configuration. */
|
|
834
|
+
web_search_options?: ChatCompletionCreateParamsWebSearchOptions;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
|
|
838
|
+
/** Non-streaming request. */
|
|
839
|
+
stream?: false | null;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
|
|
843
|
+
/** Streaming request: response arrives as server-sent events. */
|
|
844
|
+
stream: true;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export type ChatCompletionCreateParams = ChatCompletionCreateParamsNonStreaming | ChatCompletionCreateParamsStreaming;
|