docs: 重构 API 参考文档,拆分为独立文件并统一 CLI 风格格式
This commit is contained in:
File diff suppressed because it is too large
Load Diff
1036
docs/api_reference/anthropic/create.md
Normal file
1036
docs/api_reference/anthropic/create.md
Normal file
File diff suppressed because it is too large
Load Diff
240
docs/api_reference/anthropic/list.md
Normal file
240
docs/api_reference/anthropic/list.md
Normal file
@@ -0,0 +1,240 @@
|
||||
## List
|
||||
|
||||
`$ ant models list`
|
||||
|
||||
**get** `/v1/models`
|
||||
|
||||
List available models.
|
||||
|
||||
The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `--after-id: optional string`
|
||||
|
||||
Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.
|
||||
|
||||
- `--before-id: optional string`
|
||||
|
||||
Query param: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.
|
||||
|
||||
- `--limit: optional number`
|
||||
|
||||
Query param: Number of items to return per page.
|
||||
|
||||
Defaults to `20`. Ranges from `1` to `1000`.
|
||||
|
||||
- `--beta: optional array of AnthropicBeta`
|
||||
|
||||
Header param: Optional header to specify the beta version(s) you want to use.
|
||||
|
||||
### Returns
|
||||
|
||||
- `ListResponse_ModelInfo_: object { data, first_id, has_more, last_id }`
|
||||
|
||||
- `data: array of ModelInfo`
|
||||
|
||||
- `id: string`
|
||||
|
||||
Unique model identifier.
|
||||
|
||||
- `capabilities: object { batch, citations, code_execution, 6 more }`
|
||||
|
||||
Model capability information.
|
||||
|
||||
- `batch: object { supported }`
|
||||
|
||||
Whether the model supports the Batch API.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `citations: object { supported }`
|
||||
|
||||
Whether the model supports citation generation.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `code_execution: object { supported }`
|
||||
|
||||
Whether the model supports code execution tools.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }`
|
||||
|
||||
Context management support and available strategies.
|
||||
|
||||
- `clear_thinking_20251015: object { supported }`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `clear_tool_uses_20250919: object { supported }`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `compact_20260112: object { supported }`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `effort: object { high, low, max, 3 more }`
|
||||
|
||||
Effort (reasoning_effort) support and available levels.
|
||||
|
||||
- `high: object { supported }`
|
||||
|
||||
Whether the model supports high effort level.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `low: object { supported }`
|
||||
|
||||
Whether the model supports low effort level.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `max: object { supported }`
|
||||
|
||||
Whether the model supports max effort level.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `medium: object { supported }`
|
||||
|
||||
Whether the model supports medium effort level.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `xhigh: object { supported }`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `image_input: object { supported }`
|
||||
|
||||
Whether the model accepts image content blocks.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `pdf_input: object { supported }`
|
||||
|
||||
Whether the model accepts PDF content blocks.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `structured_outputs: object { supported }`
|
||||
|
||||
Whether the model supports structured output / JSON mode / strict tool schemas.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `thinking: object { supported, types }`
|
||||
|
||||
Thinking capability and supported type configurations.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `types: object { adaptive, enabled }`
|
||||
|
||||
Supported thinking type configurations.
|
||||
|
||||
- `adaptive: object { supported }`
|
||||
|
||||
Whether the model supports thinking with type 'adaptive' (auto).
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `enabled: object { supported }`
|
||||
|
||||
Whether the model supports thinking with type 'enabled'.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `created_at: string`
|
||||
|
||||
RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.
|
||||
|
||||
- `display_name: string`
|
||||
|
||||
A human-readable name for the model.
|
||||
|
||||
- `max_input_tokens: number`
|
||||
|
||||
Maximum input context window size in tokens for this model.
|
||||
|
||||
- `max_tokens: number`
|
||||
|
||||
Maximum value for the `max_tokens` parameter when using this model.
|
||||
|
||||
- `type: "model"`
|
||||
|
||||
Object type.
|
||||
|
||||
For Models, this is always `"model"`.
|
||||
|
||||
- `first_id: string`
|
||||
|
||||
First ID in the `data` list. Can be used as the `before_id` for the previous page.
|
||||
|
||||
- `has_more: boolean`
|
||||
|
||||
Indicates if there are more results in the requested page direction.
|
||||
|
||||
- `last_id: string`
|
||||
|
||||
Last ID in the `data` list. Can be used as the `after_id` for the next page.
|
||||
|
||||
### Example
|
||||
|
||||
```cli
|
||||
ant models list \
|
||||
--api-key my-anthropic-api-key
|
||||
```
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,291 +0,0 @@
|
||||
## List
|
||||
|
||||
**get** `/v1/models`
|
||||
|
||||
List available models.
|
||||
|
||||
The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
|
||||
|
||||
### Query Parameters
|
||||
|
||||
- `after_id: optional string`
|
||||
|
||||
ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.
|
||||
|
||||
- `before_id: optional string`
|
||||
|
||||
ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.
|
||||
|
||||
- `limit: optional number`
|
||||
|
||||
Number of items to return per page.
|
||||
|
||||
Defaults to `20`. Ranges from `1` to `1000`.
|
||||
|
||||
### Header Parameters
|
||||
|
||||
- `"anthropic-beta": optional array of AnthropicBeta`
|
||||
|
||||
Optional header to specify the beta version(s) you want to use.
|
||||
|
||||
- `UnionMember0 = string`
|
||||
|
||||
- `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 20 more`
|
||||
|
||||
- `"message-batches-2024-09-24"`
|
||||
|
||||
- `"prompt-caching-2024-07-31"`
|
||||
|
||||
- `"computer-use-2024-10-22"`
|
||||
|
||||
- `"computer-use-2025-01-24"`
|
||||
|
||||
- `"pdfs-2024-09-25"`
|
||||
|
||||
- `"token-counting-2024-11-01"`
|
||||
|
||||
- `"token-efficient-tools-2025-02-19"`
|
||||
|
||||
- `"output-128k-2025-02-19"`
|
||||
|
||||
- `"files-api-2025-04-14"`
|
||||
|
||||
- `"mcp-client-2025-04-04"`
|
||||
|
||||
- `"mcp-client-2025-11-20"`
|
||||
|
||||
- `"dev-full-thinking-2025-05-14"`
|
||||
|
||||
- `"interleaved-thinking-2025-05-14"`
|
||||
|
||||
- `"code-execution-2025-05-22"`
|
||||
|
||||
- `"extended-cache-ttl-2025-04-11"`
|
||||
|
||||
- `"context-1m-2025-08-07"`
|
||||
|
||||
- `"context-management-2025-06-27"`
|
||||
|
||||
- `"model-context-window-exceeded-2025-08-26"`
|
||||
|
||||
- `"skills-2025-10-02"`
|
||||
|
||||
- `"fast-mode-2026-02-01"`
|
||||
|
||||
- `"output-300k-2026-03-24"`
|
||||
|
||||
- `"advisor-tool-2026-03-01"`
|
||||
|
||||
- `"user-profiles-2026-03-24"`
|
||||
|
||||
### Returns
|
||||
|
||||
- `data: array of ModelInfo`
|
||||
|
||||
- `id: string`
|
||||
|
||||
Unique model identifier.
|
||||
|
||||
- `capabilities: ModelCapabilities`
|
||||
|
||||
Model capability information.
|
||||
|
||||
- `batch: CapabilitySupport`
|
||||
|
||||
Whether the model supports the Batch API.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `citations: CapabilitySupport`
|
||||
|
||||
Whether the model supports citation generation.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `code_execution: CapabilitySupport`
|
||||
|
||||
Whether the model supports code execution tools.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `context_management: ContextManagementCapability`
|
||||
|
||||
Context management support and available strategies.
|
||||
|
||||
- `clear_thinking_20251015: CapabilitySupport`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `clear_tool_uses_20250919: CapabilitySupport`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `compact_20260112: CapabilitySupport`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `effort: EffortCapability`
|
||||
|
||||
Effort (reasoning_effort) support and available levels.
|
||||
|
||||
- `high: CapabilitySupport`
|
||||
|
||||
Whether the model supports high effort level.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `low: CapabilitySupport`
|
||||
|
||||
Whether the model supports low effort level.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `max: CapabilitySupport`
|
||||
|
||||
Whether the model supports max effort level.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `medium: CapabilitySupport`
|
||||
|
||||
Whether the model supports medium effort level.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `xhigh: CapabilitySupport`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `image_input: CapabilitySupport`
|
||||
|
||||
Whether the model accepts image content blocks.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `pdf_input: CapabilitySupport`
|
||||
|
||||
Whether the model accepts PDF content blocks.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `structured_outputs: CapabilitySupport`
|
||||
|
||||
Whether the model supports structured output / JSON mode / strict tool schemas.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `thinking: ThinkingCapability`
|
||||
|
||||
Thinking capability and supported type configurations.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `types: ThinkingTypes`
|
||||
|
||||
Supported thinking type configurations.
|
||||
|
||||
- `adaptive: CapabilitySupport`
|
||||
|
||||
Whether the model supports thinking with type 'adaptive' (auto).
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `enabled: CapabilitySupport`
|
||||
|
||||
Whether the model supports thinking with type 'enabled'.
|
||||
|
||||
- `supported: boolean`
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `created_at: string`
|
||||
|
||||
RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.
|
||||
|
||||
- `display_name: string`
|
||||
|
||||
A human-readable name for the model.
|
||||
|
||||
- `max_input_tokens: number`
|
||||
|
||||
Maximum input context window size in tokens for this model.
|
||||
|
||||
- `max_tokens: number`
|
||||
|
||||
Maximum value for the `max_tokens` parameter when using this model.
|
||||
|
||||
- `type: "model"`
|
||||
|
||||
Object type.
|
||||
|
||||
For Models, this is always `"model"`.
|
||||
|
||||
- `"model"`
|
||||
|
||||
- `first_id: string`
|
||||
|
||||
First ID in the `data` list. Can be used as the `before_id` for the previous page.
|
||||
|
||||
- `has_more: boolean`
|
||||
|
||||
Indicates if there are more results in the requested page direction.
|
||||
|
||||
- `last_id: string`
|
||||
|
||||
Last ID in the `data` list. Can be used as the `after_id` for the next page.
|
||||
|
||||
### Example
|
||||
|
||||
```http
|
||||
curl https://api.anthropic.com/v1/models \
|
||||
-H 'anthropic-version: 2023-06-01' \
|
||||
-H "X-Api-Key: $ANTHROPIC_API_KEY"
|
||||
```
|
||||
@@ -1,86 +1,36 @@
|
||||
## Retrieve
|
||||
|
||||
`$ ant models retrieve`
|
||||
|
||||
**get** `/v1/models/{model_id}`
|
||||
|
||||
Get a specific model.
|
||||
|
||||
The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.
|
||||
|
||||
### Path Parameters
|
||||
### Parameters
|
||||
|
||||
- `model_id: string`
|
||||
- `--model-id: string`
|
||||
|
||||
Model identifier or alias.
|
||||
|
||||
### Header Parameters
|
||||
|
||||
- `"anthropic-beta": optional array of AnthropicBeta`
|
||||
- `--beta: optional array of AnthropicBeta`
|
||||
|
||||
Optional header to specify the beta version(s) you want to use.
|
||||
|
||||
- `UnionMember0 = string`
|
||||
|
||||
- `UnionMember1 = "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 20 more`
|
||||
|
||||
- `"message-batches-2024-09-24"`
|
||||
|
||||
- `"prompt-caching-2024-07-31"`
|
||||
|
||||
- `"computer-use-2024-10-22"`
|
||||
|
||||
- `"computer-use-2025-01-24"`
|
||||
|
||||
- `"pdfs-2024-09-25"`
|
||||
|
||||
- `"token-counting-2024-11-01"`
|
||||
|
||||
- `"token-efficient-tools-2025-02-19"`
|
||||
|
||||
- `"output-128k-2025-02-19"`
|
||||
|
||||
- `"files-api-2025-04-14"`
|
||||
|
||||
- `"mcp-client-2025-04-04"`
|
||||
|
||||
- `"mcp-client-2025-11-20"`
|
||||
|
||||
- `"dev-full-thinking-2025-05-14"`
|
||||
|
||||
- `"interleaved-thinking-2025-05-14"`
|
||||
|
||||
- `"code-execution-2025-05-22"`
|
||||
|
||||
- `"extended-cache-ttl-2025-04-11"`
|
||||
|
||||
- `"context-1m-2025-08-07"`
|
||||
|
||||
- `"context-management-2025-06-27"`
|
||||
|
||||
- `"model-context-window-exceeded-2025-08-26"`
|
||||
|
||||
- `"skills-2025-10-02"`
|
||||
|
||||
- `"fast-mode-2026-02-01"`
|
||||
|
||||
- `"output-300k-2026-03-24"`
|
||||
|
||||
- `"advisor-tool-2026-03-01"`
|
||||
|
||||
- `"user-profiles-2026-03-24"`
|
||||
|
||||
### Returns
|
||||
|
||||
- `ModelInfo = object { id, capabilities, created_at, 4 more }`
|
||||
- `model_info: object { id, capabilities, created_at, 4 more }`
|
||||
|
||||
- `id: string`
|
||||
|
||||
Unique model identifier.
|
||||
|
||||
- `capabilities: ModelCapabilities`
|
||||
- `capabilities: object { batch, citations, code_execution, 6 more }`
|
||||
|
||||
Model capability information.
|
||||
|
||||
- `batch: CapabilitySupport`
|
||||
- `batch: object { supported }`
|
||||
|
||||
Whether the model supports the Batch API.
|
||||
|
||||
@@ -88,7 +38,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `citations: CapabilitySupport`
|
||||
- `citations: object { supported }`
|
||||
|
||||
Whether the model supports citation generation.
|
||||
|
||||
@@ -96,7 +46,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `code_execution: CapabilitySupport`
|
||||
- `code_execution: object { supported }`
|
||||
|
||||
Whether the model supports code execution tools.
|
||||
|
||||
@@ -104,11 +54,11 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `context_management: ContextManagementCapability`
|
||||
- `context_management: object { clear_thinking_20251015, clear_tool_uses_20250919, compact_20260112, supported }`
|
||||
|
||||
Context management support and available strategies.
|
||||
|
||||
- `clear_thinking_20251015: CapabilitySupport`
|
||||
- `clear_thinking_20251015: object { supported }`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
@@ -116,7 +66,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `clear_tool_uses_20250919: CapabilitySupport`
|
||||
- `clear_tool_uses_20250919: object { supported }`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
@@ -124,7 +74,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `compact_20260112: CapabilitySupport`
|
||||
- `compact_20260112: object { supported }`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
@@ -136,11 +86,11 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `effort: EffortCapability`
|
||||
- `effort: object { high, low, max, 3 more }`
|
||||
|
||||
Effort (reasoning_effort) support and available levels.
|
||||
|
||||
- `high: CapabilitySupport`
|
||||
- `high: object { supported }`
|
||||
|
||||
Whether the model supports high effort level.
|
||||
|
||||
@@ -148,7 +98,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `low: CapabilitySupport`
|
||||
- `low: object { supported }`
|
||||
|
||||
Whether the model supports low effort level.
|
||||
|
||||
@@ -156,7 +106,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `max: CapabilitySupport`
|
||||
- `max: object { supported }`
|
||||
|
||||
Whether the model supports max effort level.
|
||||
|
||||
@@ -164,7 +114,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `medium: CapabilitySupport`
|
||||
- `medium: object { supported }`
|
||||
|
||||
Whether the model supports medium effort level.
|
||||
|
||||
@@ -176,7 +126,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `xhigh: CapabilitySupport`
|
||||
- `xhigh: object { supported }`
|
||||
|
||||
Indicates whether a capability is supported.
|
||||
|
||||
@@ -184,7 +134,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `image_input: CapabilitySupport`
|
||||
- `image_input: object { supported }`
|
||||
|
||||
Whether the model accepts image content blocks.
|
||||
|
||||
@@ -192,7 +142,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `pdf_input: CapabilitySupport`
|
||||
- `pdf_input: object { supported }`
|
||||
|
||||
Whether the model accepts PDF content blocks.
|
||||
|
||||
@@ -200,7 +150,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `structured_outputs: CapabilitySupport`
|
||||
- `structured_outputs: object { supported }`
|
||||
|
||||
Whether the model supports structured output / JSON mode / strict tool schemas.
|
||||
|
||||
@@ -208,7 +158,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `thinking: ThinkingCapability`
|
||||
- `thinking: object { supported, types }`
|
||||
|
||||
Thinking capability and supported type configurations.
|
||||
|
||||
@@ -216,11 +166,11 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `types: ThinkingTypes`
|
||||
- `types: object { adaptive, enabled }`
|
||||
|
||||
Supported thinking type configurations.
|
||||
|
||||
- `adaptive: CapabilitySupport`
|
||||
- `adaptive: object { supported }`
|
||||
|
||||
Whether the model supports thinking with type 'adaptive' (auto).
|
||||
|
||||
@@ -228,7 +178,7 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
Whether this capability is supported by the model.
|
||||
|
||||
- `enabled: CapabilitySupport`
|
||||
- `enabled: object { supported }`
|
||||
|
||||
Whether the model supports thinking with type 'enabled'.
|
||||
|
||||
@@ -258,12 +208,10 @@ The Models API response can be used to determine information about a specific mo
|
||||
|
||||
For Models, this is always `"model"`.
|
||||
|
||||
- `"model"`
|
||||
|
||||
### Example
|
||||
|
||||
```http
|
||||
curl https://api.anthropic.com/v1/models/$MODEL_ID \
|
||||
-H 'anthropic-version: 2023-06-01' \
|
||||
-H "X-Api-Key: $ANTHROPIC_API_KEY"
|
||||
```cli
|
||||
ant models retrieve \
|
||||
--api-key my-anthropic-api-key \
|
||||
--model-id model_id
|
||||
```
|
||||
175
docs/api_reference/openai/Create embeddings.md
Normal file
175
docs/api_reference/openai/Create embeddings.md
Normal file
@@ -0,0 +1,175 @@
|
||||
## Create embeddings
|
||||
|
||||
**post** `/embeddings`
|
||||
|
||||
Creates an embedding vector representing the input text.
|
||||
|
||||
### Body Parameters
|
||||
|
||||
- `input: string or array of string or array of number or array of array of number`
|
||||
|
||||
Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request.
|
||||
|
||||
- `String = string`
|
||||
|
||||
The string that will be turned into an embedding.
|
||||
|
||||
- `Array = array of string`
|
||||
|
||||
The array of strings that will be turned into an embedding.
|
||||
|
||||
- `Array = array of number`
|
||||
|
||||
The array of integers that will be turned into an embedding.
|
||||
|
||||
- `Array = array of array of number`
|
||||
|
||||
The array of arrays containing integers that will be turned into an embedding.
|
||||
|
||||
- `model: string or EmbeddingModel`
|
||||
|
||||
ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them.
|
||||
|
||||
- `string`
|
||||
|
||||
- `EmbeddingModel = "text-embedding-ada-002" or "text-embedding-3-small" or "text-embedding-3-large"`
|
||||
|
||||
- `"text-embedding-ada-002"`
|
||||
|
||||
- `"text-embedding-3-small"`
|
||||
|
||||
- `"text-embedding-3-large"`
|
||||
|
||||
- `dimensions: optional number`
|
||||
|
||||
The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.
|
||||
|
||||
- `encoding_format: optional "float" or "base64"`
|
||||
|
||||
The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).
|
||||
|
||||
- `"float"`
|
||||
|
||||
- `"base64"`
|
||||
|
||||
- `user: optional string`
|
||||
|
||||
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
|
||||
|
||||
### Returns
|
||||
|
||||
- `CreateEmbeddingResponse object { data, model, object, usage }`
|
||||
|
||||
- `data: array of Embedding`
|
||||
|
||||
The list of embeddings generated by the model.
|
||||
|
||||
- `embedding: array of number`
|
||||
|
||||
The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings).
|
||||
|
||||
- `index: number`
|
||||
|
||||
The index of the embedding in the list of embeddings.
|
||||
|
||||
- `object: "embedding"`
|
||||
|
||||
The object type, which is always "embedding".
|
||||
|
||||
- `"embedding"`
|
||||
|
||||
- `model: string`
|
||||
|
||||
The name of the model used to generate the embedding.
|
||||
|
||||
- `object: "list"`
|
||||
|
||||
The object type, which is always "list".
|
||||
|
||||
- `"list"`
|
||||
|
||||
- `usage: object { prompt_tokens, total_tokens }`
|
||||
|
||||
The usage information for the request.
|
||||
|
||||
- `prompt_tokens: number`
|
||||
|
||||
The number of tokens used by the prompt.
|
||||
|
||||
- `total_tokens: number`
|
||||
|
||||
The total number of tokens used by the request.
|
||||
|
||||
### Example
|
||||
|
||||
```http
|
||||
curl https://api.openai.com/v1/embeddings \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||
-d '{
|
||||
"input": "The quick brown fox jumped over the lazy dog",
|
||||
"model": "text-embedding-3-small",
|
||||
"encoding_format": "float",
|
||||
"user": "user-1234"
|
||||
}'
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"embedding": [
|
||||
0
|
||||
],
|
||||
"index": 0,
|
||||
"object": "embedding"
|
||||
}
|
||||
],
|
||||
"model": "model",
|
||||
"object": "list",
|
||||
"usage": {
|
||||
"prompt_tokens": 0,
|
||||
"total_tokens": 0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
```http
|
||||
curl https://api.openai.com/v1/embeddings \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"input": "The food was delicious and the waiter...",
|
||||
"model": "text-embedding-ada-002",
|
||||
"encoding_format": "float"
|
||||
}'
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"object": "embedding",
|
||||
"embedding": [
|
||||
0.0023064255,
|
||||
-0.009327292,
|
||||
.... (1536 floats total for ada-002)
|
||||
-0.0028842222,
|
||||
],
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"model": "text-embedding-ada-002",
|
||||
"usage": {
|
||||
"prompt_tokens": 8,
|
||||
"total_tokens": 8
|
||||
}
|
||||
}
|
||||
```
|
||||
367
docs/api_reference/openai/Create image.md
Normal file
367
docs/api_reference/openai/Create image.md
Normal file
@@ -0,0 +1,367 @@
|
||||
## Create image
|
||||
|
||||
**post** `/images/generations`
|
||||
|
||||
Creates an image given a prompt. [Learn more](/docs/guides/images).
|
||||
|
||||
### Body Parameters
|
||||
|
||||
- `prompt: string`
|
||||
|
||||
A text description of the desired image(s). The maximum length is 32000 characters for the GPT image models, 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`.
|
||||
|
||||
- `background: optional "transparent" or "opaque" or "auto"`
|
||||
|
||||
Allows to set transparency for the background of the generated image(s).
|
||||
This parameter is only supported for the GPT image models. Must be one of
|
||||
`transparent`, `opaque` or `auto` (default value). When `auto` is used, the
|
||||
model will automatically determine the best background for the image.
|
||||
|
||||
If `transparent`, the output format needs to support transparency, so it
|
||||
should be set to either `png` (default value) or `webp`.
|
||||
|
||||
- `"transparent"`
|
||||
|
||||
- `"opaque"`
|
||||
|
||||
- `"auto"`
|
||||
|
||||
- `model: optional string or ImageModel`
|
||||
|
||||
The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used.
|
||||
|
||||
- `string`
|
||||
|
||||
- `ImageModel = "gpt-image-1.5" or "dall-e-2" or "dall-e-3" or 2 more`
|
||||
|
||||
- `"gpt-image-1.5"`
|
||||
|
||||
- `"dall-e-2"`
|
||||
|
||||
- `"dall-e-3"`
|
||||
|
||||
- `"gpt-image-1"`
|
||||
|
||||
- `"gpt-image-1-mini"`
|
||||
|
||||
- `moderation: optional "low" or "auto"`
|
||||
|
||||
Control the content-moderation level for images generated by the GPT image models. Must be either `low` for less restrictive filtering or `auto` (default value).
|
||||
|
||||
- `"low"`
|
||||
|
||||
- `"auto"`
|
||||
|
||||
- `n: optional number`
|
||||
|
||||
The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported.
|
||||
|
||||
- `output_compression: optional number`
|
||||
|
||||
The compression level (0-100%) for the generated images. This parameter is only supported for the GPT image models with the `webp` or `jpeg` output formats, and defaults to 100.
|
||||
|
||||
- `output_format: optional "png" or "jpeg" or "webp"`
|
||||
|
||||
The format in which the generated images are returned. This parameter is only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
|
||||
|
||||
- `"png"`
|
||||
|
||||
- `"jpeg"`
|
||||
|
||||
- `"webp"`
|
||||
|
||||
- `partial_images: optional number`
|
||||
|
||||
The number of partial images to generate. This parameter is used for
|
||||
streaming responses that return partial images. Value must be between 0 and 3.
|
||||
When set to 0, the response will be a single image sent in one streaming event.
|
||||
|
||||
Note that the final image may be sent before the full number of partial images
|
||||
are generated if the full image is generated more quickly.
|
||||
|
||||
- `quality: optional "standard" or "hd" or "low" or 3 more`
|
||||
|
||||
The quality of the image that will be generated.
|
||||
|
||||
- `auto` (default value) will automatically select the best quality for the given model.
|
||||
- `high`, `medium` and `low` are supported for the GPT image models.
|
||||
- `hd` and `standard` are supported for `dall-e-3`.
|
||||
- `standard` is the only option for `dall-e-2`.
|
||||
|
||||
- `"standard"`
|
||||
|
||||
- `"hd"`
|
||||
|
||||
- `"low"`
|
||||
|
||||
- `"medium"`
|
||||
|
||||
- `"high"`
|
||||
|
||||
- `"auto"`
|
||||
|
||||
- `response_format: optional "url" or "b64_json"`
|
||||
|
||||
The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for the GPT image models, which always return base64-encoded images.
|
||||
|
||||
- `"url"`
|
||||
|
||||
- `"b64_json"`
|
||||
|
||||
- `size: optional "auto" or "1024x1024" or "1536x1024" or 5 more`
|
||||
|
||||
The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.
|
||||
|
||||
- `"auto"`
|
||||
|
||||
- `"1024x1024"`
|
||||
|
||||
- `"1536x1024"`
|
||||
|
||||
- `"1024x1536"`
|
||||
|
||||
- `"256x256"`
|
||||
|
||||
- `"512x512"`
|
||||
|
||||
- `"1792x1024"`
|
||||
|
||||
- `"1024x1792"`
|
||||
|
||||
- `stream: optional boolean`
|
||||
|
||||
Generate the image in streaming mode. Defaults to `false`. See the
|
||||
[Image generation guide](/docs/guides/image-generation) for more information.
|
||||
This parameter is only supported for the GPT image models.
|
||||
|
||||
- `style: optional "vivid" or "natural"`
|
||||
|
||||
The style of the generated images. This parameter is only supported for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.
|
||||
|
||||
- `"vivid"`
|
||||
|
||||
- `"natural"`
|
||||
|
||||
- `user: optional string`
|
||||
|
||||
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
|
||||
|
||||
### Returns
|
||||
|
||||
- `ImagesResponse object { created, background, data, 4 more }`
|
||||
|
||||
The response from the image generation endpoint.
|
||||
|
||||
- `created: number`
|
||||
|
||||
The Unix timestamp (in seconds) of when the image was created.
|
||||
|
||||
- `background: optional "transparent" or "opaque"`
|
||||
|
||||
The background parameter used for the image generation. Either `transparent` or `opaque`.
|
||||
|
||||
- `"transparent"`
|
||||
|
||||
- `"opaque"`
|
||||
|
||||
- `data: optional array of Image`
|
||||
|
||||
The list of generated images.
|
||||
|
||||
- `b64_json: optional string`
|
||||
|
||||
The base64-encoded JSON of the generated image. Returned by default for the GPT image models, and only present if `response_format` is set to `b64_json` for `dall-e-2` and `dall-e-3`.
|
||||
|
||||
- `revised_prompt: optional string`
|
||||
|
||||
For `dall-e-3` only, the revised prompt that was used to generate the image.
|
||||
|
||||
- `url: optional string`
|
||||
|
||||
When using `dall-e-2` or `dall-e-3`, the URL of the generated image if `response_format` is set to `url` (default value). Unsupported for the GPT image models.
|
||||
|
||||
- `output_format: optional "png" or "webp" or "jpeg"`
|
||||
|
||||
The output format of the image generation. Either `png`, `webp`, or `jpeg`.
|
||||
|
||||
- `"png"`
|
||||
|
||||
- `"webp"`
|
||||
|
||||
- `"jpeg"`
|
||||
|
||||
- `quality: optional "low" or "medium" or "high"`
|
||||
|
||||
The quality of the image generated. Either `low`, `medium`, or `high`.
|
||||
|
||||
- `"low"`
|
||||
|
||||
- `"medium"`
|
||||
|
||||
- `"high"`
|
||||
|
||||
- `size: optional "1024x1024" or "1024x1536" or "1536x1024"`
|
||||
|
||||
The size of the image generated. Either `1024x1024`, `1024x1536`, or `1536x1024`.
|
||||
|
||||
- `"1024x1024"`
|
||||
|
||||
- `"1024x1536"`
|
||||
|
||||
- `"1536x1024"`
|
||||
|
||||
- `usage: optional object { input_tokens, input_tokens_details, output_tokens, 2 more }`
|
||||
|
||||
For `gpt-image-1` only, the token usage information for the image generation.
|
||||
|
||||
- `input_tokens: number`
|
||||
|
||||
The number of tokens (images and text) in the input prompt.
|
||||
|
||||
- `input_tokens_details: object { image_tokens, text_tokens }`
|
||||
|
||||
The input tokens detailed information for the image generation.
|
||||
|
||||
- `image_tokens: number`
|
||||
|
||||
The number of image tokens in the input prompt.
|
||||
|
||||
- `text_tokens: number`
|
||||
|
||||
The number of text tokens in the input prompt.
|
||||
|
||||
- `output_tokens: number`
|
||||
|
||||
The number of output tokens generated by the model.
|
||||
|
||||
- `total_tokens: number`
|
||||
|
||||
The total number of tokens (images and text) used for the image generation.
|
||||
|
||||
- `output_tokens_details: optional object { image_tokens, text_tokens }`
|
||||
|
||||
The output token details for the image generation.
|
||||
|
||||
- `image_tokens: number`
|
||||
|
||||
The number of image output tokens generated by the model.
|
||||
|
||||
- `text_tokens: number`
|
||||
|
||||
The number of text output tokens generated by the model.
|
||||
|
||||
### Example
|
||||
|
||||
```http
|
||||
curl https://api.openai.com/v1/images/generations \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||
-d '{
|
||||
"prompt": "A cute baby sea otter",
|
||||
"background": "transparent",
|
||||
"moderation": "low",
|
||||
"n": 1,
|
||||
"output_compression": 100,
|
||||
"output_format": "png",
|
||||
"partial_images": 1,
|
||||
"quality": "medium",
|
||||
"response_format": "url",
|
||||
"size": "1024x1024",
|
||||
"style": "vivid",
|
||||
"user": "user-1234"
|
||||
}'
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"created": 0,
|
||||
"background": "transparent",
|
||||
"data": [
|
||||
{
|
||||
"b64_json": "b64_json",
|
||||
"revised_prompt": "revised_prompt",
|
||||
"url": "url"
|
||||
}
|
||||
],
|
||||
"output_format": "png",
|
||||
"quality": "low",
|
||||
"size": "1024x1024",
|
||||
"usage": {
|
||||
"input_tokens": 0,
|
||||
"input_tokens_details": {
|
||||
"image_tokens": 0,
|
||||
"text_tokens": 0
|
||||
},
|
||||
"output_tokens": 0,
|
||||
"total_tokens": 0,
|
||||
"output_tokens_details": {
|
||||
"image_tokens": 0,
|
||||
"text_tokens": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Generate image
|
||||
|
||||
```http
|
||||
curl https://api.openai.com/v1/images/generations \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||
-d '{
|
||||
"model": "gpt-image-1.5",
|
||||
"prompt": "A cute baby sea otter",
|
||||
"n": 1,
|
||||
"size": "1024x1024"
|
||||
}'
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"created": 1713833628,
|
||||
"data": [
|
||||
{
|
||||
"b64_json": "..."
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"total_tokens": 100,
|
||||
"input_tokens": 50,
|
||||
"output_tokens": 50,
|
||||
"input_tokens_details": {
|
||||
"text_tokens": 10,
|
||||
"image_tokens": 40
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Streaming
|
||||
|
||||
```http
|
||||
curl https://api.openai.com/v1/images/generations \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||
-d '{
|
||||
"model": "gpt-image-1.5",
|
||||
"prompt": "A cute baby sea otter",
|
||||
"n": 1,
|
||||
"size": "1024x1024",
|
||||
"stream": true
|
||||
}' \
|
||||
--no-buffer
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
event: image_generation.partial_image
|
||||
data: {"type":"image_generation.partial_image","b64_json":"...","partial_image_index":0}
|
||||
|
||||
event: image_generation.completed
|
||||
data: {"type":"image_generation.completed","b64_json":"...","usage":{"total_tokens":100,"input_tokens":50,"output_tokens":50,"input_tokens_details":{"text_tokens":10,"image_tokens":40}}}
|
||||
```
|
||||
69
docs/api_reference/openai/Retrieve model.md
Normal file
69
docs/api_reference/openai/Retrieve model.md
Normal file
@@ -0,0 +1,69 @@
|
||||
## Retrieve model
|
||||
|
||||
**get** `/models/{model}`
|
||||
|
||||
Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
|
||||
|
||||
### Path Parameters
|
||||
|
||||
- `model: string`
|
||||
|
||||
### Returns
|
||||
|
||||
- `Model object { id, created, object, owned_by }`
|
||||
|
||||
Describes an OpenAI model offering that can be used with the API.
|
||||
|
||||
- `id: string`
|
||||
|
||||
The model identifier, which can be referenced in the API endpoints.
|
||||
|
||||
- `created: number`
|
||||
|
||||
The Unix timestamp (in seconds) when the model was created.
|
||||
|
||||
- `object: "model"`
|
||||
|
||||
The object type, which is always "model".
|
||||
|
||||
- `"model"`
|
||||
|
||||
- `owned_by: string`
|
||||
|
||||
The organization that owns the model.
|
||||
|
||||
### Example
|
||||
|
||||
```http
|
||||
curl https://api.openai.com/v1/models/$MODEL \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY"
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "id",
|
||||
"created": 0,
|
||||
"object": "model",
|
||||
"owned_by": "owned_by"
|
||||
}
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
```http
|
||||
curl https://api.openai.com/v1/models/VAR_chat_model_id \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY"
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "VAR_chat_model_id",
|
||||
"object": "model",
|
||||
"created": 1686935002,
|
||||
"owned_by": "openai"
|
||||
}
|
||||
```
|
||||
248
docs/api_reference/openai/chat/Streaming events.md
Normal file
248
docs/api_reference/openai/chat/Streaming events.md
Normal file
@@ -0,0 +1,248 @@
|
||||
## Streaming events
|
||||
|
||||
Stream Chat Completions in real time. Receive chunks of completions returned from the model using server-sent events. [Learn more](https://developers.openai.com/docs/guides/streaming-responses?api-mode=chat).
|
||||
|
||||
Represents a streamed chunk of a chat completion response returned by the model, based on the provided input. [Learn more](https://developers.openai.com/docs/guides/streaming-responses).
|
||||
|
||||
id: string
|
||||
|
||||
A unique identifier for the chat completion. Each chunk has the same ID.
|
||||
|
||||
choices: array of object { delta, finish\_reason, index, logprobs }
|
||||
|
||||
A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the last chunk if you set `stream_options: {"include_usage": true}`.
|
||||
|
||||
delta: object { content, function\_call, refusal, 2 more }
|
||||
|
||||
A chat completion delta generated by streamed model responses.
|
||||
|
||||
content: optional string
|
||||
|
||||
The contents of the chunk message.
|
||||
|
||||
Deprecatedfunction\_call: optional object { arguments, name }
|
||||
|
||||
Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
|
||||
|
||||
arguments: optional string
|
||||
|
||||
The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
|
||||
|
||||
name: optional string
|
||||
|
||||
The name of the function to call.
|
||||
|
||||
refusal: optional string
|
||||
|
||||
The refusal message generated by the model.
|
||||
|
||||
role: optional "developer" or "system" or "user" or 2 more
|
||||
|
||||
The role of the author of this message.
|
||||
|
||||
One of the following:
|
||||
|
||||
"developer"
|
||||
|
||||
"system"
|
||||
|
||||
"user"
|
||||
|
||||
"assistant"
|
||||
|
||||
"tool"
|
||||
|
||||
tool\_calls: optional array of object { index, id, function, type }
|
||||
|
||||
index: number
|
||||
|
||||
id: optional string
|
||||
|
||||
The ID of the tool call.
|
||||
|
||||
function: optional object { arguments, name }
|
||||
|
||||
arguments: optional string
|
||||
|
||||
The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
|
||||
|
||||
name: optional string
|
||||
|
||||
The name of the function to call.
|
||||
|
||||
type: optional "function"
|
||||
|
||||
The type of the tool. Currently, only `function` is supported.
|
||||
|
||||
finish\_reason: "stop" or "length" or "tool\_calls" or 2 more
|
||||
|
||||
The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
|
||||
|
||||
One of the following:
|
||||
|
||||
"stop"
|
||||
|
||||
"length"
|
||||
|
||||
"tool\_calls"
|
||||
|
||||
"content\_filter"
|
||||
|
||||
"function\_call"
|
||||
|
||||
index: number
|
||||
|
||||
The index of the choice in the list of choices.
|
||||
|
||||
logprobs: optional object { content, refusal }
|
||||
|
||||
Log probability information for the choice.
|
||||
|
||||
A list of message content tokens with log probability information.
|
||||
|
||||
token: string
|
||||
|
||||
The token.
|
||||
|
||||
bytes: array of number
|
||||
|
||||
A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
|
||||
|
||||
logprob: number
|
||||
|
||||
The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
|
||||
|
||||
top\_logprobs: array of object { token, bytes, logprob }
|
||||
|
||||
List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
|
||||
|
||||
token: string
|
||||
|
||||
The token.
|
||||
|
||||
bytes: array of number
|
||||
|
||||
A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
|
||||
|
||||
logprob: number
|
||||
|
||||
The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
|
||||
|
||||
A list of message refusal tokens with log probability information.
|
||||
|
||||
token: string
|
||||
|
||||
The token.
|
||||
|
||||
bytes: array of number
|
||||
|
||||
A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
|
||||
|
||||
logprob: number
|
||||
|
||||
The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
|
||||
|
||||
top\_logprobs: array of object { token, bytes, logprob }
|
||||
|
||||
List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
|
||||
|
||||
token: string
|
||||
|
||||
The token.
|
||||
|
||||
bytes: array of number
|
||||
|
||||
A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
|
||||
|
||||
logprob: number
|
||||
|
||||
The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
|
||||
|
||||
created: number
|
||||
|
||||
The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
|
||||
|
||||
model: string
|
||||
|
||||
The model to generate the completion.
|
||||
|
||||
object: "chat.completion.chunk"
|
||||
|
||||
The object type, which is always `chat.completion.chunk`.
|
||||
|
||||
service\_tier: optional "auto" or "default" or "flex" or 2 more
|
||||
|
||||
Specifies the processing type used for serving the request.
|
||||
|
||||
- If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
|
||||
- If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
|
||||
- If set to '[flex](https://developers.openai.com/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier.
|
||||
- When not set, the default behavior is 'auto'.
|
||||
|
||||
When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.
|
||||
|
||||
One of the following:
|
||||
|
||||
"auto"
|
||||
|
||||
"default"
|
||||
|
||||
"flex"
|
||||
|
||||
"scale"
|
||||
|
||||
"priority"
|
||||
|
||||
Deprecatedsystem\_fingerprint: optional string
|
||||
|
||||
This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
|
||||
|
||||
usage: optional [CompletionUsage](https://developers.openai.com/api/reference/resources/completions#\(resource\)%20completions%20%3E%20\(model\)%20completion_usage%20%3E%20\(schema\)) { completion\_tokens, prompt\_tokens, total\_tokens, 2 more }
|
||||
|
||||
An optional field that will only be present when you set `stream_options: {"include_usage": true}` in your request. When present, it contains a null value **except for the last chunk** which contains the token usage statistics for the entire request.
|
||||
|
||||
**NOTE:** If the stream is interrupted or cancelled, you may not receive the final usage chunk which contains the total token usage for the request.
|
||||
|
||||
completion\_tokens: number
|
||||
|
||||
Number of tokens in the generated completion.
|
||||
|
||||
prompt\_tokens: number
|
||||
|
||||
Number of tokens in the prompt.
|
||||
|
||||
total\_tokens: number
|
||||
|
||||
Total number of tokens used in the request (prompt + completion).
|
||||
|
||||
completion\_tokens\_details: optional object { accepted\_prediction\_tokens, audio\_tokens, reasoning\_tokens, rejected\_prediction\_tokens }
|
||||
|
||||
Breakdown of tokens used in a completion.
|
||||
|
||||
accepted\_prediction\_tokens: optional number
|
||||
|
||||
When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.
|
||||
|
||||
audio\_tokens: optional number
|
||||
|
||||
Audio input tokens generated by the model.
|
||||
|
||||
reasoning\_tokens: optional number
|
||||
|
||||
Tokens generated by the model for reasoning.
|
||||
|
||||
rejected\_prediction\_tokens: optional number
|
||||
|
||||
When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.
|
||||
|
||||
prompt\_tokens\_details: optional object { audio\_tokens, cached\_tokens }
|
||||
|
||||
Breakdown of tokens used in the prompt.
|
||||
|
||||
audio\_tokens: optional number
|
||||
|
||||
Audio input tokens present in the prompt.
|
||||
|
||||
cached\_tokens: optional number
|
||||
|
||||
Cached tokens present in the prompt.
|
||||
Reference in New Issue
Block a user