diff --git a/apps/web/e2e/data/resources.mjs b/apps/web/e2e/data/resources.mjs index a542ef781..694ff1fd3 100644 --- a/apps/web/e2e/data/resources.mjs +++ b/apps/web/e2e/data/resources.mjs @@ -42,7 +42,7 @@ export function buildResources(now) { ].map((template, index) => ({ id: uuid(), object: "agent.environment.template", name: template.name, created_at: now - 86400 * (4 + index * 5), updated_at: now - 86400 * (1 + index * 2), - capability_directories: index === 0 ? ["/workspace/capabilities"] : [], network: template.network, packages: template.packages, + capability_directories: index === 0 ? ["/workspace/capabilities"] : [], network: template.network, desktop: { enabled: false }, packages: template.packages, files: template.files, plugins: [], skills: template.skills, })); @@ -56,7 +56,7 @@ export function buildResources(now) { const created = vault.created_at + 3600 * (index + 1); return { id: uuid(), vault_id: vault.id, name, object: "vault.credential", auth: { type: "static_bearer", mcp_server_url: `https://mcp.example.com/${name.toLowerCase().replace(/\s+/g, "-")}` }, - created_at: created, updated_at: created + (index % 2 ? 86400 : 0) }; + metadata: {}, created_at: created, updated_at: created + (index % 2 ? 86400 : 0) }; }).reverse()])); return { diff --git a/apps/web/e2e/data/routes.mjs b/apps/web/e2e/data/routes.mjs index 505d83b96..4315e4bb8 100644 --- a/apps/web/e2e/data/routes.mjs +++ b/apps/web/e2e/data/routes.mjs @@ -72,7 +72,7 @@ export function buildDemo(now = Math.floor(Date.now() / 1000), publicUrl = "http const { object: _o, metadata: _m, created_at: _c, updated_at: _u, ...snapshot } = agent; sessions.push({ id, object: "agent.session", agent: snapshot, - environment: envType === "none" ? { type: "none" } : envType === "self_hosted" ? { type: "self_hosted", id: uuid(), remote_url: daemonUrl(publicUrl), workspace_directory: "/srv/work", capability_directories: [] } : { type: "openai_hosted", id: uuid(), capability_directories: [], network: { access: "disabled", allowed_domains: [] }, packages: { npm: [], python: [], system: [] }, files: [], plugins: [], skills: [] }, + environment: envType === "none" ? { type: "none" } : envType === "self_hosted" ? { type: "self_hosted", id: uuid(), remote_url: daemonUrl(publicUrl), workspace_directory: "/srv/work", capability_directories: [] } : { type: "openai_hosted", id: uuid(), container_size: null, desktop: { enabled: false }, capability_directories: [], network: { access: "disabled", allowed_domains: [] }, packages: { npm: [], python: [], system: [] }, files: [], plugins: [], skills: [] }, status, error: status === "failed" ? pick(["Sandbox allocation failed: node unavailable.", "Model provider returned 429 Too Many Requests.", "Tool call timed out after 300 s."]) : null, metadata: {}, required_actions: status === "requires_action" ? [{ type: "function_call", call_id: uuid(), turn_id: sessionTurns.at(-1)?.id ?? uuid(), name: "approve_refund", arguments: {} }] : [], vault_ids: [], usage: status === "in_progress" ? null : sessionTurns.length ? { input_tokens: input, output_tokens: output, total_tokens: input + output, input_tokens_details: { cached_tokens: cached }, output_tokens_details: { reasoning_tokens: reasoning } } : null, diff --git a/apps/web/e2e/projects.spec.ts b/apps/web/e2e/projects.spec.ts index 1d26b0078..a0d6b29c4 100644 --- a/apps/web/e2e/projects.spec.ts +++ b/apps/web/e2e/projects.spec.ts @@ -22,7 +22,7 @@ test("creates a project, shows a new key once, revokes it and archives the proje await expect(call.getByLabel("Shell", { exact: true })).toHaveText(`export OPENAI_BASE_URL=https://core.example.com/v1\nexport OPENAI_API_KEY=${key}`); await expect(call.getByLabel("curl", { exact: true })).toContainText('curl "$OPENAI_BASE_URL/agents"'); await expect(call.getByLabel("curl", { exact: true })).toContainText('curl "$OPENAI_BASE_URL/agents/sessions"'); - await expect(call.getByLabel("Python", { exact: true })).toContainText("pip install openai==3.13.0"); + await expect(call.getByLabel("Python", { exact: true })).toContainText("pip install openai==3.45.0"); await issued.getByRole("button", { name: "I've saved this key" }).click(); await expect(page.getByRole("table", { name: "Keys of Acceptance" })).toContainText("ci"); await expect(page.getByLabel("New key ci")).toHaveCount(0); diff --git a/apps/web/src/features/api-keys/HowToCall.tsx b/apps/web/src/features/api-keys/HowToCall.tsx index 8c49e2bca..3cae7d8e4 100644 --- a/apps/web/src/features/api-keys/HowToCall.tsx +++ b/apps/web/src/features/api-keys/HowToCall.tsx @@ -9,7 +9,7 @@ import { useCopy } from "./IssuedKey"; import "./how-to-call.css"; /** The official SDK release Core is pinned to (contracts/agents-api/upstream.json). */ -const SDK_PIN = "openai==3.13.0"; +const SDK_PIN = "openai==3.45.0"; /** Stands for the model name in the Session example; the note under the samples says what to put there. */ export const MODEL_PLACEHOLDER = ""; diff --git a/contracts/agents-api/core.openapi.yaml b/contracts/agents-api/core.openapi.yaml index bff18380d..e58bd73ce 100644 --- a/contracts/agents-api/core.openapi.yaml +++ b/contracts/agents-api/core.openapi.yaml @@ -2086,6 +2086,10 @@ definitions: - ManagedArchiveReleased v1.Agent: properties: + compaction: + type: object + experimental: + type: object id: type: string instructions: @@ -2107,6 +2111,7 @@ definitions: - flex - priority - fast + - ultrafast type: string text: $ref: '#/definitions/v1.TextConfig' @@ -2161,6 +2166,10 @@ definitions: type: integer id: type: string + metadata: + additionalProperties: + type: string + type: object name: type: string object: @@ -2175,6 +2184,7 @@ definitions: - auth - created_at - id + - metadata - name - object - updated_at @@ -2187,17 +2197,21 @@ definitions: x-nullable: true mcp_server_url: type: string + networking: + type: object refresh: allOf: - $ref: '#/definitions/v1.OAuthCredentialRefresh' x-nullable: true + secret_name: + type: string type: enum: - mcp_oauth - static_bearer + - environment_variable type: string required: - - mcp_server_url - type type: object v1.CredentialDeleted: @@ -2298,6 +2312,8 @@ definitions: type: array created_at: type: integer + desktop: + type: object files: items: type: object @@ -2328,6 +2344,7 @@ definitions: required: - capability_directories - created_at + - desktop - files - id - name @@ -2504,6 +2521,12 @@ definitions: items: type: string type: array + request: + type: object + request_id: + type: string + response: + type: object role: enum: - user @@ -2525,6 +2548,9 @@ definitions: items: $ref: '#/definitions/v1.SummaryText' type: array + title: + type: string + x-nullable: true turn_id: type: string type: @@ -2535,6 +2561,9 @@ definitions: - function_call_output - agent_message - mcp_call + - computer_use_call + - computer_use_approval_request + - computer_use_approval_request_result - web_search_call - command_execution - create_subagent_call @@ -2735,10 +2764,15 @@ definitions: type: string name: type: string + request: + type: object + request_id: + type: string turn_id: type: string type: enum: + - computer_use_approval_request - function_call - environment_connection type: string @@ -3171,8 +3205,12 @@ definitions: type: object v1.SavedAgent: properties: + compaction: + type: object created_at: type: integer + experimental: + type: object id: type: string instructions: @@ -3202,6 +3240,7 @@ definitions: - flex - priority - fast + - ultrafast type: string text: $ref: '#/definitions/v1.TextConfig' @@ -3293,6 +3332,11 @@ definitions: items: $ref: '#/definitions/v1.RequiredAction' type: array + review: + enum: + - none + - auto_review + type: string status: enum: - idle @@ -3420,6 +3464,11 @@ definitions: items: type: string type: array + container_size: + type: object + x-nullable: true + desktop: + type: object files: items: type: object @@ -3646,6 +3695,7 @@ definitions: properties: bytes: type: integer + x-nullable: true created_at: type: integer expires_at: @@ -3839,9 +3889,16 @@ definitions: - context_length_exceeded - session_budget_exceeded - usage_limit_exceeded + - project_spend_limit_exceeded + - organization_spend_limit_exceeded + - organization_usage_limit_exceeded + - billing_not_active + - credit_balance_exhausted - rate_limit_exceeded + - flex_unavailable - server_overloaded - cyber_policy + - misalignment_policy_violation - connection_failed - server_error - authentication_error diff --git a/contracts/agents-api/environment-files.md b/contracts/agents-api/environment-files.md index 099f6d5bf..bbab8f1d4 100644 --- a/contracts/agents-api/environment-files.md +++ b/contracts/agents-api/environment-files.md @@ -4,7 +4,7 @@ title: "Environment files and Artifacts" A Session's workspace holds live files that the agent and its tools change. `/agents/environments/{environment_id}/files` lists one workspace directory and creates files in it. When a Turn completes, Core copies the files under the workspace's `outputs/` directory into immutable Artifacts, read through `/agents/sessions/{session_id}/artifacts`. Artifacts outlive the Environment; workspace files do not. -The routes follow the SDK pinned in [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json): the [Environment files resource](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents/environments/files.py), its [list parameters](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/agents/environments/file_list_params.py), [EnvironmentFile](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/agents/environments/environment_file.py) and [TokenPage](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/pagination.py). They need the `OpenAI-Beta: agents=v1` header. +The routes follow the SDK pinned in [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json): the [Environment files resource](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents/environments/files.py), its [list parameters](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/agents/environments/file_list_params.py), [EnvironmentFile](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/agents/environments/environment_file.py) and [TokenPage](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/pagination.py). They need the `OpenAI-Beta: agents=v1` header. ## Where files work diff --git a/contracts/agents-api/environments.md b/contracts/agents-api/environments.md index 6c06d27f8..4a9bbd4db 100644 --- a/contracts/agents-api/environments.md +++ b/contracts/agents-api/environments.md @@ -18,13 +18,14 @@ Paths follow the SDK resource methods, before the service's `/v1` prefix. The li | Resource | Operations | Rules | | --- | --- | --- | -| [Environment](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents/environments/environments.py) | `GET /agents/environments/{id}` | Created through Session configuration. Returns `id`, `type`, `status` and the `files`, `plugins` and `skills` recorded at Session creation. | -| [Template](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents/environments/templates.py) | `POST`, `GET /agents/environments/templates`; `GET`, `POST`, `DELETE /agents/environments/templates/{id}` | See [Templates](#templates). | -| [Files](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents/environments/files.py) | `POST`, `GET /agents/environments/{id}/files` | See [Environment files](./environment-files.md). | +| [Environment](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents/environments/environments.py) | `GET /agents/environments/{id}` | Created through Session configuration. Returns `id`, `type`, `status` and the `files`, `plugins` and `skills` recorded at Session creation. | +| Environment collection | `POST`, `GET /agents/environments` | Not supported: 404 `unsupported_operation` ([unsupported operations](./wire-semantics.md#unsupported-operations)). Environments are created only through Session configuration. | +| [Template](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents/environments/templates.py) | `POST`, `GET /agents/environments/templates`; `GET`, `POST`, `DELETE /agents/environments/templates/{id}` | See [Templates](#templates). | +| [Files](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents/environments/files.py) | `POST`, `GET /agents/environments/{id}/files` | See [Environment files](./environment-files.md). | An Environment read joins its live owning Session within the caller's Project and returns the durable connection status. It needs no live Runtime, starts no native work and changes no connection state. The installation arrays list API-managed files, Plugins and Skills for both placements: files as `{id, type, path, file_id, size_bytes}` without content, Skills as `{type, name, description, skill_id, version}` and Plugins as `{type, name, description}`. Capabilities discovered in local capability directories are not listed. -[Session environment input](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/environment_param.py) and [output](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/environment.py) have different shapes: +[Session environment input](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/environment_param.py) and [output](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/environment.py) have different shapes: - `none` selects no Environment. - `self_hosted` input requires `workspace_directory`; the nullable `capability_directories` defaults to an empty list. Output adds the Environment ID and the output-only `remote_url`. The output's `/workspace` default does not make the input field optional. @@ -32,10 +33,10 @@ An Environment read joins its live owning Session within the caller's Project an | Projection | States | | --- | --- | -| [Environment resource](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/agents/environment_info.py) | `pending`, `connected`, `disconnected`, `expired`, `failed` | -| [Session environment event](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/agent_session_environment_state.py) | `pending`, `ready`, `connected`, `disconnected`, `failed`, with a nullable error | +| [Environment resource](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/agents/environment_info.py) | `pending`, `ready`, `connected`, `disconnected`, `suspended`, `expired`, `failed` | +| [Session environment event](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/agent_session_environment_state.py) | The same seven states, with a nullable error | -The two vocabularies are separate; never cast one to the other. The resource moves as follows, and a failed or expired Environment is final: +Core emits `ready` only in events. It never reports `suspended`, even for an idle hosted Environment it checkpoints and stops, and it emits no `agent.session.environment.suspended`, `.expired` or `.reset` event; an Environment whose retention ends reads `expired` without the event. The resource moves as follows, and a failed or expired Environment is final: ```mermaid stateDiagram-v2 diff --git a/contracts/agents-api/go-bindings.json b/contracts/agents-api/go-bindings.json index edc891904..e1a6670ec 100644 --- a/contracts/agents-api/go-bindings.json +++ b/contracts/agents-api/go-bindings.json @@ -52,6 +52,7 @@ "CredentialAuth": { "sources": ["#/components/schemas/VaultCredentialAuthResource"], "fields": { + "mcp_server_url": {"type": "string", "omit": false}, "expires_at": {"omit": false}, "refresh": {"type": "*OAuthCredentialRefresh", "omit": false} } @@ -181,7 +182,7 @@ } }, "InputTokenDetails": { - "sources": ["#/components/schemas/InputTokensDetailsResource"] + "sources": ["#/components/schemas/InputTokensDetailsResource-2"] }, "Item": { "sources": ["#/components/schemas/SessionTurnItemResource"], @@ -275,7 +276,7 @@ "sources": ["#/components/schemas/RotateMcpOauthTokenEndpointAuthParam"] }, "OutputTokenDetails": { - "sources": ["#/components/schemas/OutputTokensDetailsResource"] + "sources": ["#/components/schemas/OutputTokensDetailsResource-2"] }, "Reasoning": { "sources": ["#/components/schemas/ReasoningParam"] @@ -297,7 +298,7 @@ }, "SavedAgent": { "sources": ["#/components/schemas/AgentResource"], - "embed": {"SavedAgentConfiguration": ["x_agents_core", "model", "name", "instructions", "multi_agent", "reasoning", "service_tier", "text", "tools"]}, + "embed": {"SavedAgentConfiguration": ["x_agents_core", "model", "name", "instructions", "multi_agent", "reasoning", "service_tier", "text", "tools", "compaction", "experimental"]}, "order": ["id", "object", "metadata", "created_at", "updated_at"] }, "SavedAgentConfiguration": { @@ -352,7 +353,8 @@ "workspace_directory": {"type": "string"}, "files": {"type": "*[]json.RawMessage"}, "plugins": {"type": "*[]json.RawMessage"}, - "skills": {"type": "*[]json.RawMessage"} + "skills": {"type": "*[]json.RawMessage"}, + "container_size": {"type": "json.RawMessage"} }, "order": ["type", "id", "capability_directories", "remote_url", "workspace_directory", "network", "packages", "files", "plugins", "skills"] }, diff --git a/contracts/agents-api/harness-capabilities.md b/contracts/agents-api/harness-capabilities.md index 6aa4a9c66..61b9a53ac 100644 --- a/contracts/agents-api/harness-capabilities.md +++ b/contracts/agents-api/harness-capabilities.md @@ -25,8 +25,9 @@ Placements are `none` (no Environment), hosted (`openai_hosted`) and self-hosted | [Message images](./message-content.md#images) | PNG and JPEG data URLs: verified on all placements; other data URLs: admitted; remote URLs: rejected | PNG and JPEG data URLs: verified on all placements; remote URLs and GIF and WebP data URLs: admitted | Rejected | | `reasoning.effort` | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`: admitted | `low`, `medium`, `high`, `xhigh`, `max`: admitted | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`: admitted | | `reasoning.summary` | `concise`, `detailed`, `auto`: admitted | `auto`: admitted | Rejected | -| `service_tier` other than `auto` | `default`, `flex`, `priority`, `fast`: admitted | Rejected | Rejected | +| `service_tier` other than `auto` | `default`, `flex`, `priority`, `fast`: admitted; `ultrafast` rejected | Rejected | Rejected | | `text.verbosity` other than `medium` | Admitted; the native model decides | Rejected | Rejected | +| `compaction.async: true`, `experimental.time_awareness: true` and the `automations` and `computer_use` tools | Rejected | Rejected | Rejected | | [Public token usage](./sessions-events.md) | Measured counters | Null | Null | Native model parameters and provider protocols per Harness are in [model execution](./model-execution.md). diff --git a/contracts/agents-api/index.md b/contracts/agents-api/index.md index 4646b5c7e..292e6f296 100644 --- a/contracts/agents-api/index.md +++ b/contracts/agents-api/index.md @@ -10,8 +10,8 @@ The target is the complete API ([public API rule](https://github.com/MiniMax-AI/ | File | Contents | | --- | --- | -| [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json) | The pin: [openai-python](https://github.com/openai/openai-python/tree/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents) 3.13.0 at commit `d7c41ef`, resources under `beta/agents`, Beta header `agents=v1` | -| [upstream/openapi.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream/openapi.json) | Unmodified official OpenAPI 3.1 at commit `046a2a0f325bf11f97966f2729219f27281ba71e`, published on 2026-09-10. Its 58 Agents, Vaults, Files and Skills operations match the pinned SDK route set. `upstream.json` records the SHA-256 checksum | +| [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json) | The pin: [openai-python](https://github.com/openai/openai-python/tree/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents) 3.45.0 at commit `9b3458a`, resources under `beta/agents`, Beta header `agents=v1` | +| [upstream/openapi.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream/openapi.json) | Unmodified official OpenAPI 3.1 at commit `820f97adaafea8cadf1e24e19bd3f98463dcb347`, published on 2026-11-03. Its 73 Agents, Vaults, Files and Skills operations match the pinned SDK route set. `upstream.json` records the SHA-256 checksum | | [upstream-routes.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream-routes.json) | The normalized method/path inventory generated from the official schema | | [openapi.yaml](./openapi.yaml) | The official public contract with Core's `x_agents_core` extension on Agent and Session request/response objects | | [go-bindings.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/go-bindings.json) | Go names, field representations, encoding order and stored projections; it does not define official field membership, enums or constraints | @@ -27,19 +27,22 @@ Evidence for a status comes from the pinned official SDK and raw HTTP against th | Resource | Operations | Status | Contract | | --- | --- | --- | --- | | Agents | create, retrieve, update, list, delete | Implemented. Every pinned setting is saved; Session admission runs a subset | [Agents](./wire-semantics.md#agents) | -| Sessions | create (JSON or stream), retrieve, update, list, delete | Implemented. Update takes `metadata` only; deletion requires an idle or failed Session | [Sessions](./wire-semantics.md#sessions), [creation streaming](./sessions-events.md#creation-streaming) | +| Sessions | create (JSON or stream), retrieve, update, list, delete | Implemented. Update takes `metadata` only and `agent` is rejected; list filters on `metadata[key]=value`; deletion requires an idle or failed Session | [Sessions](./wire-semantics.md#sessions), [creation streaming](./sessions-events.md#creation-streaming) | | Session events | create, stream | Partial: messages with text and images, cancellation, function results; the stream is live only | [Sessions, events and history](./sessions-events.md), [message content](./message-content.md) | -| Turns | retrieve, list | Implemented; Session Turn routes hold root Turns only | [Turns and Items](./sessions-events.md#turns-and-items) | +| Turns | retrieve, list; Turn Items | Implemented; Session Turn routes hold root Turns only | [Turns and Items](./sessions-events.md#turns-and-items) | | Items | list | Partial: messages, commands, MCP calls, functions, web search, reasoning and Subagent coordination Items; other native variants are not projected | [Turns and Items](./sessions-events.md#turns-and-items) | | Artifacts | retrieve, list, delete, content | Implemented | [Environment files and Artifacts](./environment-files.md) | | Subagents | retrieve, list; Items; Turns retrieve and list; Turn Items | Partial: read-only child work; no live child progress or optional native operations | [Subagents](./subagents.md) | -| Environments | retrieve | Implemented; Session-scoped ([ownership](./environments.md#resources-and-states)). The pinned contract rejects `environment.environment_id`; existing hosted Environments cannot be attached across Sessions. Workspaces shared across Sessions belong to the application ([Projects own assets](../../docs/concepts.md#projects-own-assets)) | [Environments](./environments.md) | +| Environments | retrieve | Implemented; Session-scoped ([ownership](./environments.md#resources-and-states)). Core rejects `environment.environment_id`, so an existing hosted Environment cannot be attached to another Session. Workspaces shared across Sessions belong to the application ([Projects own assets](../../docs/concepts.md#projects-own-assets)) | [Environments](./environments.md) | | Environment files | create, list | Implemented; the list is not recursive | [Environment files and Artifacts](./environment-files.md) | | Environment Templates | create, retrieve, update, list, delete | Implemented; execution limits are listed under [known gaps](#known-gaps) | [Environment Templates](./environments.md#templates) | -| Vaults | create, retrieve, list, delete | Implemented | [Vaults and Credentials](./vaults.md) | -| Vault Credentials | create, retrieve, update, list, delete | Implemented for `static_bearer` and `mcp_oauth` | [Vaults and Credentials](./vaults.md) | +| Vaults | create, retrieve, update, list, delete | Implemented | [Vaults and Credentials](./vaults.md) | +| Vault Credentials | create, retrieve, update, list, delete | Implemented for `static_bearer` and `mcp_oauth`, with `metadata` | [Vaults and Credentials](./vaults.md) | | Files | create, retrieve, list, delete, content | Implemented for `purpose=user_data`; content download is rejected | [Files and Skills](./source-files.md) | | Skills and Skill versions | create, retrieve, update, list, delete, content | Implemented | [Files and Skills](./source-files.md) | +| Automations | all 10 operations | Not supported: 404 `unsupported_operation` | [Unsupported operations](./wire-semantics.md#unsupported-operations) | +| Environments collection | create, list (`/agents/environments`) | Not supported: 404 `unsupported_operation`; Core's Environments are Session-scoped | [Unsupported operations](./wire-semantics.md#unsupported-operations) | +| Session traces | list | Not supported: 404 `unsupported_operation` | [Unsupported operations](./wire-semantics.md#unsupported-operations) | Which operation each Harness supports on each placement is in the [Harness capabilities](./harness-capabilities.md). [API behavior](./wire-semantics.md) holds the rules that apply across resources: requests, errors and lists. @@ -65,12 +68,13 @@ Each item is Core's deliberate or native behavior where the official service beh - A deleted Agent used as a cursor returns 404; the official service still pages from it. - A Turn cursor from another Session, a Credential cursor equal to its Vault ID, and a Skills cursor that is not a Skill ID return 404. -- Vault and Credential lists clamp a negative `limit`, as the pinned SDK describes; the official service returns 400. **Agents and Sessions** ([Agents](./wire-semantics.md#agents), [Sessions](./wire-semantics.md#sessions)) - A repeated Session creation with the same `Idempotency-Key` returns the original Session; the official service creates a new one. - Omitted programmatic tool calling keeps the Harness's native behavior; the official default is on. +- The official default compaction, which is background compaction, runs as the Harness's native blocking compaction ([Agents](./wire-semantics.md#agents)). +- Core rejects official fields and inputs it has no native home for with 400 naming the param ([unsupported fields](./wire-semantics.md#unsupported-fields)), and answers 404 `unsupported_operation` on the routes it does not run ([unsupported operations](./wire-semantics.md#unsupported-operations)). - An Agent without a `web_search` tool keeps the Harness's [native search](./execution-tools.md#web-search-and-programmatic-tool-calling); the pinned contract does not define search without the tool. - Claude Code on a workspace placement appends the Agent's `instructions` to its native system prompt and runs its [native tool set](./execution-tools.md#web-search-and-programmatic-tool-calling). Its search has no cached mode and no domain, location or context-size settings. - Claude Code drops whitespace-only text blocks natively and sends `(no content)` for an all-blank message; Codex delivers whitespace-only text unchanged. @@ -138,7 +142,8 @@ Each item is Core's deliberate or native behavior where the official service beh **Configuration and tools** -- A `reasoning.effort`, `reasoning.summary`, `service_tier`, `text.verbosity`, `web_search` mode or setting or `programmatic_tool_calling` value that the selected Harness does not declare is saved but rejected at Session admission ([Harness capabilities](./harness-capabilities.md#execution-and-input)). +- A `reasoning.effort`, `reasoning.summary`, `service_tier` (including `ultrafast`), `text.verbosity`, `web_search` mode or setting, `programmatic_tool_calling` value that the selected Harness does not declare is saved but rejected at Session admission ([Harness capabilities](./harness-capabilities.md#execution-and-input)). +- `compaction.async: true`, `experimental.time_awareness: true` and the `automations` and `computer_use` tools are saved but rejected at Session admission for every Harness, because none runs them natively ([Session admission](./wire-semantics.md#session-admission)). - Harness support for tools, structured output, deferred discovery, subagents and MCP differs by Harness and placement; see the [Harness capabilities](./harness-capabilities.md). MiniMax Code has no image input and accepts at most 32 KiB of `instructions`. - Model-derived reasoning defaults are not resolved. @@ -158,6 +163,7 @@ Each item is Core's deliberate or native behavior where the official service beh **Environments and Templates** +- Core never reports the `suspended` state or the `suspended`, `expired` and `reset` Environment events ([resources and states](./environments.md#resources-and-states)). - Hosted workspace admission is limited by the [tenant capacity policy](../../docs/configuration.md#tenant-capacity) and the [input reservation deadline](./environments.md#reservations). - MiniMax Code does not declare `retained_native_history`, so it cannot run on microsandbox, which keeps every Environment on workspace storage; Core rejects the Session ([Harness capabilities](./harness-capabilities.md)). - The model provider's port stays reachable at public addresses from the sandbox because the Harness runs there, and a private model provider host only when the network cap lists its name or a `*.` entry that covers it; under `disabled` the host's DNS server stays reachable on port 53; MCP connections from the Environment follow the deployment's [network cap](./sandbox-deployment.md#network). E2B sandboxes cannot reach private networks, and `169.254.169.254` answers inside an E2B sandbox under every cap. @@ -169,7 +175,6 @@ Each item is Core's deliberate or native behavior where the official service beh **Files and Environment files** - Files accept only `purpose=user_data`; other purposes, `expires_after` and the Uploads API are not supported. -- The Skills create route accepts a single `files` part, but the pinned SDK sends no part when `files` is one file instead of a list ([upload a bundle](./source-files.md#upload-a-bundle)). - An Environment file write whose outcome is uncertain is never retried or recovered automatically; it blocks further writes and messages to the Session. **Vaults and Credentials** @@ -180,6 +185,7 @@ Each item is Core's deliberate or native behavior where the official service beh **Sessions** +- The pinned SDK sends `spend_control` on Session create and update, but the pinned OpenAPI schema does not define it; Core rejects it as an unknown parameter. - Session deletion does not purge the stored history physically. - Stream lifetimes for `self_hosted`, hosted and no-input creation, and the creation-stream retry, are Core's own choices. diff --git a/contracts/agents-api/openapi.yaml b/contracts/agents-api/openapi.yaml index 43e25a570..d645a75a1 100644 --- a/contracts/agents-api/openapi.yaml +++ b/contracts/agents-api/openapi.yaml @@ -76,6 +76,10 @@ "name": "Moderations", "description": "Given text and/or image inputs, classifies if those inputs are potentially harmful." }, + { + "name": "Responses", + "description": "Create and manage model responses." + }, { "name": "Audit Logs", "description": "List user actions and configuration changes within this organization." @@ -88,7 +92,8 @@ "tags": [ "Files" ], - "summary": "Returns a list of files.", + "summary": "List files", + "description": "Returns a list of files.", "parameters": [ { "in": "query", @@ -141,10 +146,39 @@ } } } + }, + "400": { + "description": "The file listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The file specified by the after cursor was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List files", "group": "files", "examples": { "request": { @@ -152,7 +186,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.list()\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.files.list();\n\n for await (const file of list) {\n console.log(file);\n }\n}\n\nmain();" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 175,\n \"created_at\": 1613677385,\n \"expires_at\": 1677614202,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"expires_at\": 1677614202,\n \"filename\": \"puppy.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 175,\n \"created_at\": 1613677385,\n \"expires_at\": 1677614202,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n \"status\": \"processed\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"expires_at\": 1677614202,\n \"filename\": \"puppy.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"processed\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" } } }, @@ -161,7 +195,8 @@ "tags": [ "Files" ], - "summary": "Upload a file that can be used across various endpoints. Individual files\ncan be up to 512 MB, and each project can store up to 2.5 TB of files in\ntotal. There is no organization-wide storage limit. Uploads to this\nendpoint are rate-limited to 1,000 requests per minute per authenticated\nuser.\n\n- The Assistants API supports files up to 2 million tokens and of specific\n file types. See the [Assistants Tools guide](https://developers.openai.com/api/docs/guides/tools) for\n details.\n- The Fine-tuning API only supports `.jsonl` files. The input also has\n certain required formats for fine-tuning\n [chat](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) or\n [completions](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) models.\n- The Batch API only supports `.jsonl` files up to 200 MB in size. The input\n also has a specific required\n [format](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file).\n- For Retrieval or `file_search` ingestion, upload files here first. If\n you need to attach multiple uploaded files to the same vector store, use\n [`/vector_stores/{vector_store_id}/file_batches`](https://developers.openai.com/api/reference/resources/vector_stores/subresources/file_batches/methods/create)\n instead of attaching them one by one. Vector store attachment has separate\n limits from file upload, including 2,000 attached files per minute per\n organization.\n\nPlease [contact us](https://help.openai.com/) if you need to increase these\nstorage limits.\n", + "summary": "Upload file", + "description": "Upload a file that can be used across various endpoints. Individual files\ncan be up to 512 MB, and each project can store up to 2.5 TB of files in\ntotal. There is no organization-wide storage limit. Uploads to this\nendpoint are rate-limited to 1,000 requests per minute per authenticated\nuser.\n\n- The Assistants API supports files up to 2 million tokens and of specific\n file types. See the [Assistants Tools guide](https://developers.openai.com/api/docs/guides/tools) for\n details.\n- The Fine-tuning API only supports `.jsonl` files. The input also has\n certain required formats for fine-tuning\n [chat](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) or\n [completions](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) models.\n- The Batch API only supports `.jsonl` files up to 200 MB in size. The input\n also has a specific required\n [format](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file).\n- For Retrieval or `file_search` ingestion, upload files here first. If\n you need to attach multiple uploaded files to the same vector store, use\n [`/vector_stores/{vector_store_id}/file_batches`](https://developers.openai.com/api/reference/resources/vector_stores/subresources/file_batches/methods/create)\n instead of attaching them one by one. Vector store attachment has separate\n limits from file upload, including 2,000 attached files per minute per\n organization.\n\nPlease [contact us](https://help.openai.com/) if you need to increase these\nstorage limits.\n", "requestBody": { "required": true, "content": { @@ -182,19 +217,47 @@ } } } + }, + "400": { + "description": "The file upload request is invalid or exceeds a file size or storage quota limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The file could not be uploaded because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Upload file", "group": "files", - "description": "Uploads a file for later use across OpenAI APIs. Uploads to this endpoint are rate-limited to 1,000 requests per minute per authenticated user. For Retrieval or `file_search` ingestion, upload files here first. If you need to attach multiple uploaded files to the same vector store, use vector store file batches instead of attaching them one by one.\n", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F purpose=\"fine-tune\" \\\n -F file=\"@mydata.jsonl\"\n -F expires_after[anchor]=\"created_at\"\n -F expires_after[seconds]=2592000\n", + "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F purpose=\"fine-tune\" \\\n -F file=\"@mydata.jsonl\" \\\n -F 'expires_after[anchor]=created_at' \\\n -F 'expires_after[seconds]=2592000'\n", "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.create(\n file=open(\"mydata.jsonl\", \"rb\"),\n purpose=\"fine-tune\",\n expires_after={\n \"anchor\": \"created_at\",\n \"seconds\": 2592000\n }\n)\n", "javascript": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.create({\n file: fs.createReadStream(\"mydata.jsonl\"),\n purpose: \"fine-tune\",\n expires_after: {\n anchor: \"created_at\",\n seconds: 2592000\n }\n });\n\n console.log(file);\n}\n\nmain();" }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1677614202,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n}\n" + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1680202602,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"processed\"\n}\n" } } } @@ -205,7 +268,8 @@ "tags": [ "Files" ], - "summary": "Delete a file and remove it from all vector stores.", + "summary": "Delete file", + "description": "Delete a file and remove it from all vector stores.", "parameters": [ { "in": "path", @@ -227,10 +291,29 @@ } } } + }, + "404": { + "description": "The file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete file", "group": "files", "examples": { "request": { @@ -247,7 +330,8 @@ "tags": [ "Files" ], - "summary": "Returns information about a specific file.", + "summary": "Retrieve file", + "description": "Returns information about a specific file.", "parameters": [ { "in": "path", @@ -269,10 +353,29 @@ } } } + }, + "404": { + "description": "The file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve file", "group": "files", "examples": { "request": { @@ -280,7 +383,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.retrieve(\"file-abc123\")\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.retrieve(\"file-abc123\");\n\n console.log(file);\n}\n\nmain();" }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1677614202,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n}\n" + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1680202602,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"processed\"\n}\n" } } } @@ -291,7 +394,8 @@ "tags": [ "Files" ], - "summary": "Returns a response containing the contents of the specified file.", + "summary": "Retrieve file content", + "description": "Returns a response containing the contents of the specified file.", "parameters": [ { "in": "path", @@ -306,17 +410,57 @@ "responses": { "200": { "description": "OK", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "400": { + "description": "The file cannot be downloaded for its purpose or the account does not have permission to download it.", "content": { "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The file could not be downloaded because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Retrieve file content", "group": "files", "examples": { "request": { @@ -333,7 +477,8 @@ "tags": [ "Skills" ], - "summary": "Create a new skill.", + "summary": "Create Skill", + "description": "Create a new skill.", "operationId": "CreateSkill", "parameters": [], "requestBody": { @@ -361,8 +506,28 @@ } } }, + "400": { + "description": "The uploaded skill files or archive are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The skill could not be saved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } } }, @@ -370,7 +535,8 @@ "tags": [ "Skills" ], - "summary": "List all skills for the current project.", + "summary": "List Skills", + "description": "List all skills for the current project.", "operationId": "ListSkills", "parameters": [ { @@ -415,6 +581,16 @@ } } }, + "404": { + "description": "The skill specified by `after` was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } @@ -426,7 +602,8 @@ "tags": [ "Skills" ], - "summary": "Delete a skill by its ID.", + "summary": "Delete Skill", + "description": "Delete a skill by its ID.", "operationId": "DeleteSkill", "parameters": [ { @@ -451,6 +628,16 @@ } } }, + "404": { + "description": "The skill was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } @@ -460,7 +647,8 @@ "tags": [ "Skills" ], - "summary": "Get a skill by its ID.", + "summary": "Get Skill", + "description": "Get a skill by its ID.", "operationId": "GetSkill", "parameters": [ { @@ -485,6 +673,16 @@ } } }, + "404": { + "description": "The skill was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } @@ -494,7 +692,8 @@ "tags": [ "Skills" ], - "summary": "Update the default version pointer for a skill.", + "summary": "Update Skill Default Version", + "description": "Update the default version pointer for a skill.", "operationId": "UpdateSkillDefaultVersion", "parameters": [ { @@ -528,6 +727,26 @@ } } }, + "400": { + "description": "The requested version is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The skill or requested skill version was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } @@ -539,7 +758,8 @@ "tags": [ "Skills" ], - "summary": "Download a skill zip bundle by its ID.", + "summary": "Get Skill Content", + "description": "Download a skill zip bundle by its ID.", "operationId": "GetSkillContent", "parameters": [ { @@ -570,6 +790,16 @@ } } }, + "404": { + "description": "The skill was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } @@ -581,7 +811,8 @@ "tags": [ "Skills" ], - "summary": "Create a new immutable skill version.", + "summary": "Create Skill Version", + "description": "Create a new immutable skill version.", "operationId": "CreateSkillVersion", "parameters": [ { @@ -620,8 +851,38 @@ } } }, + "400": { + "description": "The uploaded skill files or archive are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The skill was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The skill version could not be saved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } } }, @@ -629,7 +890,8 @@ "tags": [ "Skills" ], - "summary": "List skill versions for a skill.", + "summary": "List Skill Versions", + "description": "List skill versions for a skill.", "operationId": "ListSkillVersions", "parameters": [ { @@ -684,6 +946,26 @@ } } }, + "400": { + "description": "The version specified by `after` does not belong to this skill.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The skill or the version specified by `after` was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } @@ -695,7 +977,8 @@ "tags": [ "Skills" ], - "summary": "Get a specific skill version.", + "summary": "Get Skill Version", + "description": "Get a specific skill version.", "operationId": "GetSkillVersion", "parameters": [ { @@ -730,6 +1013,26 @@ } } }, + "400": { + "description": "The requested version is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The skill or requested skill version was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } @@ -739,7 +1042,8 @@ "tags": [ "Skills" ], - "summary": "Delete a skill version.", + "summary": "Delete Skill Version", + "description": "Delete a skill version.", "operationId": "DeleteSkillVersion", "parameters": [ { @@ -774,6 +1078,26 @@ } } }, + "400": { + "description": "The requested version is invalid, or it is the default version and other versions remain.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The skill or requested skill version was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } @@ -785,7 +1109,8 @@ "tags": [ "Skills" ], - "summary": "Download a skill version zip bundle.", + "summary": "Get Skill Version Content", + "description": "Download a skill version zip bundle.", "operationId": "GetSkillVersionContent", "parameters": [ { @@ -826,49 +1151,57 @@ } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } + "400": { + "description": "The requested version is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The skill or requested skill version was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + } } } }, - "/agents/environments/{environment_id}": { - "get": { - "operationId": "retrieveAgentEnvironment", - "summary": "Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle).", - "description": "Retrieves an execution environment's connection status and safe installed metadata.", + "/agents/automations": { + "post": { + "operationId": "createAgentAutomation", + "summary": "Create an automation", + "description": "Saves an active automation without invoking it immediately.", "tags": [ "Agents" ], - "parameters": [ - { - "name": "environment_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the environment." - }, - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, - "schema": { - "type": "string", - "const": "agents=v1" + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAutomationParams" + } } - } - ], + }, + "required": true + }, "responses": { - "200": { - "description": "The requested environment.", + "201": { + "description": "The created automation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PublicEnvironmentResource" + "$ref": "#/components/schemas/AutomationResource" } } } @@ -893,6 +1226,16 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { "description": "The requested session or event was not found.", "content": { @@ -934,71 +1277,62 @@ } } }, - "x-oaiMeta": { - "name": "Retrieve an agent environment" - } - } - }, - "/agents/environments/{environment_id}/files": { - "get": { - "operationId": "listAgentEnvironmentFiles", - "summary": "Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).", - "description": "Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination.", - "tags": [ - "Agents" - ], "parameters": [ { - "name": "environment_id", - "in": "path", + "name": "OpenAI-Beta", + "in": "header", "required": true, "schema": { "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the environment." - }, + "const": "agents=v1" + } + } + ] + }, + "get": { + "operationId": "listAgentAutomations", + "summary": "List automations", + "description": "Lists project-owned automations, optionally filtered by target session.", + "tags": [ + "Agents" + ], + "parameters": [ { - "name": "path", + "name": "limit", "in": "query", "required": false, "schema": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576 + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 }, - "description": "Restrict the listing to this absolute workspace directory." + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { - "name": "limit", + "name": "order", "in": "query", "required": false, "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 1, - "maximum": 100 + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" }, - "description": "The maximum number of files to return, between 1 and 100." + "description": "The order in which resources are returned. Defaults to `desc`." }, { - "name": "order", + "name": "after", "in": "query", "required": false, "schema": { - "$ref": "#/components/schemas/ListOrderParam" + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "description": "Sort by case-sensitive path components. Defaults to descending." + "description": "Return resources after this resource ID in the selected order." }, { - "name": "page", + "name": "session_id", "in": "query", "required": false, "schema": { @@ -1006,7 +1340,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The opaque token from the previous page. Keep the same path, order, and limit." + "description": "Matches existing-session targets, including agent-created automations." }, { "name": "OpenAI-Beta", @@ -1020,11 +1354,60 @@ ], "responses": { "200": { - "description": "A page of live environment files.", + "description": "The automations.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentFileListResource" + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AutomationResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." } } } @@ -1049,6 +1432,16 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { "description": "The requested session or event was not found.", "content": { @@ -1079,6 +1472,16 @@ } } }, + "501": { + "description": "Automation listing is not implemented.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "503": { "description": "The service is temporarily unavailable.", "content": { @@ -1089,29 +1492,27 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent environment files" } - }, - "post": { - "operationId": "createAgentEnvironmentFile", - "summary": "Copies inline bytes or a Files API file into a connected execution environment. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).", - "description": "Copies inline bytes or a Files API file into a connected execution environment.", + } + }, + "/agents/automations/{automation_id}": { + "get": { + "operationId": "getAgentAutomation", + "summary": "Get an automation", + "description": "Retrieves a project-owned automation.", "tags": [ "Agents" ], "parameters": [ { - "name": "environment_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the environment." + } }, { "name": "OpenAI-Beta", @@ -1123,22 +1524,13 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HostedEnvironmentFileParam" - } - } - } - }, "responses": { - "201": { - "description": "The created live environment file.", + "200": { + "description": "Successful response.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentFileResource" + "$ref": "#/components/schemas/AutomationResource" } } } @@ -1163,6 +1555,16 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { "description": "The requested session or event was not found.", "content": { @@ -1203,132 +1605,53 @@ } } } - }, - "x-oaiMeta": { - "name": "Create an agent environment file" } - } - }, - "/agents/sessions/{session_id}/subagents": { - "get": { - "operationId": "listAgentSessionSubagents", - "summary": "Lists subagents in a session, including nested and closed subagents. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Lists subagents in a session, including nested and closed subagents.", + }, + "post": { + "operationId": "updateAgentAutomation", + "summary": "Update an automation", + "description": "Updates supplied fields; target and metadata replace the whole field.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the session." + } }, { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." - }, - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, + "name": "OpenAI-Beta", + "in": "header", + "required": true, "schema": { "type": "string", "const": "agents=v1" } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateAutomationParams" + } + } + }, + "required": true + }, "responses": { "200": { - "description": "The requested subagents.", + "description": "Successful response.", "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "default": "list", - "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SubagentResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." - }, - "first_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." - }, - "last_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." - }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "$ref": "#/components/schemas/AutomationResource" } } } @@ -1354,7 +1677,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -1403,42 +1726,25 @@ } } } - }, - "x-oaiMeta": { - "name": "List session subagents" } - } - }, - "/agents/sessions/{session_id}/subagents/{subagent_id}": { - "get": { - "operationId": "retrieveAgentSessionSubagent", - "summary": "Retrieves a subagent belonging to this session. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Retrieves a subagent belonging to this session.", + }, + "delete": { + "operationId": "deleteAgentAutomation", + "summary": "Delete an automation", + "description": "Deletes the automation and prevents future invocations without deleting its target session.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "subagent_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." + } }, { "name": "OpenAI-Beta", @@ -1452,11 +1758,11 @@ ], "responses": { "200": { - "description": "The requested subagent.", + "description": "Successful response.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SubagentResource" + "$ref": "#/components/schemas/DeletedAutomationResource" } } } @@ -1482,7 +1788,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -1531,76 +1837,27 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve a session subagent" } } }, - "/agents/sessions/{session_id}/subagents/{subagent_id}/items": { - "get": { - "operationId": "listAgentSessionSubagentItems", - "summary": "Lists this subagent's own items across all of its turns. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Lists this subagent's own items across all of its turns.", + "/agents/automations/{automation_id}/pause": { + "post": { + "operationId": "pauseAgentAutomation", + "summary": "Pause an automation", + "description": "Pauses future scheduled delivery without stopping an active session.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "subagent_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + } }, { "name": "OpenAI-Beta", @@ -1614,11 +1871,11 @@ ], "responses": { "200": { - "description": "The requested subagent history.", + "description": "Successful response.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionItemListResource" + "$ref": "#/components/schemas/AutomationResource" } } } @@ -1644,7 +1901,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -1693,76 +1950,27 @@ } } } - }, - "x-oaiMeta": { - "name": "List subagent items" } } }, - "/agents/sessions/{session_id}/subagents/{subagent_id}/turns": { - "get": { - "operationId": "listAgentSessionSubagentTurns", - "summary": "Lists all turns of this subagent, including turns after a resume. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Lists all turns of this subagent, including turns after a resume.", + "/agents/automations/{automation_id}/resume": { + "post": { + "operationId": "resumeAgentAutomation", + "summary": "Resume an automation", + "description": "Resumes scheduled delivery; one-time automations without a pending invocation require a future run_at.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "subagent_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + } }, { "name": "OpenAI-Beta", @@ -1776,12 +1984,11 @@ ], "responses": { "200": { - "description": "The requested subagent history.", + "description": "Successful response.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionTurnListResource", - "description": "A page of turns from an agent session or subagent." + "$ref": "#/components/schemas/AutomationResource" } } } @@ -1807,7 +2014,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -1856,57 +2063,31 @@ } } } - }, - "x-oaiMeta": { - "name": "List subagent turns" } } }, - "/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}": { - "get": { - "operationId": "retrieveAgentSessionSubagentTurn", - "summary": "Retrieves a turn belonging to this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Retrieves a turn belonging to this subagent.", + "/agents/automations/{automation_id}/invocations": { + "post": { + "operationId": "createAgentAutomationInvocation", + "summary": "Invoke an automation", + "description": "Queues a manual delivery without changing the saved schedule.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "subagent_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." + } }, { - "name": "turn_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of a turn belonging to this subagent." - }, - { - "name": "OpenAI-Beta", - "in": "header", + "name": "OpenAI-Beta", + "in": "header", "required": true, "schema": { "type": "string", @@ -1916,11 +2097,11 @@ ], "responses": { "200": { - "description": "The requested subagent history.", + "description": "The queued invocation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TurnResource" + "$ref": "#/components/schemas/AutomationInvocationResource" } } } @@ -1946,7 +2127,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -1995,53 +2176,25 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve a subagent turn" } - } - }, - "/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items": { + }, "get": { - "operationId": "listAgentSessionSubagentTurnItems", - "summary": "Lists items belonging to one turn of this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Lists items belonging to one turn of this subagent.", + "operationId": "listAgentAutomationInvocations", + "summary": "List automation invocations", + "description": "Lists delivery records for a project-owned automation.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "subagent_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." - }, - { - "name": "turn_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of a turn belonging to this subagent." + } }, { "name": "limit", @@ -2089,11 +2242,60 @@ ], "responses": { "200": { - "description": "The requested subagent history.", + "description": "The invocation history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionItemListResource" + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AutomationInvocationResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." } } } @@ -2119,7 +2321,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -2158,6 +2360,16 @@ } } }, + "501": { + "description": "This operation is not implemented.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "503": { "description": "The service is temporarily unavailable.", "content": { @@ -2168,55 +2380,37 @@ } } } - }, - "x-oaiMeta": { - "name": "List subagent turn items" } } }, - "/agents": { + "/agents/automations/{automation_id}/invocations/{invocation_id}": { "get": { - "operationId": "listAgents", - "summary": "Lists reusable agents in the current project. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Lists reusable agents in the current project.", + "operationId": "getAgentAutomationInvocation", + "summary": "Get an automation invocation", + "description": "Retrieves a delivery record for a project-owned automation.", "tags": [ "Agents" ], "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 1 - }, - "description": "The maximum number of resources to return." - }, - { - "name": "order", - "in": "query", - "required": false, + "name": "automation_id", + "in": "path", + "required": true, "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." + "type": "string", + "minLength": 0, + "maxLength": 1048576 + } }, { - "name": "after", - "in": "query", - "required": false, + "name": "invocation_id", + "in": "path", + "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + } }, { "name": "OpenAI-Beta", @@ -2230,12 +2424,11 @@ ], "responses": { "200": { - "description": "A page of agents.", + "description": "The invocation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AgentListResource", - "description": "A page of reusable agents." + "$ref": "#/components/schemas/AutomationInvocationResource" } } } @@ -2260,6 +2453,16 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { "description": "The requested session or event was not found.", "content": { @@ -2300,34 +2503,79 @@ } } } - }, - "x-oaiMeta": { - "name": "List agents" } - }, - "post": { - "operationId": "createAgent", - "summary": "Creates a reusable agent without storing credentials. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Creates a reusable agent without storing credentials.", + } + }, + "/agents/environments": { + "get": { + "operationId": "listAgentEnvironments", + "summary": "List agent environments", + "description": "Lists OpenAI-hosted environments owned by the authenticated principal. Requires access to the prewarming beta.", "tags": [ "Agents" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAgentParams" - } + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "type", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/EnvironmentTypeParam" + }, + "description": "The hosting type to list. Defaults to `openai_hosted`." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" } } - }, + ], "responses": { - "201": { - "description": "The created agent.", + "200": { + "description": "A page of owned environments.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AgentResource" + "$ref": "#/components/schemas/AgentEnvironmentListResource", + "description": "An ID-paginated list of owned environments." } } } @@ -2352,8 +2600,18 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { - "description": "The requested session or event was not found.", + "description": "The requested environment or referenced resource was not found.", "content": { "application/json": { "schema": { @@ -2363,7 +2621,7 @@ } }, "409": { - "description": "The request conflicted with the current session state.", + "description": "The request conflicted with the current environment state.", "content": { "application/json": { "schema": { @@ -2392,11 +2650,27 @@ } } } - }, - "x-oaiMeta": { - "name": "Create an agent" - }, + } + }, + "post": { + "operationId": "createAgentEnvironment", + "summary": "Create an agent environment", + "description": "Creates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta.", + "tags": [ + "Agents" + ], "parameters": [ + { + "name": "Idempotency-Key", + "in": "header", + "required": false, + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "description": "Deduplicates creation for 24 hours within the authenticated organization, project, and creator. Retry the same JSON parameters with the same key to retrieve the original environment in its current state. Different parameters or an incomplete hosted creation return 409. Deleted environments are not recreated. After retention expires, the key may create a new environment. Without this header, each request creates a new environment." + }, { "name": "OpenAI-Beta", "in": "header", @@ -2406,46 +2680,24 @@ "const": "agents=v1" } } - ] - } - }, - "/agents/{agent_id}": { - "get": { - "operationId": "retrieveAgent", - "summary": "Retrieves a reusable agent by ID. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Retrieves a reusable agent by ID.", - "tags": [ - "Agents" ], - "parameters": [ - { - "name": "agent_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the reusable agent." - }, - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, - "schema": { - "type": "string", - "const": "agents=v1" + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAgentEnvironmentParams" + } } - } - ], + }, + "required": true + }, "responses": { - "200": { - "description": "The requested agent.", + "201": { + "description": "The created OpenAI-hosted environment.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AgentResource" + "$ref": "#/components/schemas/PublicEnvironmentResource" } } } @@ -2470,8 +2722,18 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { - "description": "The requested session or event was not found.", + "description": "The requested environment or referenced resource was not found.", "content": { "application/json": { "schema": { @@ -2481,7 +2743,17 @@ } }, "409": { - "description": "The request conflicted with the current session state.", + "description": "The request conflicted with the current environment state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "429": { + "description": "The request exceeded a rate or capacity limit.", "content": { "application/json": { "schema": { @@ -2510,21 +2782,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve an agent" } - }, - "post": { - "operationId": "updateAgent", - "summary": "Updates a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Updates a reusable agent.", + } + }, + "/agents/environments/{environment_id}": { + "get": { + "operationId": "retrieveAgentEnvironment", + "summary": "Retrieve an agent environment", + "description": "Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle).", "tags": [ "Agents" ], "parameters": [ { - "name": "agent_id", + "name": "environment_id", "in": "path", "required": true, "schema": { @@ -2532,7 +2803,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the reusable agent." + "description": "The ID of the environment." }, { "name": "OpenAI-Beta", @@ -2544,22 +2815,13 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateAgentParams" - } - } - } - }, "responses": { "200": { - "description": "The updated agent.", + "description": "The requested environment.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AgentResource" + "$ref": "#/components/schemas/PublicEnvironmentResource" } } } @@ -2584,6 +2846,16 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { "description": "The requested session or event was not found.", "content": { @@ -2624,21 +2896,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Update an agent" } - }, - "delete": { - "operationId": "deleteAgent", - "summary": "Deletes a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Deletes a reusable agent.", + } + }, + "/agents/environments/{environment_id}/files": { + "get": { + "operationId": "listAgentEnvironmentFiles", + "summary": "List agent environment files", + "description": "Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).", "tags": [ "Agents" ], "parameters": [ { - "name": "agent_id", + "name": "environment_id", "in": "path", "required": true, "schema": { @@ -2646,7 +2917,56 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the reusable agent." + "description": "The ID of the environment." + }, + { + "name": "path", + "in": "query", + "required": false, + "schema": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Restrict the listing to this absolute workspace directory." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "minimum": 1, + "maximum": 100 + }, + "description": "The maximum number of files to return, between 1 and 100." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam" + }, + "description": "Sort by case-sensitive path components. Defaults to descending." + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The opaque token from the previous page. Keep the same path, order, and limit." }, { "name": "OpenAI-Beta", @@ -2660,11 +2980,11 @@ ], "responses": { "200": { - "description": "The deleted agent.", + "description": "A page of live environment files.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedAgentResource" + "$ref": "#/components/schemas/EnvironmentFileListResource" } } } @@ -2689,6 +3009,16 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { "description": "The requested session or event was not found.", "content": { @@ -2729,54 +3059,26 @@ } } } - }, - "x-oaiMeta": { - "name": "Delete an agent" } - } - }, - "/agents/environments/templates": { - "get": { - "operationId": "listAgentEnvironmentTemplates", - "summary": "Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Lists reusable environment templates without returning confidential values.", + }, + "post": { + "operationId": "createAgentEnvironmentFile", + "summary": "Write an agent environment file", + "description": "Copies inline bytes or a Files API file into a connected execution environment, replacing an existing regular file at the same path. Upload between turns and wait for success before starting the next turn. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).", "tags": [ "Agents" ], "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, + "name": "environment_id", + "in": "path", + "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 }, - "description": "Return resources after this resource ID in the selected order." + "description": "The ID of the environment." }, { "name": "OpenAI-Beta", @@ -2788,14 +3090,22 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HostedEnvironmentFileParam" + } + } + } + }, "responses": { - "200": { - "description": "A page of environment templates.", + "201": { + "description": "The written live environment file.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentTemplateListResource", - "description": "A page of reusable environment templates." + "$ref": "#/components/schemas/EnvironmentFileResource" } } } @@ -2821,7 +3131,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -2831,7 +3141,27 @@ } }, "404": { - "description": "The requested environment definition was not found.", + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "429": { + "description": "The Files API rate limit for your user has been exceeded.", "content": { "application/json": { "schema": { @@ -2860,126 +3190,20 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent environment templates" } - }, - "post": { - "operationId": "createAgentEnvironmentTemplate", - "summary": "Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Creates reusable environment configuration without returning confidential setup commands or environment values.", - "tags": [ - "Agents" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateEnvironmentTemplateParams" - } - } - } - }, - "responses": { - "201": { - "description": "The created environment template.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EnvironmentTemplateResource" - } - } - } - }, - "400": { - "description": "The request was invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "403": { - "description": "The API key lacks the required management permission.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "404": { - "description": "The requested environment definition was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "500": { - "description": "An internal error occurred.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "503": { - "description": "The service is temporarily unavailable.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - } - }, - "x-oaiMeta": { - "name": "Create an agent environment template" - }, - "parameters": [ - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, - "schema": { - "type": "string", - "const": "agents=v1" - } - } - ] } }, - "/agents/environments/templates/{environment_template_id}": { + "/agents/sessions/{session_id}/subagents": { "get": { - "operationId": "retrieveAgentEnvironmentTemplate", - "summary": "Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Retrieves reusable environment configuration without returning confidential values.", + "operationId": "listAgentSessionSubagents", + "summary": "List session subagents", + "description": "Lists subagents in a session, including nested and closed subagents. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ "Agents" ], "parameters": [ { - "name": "environment_template_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -2987,7 +3211,41 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the reusable environment template." + "description": "The ID of the session." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." }, { "name": "OpenAI-Beta", @@ -3001,11 +3259,60 @@ ], "responses": { "200": { - "description": "The requested environment template.", + "description": "The requested subagents.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentTemplateResource" + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SubagentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." } } } @@ -3031,7 +3338,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -3041,7 +3348,17 @@ } }, "404": { - "description": "The requested environment definition was not found.", + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -3070,21 +3387,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve an agent environment template" } - }, - "post": { - "operationId": "updateAgentEnvironmentTemplate", - "summary": "Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Updates reusable environment configuration without returning confidential values.", + } + }, + "/agents/sessions/{session_id}/subagents/{subagent_id}": { + "get": { + "operationId": "retrieveAgentSessionSubagent", + "summary": "Retrieve a session subagent", + "description": "Retrieves a subagent belonging to this session. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ "Agents" ], "parameters": [ { - "name": "environment_template_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -3092,7 +3408,18 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the reusable environment template." + "description": "The ID of the session." + }, + { + "name": "subagent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the subagent in this session." }, { "name": "OpenAI-Beta", @@ -3104,22 +3431,13 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateEnvironmentTemplateParams" - } - } - } - }, "responses": { "200": { - "description": "The updated environment template.", + "description": "The requested subagent.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentTemplateResource" + "$ref": "#/components/schemas/SubagentResource" } } } @@ -3145,7 +3463,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -3155,7 +3473,7 @@ } }, "404": { - "description": "The requested environment definition was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -3165,7 +3483,7 @@ } }, "409": { - "description": "The request conflicted with the current environment state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -3194,21 +3512,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Update an agent environment template" } - }, - "delete": { - "operationId": "deleteAgentEnvironmentTemplate", - "summary": "Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Deletes reusable environment configuration and all confidential template inputs.", + } + }, + "/agents/sessions/{session_id}/subagents/{subagent_id}/items": { + "get": { + "operationId": "listAgentSessionSubagentItems", + "summary": "List subagent items", + "description": "Lists this subagent's own items across all of its turns. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ "Agents" ], "parameters": [ { - "name": "environment_template_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -3216,7 +3533,52 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the reusable environment template." + "description": "The ID of the session." + }, + { + "name": "subagent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the subagent in this session." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." }, { "name": "OpenAI-Beta", @@ -3230,11 +3592,11 @@ ], "responses": { "200": { - "description": "The deleted environment template.", + "description": "The requested subagent history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedEnvironmentTemplateResource" + "$ref": "#/components/schemas/SessionItemListResource" } } } @@ -3260,7 +3622,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -3270,7 +3632,7 @@ } }, "404": { - "description": "The requested environment definition was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -3280,7 +3642,7 @@ } }, "409": { - "description": "The request conflicted with the current environment state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -3309,34 +3671,52 @@ } } } - }, - "x-oaiMeta": { - "name": "Delete an agent environment template" } } }, - "/agents/sessions": { + "/agents/sessions/{session_id}/subagents/{subagent_id}/turns": { "get": { - "operationId": "listAgentSessions", - "summary": "Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", - "description": "Lists managed agent sessions using ID-based pagination and the requested sort order.", + "operationId": "listAgentSessionSubagentTurns", + "summary": "List subagent turns", + "description": "Lists all turns of this subagent, including turns after a resume. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ "Agents" ], "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + }, + { + "name": "subagent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the subagent in this session." + }, { "name": "limit", "in": "query", "required": false, "schema": { - "type": [ - "integer", - "null" - ], + "type": "integer", "format": "int64", - "minimum": 1 + "minimum": 1, + "maximum": 100, + "default": 20 }, - "description": "The maximum number of resources to return." + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { "name": "order", @@ -3346,18 +3726,7 @@ "$ref": "#/components/schemas/ListOrderParam", "default": "desc" }, - "description": "Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`." - }, - { - "name": "agent_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Only return sessions whose root agent has this ID. Omit to return sessions for all agents." + "description": "The order in which resources are returned. Defaults to `desc`." }, { "name": "after", @@ -3382,12 +3751,12 @@ ], "responses": { "200": { - "description": "A page of sessions.", + "description": "The requested subagent history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionListResource", - "description": "A paginated list of sessions." + "$ref": "#/components/schemas/SessionTurnListResource", + "description": "A page of turns from an agent session or subagent." } } } @@ -3413,7 +3782,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -3462,39 +3831,68 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent sessions" } - }, - "post": { - "operationId": "createAgentSession", - "summary": "Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions).", - "description": "Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true.", + } + }, + "/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}": { + "get": { + "operationId": "retrieveAgentSessionSubagentTurn", + "summary": "Retrieve a subagent turn", + "description": "Retrieves a turn belonging to this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ "Agents" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAgentSessionParams" - } + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + }, + { + "name": "subagent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the subagent in this session." + }, + { + "name": "turn_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of a turn belonging to this subagent." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" } } - }, + ], "responses": { - "201": { - "description": "The created session or its event stream.", + "200": { + "description": "The requested subagent history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionResource" - } - }, - "text/event-stream": { - "schema": { - "$ref": "#/components/schemas/SessionEvent" + "$ref": "#/components/schemas/TurnResource" } } } @@ -3520,7 +3918,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -3569,32 +3967,14 @@ } } } - }, - "x-oai-streaming": { - "request_field": "stream", - "response_status_code": 201 - }, - "x-oaiMeta": { - "name": "Create an agent session" - }, - "parameters": [ - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, - "schema": { - "type": "string", - "const": "agents=v1" - } - } - ] + } } }, - "/agents/sessions/{session_id}": { + "/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items": { "get": { - "operationId": "retrieveAgentSession", - "summary": "Retrieves the current state of a managed agent session. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", - "description": "Retrieves the current state of a managed agent session.", + "operationId": "listAgentSessionSubagentTurnItems", + "summary": "List subagent turn items", + "description": "Lists items belonging to one turn of this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ "Agents" ], @@ -3611,48 +3991,104 @@ "description": "The ID of the session." }, { - "name": "OpenAI-Beta", - "in": "header", + "name": "subagent_id", + "in": "path", "required": true, "schema": { "type": "string", - "const": "agents=v1" - } - } - ], - "responses": { - "200": { - "description": "The requested session.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SessionResource" - } - } - } + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the subagent in this session." }, - "400": { - "description": "The request was invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } + { + "name": "turn_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of a turn belonging to this subagent." }, - "401": { - "description": "Authentication or project context was missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "The requested subagent history.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionItemListResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -3701,29 +4137,51 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve an agent session" } - }, - "post": { - "operationId": "updateAgentSession", - "summary": "Updates session metadata. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", - "description": "Updates session metadata. Omitted fields are unchanged.", + } + }, + "/agents": { + "get": { + "operationId": "listAgents", + "summary": "List agents", + "description": "Lists reusable agents in the current project. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the session." + "description": "Return resources after this resource ID in the selected order." }, { "name": "OpenAI-Beta", @@ -3735,22 +4193,14 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateAgentSessionParams" - } - } - } - }, "responses": { "200": { - "description": "The updated session.", + "description": "A page of agents.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionResource" + "$ref": "#/components/schemas/AgentListResource", + "description": "A page of reusable agents." } } } @@ -3776,7 +4226,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -3825,47 +4275,31 @@ } } } - }, - "x-oaiMeta": { - "name": "Update an agent session" } }, - "delete": { - "operationId": "deleteAgentSession", - "summary": "Removes a managed agent session from the public API and returns a deletion confirmation. Physical cleanup may continue asynchronously. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", - "description": "Removes a managed agent session from the public API and returns a deletion confirmation. Physical cleanup may continue asynchronously.", + "post": { + "operationId": "createAgent", + "summary": "Create an agent", + "description": "Creates a reusable agent without storing credentials. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", "tags": [ "Agents" ], - "parameters": [ - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, - "schema": { - "type": "string", - "const": "agents=v1" + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAgentParams" + } } } - ], + }, "responses": { - "200": { - "description": "The deleted session.", + "201": { + "description": "The created agent.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedSessionResource" + "$ref": "#/components/schemas/AgentResource" } } } @@ -3891,7 +4325,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -3941,22 +4375,30 @@ } } }, - "x-oaiMeta": { - "name": "Delete an agent session" - } + "parameters": [ + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ] } }, - "/agents/sessions/{session_id}/artifacts": { + "/agents/{agent_id}": { "get": { - "operationId": "listAgentSessionArtifacts", - "summary": "Lists immutable artifacts published by completed hosted session turns. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", - "description": "Lists immutable artifacts published by completed hosted session turns.", + "operationId": "retrieveAgent", + "summary": "Retrieve an agent", + "description": "Retrieves a reusable agent by ID. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "agent_id", "in": "path", "required": true, "schema": { @@ -3964,59 +4406,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the session." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam" - }, - "description": "Sort by creation time and ID. Defaults to descending." - }, - { - "name": "environment_id", - "in": "query", - "required": false, - "schema": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Restrict the listing to artifacts produced by this environment." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 1, - "maximum": 100 - }, - "description": "The maximum number of artifacts to return, between 1 and 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return artifacts after this immutable artifact ID." + "description": "The ID of the reusable agent." }, { "name": "OpenAI-Beta", @@ -4030,12 +4420,11 @@ ], "responses": { "200": { - "description": "A page of durable session artifacts.", + "description": "The requested agent.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionArtifactListResource", - "description": "A page of durable artifacts published by a session." + "$ref": "#/components/schemas/AgentResource" } } } @@ -4061,7 +4450,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -4110,23 +4499,18 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent session artifacts" } - } - }, - "/agents/sessions/{session_id}/artifacts/{artifact_id}": { - "get": { - "operationId": "retrieveAgentSessionArtifact", - "summary": "Retrieves immutable metadata for one durable session artifact. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", - "description": "Retrieves immutable metadata for one durable session artifact.", + }, + "post": { + "operationId": "updateAgent", + "summary": "Update an agent", + "description": "Updates a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "agent_id", "in": "path", "required": true, "schema": { @@ -4134,18 +4518,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the session that owns the artifact." - }, - { - "name": "artifact_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The immutable session artifact ID." + "description": "The ID of the reusable agent." }, { "name": "OpenAI-Beta", @@ -4157,13 +4530,22 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateAgentParams" + } + } + } + }, "responses": { "200": { - "description": "The requested session artifact.", + "description": "The updated agent.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionArtifactResource" + "$ref": "#/components/schemas/AgentResource" } } } @@ -4189,7 +4571,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -4240,30 +4622,28 @@ } }, "x-oaiMeta": { - "name": "Retrieve an agent session artifact" + "examples": { + "request": { + "curl": "# 1. Omit reasoning: keep its current settings while renaming the agent.\ncurl \"https://api.openai.com/v1/agents/$AGENT_ID\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: agents=v1\" \\\n -d '{\"name\": \"Renamed\"}'\n\n# 2. Send null: reset reasoning to the model's defaults.\ncurl \"https://api.openai.com/v1/agents/$AGENT_ID\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: agents=v1\" \\\n -d '{\"reasoning\": null}'\n\n# 3. Send an object: replace the entire reasoning configuration, without merging.\n# The agent's model must support the \"low\" reasoning effort.\ncurl \"https://api.openai.com/v1/agents/$AGENT_ID\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: agents=v1\" \\\n -d '{\"reasoning\": {\"effort\": \"low\"}}'\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nagent_id = \"your-agent-id\"\n\n# 1. Omit reasoning: keep its current settings while renaming the agent.\nclient.beta.agents.update(agent_id, name=\"Renamed\")\n\n# 2. Python's None sends JSON null: reset reasoning to the model's defaults.\nclient.beta.agents.update(agent_id, reasoning=None)\n\n# 3. Send an object: replace the entire reasoning configuration, without merging.\n# The agent's model must support the \"low\" reasoning effort.\nclient.beta.agents.update(agent_id, reasoning={\"effort\": \"low\"})\n", + "javascript": "import OpenAI from \"openai\";\n\nconst client = new OpenAI();\nconst agentId = \"your-agent-id\";\n\n// 1. Omit reasoning: keep its current settings while renaming the agent.\nawait client.beta.agents.update(agentId, { name: \"Renamed\" });\n\n// 2. Send null: reset reasoning to the model's defaults.\nawait client.beta.agents.update(agentId, { reasoning: null });\n\n// 3. Send an object: replace the entire reasoning configuration, without merging.\n// The agent's model must support the \"low\" reasoning effort.\nawait client.beta.agents.update(agentId, { reasoning: { effort: \"low\" } });\n", + "go": "package main\n\nimport (\n \"context\"\n \"log\"\n\n \"github.com/openai/openai-go/v3\"\n \"github.com/openai/openai-go/v3/packages/param\"\n)\n\nfunc main() {\n client := openai.NewClient()\n ctx := context.Background()\n agentID := \"your-agent-id\"\n\n // 1. Omit reasoning: keep its current settings while renaming the agent.\n _, err := client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{\n Name: openai.String(\"Renamed\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n\n // 2. Send null: reset reasoning to the model's defaults.\n _, err = client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{\n Reasoning: param.NullStruct[openai.AgentReasoningParam](),\n })\n if err != nil {\n log.Fatal(err)\n }\n\n // 3. Send an object: replace the entire reasoning configuration, without merging.\n // The agent's model must support the \"low\" reasoning effort.\n _, err = client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{\n Reasoning: openai.AgentReasoningParam{Effort: openai.AgentReasoningParamEffortLow},\n })\n if err != nil {\n log.Fatal(err)\n }\n}\n", + "java": "import com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.core.JsonValue;\nimport com.openai.models.beta.agents.AgentReasoningParam;\nimport com.openai.models.beta.agents.AgentUpdateParams;\n\npublic class AgentUpdateExample {\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n String agentId = \"your-agent-id\";\n\n // 1. Omit reasoning: keep its current settings while renaming the agent.\n client.beta().agents().update(AgentUpdateParams.builder()\n .agentId(agentId)\n .name(\"Renamed\")\n .build());\n\n // 2. Send null: reset reasoning to the model's defaults.\n client.beta().agents().update(AgentUpdateParams.builder()\n .agentId(agentId)\n .reasoning(JsonValue.from(null))\n .build());\n\n // 3. Send an object: replace the entire reasoning configuration, without merging.\n // The agent's model must support the \"low\" reasoning effort.\n client.beta().agents().update(AgentUpdateParams.builder()\n .agentId(agentId)\n .reasoning(AgentReasoningParam.builder()\n .effort(AgentReasoningParam.Effort.LOW)\n .build())\n .build());\n }\n}\n", + "ruby": "require \"openai\"\n\nclient = OpenAI::Client.new\nagent_id = \"your-agent-id\"\n\n# 1. Omit reasoning: keep its current settings while renaming the agent.\nclient.beta.agents.update(agent_id, name: \"Renamed\")\n\n# 2. Ruby's nil sends JSON null: reset reasoning to the model's defaults.\nclient.beta.agents.update(agent_id, reasoning: nil)\n\n# 3. Send an object: replace the entire reasoning configuration, without merging.\n# The agent's model must support the \"low\" reasoning effort.\nclient.beta.agents.update(agent_id, reasoning: {effort: :low})\n" + } + } } }, "delete": { - "operationId": "deleteAgentSessionArtifact", - "summary": "Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", - "description": "Deletes an immutable session artifact without deleting its live environment file or original Files API object.", + "operationId": "deleteAgent", + "summary": "Delete an agent", + "description": "Deletes a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session that owns the artifact." - }, - { - "name": "artifact_id", + "name": "agent_id", "in": "path", "required": true, "schema": { @@ -4271,7 +4651,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The immutable session artifact ID." + "description": "The ID of the reusable agent." }, { "name": "OpenAI-Beta", @@ -4285,11 +4665,11 @@ ], "responses": { "200": { - "description": "The deleted session artifact.", + "description": "The deleted agent.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedSessionArtifactResource" + "$ref": "#/components/schemas/DeletedAgentResource" } } } @@ -4315,7 +4695,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -4364,42 +4744,51 @@ } } } - }, - "x-oaiMeta": { - "name": "Delete an agent session artifact" } } }, - "/agents/sessions/{session_id}/artifacts/{artifact_id}/content": { + "/agents/environments/templates": { "get": { - "operationId": "retrieveAgentSessionArtifactContent", - "summary": "Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", - "description": "Downloads immutable session artifact bytes after the execution environment expires.", + "operationId": "listAgentEnvironmentTemplates", + "summary": "List agent environment templates", + "description": "Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 }, - "description": "The ID of the session that owns the artifact." + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { - "name": "artifact_id", - "in": "path", - "required": true, + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 }, - "description": "The immutable session artifact ID." + "description": "Return resources after this resource ID in the selected order." }, { "name": "OpenAI-Beta", @@ -4413,12 +4802,12 @@ ], "responses": { "200": { - "description": "The immutable artifact contents.", + "description": "A page of environment templates.", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "$ref": "#/components/schemas/EnvironmentTemplateListResource", + "description": "A page of reusable environment templates." } } } @@ -4444,7 +4833,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required management permission.", "content": { "application/json": { "schema": { @@ -4454,17 +4843,7 @@ } }, "404": { - "description": "The requested session or event was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "409": { - "description": "The request conflicted with the current session state.", + "description": "The requested environment definition was not found.", "content": { "application/json": { "schema": { @@ -4493,49 +4872,31 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve agent session artifact content" } - } - }, - "/agents/sessions/{session_id}/events": { - "get": { - "operationId": "listAgentSessionEvents", - "summary": "Streams live events for an agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).", - "description": "Streams live events for an agent session.", + }, + "post": { + "operationId": "createAgentEnvironmentTemplate", + "summary": "Create an agent environment template", + "description": "Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", "tags": [ "Agents" ], - "parameters": [ - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, - "schema": { - "type": "string", - "const": "agents=v1" + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateEnvironmentTemplateParams" + } } } - ], + }, "responses": { - "200": { - "description": "A live stream of session events.", + "201": { + "description": "The created environment template.", "content": { - "text/event-stream": { + "application/json": { "schema": { - "$ref": "#/components/schemas/SessionEvent" + "$ref": "#/components/schemas/EnvironmentTemplateResource" } } } @@ -4561,7 +4922,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required management permission.", "content": { "application/json": { "schema": { @@ -4571,17 +4932,7 @@ } }, "404": { - "description": "The requested session or event was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "409": { - "description": "The request conflicted with the current session state.", + "description": "The requested environment definition was not found.", "content": { "application/json": { "schema": { @@ -4611,24 +4962,30 @@ } } }, - "x-oai-streaming": { - "request_field": null, - "response_status_code": 200 - }, - "x-oaiMeta": { - "name": "Stream agent session events" - } - }, - "post": { - "operationId": "createAgentSessionEvents", - "summary": "Submits message, cancellation, or tool-result events to a managed agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).", - "description": "Submits message, cancellation, or tool-result events to a managed agent session.", + "parameters": [ + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ] + } + }, + "/agents/environments/templates/{environment_template_id}": { + "get": { + "operationId": "retrieveAgentEnvironmentTemplate", + "summary": "Retrieve an agent environment template", + "description": "Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "environment_template_id", "in": "path", "required": true, "schema": { @@ -4636,18 +4993,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the session." - }, - { - "name": "Idempotency-Key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "description": "An optional client-generated key that makes retries of submitted messages idempotent." + "description": "The ID of the reusable environment template." }, { "name": "OpenAI-Beta", @@ -4659,18 +5005,16 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateSessionEventsParams" + "responses": { + "200": { + "description": "The requested environment template.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnvironmentTemplateResource" + } } } - } - }, - "responses": { - "202": { - "description": "The events were accepted." }, "400": { "description": "The request was invalid.", @@ -4693,7 +5037,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required management permission.", "content": { "application/json": { "schema": { @@ -4703,17 +5047,7 @@ } }, "404": { - "description": "The requested session or event was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "409": { - "description": "The request conflicted with the current session state.", + "description": "The requested environment definition was not found.", "content": { "application/json": { "schema": { @@ -4742,23 +5076,18 @@ } } } - }, - "x-oaiMeta": { - "name": "Create agent session input events" } - } - }, - "/agents/sessions/{session_id}/items": { - "get": { - "operationId": "listAgentSessionItems", - "summary": "Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).", - "description": "Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history.", + }, + "post": { + "operationId": "updateAgentEnvironmentTemplate", + "summary": "Update an agent environment template", + "description": "Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "environment_template_id", "in": "path", "required": true, "schema": { @@ -4766,41 +5095,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the session." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + "description": "The ID of the reusable environment template." }, { "name": "OpenAI-Beta", @@ -4812,13 +5107,22 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateEnvironmentTemplateParams" + } + } + } + }, "responses": { "200": { - "description": "A page of session items.", + "description": "The updated environment template.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionItemListResource" + "$ref": "#/components/schemas/EnvironmentTemplateResource" } } } @@ -4844,7 +5148,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required management permission.", "content": { "application/json": { "schema": { @@ -4854,7 +5158,7 @@ } }, "404": { - "description": "The requested session or event was not found.", + "description": "The requested environment definition was not found.", "content": { "application/json": { "schema": { @@ -4864,7 +5168,7 @@ } }, "409": { - "description": "The request conflicted with the current session state.", + "description": "The request conflicted with the current environment state.", "content": { "application/json": { "schema": { @@ -4893,23 +5197,18 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent session items" } - } - }, - "/agents/sessions/{session_id}/turns": { - "get": { - "operationId": "listAgentSessionTurns", - "summary": "Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).", - "description": "Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order.", + }, + "delete": { + "operationId": "deleteAgentEnvironmentTemplate", + "summary": "Delete an agent environment template", + "description": "Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "environment_template_id", "in": "path", "required": true, "schema": { @@ -4917,41 +5216,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the session." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + "description": "The ID of the reusable environment template." }, { "name": "OpenAI-Beta", @@ -4965,12 +5230,11 @@ ], "responses": { "200": { - "description": "A page of session turns.", + "description": "The deleted environment template.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionTurnListResource", - "description": "A page of turns from an agent session or subagent." + "$ref": "#/components/schemas/DeletedEnvironmentTemplateResource" } } } @@ -4995,8 +5259,18 @@ } } }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { - "description": "The requested session or event was not found.", + "description": "The requested environment definition was not found.", "content": { "application/json": { "schema": { @@ -5006,7 +5280,7 @@ } }, "409": { - "description": "The request conflicted with the current session state.", + "description": "The request conflicted with the current environment state.", "content": { "application/json": { "schema": { @@ -5035,42 +5309,85 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent session turns" } } }, - "/agents/sessions/{session_id}/turns/{turn_id}": { + "/agents/sessions": { "get": { - "operationId": "retrieveAgentSessionTurn", - "summary": "Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).", - "description": "Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session.", + "operationId": "listAgentSessions", + "summary": "List agent sessions", + "description": "Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the session that owns the turn." + "description": "Return resources after this resource ID in the selected order." }, { - "name": "turn_id", - "in": "path", - "required": true, + "name": "agent_id", + "in": "query", + "required": false, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the turn." + "description": "Only return sessions whose root agent has this ID. Omit to return sessions for all agents." + }, + { + "name": "metadata", + "in": "query", + "required": false, + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 + }, + "description": "Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. New sessions and metadata updates may take time to appear in filtered results.", + "style": "deepObject", + "explode": true }, { "name": "OpenAI-Beta", @@ -5084,11 +5401,12 @@ ], "responses": { "200": { - "description": "The requested turn.", + "description": "A page of sessions.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TurnResource" + "$ref": "#/components/schemas/SessionListResource", + "description": "A paginated list of sessions." } } } @@ -5113,6 +5431,16 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { "description": "The requested session or event was not found.", "content": { @@ -5153,83 +5481,36 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve an agent session turn" } - } - }, - "/vaults": { - "get": { - "operationId": "listVaults", - "summary": "Lists vaults using ID-based pagination. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Lists vaults using ID-based pagination.", + }, + "post": { + "operationId": "createAgentSession", + "summary": "Create an agent session", + "description": "Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions).", "tags": [ - "Vaults" + "Agents" ], - "parameters": [ - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 0 - }, - "description": "The maximum number of resources to return. Defaults to 20. Values are clamped between 1 and 100." - }, - { - "name": "status", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/VaultStatusFilterParam" - }, - "description": "Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." - }, - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, - "schema": { - "type": "string", - "const": "agents=v1" + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAgentSessionParams" + } } } - ], + }, "responses": { - "200": { - "description": "A page of vaults.", + "201": { + "description": "The created session or its event stream.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultListResource", - "description": "A page of vaults." + "$ref": "#/components/schemas/SessionResource" + } + }, + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/SessionEvent" } } } @@ -5255,7 +5536,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -5265,7 +5546,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -5275,7 +5556,17 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "429": { + "description": "The Files API rate limit for your user has been exceeded.", "content": { "application/json": { "schema": { @@ -5305,33 +5596,60 @@ } } }, - "x-oaiMeta": { - "name": "List vaults" - } - }, - "post": { - "operationId": "createVault", - "summary": "Creates a vault for the current project. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Creates a vault for the current project.", + "x-oai-streaming": { + "request_field": "stream", + "response_status_code": 201 + }, + "parameters": [ + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ] + } + }, + "/agents/sessions/{session_id}": { + "get": { + "operationId": "retrieveAgentSession", + "summary": "Retrieve an agent session", + "description": "Retrieves the current state of a managed agent session. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", "tags": [ - "Vaults" + "Agents" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVaultParams" - } + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" } } - }, + ], "responses": { - "201": { - "description": "The created vault.", + "200": { + "description": "The requested session.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultResource" + "$ref": "#/components/schemas/SessionResource" } } } @@ -5357,7 +5675,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -5367,7 +5685,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -5377,7 +5695,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -5406,34 +5724,18 @@ } } } - }, - "x-oaiMeta": { - "name": "Create a vault" - }, - "parameters": [ - { - "name": "OpenAI-Beta", - "in": "header", - "required": true, - "schema": { - "type": "string", - "const": "agents=v1" - } - } - ] - } - }, - "/vaults/{vault_id}": { - "get": { - "operationId": "retrieveVault", - "summary": "Retrieves a vault by its ID. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Retrieves a vault by its ID.", + } + }, + "post": { + "operationId": "updateAgentSession", + "summary": "Update an agent session", + "description": "Updates session tools, metadata, model, reasoning effort, or service tier. Model settings apply to subsequent turns. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -5441,7 +5743,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session." }, { "name": "OpenAI-Beta", @@ -5453,13 +5755,22 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateAgentSessionParams" + } + } + } + }, "responses": { "200": { - "description": "The requested vault.", + "description": "The updated session.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultResource" + "$ref": "#/components/schemas/SessionResource" } } } @@ -5485,7 +5796,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -5495,7 +5806,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -5505,7 +5816,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -5534,21 +5845,18 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve a vault" } }, "delete": { - "operationId": "deleteVault", - "summary": "Deletes a vault and all its credentials. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Deletes a vault and all its credentials.", + "operationId": "deleteAgentSession", + "summary": "Delete an agent session", + "description": "Removes a managed agent session from the public API and returns a deletion confirmation. If backend execution has ended, deletion can cancel a still-open public turn and abandon unpublished outputs. Running execution must be cancelled first. Physical cleanup may continue asynchronously. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -5556,7 +5864,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session." }, { "name": "OpenAI-Beta", @@ -5570,11 +5878,11 @@ ], "responses": { "200": { - "description": "The deleted vault.", + "description": "The deleted session.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedVaultResource" + "$ref": "#/components/schemas/DeletedSessionResource" } } } @@ -5600,7 +5908,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -5610,7 +5918,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -5620,7 +5928,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -5649,23 +5957,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Delete a vault" } } }, - "/vaults/{vault_id}/credentials": { + "/agents/sessions/{session_id}/artifacts": { "get": { - "operationId": "listVaultCredentials", - "summary": "Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Lists a vault's credentials using ID-based pagination without returning secret values.", + "operationId": "listAgentSessionArtifacts", + "summary": "List agent session artifacts", + "description": "Lists immutable artifacts published by completed hosted session turns. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -5673,51 +5978,55 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session." }, { - "name": "order", + "name": "limit", "in": "query", "required": false, "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 }, - "description": "Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`." + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { - "name": "limit", + "name": "order", "in": "query", "required": false, "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 0 + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" }, - "description": "The maximum number of resources to return. Defaults to 20. Values are clamped between 1 and 100." + "description": "The order in which resources are returned. Defaults to `desc`." }, { - "name": "status", + "name": "after", "in": "query", "required": false, "schema": { - "$ref": "#/components/schemas/VaultStatusFilterParam" + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "description": "Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default." + "description": "Return resources after this resource ID in the selected order." }, { - "name": "after", + "name": "environment_id", "in": "query", "required": false, "schema": { - "type": "string", + "type": [ + "string", + "null" + ], "minLength": 0, "maxLength": 1048576 }, - "description": "Return resources after this resource ID in the selected order." + "description": "Restrict the listing to artifacts produced by this environment." }, { "name": "OpenAI-Beta", @@ -5731,12 +6040,12 @@ ], "responses": { "200": { - "description": "A page of vault credentials.", + "description": "A page of durable session artifacts.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultCredentialListResource", - "description": "A page of credentials in a vault." + "$ref": "#/components/schemas/SessionArtifactListResource", + "description": "A page of durable artifacts published by a session." } } } @@ -5762,7 +6071,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -5772,7 +6081,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -5782,7 +6091,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -5811,21 +6120,20 @@ } } } - }, - "x-oaiMeta": { - "name": "List vault credentials" } - }, - "post": { - "operationId": "createVaultCredential", - "summary": "Creates a vault credential. Secret values are write-only and are never returned. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Creates a vault credential. Secret values are write-only and are never returned.", + } + }, + "/agents/sessions/{session_id}/artifacts/{artifact_id}": { + "get": { + "operationId": "retrieveAgentSessionArtifact", + "summary": "Retrieve an agent session artifact", + "description": "Retrieves immutable metadata for one durable session artifact. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -5833,7 +6141,18 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session that owns the artifact." + }, + { + "name": "artifact_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The immutable session artifact ID." }, { "name": "OpenAI-Beta", @@ -5845,22 +6164,13 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVaultCredentialParams" - } - } - } - }, "responses": { - "201": { - "description": "The created vault credential without secret values.", + "200": { + "description": "The requested session artifact.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultCredentialResource" + "$ref": "#/components/schemas/SessionArtifactResource" } } } @@ -5886,7 +6196,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -5896,7 +6206,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -5906,7 +6216,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -5935,23 +6245,18 @@ } } } - }, - "x-oaiMeta": { - "name": "Create a vault credential" } - } - }, - "/vaults/{vault_id}/credentials/{credential_id}": { - "get": { - "operationId": "retrieveVaultCredential", - "summary": "Retrieves vault credential metadata without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Retrieves vault credential metadata without returning secret values.", + }, + "delete": { + "operationId": "deleteAgentSessionArtifact", + "summary": "Delete an agent session artifact", + "description": "Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -5959,10 +6264,10 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session that owns the artifact." }, { - "name": "credential_id", + "name": "artifact_id", "in": "path", "required": true, "schema": { @@ -5970,7 +6275,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault credential." + "description": "The immutable session artifact ID." }, { "name": "OpenAI-Beta", @@ -5984,11 +6289,11 @@ ], "responses": { "200": { - "description": "The requested vault credential without secret values.", + "description": "The deleted session artifact.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultCredentialResource" + "$ref": "#/components/schemas/DeletedSessionArtifactResource" } } } @@ -6014,7 +6319,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -6024,7 +6329,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -6034,7 +6339,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -6063,21 +6368,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve a vault credential" } - }, - "post": { - "operationId": "rotateVaultCredential", - "summary": "Rotates a vault credential's write-only secret and returns only credential metadata. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Rotates a vault credential's write-only secret and returns only credential metadata.", + } + }, + "/agents/sessions/{session_id}/artifacts/{artifact_id}/content": { + "get": { + "operationId": "retrieveAgentSessionArtifactContent", + "summary": "Retrieve agent session artifact content", + "description": "Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -6085,10 +6389,10 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session that owns the artifact." }, { - "name": "credential_id", + "name": "artifact_id", "in": "path", "required": true, "schema": { @@ -6096,7 +6400,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault credential." + "description": "The immutable session artifact ID." }, { "name": "OpenAI-Beta", @@ -6108,22 +6412,14 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RotateVaultCredentialParams" - } - } - } - }, "responses": { "200": { - "description": "The rotated vault credential without secret values.", + "description": "The immutable artifact contents.", "content": { - "application/json": { + "application/octet-stream": { "schema": { - "$ref": "#/components/schemas/VaultCredentialResource" + "type": "string", + "format": "binary" } } } @@ -6149,7 +6445,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -6159,7 +6455,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -6169,7 +6465,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -6198,32 +6494,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Rotate a vault credential" } - }, - "delete": { - "operationId": "deleteVaultCredential", - "summary": "Deletes a vault credential. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Deletes a vault credential.", + } + }, + "/agents/sessions/{session_id}/events": { + "get": { + "operationId": "listAgentSessionEvents", + "summary": "Stream agent session events", + "description": "Streams live events for an agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the vault." - }, - { - "name": "credential_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -6231,7 +6515,7 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault credential." + "description": "The ID of the session." }, { "name": "OpenAI-Beta", @@ -6245,11 +6529,11 @@ ], "responses": { "200": { - "description": "The deleted vault credential.", + "description": "A live stream of session events.", "content": { - "application/json": { + "text/event-stream": { "schema": { - "$ref": "#/components/schemas/DeletedVaultCredentialResource" + "$ref": "#/components/schemas/SessionEvent" } } } @@ -6275,7 +6559,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -6285,7 +6569,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -6295,7 +6579,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -6325,1147 +6609,6382 @@ } } }, - "x-oaiMeta": { - "name": "Delete a vault credential" + "x-oai-streaming": { + "request_field": null, + "response_status_code": 200 } - } - } - }, - "webhooks": { - "batch_cancelled": { + }, "post": { - "description": "Sent when a batch has been cancelled.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookBatchCancelled" - } + "operationId": "createAgentSessionEvents", + "summary": "Create agent session input events", + "description": "Submits message, cancellation, tool-result, or computer-use approval-response events to a managed agent session. Cancellation can recover a still-open turn whose backend execution has ended by marking it cancelled and abandoning unpublished outputs. Saved results, published files, and existing terminal outcomes are preserved. HTTP 202 confirms acceptance, not durable completion. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + }, + { + "name": "Idempotency-Key", + "in": "header", + "required": false, + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "description": "An optional client-generated key that makes retries of submitted messages idempotent." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" } } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" - } - } - } - }, - "batch_completed": { - "post": { - "description": "Sent when a batch has completed processing.\n", + ], "requestBody": { - "description": "The event payload sent by the API.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WebhookBatchCompleted" + "$ref": "#/components/schemas/CreateSessionEventsParams" } } } }, "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" - } - } - } - }, - "batch_expired": { - "post": { - "description": "Sent when a batch has expired before completion.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookBatchExpired" + "202": { + "description": "The events were accepted." + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" - } - } - } - }, - "batch_failed": { - "post": { - "description": "Sent when a batch has failed.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookBatchFailed" + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" - } - } - } - }, - "eval_run_canceled": { - "post": { - "description": "Sent when an eval run has been canceled.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookEvalRunCanceled" + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "eval_run_failed": { - "post": { - "description": "Sent when an eval run has failed.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookEvalRunFailed" + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "eval_run_succeeded": { - "post": { - "description": "Sent when an eval run has succeeded.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookEvalRunSucceeded" + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "fine_tuning_job_cancelled": { - "post": { - "description": "Sent when a fine-tuning job has been cancelled.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookFineTuningJobCancelled" + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "fine_tuning_job_failed": { - "post": { - "description": "Sent when a fine-tuning job has failed.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookFineTuningJobFailed" + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } } } }, - "fine_tuning_job_succeeded": { - "post": { - "description": "Sent when a fine-tuning job has succeeded.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookFineTuningJobSucceeded" - } + "/agents/sessions/{session_id}/items": { + "get": { + "operationId": "listAgentSessionItems", + "summary": "List agent session items", + "description": "Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" } } - }, + ], "responses": { "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "live_call_incoming": { - "post": { - "deprecated": true, - "description": "Deprecated: use `live.transport.incoming`. Retained only for existing subscriptions.\nSent when an incoming API SIP session is available for Live acceptance.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookLiveCallIncoming" + "description": "A page of session items.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionItemListResource" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" - } - } - } - }, - "live_transport_incoming": { - "post": { - "description": "Sent when an incoming API SIP session is available for Live acceptance.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookLiveTransportIncoming" + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" - } - } - } - }, - "realtime_call_incoming": { - "post": { - "description": "Sent when an incoming API SIP session is available for Realtime acceptance.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookRealtimeCallIncoming" + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" - } - } - } - }, - "response_cancelled": { - "post": { - "description": "Sent when a background response has been cancelled.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookResponseCancelled" + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" } } } }, - "response_completed": { - "post": { - "description": "Sent when a background response has completed successfully.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookResponseCompleted" - } + "/agents/sessions/{session_id}/traces": { + "get": { + "operationId": "listAgentSessionTraces", + "summary": "List agent session traces", + "description": "Lists published root-turn traces as OTLP JSON, ordered by turn creation time and ID. Unpublished traces are skipped. Each page returns data available when read; it does not wait for late traces. Trace reads and the JSON response are limited to 16 MiB per request. If the limit is exceeded, request fewer traces.", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" } } - }, + ], "responses": { "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + "description": "A page of published session traces.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionTraceListResource", + "description": "A page of published session traces." + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } } }, - "response_failed": { - "post": { - "description": "Sent when a background response has failed.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookResponseFailed" - } - } + "/agents/sessions/{session_id}/turns": { + "get": { + "operationId": "listAgentSessionTurns", + "summary": "List agent session turns", + "description": "Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "A page of session turns.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionTurnListResource", + "description": "A page of turns from an agent session or subagent." + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/agents/sessions/{session_id}/turns/{turn_id}": { + "get": { + "operationId": "retrieveAgentSessionTurn", + "summary": "Retrieve an agent session turn", + "description": "Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session that owns the turn." + }, + { + "name": "turn_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the turn." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "The requested turn.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TurnResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/agents/sessions/{session_id}/turns/{turn_id}/items": { + "get": { + "operationId": "listAgentSessionTurnItems", + "summary": "List agent session turn items", + "description": "Lists items belonging to one root-agent turn, including its interactions with subagents. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session that owns the turn." + }, + { + "name": "turn_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the turn." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "A page of session turn items.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionItemListResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/vaults": { + "get": { + "operationId": "listVaults", + "summary": "List vaults", + "description": "Lists vaults using ID-based pagination. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "metadata", + "in": "query", + "required": false, + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 + }, + "description": "Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear.", + "style": "deepObject", + "explode": true + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/VaultStatusFilterParam" + }, + "description": "Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "A page of vaults.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultListResource", + "description": "A page of vaults." + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + }, + "post": { + "operationId": "createVault", + "summary": "Create a vault", + "description": "Creates a vault for the current project. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVaultParams" + } + } + } + }, + "responses": { + "201": { + "description": "The created vault.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + }, + "parameters": [ + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ] + } + }, + "/vaults/{vault_id}": { + "get": { + "operationId": "retrieveVault", + "summary": "Retrieve a vault", + "description": "Retrieves a vault by its ID. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "The requested vault.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + }, + "post": { + "operationId": "updateVault", + "summary": "Update a vault", + "description": "Updates the name or metadata of an active vault. Omitted fields remain unchanged. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateVaultParams" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The updated vault.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteVault", + "summary": "Delete a vault", + "description": "Deletes a vault and all its credentials. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "The deleted vault.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedVaultResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/vaults/{vault_id}/credentials": { + "get": { + "operationId": "listVaultCredentials", + "summary": "List vault credentials", + "description": "Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "metadata", + "in": "query", + "required": false, + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 + }, + "description": "Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear.", + "style": "deepObject", + "explode": true + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/VaultStatusFilterParam" + }, + "description": "Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "A page of vault credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCredentialListResource", + "description": "A page of credentials in a vault." + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + }, + "post": { + "operationId": "createVaultCredential", + "summary": "Create a vault credential", + "description": "Creates a vault credential. Secret values are write-only and are never returned. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVaultCredentialParams" + } + } + } + }, + "responses": { + "201": { + "description": "The created vault credential without secret values.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCredentialResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/vaults/{vault_id}/credentials/{credential_id}": { + "get": { + "operationId": "retrieveVaultCredential", + "summary": "Retrieve a vault credential", + "description": "Retrieves vault credential metadata without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + }, + { + "name": "credential_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault credential." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "The requested vault credential without secret values.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCredentialResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + }, + "post": { + "operationId": "rotateVaultCredential", + "summary": "Update a vault credential", + "description": "Updates credential metadata or rotates its write-only secret. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + }, + { + "name": "credential_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault credential." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RotateVaultCredentialParams" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The updated vault credential without secret values.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCredentialResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteVaultCredential", + "summary": "Delete a vault credential", + "description": "Deletes a vault credential. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + }, + { + "name": "credential_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault credential." + }, + { + "name": "OpenAI-Beta", + "in": "header", + "required": true, + "schema": { + "type": "string", + "const": "agents=v1" + } + } + ], + "responses": { + "200": { + "description": "The deleted vault credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedVaultCredentialResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + } + }, + "webhooks": { + "agent_environment_expired": { + "post": { + "description": "Sent when an agent environment expires and can no longer resume from a snapshot.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentEnvironmentExpired" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_environment_failed": { + "post": { + "description": "Sent when setup fails for a prewarmed OpenAI-hosted environment before it is attached to a session.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentEnvironmentFailed" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_environment_ready": { + "post": { + "description": "Sent when a prewarmed OpenAI-hosted environment finishes setup before being attached to a session.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentEnvironmentReady" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_environment_suspended": { + "post": { + "description": "Sent when an agent environment is suspended and can resume from a snapshot.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentEnvironmentSuspended" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_session_action_required": { + "post": { + "description": "Sent when an agent session requires an action. Retrieve the session for action details.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionActionRequired" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_session_created": { + "post": { + "description": "Sent when an agent session is created.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionCreated" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_session_failed": { + "post": { + "description": "Sent when an agent session fails.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionFailed" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_session_idle": { + "post": { + "description": "Sent when an agent session becomes idle.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionIdle" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_session_in_progress": { + "post": { + "description": "Sent when an agent session enters the in-progress state.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionInProgress" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "batch_cancelled": { + "post": { + "description": "Sent when a batch has been cancelled.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookBatchCancelled" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "batch_completed": { + "post": { + "description": "Sent when a batch has completed processing.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookBatchCompleted" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "batch_expired": { + "post": { + "description": "Sent when a batch has expired before completion.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookBatchExpired" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "batch_failed": { + "post": { + "description": "Sent when a batch has failed.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookBatchFailed" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "eval_run_canceled": { + "post": { + "description": "Sent when an eval run has been canceled.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEvalRunCanceled" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "eval_run_failed": { + "post": { + "description": "Sent when an eval run has failed.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEvalRunFailed" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "eval_run_succeeded": { + "post": { + "description": "Sent when an eval run has succeeded.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEvalRunSucceeded" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "fine_tuning_job_cancelled": { + "post": { + "description": "Sent when a fine-tuning job has been cancelled.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookFineTuningJobCancelled" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "fine_tuning_job_failed": { + "post": { + "description": "Sent when a fine-tuning job has failed.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookFineTuningJobFailed" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "fine_tuning_job_succeeded": { + "post": { + "description": "Sent when a fine-tuning job has succeeded.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookFineTuningJobSucceeded" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "live_call_incoming": { + "post": { + "deprecated": true, + "description": "Deprecated: use `live.transport.incoming`. Retained only for existing subscriptions.\nSent when an incoming API SIP session is available for Live acceptance.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookLiveCallIncoming" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "live_transport_incoming": { + "post": { + "description": "Sent when an incoming API SIP session is available for Live acceptance.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookLiveTransportIncoming" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "realtime_call_incoming": { + "post": { + "description": "Sent when an incoming API SIP session is available for Realtime acceptance.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookRealtimeCallIncoming" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "response_cancelled": { + "post": { + "description": "Sent when a background response has been cancelled.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookResponseCancelled" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "response_completed": { + "post": { + "description": "Sent when a background response has completed successfully.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookResponseCompleted" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "response_failed": { + "post": { + "description": "Sent when a background response has failed.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookResponseFailed" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "response_incomplete": { + "post": { + "description": "Sent when a background response is incomplete.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookResponseIncomplete" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "safety_alert_created": { + "post": { + "description": "Sent when an approved safety alert is available for an API project.\nRetrieve the alert with a project API key granted `api.safety.alerts.read`.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSafetyAlertCreated" + } + } + } + }, + "responses": { + "200": { + "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + } + } + } + }, + "safety_deactivation_issued": { + "post": { + "description": "Sent when a deactivation is issued for a safety identifier in your organization.\nRetrieve the case details with `GET /v1/safety/cases/{id}` using `data.id`.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSafetyDeactivationIssued" + } + } + } + }, + "responses": { + "200": { + "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + } + } + } + }, + "safety_org_alert_created": { + "post": { + "description": "Sent when an approved safety alert is available for an enterprise workspace.\nRetrieve the alert from `https://api.chatgpt.com/v1/safety/alerts/{id}` with\nan administrator API key for the workspace's backing organization granted\n`chatgpt.enterprise.safety_alerts.read`.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSafetyOrgAlertCreated" + } + } + } + }, + "responses": { + "200": { + "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + } + } + } + }, + "safety_warning_issued": { + "post": { + "description": "Sent when a warning is issued for a safety identifier in your organization.\nRetrieve the case details with `GET /v1/safety/cases/{id}` using `data.id`.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSafetyWarningIssued" + } + } + } + }, + "responses": { + "200": { + "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + } + } + } + } + }, + "components": { + "schemas": { + "CreateFileRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "description": "The File object (not file name) to be uploaded.\n", + "type": "string", + "format": "binary" + }, + "purpose": { + "description": "The intended purpose of the uploaded file. One of:\n- `assistants`: Used in the Assistants API\n- `batch`: Used in the Batch API\n- `fine-tune`: Used for fine-tuning\n- `vision`: Images used for vision fine-tuning\n- `user_data`: Flexible file type for any purpose\n- `evals`: Used for eval data sets\n", + "type": "string", + "enum": [ + "assistants", + "batch", + "fine-tune", + "vision", + "user_data", + "evals" + ] + }, + "expires_after": { + "$ref": "#/components/schemas/FileExpirationAfter" + } + }, + "required": [ + "file", + "purpose" + ] + }, + "DeleteFileResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "object": { + "type": "string", + "enum": [ + "file" + ], + "x-stainless-const": true + }, + "deleted": { + "type": "boolean" + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "Error": { + "type": "object", + "properties": { + "code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "message": { + "type": "string" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "misalignment": { + "$ref": "#/components/schemas/MisalignmentErrorDetailsResource" + } + }, + "required": [ + "type", + "message", + "param", + "code" + ] + }, + "ErrorResponse": { + "type": "object", + "properties": { + "error": { + "$ref": "#/components/schemas/Error" + } + }, + "required": [ + "error" + ] + }, + "FileExpirationAfter": { + "type": "object", + "title": "File expiration policy", + "description": "The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted.", + "properties": { + "anchor": { + "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`.", + "type": "string", + "enum": [ + "created_at" + ], + "x-stainless-const": true + }, + "seconds": { + "description": "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).", + "type": "integer", + "format": "int64", + "minimum": 3600, + "maximum": 2592000 + } + }, + "required": [ + "anchor", + "seconds" + ] + }, + "ListFilesResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIFile" + } + }, + "first_id": { + "type": "string", + "example": "file-abc123" + }, + "last_id": { + "type": "string", + "example": "file-abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "OpenAIFile": { + "title": "OpenAIFile", + "description": "The `File` object represents a document that has been uploaded to OpenAI.", + "properties": { + "id": { + "type": "string", + "description": "The file identifier, which can be referenced in the API endpoints." + }, + "bytes": { + "type": [ + "integer", + "null" + ], + "description": "The size of the file, in bytes. In a completed file upload response, this can\nbe null when the file size is not yet available.\n" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the file was created." + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the file will expire. In a\ncompleted file upload response, this can be null when no expiry is set.\n" + }, + "filename": { + "type": "string", + "description": "The name of the file." + }, + "object": { + "type": "string", + "description": "The object type, which is always `file`.", + "enum": [ + "file" + ], + "x-stainless-const": true + }, + "purpose": { + "type": "string", + "description": "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.", + "enum": [ + "assistants", + "assistants_output", + "batch", + "batch_output", + "fine-tune", + "fine-tune-results", + "vision", + "user_data" + ] + }, + "status": { + "type": "string", + "deprecated": true, + "description": "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.", + "enum": [ + "uploaded", + "processed", + "error" + ] + }, + "status_details": { + "type": "string", + "deprecated": true, + "description": "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. Completed file upload responses can return null when these details are unset." + } + }, + "required": [ + "id", + "object", + "bytes", + "created_at", + "filename", + "purpose", + "status" + ], + "x-oaiMeta": { + "name": "The file object", + "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1680202602,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n \"status\": \"processed\"\n}\n" + } + }, + "_MisalignmentErrorType": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "potentially_unintended_data_transfer", + "potentially_unintended_data_access", + "potentially_unintended_destructive_activity", + "other" + ] + } + ] + }, + "_MisalignmentSteer": { + "properties": { + "message": { + "type": "string", + "description": "The public continuation instruction." + } + }, + "type": "object", + "required": [ + "message" + ] + }, + "MisalignmentErrorDetailsResource": { + "properties": { + "review_target": { + "anyOf": [ + { + "not": { + "pattern": "[^A-Za-z0-9._~:-]" + }, + "type": "string", + "maxLength": 96, + "minLength": 1, + "pattern": "^[A-Za-z0-9._~:-]+$", + "description": "An opaque target for explicitly continuing this review, or null when unavailable." + }, + { + "type": "null" + } + ] + }, + "error_type": { + "$ref": "#/components/schemas/_MisalignmentErrorType", + "description": "An optional classification; clients must accept additional values." + }, + "detailed_explanation": { + "type": "string", + "description": "The public explanation for this block." + }, + "steer": { + "$ref": "#/components/schemas/_MisalignmentSteer", + "description": "An optional public continuation instruction." + } + }, + "type": "object", + "required": [] + }, + "OrderEnum": { + "type": "string", + "enum": [ + "asc", + "desc" + ] + }, + "SkillResource": { + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the skill." + }, + "object": { + "type": "string", + "enum": [ + "skill" + ], + "description": "The object type, which is `skill`.", + "default": "skill", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "Name of the skill." + }, + "description": { + "type": "string", + "description": "Description of the skill." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (seconds) for when the skill was created." + }, + "default_version": { + "type": "string", + "description": "Default version for the skill." + }, + "latest_version": { + "type": "string", + "description": "Latest version for the skill." + } + }, + "type": "object", + "required": [ + "id", + "object", + "name", + "description", + "created_at", + "default_version", + "latest_version" + ] + }, + "SkillListResource": { + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object returned, must be `list`.", + "default": "list", + "x-stainless-const": true + }, + "data": { + "items": { + "$ref": "#/components/schemas/SkillResource" + }, + "type": "array", + "description": "A list of items" + }, + "first_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the first item in the list." + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the last item in the list." + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." + } + }, + "type": "object", + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "CreateSkillBody": { + "properties": { + "files": { + "oneOf": [ + { + "items": { + "type": "string", + "format": "binary" + }, + "type": "array", + "maxItems": 500, + "description": "Skill files to upload (directory upload) or a single zip file." + }, + { + "type": "string", + "format": "binary", + "description": "Skill zip file to upload." + } + ] + } + }, + "type": "object", + "required": [ + "files" + ], + "title": "Create skill request", + "description": "Uploads a skill either as a directory (multipart `files[]`) or as a single zip file." + }, + "SetDefaultSkillVersionBody": { + "properties": { + "default_version": { + "type": "string", + "description": "The skill version number to set as default." + } + }, + "type": "object", + "required": [ + "default_version" + ], + "title": "Update skill request", + "description": "Updates the default version pointer for a skill." + }, + "DeletedSkillResource": { + "properties": { + "object": { + "type": "string", + "enum": [ + "skill.deleted" + ], + "default": "skill.deleted", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + } + }, + "type": "object", + "required": [ + "object", + "deleted", + "id" + ] + }, + "SkillVersionResource": { + "properties": { + "object": { + "type": "string", + "enum": [ + "skill.version" + ], + "description": "The object type, which is `skill.version`.", + "default": "skill.version", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "Unique identifier for the skill version." + }, + "skill_id": { + "type": "string", + "description": "Identifier of the skill for this version." + }, + "version": { + "type": "string", + "description": "Version number for this skill." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (seconds) for when the version was created." + }, + "name": { + "type": "string", + "description": "Name of the skill version." + }, + "description": { + "type": "string", + "description": "Description of the skill version." + } + }, + "type": "object", + "required": [ + "object", + "id", + "skill_id", + "version", + "created_at", + "name", + "description" + ] + }, + "SkillVersionListResource": { + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object returned, must be `list`.", + "default": "list", + "x-stainless-const": true + }, + "data": { + "items": { + "$ref": "#/components/schemas/SkillVersionResource" + }, + "type": "array", + "description": "A list of items" + }, + "first_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the first item in the list." + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the last item in the list." + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." + } + }, + "type": "object", + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "CreateSkillVersionBody": { + "properties": { + "files": { + "oneOf": [ + { + "items": { + "type": "string", + "format": "binary" + }, + "type": "array", + "maxItems": 500, + "description": "Skill files to upload (directory upload) or a single zip file." + }, + { + "type": "string", + "format": "binary", + "description": "Skill zip file to upload." + } + ] + }, + "default": { + "type": "boolean", + "description": "Whether to set this version as the default." + } + }, + "type": "object", + "required": [ + "files" + ], + "title": "Create skill version request", + "description": "Uploads a new immutable version of a skill." + }, + "DeletedSkillVersionResource": { + "properties": { + "object": { + "type": "string", + "enum": [ + "skill.version.deleted" + ], + "default": "skill.version.deleted", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "version": { + "type": "string", + "description": "The deleted skill version." + } + }, + "type": "object", + "required": [ + "object", + "deleted", + "id", + "version" + ] + }, + "ListOrderParam": { + "type": "string", + "enum": [ + "asc", + "desc" + ], + "x-enumDescriptions": [ + "Returns resources in ascending order.", + "Returns resources in descending order." + ], + "description": "The order in which paginated resources are returned." + }, + "ReasoningEffortResource": { + "type": "string", + "enum": [ + "none", + "minimal", + "low", + "medium", + "high", + "xhigh", + "max" + ], + "description": "The amount of reasoning effort used by an agent." + }, + "ReasoningSummaryResource": { + "type": "string", + "enum": [ + "concise", + "detailed", + "auto" + ], + "x-enumDescriptions": [ + "Returns a concise reasoning summary when supported.", + "Returns a detailed reasoning summary when supported.", + "Automatically selects the most detailed summary supported by the model." + ], + "description": "The reasoning summary format requested from an agent." + }, + "ReasoningResource": { + "type": "object", + "properties": { + "effort": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningEffortResource" + }, + { + "type": "null" + } + ], + "description": "The requested reasoning effort, or `null` when the model selects its own default." + }, + "summary": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningSummaryResource" + }, + { + "type": "null" + } + ], + "description": "The requested reasoning summary format, or `null` when summaries are disabled." + } + }, + "required": [ + "effort", + "summary" + ], + "additionalProperties": false, + "description": "The reasoning configuration used by an agent." + }, + "TextFormatResourceText": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "text" + ], + "default": "text", + "x-stainless-const": true, + "description": "The type of the object. Always `text`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Generates ordinary text without a structured-output constraint." + }, + "TextFormatResourceJsonSchema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "json_schema" + ], + "default": "json_schema", + "x-stainless-const": true, + "description": "The type of the object. Always `json_schema`." + }, + "schema": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "The JSON Schema that generated text must match." + } + }, + "required": [ + "type", + "schema" + ], + "additionalProperties": false, + "description": "Constrains generated text to a JSON Schema." + }, + "TextFormatResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/TextFormatResourceText" + }, + { + "$ref": "#/components/schemas/TextFormatResourceJsonSchema" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "text": "#/components/schemas/TextFormatResourceText", + "json_schema": "#/components/schemas/TextFormatResourceJsonSchema" + } + }, + "x-oai-discriminator-values": [ + "text", + "json_schema" + ], + "description": "The effective output format for generated text." + }, + "VerbosityResource": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ], + "description": "The amount of text produced by an agent." + }, + "TextResource": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/TextFormatResource", + "description": "The effective output format. Defaults to ordinary text." + }, + "verbosity": { + "$ref": "#/components/schemas/VerbosityResource", + "description": "The amount of text produced by the agent. Defaults to `medium`." + } + }, + "required": [ + "format", + "verbosity" + ], + "additionalProperties": false, + "description": "The text configuration used by an agent." + }, + "ServiceTierResource": { + "type": "string", + "enum": [ + "auto", + "default", + "flex", + "priority", + "fast", + "ultrafast" + ], + "description": "The service-tier policy configured for an agent." + }, + "AgentToolResourceFunction": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ], + "default": "function", + "x-stainless-const": true, + "description": "The type of the object. Always `function`." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The name of the function." + }, + "description": { + "type": "string", + "minLength": 0, + "description": "A description of what the function does." + }, + "parameters": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "A JSON Schema object describing the function's arguments." + }, + "defer_loading": { + "type": "boolean", + "description": "Whether the function is deferred and discovered through tool search." + } + }, + "required": [ + "type", + "name", + "description", + "parameters", + "defer_loading" + ], + "additionalProperties": false, + "description": "A function defined by the application." + }, + "AgentToolResourceProgrammaticToolCalling": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "programmatic_tool_calling" + ], + "default": "programmatic_tool_calling", + "x-stainless-const": true, + "description": "The type of the object. Always `programmatic_tool_calling`." + }, + "enabled": { + "type": "boolean", + "description": "Whether tools can be called from model-generated code." + } + }, + "required": [ + "type", + "enabled" + ], + "additionalProperties": false, + "description": "Enables calling tools from model-generated code." + }, + "McpTransportResourceHttp": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "http" + ], + "default": "http", + "x-stainless-const": true, + "description": "The type of the object. Always `http`." + }, + "server_url": { + "type": "string", + "minLength": 0, + "description": "The URL of the MCP server." + } + }, + "required": [ + "type", + "server_url" + ], + "additionalProperties": false, + "description": "Connects to an MCP server over HTTP." + }, + "McpTransportResourceStdio": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "stdio" + ], + "default": "stdio", + "x-stainless-const": true, + "description": "The type of the object. Always `stdio`." + }, + "command": { + "type": "string", + "minLength": 0, + "description": "The command used to start the MCP server." + }, + "args": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Arguments passed to the MCP server command." + }, + "cwd": { + "type": "string", + "minLength": 0, + "description": "The working directory used to start the MCP server." + }, + "env_vars": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Environment variable names inherited from the execution environment." + } + }, + "required": [ + "type", + "command", + "args", + "cwd", + "env_vars" + ], + "additionalProperties": false, + "description": "Starts an MCP server as a local process." + }, + "McpTransportResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/McpTransportResourceHttp" + }, + { + "$ref": "#/components/schemas/McpTransportResourceStdio" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "http": "#/components/schemas/McpTransportResourceHttp", + "stdio": "#/components/schemas/McpTransportResourceStdio" + } + }, + "x-oai-discriminator-values": [ + "http", + "stdio" + ], + "description": "The transport used to connect to an MCP server." + }, + "McpConnectionOriginResource": { + "type": "string", + "enum": [ + "service", + "environment" + ], + "description": "Where outbound MCP HTTP connections originate." + }, + "AgentToolResourceMcp": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp" + ], + "default": "mcp", + "x-stainless-const": true, + "description": "The type of the object. Always `mcp`." + }, + "server_label": { + "type": "string", + "minLength": 0, + "description": "A label used to identify the MCP server in tool calls." + }, + "credential_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL." + }, + "transport": { + "$ref": "#/components/schemas/McpTransportResource", + "description": "The transport used to connect to the MCP server." + }, + "request_metadata": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Metadata included with requests to this MCP server." + }, + "allowed_tools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "The MCP tools the agent may call." + }, + "required": { + "type": "boolean", + "description": "Whether this MCP server must initialize before the first turn." + }, + "connection_origin": { + "$ref": "#/components/schemas/McpConnectionOriginResource", + "description": "Where outbound MCP HTTP connections originate." + } + }, + "required": [ + "type", + "server_label", + "credential_id", + "transport", + "request_metadata", + "allowed_tools", + "required", + "connection_origin" + ], + "additionalProperties": false, + "description": "Tools provided by a remote MCP server." + }, + "WebSearchModeResource": { + "type": "string", + "enum": [ + "disabled", + "cached", + "live" + ], + "description": "The source used for web search results." + }, + "WebSearchContextSizeResource": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ], + "description": "The amount of web search context made available to the model." + }, + "WebSearchLocationResource": { + "type": "object", + "properties": { + "country": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The two-letter ISO country code, such as `US`." + }, + "region": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The region or state name." + }, + "city": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The city name." + }, + "timezone": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The IANA timezone, such as `America/Los_Angeles`." + } + }, + "required": [ + "country", + "region", + "city", + "timezone" + ], + "additionalProperties": false, + "description": "Approximate user location used to localize web search results." + }, + "AgentToolResourceWebSearch": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "web_search" + ], + "default": "web_search", + "x-stainless-const": true, + "description": "The type of the object. Always `web_search`." + }, + "mode": { + "$ref": "#/components/schemas/WebSearchModeResource", + "description": "The source used for web search results." + }, + "context_size": { + "$ref": "#/components/schemas/WebSearchContextSizeResource", + "description": "The amount of search context made available to the model. Defaults to `medium`." + }, + "allowed_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Allowed search domains, or `null` when the search is unrestricted." + }, + "location": { + "anyOf": [ + { + "$ref": "#/components/schemas/WebSearchLocationResource" + }, + { + "type": "null" + } + ], + "description": "Approximate location used to localize search results, if provided." + } + }, + "required": [ + "type", + "mode", + "context_size", + "allowed_domains", + "location" + ], + "additionalProperties": false, + "description": "Web search." + }, + "AgentToolResourceComputerUse": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "computer_use" + ], + "default": "computer_use", + "x-stainless-const": true, + "description": "The type of the object. Always `computer_use`." + }, + "include_screenshots": { + "type": "boolean", + "description": "Whether computer tool outputs include screenshots." + } + }, + "required": [ + "type", + "include_screenshots" + ], + "additionalProperties": false, + "description": "Browser use in an OpenAI-hosted session." + }, + "AgentToolResourceAutomations": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "automations" + ], + "default": "automations", + "x-stainless-const": true, + "description": "The type of the object. Always `automations`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Lets the agent manage its own scheduled wakeups." + }, + "AgentToolResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AgentToolResourceFunction" + }, + { + "$ref": "#/components/schemas/AgentToolResourceProgrammaticToolCalling" + }, + { + "$ref": "#/components/schemas/AgentToolResourceMcp" + }, + { + "$ref": "#/components/schemas/AgentToolResourceWebSearch" + }, + { + "$ref": "#/components/schemas/AgentToolResourceComputerUse" + }, + { + "$ref": "#/components/schemas/AgentToolResourceAutomations" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "function": "#/components/schemas/AgentToolResourceFunction", + "programmatic_tool_calling": "#/components/schemas/AgentToolResourceProgrammaticToolCalling", + "mcp": "#/components/schemas/AgentToolResourceMcp", + "web_search": "#/components/schemas/AgentToolResourceWebSearch", + "computer_use": "#/components/schemas/AgentToolResourceComputerUse", + "automations": "#/components/schemas/AgentToolResourceAutomations" + } + }, + "x-oai-discriminator-values": [ + "function", + "programmatic_tool_calling", + "mcp", + "web_search", + "computer_use", + "automations" + ], + "description": "A tool available to the agent." + }, + "MultiAgentConfigResource": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether subagent tools are enabled. Defaults to false." + }, + "max_concurrent_subagents": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "minimum": 1, + "maximum": 4294967295, + "description": "Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled." + } + }, + "required": [ + "enabled", + "max_concurrent_subagents" + ], + "additionalProperties": false, + "description": "The resolved configuration for creating and coordinating subagents." + }, + "CompactionResource": { + "type": "object", + "properties": { + "async": { + "type": "boolean", + "description": "Whether context is compacted in the background. Defaults to true." + } + }, + "required": [ + "async" + ], + "additionalProperties": false, + "description": "The effective settings for compacting the agent's context." + }, + "ExperimentalConfigResource": { + "type": "object", + "properties": { + "time_awareness": { + "type": "boolean", + "description": "Whether the model receives periodic current-time reminders." + } + }, + "required": [ + "time_awareness" + ], + "additionalProperties": false, + "description": "The effective experimental settings for an agent." + }, + "AutomationAgentConfigResource": { + "type": "object", + "properties": { + "model": { + "type": "string", + "minLength": 0, + "description": "The requested model name." + }, + "reasoning": { + "$ref": "#/components/schemas/ReasoningResource", + "description": "The configured reasoning policy." + }, + "text": { + "$ref": "#/components/schemas/TextResource", + "description": "The configured output format and verbosity." + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTierResource", + "description": "The configured service-tier policy." + }, + "instructions": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "Custom instructions, or null when absent." + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AgentToolResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Configured tools, excluding confidential credentials." + }, + "multi_agent": { + "$ref": "#/components/schemas/MultiAgentConfigResource", + "description": "The configuration for creating and coordinating subagents." + }, + "compaction": { + "$ref": "#/components/schemas/CompactionResource", + "description": "The effective context compaction settings." + }, + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigResource", + "description": "The effective experimental settings for the agent." + } + }, + "required": [ + "model", + "reasoning", + "text", + "service_tier", + "instructions", + "tools", + "multi_agent" + ], + "additionalProperties": false, + "description": "Inline agent configuration without a generated session-local identity." + }, + "AutomationEnvironmentResourceNone": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "none" + ], + "default": "none", + "x-stainless-const": true, + "description": "The type of the object. Always `none`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "ContainerSizeResource": { + "type": "string", + "enum": [ + "small", + "medium", + "large" + ], + "description": "The effective CPU and memory tier of an OpenAI-hosted environment." + }, + "EnvironmentPackagesResource": { + "type": "object", + "properties": { + "python": { + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Python packages installed in the environment." + }, + "system": { + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "System packages installed in the environment." + }, + "npm": { + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "npm packages installed globally in the environment." + } + }, + "required": [ + "python", + "system", + "npm" + ], + "additionalProperties": false, + "description": "Packages installed in an OpenAI-hosted environment." + }, + "NetworkAccessResource": { + "type": "string", + "enum": [ + "enabled", + "disabled", + "restricted" + ], + "x-enumDescriptions": [ + "Allows unrestricted network access.", + "Disables network access.", + "Applies the configured domain restrictions." + ], + "description": "The network access mode for an OpenAI-hosted environment." + }, + "NetworkPolicyResource": { + "type": "object", + "properties": { + "access": { + "$ref": "#/components/schemas/NetworkAccessResource", + "description": "The environment's network access mode." + }, + "allowed_domains": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Domains the environment may access when network access is restricted." + } + }, + "required": [ + "access", + "allowed_domains" + ], + "additionalProperties": false, + "description": "Network access for an OpenAI-hosted environment." + }, + "DesktopResource": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether the environment provisions a desktop and browser proxy." + } + }, + "required": [ + "enabled" + ], + "additionalProperties": false, + "description": "The effective desktop configuration for an OpenAI-hosted environment." + }, + "HostedTemplateSkillResourceSkillReference": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "skill_reference" + ], + "default": "skill_reference", + "x-stainless-const": true, + "description": "The type of the object. Always `skill_reference`." + }, + "skill_id": { + "type": "string", + "minLength": 0, + "description": "The referenced skill ID." + }, + "version": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The requested version selector, including `latest`." + } + }, + "required": [ + "type", + "skill_id", + "version" + ], + "additionalProperties": false, + "description": "A skill resolved afresh from the Skills API whenever a session starts." + }, + "HostedTemplateSkillResourceInline": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "inline" + ], + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The skill name declared in `SKILL.md`." + }, + "description": { + "type": "string", + "minLength": 0, + "description": "The skill description declared in `SKILL.md`." + } + }, + "required": [ + "type", + "name", + "description" + ], + "additionalProperties": false, + "description": "Safe metadata for an inline skill archive." + }, + "HostedTemplateSkillResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedTemplateSkillResourceSkillReference" + }, + { + "$ref": "#/components/schemas/HostedTemplateSkillResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "skill_reference": "#/components/schemas/HostedTemplateSkillResourceSkillReference", + "inline": "#/components/schemas/HostedTemplateSkillResourceInline" + } + }, + "x-oai-discriminator-values": [ + "skill_reference", + "inline" + ], + "description": "Safe metadata for a skill configured by an environment template." + }, + "HostedPluginResourceInline": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "inline" + ], + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The installed plugin name." + }, + "description": { + "type": "string", + "minLength": 0, + "description": "The installed plugin description." + } + }, + "required": [ + "type", + "name", + "description" + ], + "additionalProperties": false, + "description": "A plugin installed from an inline ZIP archive." + }, + "HostedPluginResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedPluginResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "inline": "#/components/schemas/HostedPluginResourceInline" + } + }, + "x-oai-discriminator-values": [ + "inline" + ], + "description": "A plugin installed in an OpenAI-hosted environment." + }, + "HostedTemplateFileResourceFileId": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "file_id" + ], + "default": "file_id", + "x-stainless-const": true, + "description": "The type of the object. Always `file_id`." + }, + "file_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the uploaded file." + }, + "path": { + "type": "string", + "minLength": 0, + "description": "The file's absolute path inside the environment." + } + }, + "required": [ + "type", + "file_id", + "path" + ], + "additionalProperties": false, + "description": "A project-scoped Files API reference resolved separately for each session." + }, + "HostedTemplateFileResourceInline": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "inline" + ], + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." + }, + "path": { + "type": "string", + "minLength": 0, + "description": "The file's absolute path inside the environment." + }, + "size_bytes": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "The decoded size of the inline file in bytes." + } + }, + "required": [ + "type", + "path", + "size_bytes" + ], + "additionalProperties": false, + "description": "Metadata for confidential inline file contents." + }, + "HostedTemplateFileResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedTemplateFileResourceFileId" + }, + { + "$ref": "#/components/schemas/HostedTemplateFileResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "file_id": "#/components/schemas/HostedTemplateFileResourceFileId", + "inline": "#/components/schemas/HostedTemplateFileResourceInline" + } + }, + "x-oai-discriminator-values": [ + "file_id", + "inline" + ], + "description": "Safe metadata for a file configured by an environment template." + }, + "AutomationEnvironmentResourceOpenaiHosted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "openai_hosted" + ], + "default": "openai_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `openai_hosted`." + }, + "environment_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "An existing environment reference, or null when provisioning a new environment." + }, + "environment_template_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "A template reference, or null when no template is selected." + }, + "container_size": { + "anyOf": [ + { + "$ref": "#/components/schemas/ContainerSizeResource" + }, + { + "type": "null" + } + ], + "description": "The configured container size, or null to use the creation default." + }, + "packages": { + "anyOf": [ + { + "$ref": "#/components/schemas/EnvironmentPackagesResource" + }, + { + "type": "null" + } + ], + "description": "Package overrides, or null to inherit the template or creation default." + }, + "network": { + "anyOf": [ + { + "$ref": "#/components/schemas/NetworkPolicyResource" + }, + { + "type": "null" + } + ], + "description": "Network overrides, or null to inherit the template or creation default." + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopResource" + }, + { + "type": "null" + } + ], + "description": "Desktop overrides, or null to inherit the template or creation default." + }, + "capability_directories": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Directory overrides, or null to inherit the template or creation default." + }, + "skills": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedTemplateSkillResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Skill overrides, excluding archive contents, or null to inherit." + }, + "plugins": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedPluginResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Plugin overrides, excluding archive contents, or null to inherit." + }, + "files": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedTemplateFileResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "File overrides, excluding contents, or null to inherit." + } + }, + "required": [ + "type", + "environment_id", + "environment_template_id", + "container_size", + "packages", + "network", + "desktop", + "capability_directories", + "skills", + "plugins", + "files" + ], + "additionalProperties": false, + "description": "Hosted environment selection with confidential setup commands and variables omitted." + }, + "AutomationEnvironmentResourceSelfHosted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "self_hosted" + ], + "default": "self_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `self_hosted`." + }, + "environment_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "An existing registration, or null to create a session-owned environment." + }, + "workspace_directory": { + "type": "string", + "minLength": 0, + "description": "The absolute project directory in the environment." + }, + "capability_directories": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Directories that expose capabilities to the agent." + } + }, + "required": [ + "type", + "environment_id", + "workspace_directory", + "capability_directories" + ], + "additionalProperties": false + }, + "AutomationEnvironmentResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationEnvironmentResourceNone" + }, + { + "$ref": "#/components/schemas/AutomationEnvironmentResourceOpenaiHosted" + }, + { + "$ref": "#/components/schemas/AutomationEnvironmentResourceSelfHosted" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "none": "#/components/schemas/AutomationEnvironmentResourceNone", + "openai_hosted": "#/components/schemas/AutomationEnvironmentResourceOpenaiHosted", + "self_hosted": "#/components/schemas/AutomationEnvironmentResourceSelfHosted" + } + }, + "x-oai-discriminator-values": [ + "none", + "openai_hosted", + "self_hosted" + ], + "description": "Environment selection saved before an invocation creates its session." + }, + "InputContentResourceInputText": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_text" + ], + "default": "input_text", + "x-stainless-const": true, + "description": "The type of the object. Always `input_text`." + }, + "text": { + "type": "string", + "minLength": 0, + "description": "The text supplied to the agent." + } + }, + "required": [ + "type", + "text" + ], + "additionalProperties": false, + "description": "Text input recorded in a session item." + }, + "InputContentResourceInputImage": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_image" + ], + "default": "input_image", + "x-stainless-const": true, + "description": "The type of the object. Always `input_image`." + }, + "image_url": { + "type": "string", + "minLength": 0, + "description": "The URL of the image supplied to the agent, which may be a base64-encoded data URL." + } + }, + "required": [ + "type", + "image_url" + ], + "additionalProperties": false, + "description": "Image input recorded in a session item." + }, + "InputContentResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/InputContentResourceInputText" + }, + { + "$ref": "#/components/schemas/InputContentResourceInputImage" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "input_text": "#/components/schemas/InputContentResourceInputText", + "input_image": "#/components/schemas/InputContentResourceInputImage" + } + }, + "x-oai-discriminator-values": [ + "input_text", + "input_image" + ], + "description": "User-provided content recorded in a session item." + }, + "InputMessageResource-2": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "message" + ], + "default": "message", + "x-stainless-const": true, + "description": "The type of the input item. Always `message`." + }, + "role": { + "type": "string", + "enum": [ + "user" + ], + "default": "user", + "x-stainless-const": true, + "description": "The role of the message author. Always `user`." + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputContentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The content of the message." + } + }, + "required": [ + "type", + "role", + "content" + ], + "additionalProperties": false, + "description": "A user message recorded in a session." + }, + "AutomationTargetResourceNewSession": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "new_session" + ], + "default": "new_session", + "x-stainless-const": true, + "description": "The type of the object. Always `new_session`." + }, + "agent_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The saved agent reference, or null when an inline agent is configured." + }, + "agent": { + "anyOf": [ + { + "$ref": "#/components/schemas/AutomationAgentConfigResource" + }, + { + "type": "null" + } + ], + "description": "The inline agent configuration, or null when agent_id is configured." + }, + "environment": { + "$ref": "#/components/schemas/AutomationEnvironmentResource", + "description": "Configuration or references used to select the execution environment." + }, + "input": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputMessageResource-2" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Initial input delivered to each new session." + }, + "vault_ids": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Vaults made available to each new session." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Metadata attached to each new session." + } + }, + "required": [ + "type", + "agent_id", + "agent", + "environment", + "input", + "vault_ids", + "metadata" + ], + "additionalProperties": false + }, + "AutomationTargetResourceExistingSession": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "existing_session" + ], + "default": "existing_session", + "x-stainless-const": true, + "description": "The type of the object. Always `existing_session`." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The session receiving each invocation." + }, + "instructions": { + "type": "string", + "minLength": 0, + "description": "Saved instructions delivered as an automation notification." + } + }, + "required": [ + "type", + "session_id", + "instructions" + ], + "additionalProperties": false + }, + "AutomationTargetResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationTargetResourceNewSession" + }, + { + "$ref": "#/components/schemas/AutomationTargetResourceExistingSession" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "new_session": "#/components/schemas/AutomationTargetResourceNewSession", + "existing_session": "#/components/schemas/AutomationTargetResourceExistingSession" + } + }, + "x-oai-discriminator-values": [ + "new_session", + "existing_session" + ], + "description": "Saved target configuration, excluding confidential request-only values." + }, + "AutomationCreatedByResourceDeveloper": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "developer" + ], + "default": "developer", + "x-stainless-const": true, + "description": "The type of the object. Always `developer`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "AutomationCreatedByResourceAgent": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "agent" + ], + "default": "agent", + "x-stainless-const": true, + "description": "The type of the object. Always `agent`." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The creator session, which is also the automation's target." + }, + "tool_call_id": { + "type": "string", + "minLength": 0, + "description": "The tool call that created the automation." + } + }, + "required": [ + "type", + "session_id", + "tool_call_id" + ], + "additionalProperties": false + }, + "AutomationCreatedByResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationCreatedByResourceDeveloper" + }, + { + "$ref": "#/components/schemas/AutomationCreatedByResourceAgent" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "developer": "#/components/schemas/AutomationCreatedByResourceDeveloper", + "agent": "#/components/schemas/AutomationCreatedByResourceAgent" + } + }, + "x-oai-discriminator-values": [ + "developer", + "agent" + ], + "description": "How the automation was created, independently of how an invocation started." + }, + "PeriodicAutomationStatusResource": { + "type": "string", + "enum": [ + "active", + "paused" + ] + }, + "AutomationResourcePeriodic": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "periodic" + ], + "default": "periodic", + "x-stainless-const": true, + "description": "The type of the object. Always `periodic`." + }, + "id": { + "type": "string", + "minLength": 0, + "description": "The automation ID." + }, + "object": { + "type": "string", + "enum": [ + "agent.automation" + ], + "default": "agent.automation", + "x-stainless-const": true, + "description": "Always `agent.automation`." + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "The creation time as a Unix timestamp in seconds." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The automation's display name." + }, + "target": { + "$ref": "#/components/schemas/AutomationTargetResource", + "description": "The session configuration or existing session receiving invocations." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Custom string key-value pairs attached to the automation." + }, + "created_by": { + "$ref": "#/components/schemas/AutomationCreatedByResource", + "description": "Service-recorded provenance; callers cannot supply this field." + }, + "expression": { + "type": "string", + "minLength": 0, + "description": "The cron expression determining scheduled occurrences." + }, + "timezone": { + "type": "string", + "minLength": 0, + "description": "The timezone used to interpret the expression." + }, + "status": { + "$ref": "#/components/schemas/PeriodicAutomationStatusResource", + "description": "Whether scheduled delivery is active or paused." + } + }, + "required": [ + "type", + "id", + "object", + "created_at", + "name", + "target", + "metadata", + "created_by", + "expression", + "timezone", + "status" + ], + "additionalProperties": false, + "description": "Fields shared by periodic and one-time automations." + }, + "OnceAutomationStatusResource": { + "type": "string", + "enum": [ + "active", + "paused", + "completed" + ] + }, + "AutomationResourceOnce": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "once" + ], + "default": "once", + "x-stainless-const": true, + "description": "The type of the object. Always `once`." + }, + "id": { + "type": "string", + "minLength": 0, + "description": "The automation ID." + }, + "object": { + "type": "string", + "enum": [ + "agent.automation" + ], + "default": "agent.automation", + "x-stainless-const": true, + "description": "Always `agent.automation`." + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "The creation time as a Unix timestamp in seconds." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The automation's display name." + }, + "target": { + "$ref": "#/components/schemas/AutomationTargetResource", + "description": "The session configuration or existing session receiving invocations." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Custom string key-value pairs attached to the automation." + }, + "created_by": { + "$ref": "#/components/schemas/AutomationCreatedByResource", + "description": "Service-recorded provenance; callers cannot supply this field." + }, + "run_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, of the scheduled occurrence." + }, + "status": { + "$ref": "#/components/schemas/OnceAutomationStatusResource", + "description": "Completion means the schedule has finished, not the agent's work." } }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + "required": [ + "type", + "id", + "object", + "created_at", + "name", + "target", + "metadata", + "created_by", + "run_at", + "status" + ], + "additionalProperties": false, + "description": "Fields shared by periodic and one-time automations." + }, + "AutomationResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationResourcePeriodic" + }, + { + "$ref": "#/components/schemas/AutomationResourceOnce" } - } - } - }, - "response_incomplete": { - "post": { - "description": "Sent when a background response is incomplete.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookResponseIncomplete" - } - } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "periodic": "#/components/schemas/AutomationResourcePeriodic", + "once": "#/components/schemas/AutomationResourceOnce" } }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + "x-oai-discriminator-values": [ + "periodic", + "once" + ], + "description": "A saved automation and its schedule." + }, + "ErrorBodyResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "minLength": 0, + "description": "The error type." + }, + "code": { + "type": "string", + "minLength": 0, + "description": "A machine-readable error code." + }, + "message": { + "type": "string", + "minLength": 0, + "description": "A human-readable error message." + }, + "param": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The request parameter that caused the error, or null for a request-wide error." } - } - } - }, - "safety_alert_created": { - "post": { - "description": "Sent when an approved safety alert is available for an API project.\nRetrieve the alert with a project API key granted `api.safety.alerts.read`.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookSafetyAlertCreated" - } - } + }, + "required": [ + "type", + "code", + "message", + "param" + ], + "additionalProperties": false, + "description": "Details about an API error." + }, + "ErrorResponse-2": { + "type": "object", + "properties": { + "error": { + "$ref": "#/components/schemas/ErrorBodyResource", + "description": "The error returned by the API." } }, - "responses": { - "200": { - "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + "required": [ + "error" + ], + "additionalProperties": false, + "description": "An API error response." + }, + "ExperimentalConfigOverridesParam": { + "type": "object", + "properties": { + "time_awareness": { + "type": "boolean", + "description": "Whether to give the model periodic current-time reminders. Omit to keep the current setting." } - } - } - }, - "safety_org_alert_created": { - "post": { - "description": "Sent when an approved safety alert is available for an enterprise workspace.\nRetrieve the alert from `https://api.chatgpt.com/v1/safety/alerts/{id}` with\nan administrator API key for the workspace's backing organization granted\n`chatgpt.enterprise.safety_alerts.read`.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookSafetyOrgAlertCreated" + }, + "additionalProperties": false, + "description": "Experimental settings to update. Omitted settings keep their current values." + }, + "ReasoningEffortParam": { + "type": "string", + "enum": [ + "none", + "minimal", + "low", + "medium", + "high", + "xhigh", + "max" + ], + "description": "The amount of reasoning effort the model should use." + }, + "ReasoningSummaryParam": { + "type": "string", + "enum": [ + "concise", + "detailed", + "auto" + ], + "x-enumDescriptions": [ + "Returns a concise reasoning summary when supported.", + "Returns a detailed reasoning summary when supported.", + "Automatically selects the most detailed summary supported by the model." + ], + "description": "The reasoning summary format requested from the model." + }, + "ReasoningParam": { + "type": "object", + "properties": { + "effort": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningEffortParam" + }, + { + "type": "null" } - } + ], + "description": "The amount of reasoning effort the model should use. Omission lets the model select it." + }, + "summary": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningSummaryParam" + }, + { + "type": "null" + } + ], + "description": "Controls whether the response includes a reasoning summary." } }, - "responses": { - "200": { - "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." - } - } - } - } - }, - "components": { - "schemas": { - "CreateFileRequest": { - "type": "object", "additionalProperties": false, + "description": "Reasoning configuration for the agent." + }, + "TextFormatParamText": { + "type": "object", "properties": { - "file": { - "description": "The File object (not file name) to be uploaded.\n", + "type": { "type": "string", - "format": "binary" - }, - "purpose": { - "description": "The intended purpose of the uploaded file. One of:\n- `assistants`: Used in the Assistants API\n- `batch`: Used in the Batch API\n- `fine-tune`: Used for fine-tuning\n- `vision`: Images used for vision fine-tuning\n- `user_data`: Flexible file type for any purpose\n- `evals`: Used for eval data sets\n", + "enum": [ + "text" + ], + "default": "text", + "x-stainless-const": true, + "description": "The type of the object. Always `text`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Generates ordinary text without a structured-output constraint." + }, + "TextFormatParamJsonSchema": { + "type": "object", + "properties": { + "type": { "type": "string", "enum": [ - "assistants", - "batch", - "fine-tune", - "vision", - "user_data", - "evals" - ] + "json_schema" + ], + "default": "json_schema", + "x-stainless-const": true, + "description": "The type of the object. Always `json_schema`." }, - "expires_after": { - "$ref": "#/components/schemas/FileExpirationAfter" + "schema": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "The JSON Schema that generated text must match." } }, - "required": [ - "file", - "purpose" - ] + "required": [ + "type", + "schema" + ], + "additionalProperties": false, + "description": "Constrains generated text to a JSON Schema." }, - "DeleteFileResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "object": { - "type": "string", - "enum": [ - "file" - ], - "x-stainless-const": true + "TextFormatParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/TextFormatParamText" }, - "deleted": { - "type": "boolean" + { + "$ref": "#/components/schemas/TextFormatParamJsonSchema" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "text": "#/components/schemas/TextFormatParamText", + "json_schema": "#/components/schemas/TextFormatParamJsonSchema" } }, - "required": [ - "id", - "object", - "deleted" - ] + "x-oai-discriminator-values": [ + "text", + "json_schema" + ], + "description": "The output format for generated text." }, - "Error": { + "VerbosityParam": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ], + "x-enumDescriptions": [ + "Produces less text.", + "Uses the default amount of text.", + "Produces more text." + ], + "description": "The amount of text the model should produce." + }, + "TextParam": { "type": "object", "properties": { - "code": { + "format": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/TextFormatParam" }, { "type": "null" } - ] - }, - "message": { - "type": "string" + ], + "description": "The output format. Omission uses ordinary text (`{\"type\": \"text\"}`)." }, - "param": { + "verbosity": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/VerbosityParam" }, { "type": "null" } - ] + ], + "description": "The amount of text the model should produce. Defaults to `medium`, matching Responses." + } + }, + "additionalProperties": false, + "description": "Configuration for text generated by the agent." + }, + "ServiceTierParam": { + "type": "string", + "enum": [ + "auto", + "default", + "flex", + "priority", + "fast", + "ultrafast" + ], + "x-enumDescriptions": [ + "Selects the service tier automatically.", + "Uses the default service tier.", + "Uses the flex service tier.", + "Uses the priority service tier.", + "Uses the fast service tier.", + "Uses the ultrafast service tier." + ], + "description": "The service tier used for model requests." + }, + "MultiAgentConfigCurrentParam": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether subagent tools are enabled." }, + "max_concurrent_subagents": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 4294967295, + "description": "Maximum number of subagents that may run concurrently. Defaults to 6." + } + }, + "required": [ + "enabled" + ], + "additionalProperties": false, + "description": "Explicit configuration for creating and coordinating subagents." + }, + "CompactionParam": { + "type": "object", + "properties": { + "async": { + "type": [ + "boolean", + "null" + ], + "description": "Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage." + } + }, + "additionalProperties": false, + "description": "Settings for compacting the agent's context." + }, + "AgentToolConfigParamFunction": { + "type": "object", + "properties": { "type": { - "type": "string" + "type": "string", + "enum": [ + "function" + ], + "default": "function", + "x-stainless-const": true, + "description": "The type of the object. Always `function`." }, - "misalignment": { - "$ref": "#/components/schemas/MisalignmentErrorDetailsResource" + "name": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The name of the function." + }, + "description": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "A description of what the function does." + }, + "parameters": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "A JSON Schema object describing the function's arguments." + }, + "defer_loading": { + "type": "boolean", + "default": false, + "description": "Whether this function is deferred and discovered through tool search. Defaults to `false`." } }, "required": [ "type", - "message", - "param", - "code" - ] + "name", + "description", + "parameters" + ], + "additionalProperties": false, + "description": "A function defined by the application." }, - "ErrorResponse": { + "AgentToolConfigParamToolSearch": { "type": "object", "properties": { - "error": { - "$ref": "#/components/schemas/Error" + "type": { + "type": "string", + "enum": [ + "tool_search" + ], + "default": "tool_search", + "x-stainless-const": true, + "description": "The type of the object. Always `tool_search`." } }, "required": [ - "error" - ] + "type" + ], + "additionalProperties": false, + "description": "Discovers deferred function tools and loads them into the model context." }, - "FileExpirationAfter": { + "AgentToolConfigParamProgrammaticToolCalling": { "type": "object", - "title": "File expiration policy", - "description": "The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted.", "properties": { - "anchor": { - "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`.", + "type": { "type": "string", "enum": [ - "created_at" + "programmatic_tool_calling" ], - "x-stainless-const": true + "default": "programmatic_tool_calling", + "x-stainless-const": true, + "description": "The type of the object. Always `programmatic_tool_calling`." }, - "seconds": { - "description": "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).", - "type": "integer", - "format": "int64", - "minimum": 3600, - "maximum": 2592000 + "enabled": { + "type": "boolean", + "default": true, + "description": "Whether tools can be called from model-generated code. Defaults to `true`." } }, "required": [ - "anchor", - "seconds" - ] + "type" + ], + "additionalProperties": false, + "description": "Enables calling tools from model-generated code." }, - "ListFilesResponse": { + "McpTransportConfigParamHttp": { "type": "object", "properties": { - "object": { + "type": { "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIFile" - } + "enum": [ + "http" + ], + "default": "http", + "x-stainless-const": true, + "description": "The type of the object. Always `http`." }, - "first_id": { + "server_url": { "type": "string", - "example": "file-abc123" + "minLength": 0, + "maxLength": 1048576, + "description": "The URL of the MCP server." }, - "last_id": { - "type": "string", - "example": "file-abc456" + "authorization": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The authorization value sent to the MCP server, if any." }, - "has_more": { - "type": "boolean", - "example": false + "headers": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Additional HTTP headers sent to the MCP server." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] + "type", + "server_url" + ], + "additionalProperties": false, + "description": "Connects to an MCP server over HTTP." }, - "OpenAIFile": { - "title": "OpenAIFile", - "description": "The `File` object represents a document that has been uploaded to OpenAI.", + "McpTransportConfigParamStdio": { + "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "The file identifier, which can be referenced in the API endpoints." - }, - "bytes": { - "type": "integer", - "description": "The size of the file, in bytes." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the file was created." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the file will expire." + "enum": [ + "stdio" + ], + "default": "stdio", + "x-stainless-const": true, + "description": "The type of the object. Always `stdio`." }, - "filename": { + "command": { "type": "string", - "description": "The name of the file." + "minLength": 0, + "maxLength": 1048576, + "description": "The command used to start the MCP server." }, - "object": { - "type": "string", - "description": "The object type, which is always `file`.", - "enum": [ - "file" + "args": { + "type": [ + "array", + "null" ], - "x-stainless-const": true + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Arguments passed to the MCP server command." }, - "purpose": { + "cwd": { "type": "string", - "description": "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.", - "enum": [ - "assistants", - "assistants_output", - "batch", - "batch_output", - "fine-tune", - "fine-tune-results", - "vision", - "user_data" - ] + "minLength": 0, + "maxLength": 1048576, + "description": "The working directory used to start the MCP server." }, - "status": { - "type": "string", - "deprecated": true, - "description": "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.", - "enum": [ - "uploaded", - "processed", - "error" - ] + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Environment variables set for the MCP server process." }, - "status_details": { - "type": "string", - "deprecated": true, - "description": "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`." + "env_vars": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Environment variable names to inherit from the selected execution environment." } }, "required": [ - "id", - "object", - "bytes", - "created_at", - "filename", - "purpose", - "status" + "type", + "command", + "cwd" ], - "x-oaiMeta": { - "name": "The file object", - "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1680202602,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n}\n" - } + "additionalProperties": false, + "description": "Starts an MCP server as a local process." }, - "_MisalignmentErrorType": { - "anyOf": [ + "McpTransportConfigParam": { + "oneOf": [ { - "type": "string" + "$ref": "#/components/schemas/McpTransportConfigParamHttp" }, { - "type": "string", - "enum": [ - "potentially_unintended_data_transfer", - "potentially_unintended_data_access", - "potentially_unintended_destructive_activity", - "other" - ] + "$ref": "#/components/schemas/McpTransportConfigParamStdio" } - ] - }, - "_MisalignmentSteer": { - "properties": { - "message": { - "type": "string", - "description": "The public continuation instruction." + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "http": "#/components/schemas/McpTransportConfigParamHttp", + "stdio": "#/components/schemas/McpTransportConfigParamStdio" } }, - "type": "object", - "required": [ - "message" - ] + "x-oai-discriminator-values": [ + "http", + "stdio" + ], + "description": "The transport used to connect to an MCP server." }, - "MisalignmentErrorDetailsResource": { + "McpConnectionOriginParam": { + "type": "string", + "enum": [ + "service", + "environment" + ], + "x-enumDescriptions": [ + "Uses the Managed Agents service network.", + "Uses the session's execution environment." + ], + "description": "Where outbound MCP HTTP connections originate." + }, + "AgentToolConfigParamMcp": { + "type": "object", "properties": { - "error_type": { - "$ref": "#/components/schemas/_MisalignmentErrorType", - "description": "An optional classification; clients must accept additional values." + "type": { + "type": "string", + "enum": [ + "mcp" + ], + "default": "mcp", + "x-stainless-const": true, + "description": "The type of the object. Always `mcp`." + }, + "server_label": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "A label used to identify the MCP server in tool calls." + }, + "credential_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL." + }, + "transport": { + "$ref": "#/components/schemas/McpTransportConfigParam", + "description": "The transport used to connect to the MCP server." + }, + "request_metadata": { + "type": [ + "object", + "null" + ], + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Metadata included with requests to this MCP server." + }, + "allowed_tools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "The MCP tools the agent may call. All server tools are allowed when omitted." }, - "detailed_explanation": { - "type": "string", - "description": "The public explanation for this block." + "required": { + "type": "boolean", + "default": false, + "description": "Whether this MCP server must initialize before the first turn. Defaults to `false`." }, - "steer": { - "$ref": "#/components/schemas/_MisalignmentSteer", - "description": "An optional public continuation instruction." + "connection_origin": { + "anyOf": [ + { + "$ref": "#/components/schemas/McpConnectionOriginParam" + }, + { + "type": "null" + } + ], + "description": "Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment." } }, - "type": "object", - "required": [] + "required": [ + "type", + "server_label", + "transport" + ], + "additionalProperties": false, + "description": "Tools provided by a remote MCP server." }, - "OrderEnum": { + "WebSearchModeParam": { "type": "string", "enum": [ - "asc", - "desc" - ] + "disabled", + "cached", + "live" + ], + "x-enumDescriptions": [ + "Disables web search.", + "Uses cached search results.", + "Searches the live web." + ], + "description": "The source used for web search results." }, - "SkillResource": { + "WebSearchContextSizeParam": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ], + "description": "The amount of web search context made available to the model." + }, + "WebSearchLocationParam": { + "type": "object", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the skill." - }, - "object": { - "type": "string", - "enum": [ - "skill" + "country": { + "type": [ + "string", + "null" ], - "description": "The object type, which is `skill`.", - "default": "skill", - "x-stainless-const": true - }, - "name": { - "type": "string", - "description": "Name of the skill." - }, - "description": { - "type": "string", - "description": "Description of the skill." + "minLength": 0, + "maxLength": 1048576, + "description": "The two-letter ISO country code, such as `US`." }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (seconds) for when the skill was created." + "region": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The region or state name." }, - "default_version": { - "type": "string", - "description": "Default version for the skill." + "city": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The city name." }, - "latest_version": { - "type": "string", - "description": "Latest version for the skill." + "timezone": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The IANA timezone, such as `America/Los_Angeles`." } }, - "type": "object", - "required": [ - "id", - "object", - "name", - "description", - "created_at", - "default_version", - "latest_version" - ] + "additionalProperties": false, + "description": "Approximate user location used to localize web search results." }, - "SkillListResource": { + "AgentToolConfigParamWebSearch": { + "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "web_search" ], - "description": "The type of object returned, must be `list`.", - "default": "list", - "x-stainless-const": true - }, - "data": { - "items": { - "$ref": "#/components/schemas/SkillResource" - }, - "type": "array", - "description": "A list of items" + "default": "web_search", + "x-stainless-const": true, + "description": "The type of the object. Always `web_search`." }, - "first_id": { + "mode": { "anyOf": [ { - "type": "string", - "description": "The ID of the first item in the list." + "$ref": "#/components/schemas/WebSearchModeParam" }, { "type": "null" } - ] + ], + "description": "The source used for web search results. Defaults to `live`." }, - "last_id": { + "context_size": { "anyOf": [ { - "type": "string", - "description": "The ID of the last item in the list." + "$ref": "#/components/schemas/WebSearchContextSizeParam" }, { "type": "null" } - ] + ], + "description": "The amount of search context made available to the model. Defaults to `medium`." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more items available." - } - }, - "type": "object", - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "CreateSkillBody": { - "properties": { - "files": { - "oneOf": [ + "allowed_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Domains the search may include." + }, + "location": { + "anyOf": [ { - "items": { - "type": "string", - "format": "binary" - }, - "type": "array", - "maxItems": 500, - "description": "Skill files to upload (directory upload) or a single zip file." + "$ref": "#/components/schemas/WebSearchLocationParam" }, { - "type": "string", - "format": "binary", - "description": "Skill zip file to upload." + "type": "null" } - ] + ], + "description": "Approximate location used to localize search results." } }, - "type": "object", "required": [ - "files" + "type" ], - "title": "Create skill request", - "description": "Uploads a skill either as a directory (multipart `files[]`) or as a single zip file." + "additionalProperties": false, + "description": "Web search." }, - "SetDefaultSkillVersionBody": { - "properties": { - "default_version": { - "type": "string", - "description": "The skill version number to set as default." - } - }, + "AgentToolConfigParamComputerUse": { "type": "object", - "required": [ - "default_version" - ], - "title": "Update skill request", - "description": "Updates the default version pointer for a skill." - }, - "DeletedSkillResource": { "properties": { - "object": { + "type": { "type": "string", "enum": [ - "skill.deleted" - ], - "default": "skill.deleted", - "x-stainless-const": true - }, - "deleted": { - "type": "boolean" + "computer_use" + ], + "default": "computer_use", + "x-stainless-const": true, + "description": "The type of the object. Always `computer_use`." }, - "id": { - "type": "string" + "include_screenshots": { + "type": "boolean", + "default": false, + "description": "Whether computer tool outputs include screenshots. Defaults to `false`." } }, - "type": "object", "required": [ - "object", - "deleted", - "id" - ] + "type" + ], + "additionalProperties": false, + "description": "Browser use in an OpenAI-hosted session." }, - "SkillVersionResource": { + "AgentToolConfigParamAutomations": { + "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "skill.version" + "automations" ], - "description": "The object type, which is `skill.version`.", - "default": "skill.version", - "x-stainless-const": true + "default": "automations", + "x-stainless-const": true, + "description": "The type of the object. Always `automations`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Lets the agent manage its own scheduled wakeups." + }, + "AgentToolConfigParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/AgentToolConfigParamFunction" }, - "id": { - "type": "string", - "description": "Unique identifier for the skill version." + { + "$ref": "#/components/schemas/AgentToolConfigParamToolSearch" }, - "skill_id": { - "type": "string", - "description": "Identifier of the skill for this version." + { + "$ref": "#/components/schemas/AgentToolConfigParamProgrammaticToolCalling" }, - "version": { - "type": "string", - "description": "Version number for this skill." + { + "$ref": "#/components/schemas/AgentToolConfigParamMcp" }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (seconds) for when the version was created." + { + "$ref": "#/components/schemas/AgentToolConfigParamWebSearch" }, - "name": { - "type": "string", - "description": "Name of the skill version." + { + "$ref": "#/components/schemas/AgentToolConfigParamComputerUse" }, - "description": { - "type": "string", - "description": "Description of the skill version." + { + "$ref": "#/components/schemas/AgentToolConfigParamAutomations" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "function": "#/components/schemas/AgentToolConfigParamFunction", + "tool_search": "#/components/schemas/AgentToolConfigParamToolSearch", + "programmatic_tool_calling": "#/components/schemas/AgentToolConfigParamProgrammaticToolCalling", + "mcp": "#/components/schemas/AgentToolConfigParamMcp", + "web_search": "#/components/schemas/AgentToolConfigParamWebSearch", + "computer_use": "#/components/schemas/AgentToolConfigParamComputerUse", + "automations": "#/components/schemas/AgentToolConfigParamAutomations" } }, - "type": "object", - "required": [ - "object", - "id", - "skill_id", - "version", - "created_at", - "name", - "description" - ] + "x-oai-discriminator-values": [ + "function", + "tool_search", + "programmatic_tool_calling", + "mcp", + "web_search", + "computer_use", + "automations" + ], + "description": "A tool available to the agent." }, - "SkillVersionListResource": { + "SessionAgentConfigParam": { + "type": "object", "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object returned, must be `list`.", - "default": "list", - "x-stainless-const": true + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigOverridesParam", + "default": {}, + "description": "Experimental settings to merge by key. Omitted settings keep their current values." }, - "data": { - "items": { - "$ref": "#/components/schemas/SkillVersionResource" - }, - "type": "array", - "description": "A list of items" + "model": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The model to use for the agent. The requested model name is preserved." }, - "first_id": { + "reasoning": { "anyOf": [ { - "type": "string", - "description": "The ID of the first item in the list." + "$ref": "#/components/schemas/ReasoningParam" }, { "type": "null" } - ] + ], + "description": "Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort." }, - "last_id": { + "text": { "anyOf": [ { - "type": "string", - "description": "The ID of the last item in the list." + "$ref": "#/components/schemas/TextParam" }, { "type": "null" } - ] + ], + "description": "Configuration for text generated by the agent." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more items available." - } - }, - "type": "object", - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "CreateSkillVersionBody": { - "properties": { - "files": { - "oneOf": [ + "service_tier": { + "anyOf": [ { - "items": { - "type": "string", - "format": "binary" - }, - "type": "array", - "maxItems": 500, - "description": "Skill files to upload (directory upload) or a single zip file." + "$ref": "#/components/schemas/ServiceTierParam" }, { - "type": "string", - "format": "binary", - "description": "Skill zip file to upload." + "type": "null" } - ] + ], + "description": "The service tier used for model requests." }, - "default": { - "type": "boolean", - "description": "Whether to set this version as the default." - } - }, - "type": "object", - "required": [ - "files" - ], - "title": "Create skill version request", - "description": "Uploads a new immutable version of a skill." - }, - "DeletedSkillVersionResource": { - "properties": { - "object": { - "type": "string", - "enum": [ - "skill.version.deleted" + "instructions": { + "type": [ + "string", + "null" ], - "default": "skill.version.deleted", - "x-stainless-const": true + "minLength": 0, + "maxLength": 1048576, + "description": "Additional instructions appended to the agent's default base instructions. Omit to leave unchanged." }, - "deleted": { - "type": "boolean" + "multi_agent": { + "anyOf": [ + { + "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for creating and coordinating subagents." }, - "id": { - "type": "string" + "compaction": { + "anyOf": [ + { + "$ref": "#/components/schemas/CompactionParam" + }, + { + "type": "null" + } + ], + "description": "Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction." }, - "version": { - "type": "string", - "description": "The deleted skill version." - } - }, - "type": "object", - "required": [ - "object", - "deleted", - "id", - "version" - ] - }, - "EnvironmentTypeResource": { - "type": "string", - "enum": [ - "openai_hosted", - "self_hosted" - ], - "description": "The kind of execution environment." - }, - "EnvironmentStatusResource": { - "type": "string", - "enum": [ - "pending", - "connected", - "disconnected", - "expired", - "failed" - ], - "description": "The public lifecycle status of an execution environment." + "tools": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/AgentToolConfigParam" + }, + "minItems": 0, + "maxItems": 16384, + "description": "Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON." + }, + "x_agents_core": { + "anyOf": [ + { + "$ref": "#/components/schemas/v1.AgentsCore" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "description": "Agent configuration for a session. Omitted fields inherit from `agent_id` when supplied. Supplied objects and arrays replace the whole field, except experimental settings, which merge by key. Null resets nullable fields." }, - "HostedEnvironmentFileResourceFileId": { + "EnvironmentParamNone": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "file_id" + "none" ], - "default": "file_id", + "default": "none", "x-stainless-const": true, - "description": "The type of the object. Always `file_id`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The session-scoped ID of the file in the execution environment." - }, - "file_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the uploaded file." - }, - "path": { - "type": "string", - "minLength": 0, - "description": "The file's absolute path inside the environment." - }, - "size_bytes": { - "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The decoded file size in bytes." + "description": "The type of the object. Always `none`." } }, "required": [ - "type", - "id", - "file_id", - "path", - "size_bytes" + "type" ], "additionalProperties": false, - "description": "A file copied from the OpenAI Files API." + "description": "Runs the agent without an execution environment." }, - "HostedEnvironmentFileResourceInline": { + "EnvironmentPackagesParam": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "inline" + "python": { + "type": [ + "array", + "null" ], - "default": "inline", - "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Python packages to install. Defaults to an empty list." }, - "id": { - "type": "string", - "minLength": 0, - "description": "The session-scoped ID of the file in the execution environment." + "system": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "System packages to install. Defaults to an empty list." }, - "path": { + "npm": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "npm packages to install globally. Defaults to an empty list." + } + }, + "additionalProperties": false, + "description": "Packages to install in an OpenAI-hosted environment." + }, + "SetupCommandParam": { + "type": "object", + "properties": { + "command": { "type": "string", "minLength": 0, - "description": "The file's absolute path inside the environment." + "maxLength": 65536, + "description": "The shell command to execute." }, - "size_bytes": { - "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The decoded file size in bytes." + "cwd": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 4096, + "description": "The absolute working directory. Defaults to `/workspace`." } }, "required": [ - "type", - "id", - "path", - "size_bytes" + "command" ], "additionalProperties": false, - "description": "A file supplied inline when the session was created." + "description": "A confidential setup command executed before the hosted agent starts." }, - "HostedEnvironmentFileResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/HostedEnvironmentFileResourceFileId" + "NetworkAccessParam": { + "type": "string", + "enum": [ + "enabled", + "disabled", + "restricted" + ], + "x-enumDescriptions": [ + "Allows unrestricted network access.", + "Disables network access.", + "Applies the configured domain restrictions." + ], + "description": "The network access mode for an OpenAI-hosted environment." + }, + "NetworkPolicyParam": { + "type": "object", + "properties": { + "access": { + "$ref": "#/components/schemas/NetworkAccessParam", + "description": "The environment's network access mode." }, - { - "$ref": "#/components/schemas/HostedEnvironmentFileResourceInline" + "allowed_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Domains the environment may access when network access is restricted." + }, + "blocked_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 100, + "description": "Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported." } + }, + "required": [ + "access" ], - "discriminator": { - "propertyName": "type", - "mapping": { - "file_id": "#/components/schemas/HostedEnvironmentFileResourceFileId", - "inline": "#/components/schemas/HostedEnvironmentFileResourceInline" + "additionalProperties": false, + "description": "Network access for an OpenAI-hosted environment." + }, + "DesktopParam": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether to provision the desktop and its browser proxy." } }, - "x-oai-discriminator-values": [ - "file_id", - "inline" + "required": [ + "enabled" ], - "description": "Metadata for a file materialized in an OpenAI-hosted execution environment." + "additionalProperties": false, + "description": "Desktop configuration for an OpenAI-hosted environment." }, - "HostedSkillResourceSkillReference": { + "HostedSkillParamSkillReference": { "type": "object", "properties": { "type": { @@ -7479,89 +12998,81 @@ }, "skill_id": { "type": "string", - "minLength": 0, - "description": "The referenced skill ID." + "minLength": 1, + "maxLength": 64, + "description": "The ID of the skill created through `/v1/skills`." }, "version": { - "type": "string", - "minLength": 0, - "description": "The concrete skill version installed for this session." - }, - "name": { - "type": "string", - "minLength": 0, - "description": "The installed skill name." - }, - "description": { - "type": "string", + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The installed skill description." + "maxLength": 1048576, + "description": "The skill version, a positive integer or `latest`; omission selects the default." } }, "required": [ "type", - "skill_id", - "version", - "name", - "description" + "skill_id" ], "additionalProperties": false, - "description": "A skill installed from the Skills API." + "description": "References a skill uploaded through the Skills API." }, - "HostedSkillResourceInline": { + "InlineCapabilitySourceParamBase64": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "base64" ], - "default": "inline", + "default": "base64", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "description": "The type of the object. Always `base64`." }, - "name": { + "media_type": { "type": "string", - "minLength": 0, - "description": "The installed skill name." + "enum": [ + "application/zip" + ], + "default": "application/zip", + "x-stainless-const": true, + "description": "The archive media type, always `application/zip`." }, - "description": { + "data": { "type": "string", - "minLength": 0, - "description": "The installed skill description." + "minLength": 1, + "maxLength": 70254592, + "description": "Standard-base64 encoded ZIP archive bytes." } }, "required": [ "type", - "name", - "description" + "media_type", + "data" ], "additionalProperties": false, - "description": "A skill installed from an inline ZIP archive." + "description": "Provides ZIP bytes encoded with standard base64." }, - "HostedSkillResource": { + "InlineCapabilitySourceParam": { "oneOf": [ { - "$ref": "#/components/schemas/HostedSkillResourceSkillReference" - }, - { - "$ref": "#/components/schemas/HostedSkillResourceInline" + "$ref": "#/components/schemas/InlineCapabilitySourceParamBase64" } ], "discriminator": { "propertyName": "type", "mapping": { - "skill_reference": "#/components/schemas/HostedSkillResourceSkillReference", - "inline": "#/components/schemas/HostedSkillResourceInline" + "base64": "#/components/schemas/InlineCapabilitySourceParamBase64" } }, "x-oai-discriminator-values": [ - "skill_reference", - "inline" + "base64" ], - "description": "A skill installed in an OpenAI-hosted environment." + "description": "The encoded ZIP archive for an inline skill or plugin." }, - "HostedPluginResourceInline": { + "HostedSkillParamInline": { "type": "object", "properties": { "type": { @@ -7575,251 +13086,106 @@ }, "name": { "type": "string", - "minLength": 0, - "description": "The installed plugin name." + "minLength": 1, + "maxLength": 64, + "description": "The skill name declared in `SKILL.md`." }, "description": { "type": "string", "minLength": 0, - "description": "The installed plugin description." + "maxLength": 1048576, + "description": "The skill description declared in `SKILL.md`." + }, + "source": { + "$ref": "#/components/schemas/InlineCapabilitySourceParam", + "description": "The inline ZIP archive." } }, "required": [ "type", "name", - "description" + "description", + "source" ], "additionalProperties": false, - "description": "A plugin installed from an inline ZIP archive." + "description": "Supplies a skill ZIP directly in the session request." }, - "HostedPluginResource": { + "HostedSkillParam": { "oneOf": [ { - "$ref": "#/components/schemas/HostedPluginResourceInline" + "$ref": "#/components/schemas/HostedSkillParamSkillReference" + }, + { + "$ref": "#/components/schemas/HostedSkillParamInline" } ], "discriminator": { "propertyName": "type", "mapping": { - "inline": "#/components/schemas/HostedPluginResourceInline" + "skill_reference": "#/components/schemas/HostedSkillParamSkillReference", + "inline": "#/components/schemas/HostedSkillParamInline" } }, "x-oai-discriminator-values": [ + "skill_reference", "inline" ], - "description": "A plugin installed in an OpenAI-hosted environment." - }, - "PublicEnvironmentResource": { - "type": "object", - "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the environment." - }, - "object": { - "type": "string", - "enum": [ - "agent.environment" - ], - "default": "agent.environment", - "x-stainless-const": true, - "description": "The object type. Always `agent.environment`." - }, - "type": { - "$ref": "#/components/schemas/EnvironmentTypeResource", - "description": "Whether the environment is hosted by OpenAI or by the application." - }, - "status": { - "$ref": "#/components/schemas/EnvironmentStatusResource", - "description": "The current environment connection status." - }, - "files": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Files installed in the environment, without their contents." - }, - "skills": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedSkillResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Skills installed in the environment, without their archive contents." - }, - "plugins": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedPluginResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Plugins installed in the environment, without their archive contents." - } - }, - "required": [ - "id", - "object", - "type", - "status", - "files", - "skills", - "plugins" - ], - "additionalProperties": false, - "description": "Safe metadata for a first-class execution environment." + "description": "A skill installed in an OpenAI-hosted environment." }, - "ErrorBodyResource": { + "HostedPluginParamInline": { "type": "object", "properties": { "type": { - "type": "string", - "minLength": 0, - "description": "The error type." - }, - "code": { - "type": "string", - "minLength": 0, - "description": "A machine-readable error code." - }, - "message": { - "type": "string", - "minLength": 0, - "description": "A human-readable error message." - }, - "param": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The request parameter that caused the error, or null for a request-wide error." - } - }, - "required": [ - "type", - "code", - "message", - "param" - ], - "additionalProperties": false, - "description": "Details about an API error." - }, - "ErrorResponse-2": { - "type": "object", - "properties": { - "error": { - "$ref": "#/components/schemas/ErrorBodyResource", - "description": "The error returned by the API." - } - }, - "required": [ - "error" - ], - "additionalProperties": false, - "description": "An API error response." - }, - "ListOrderParam": { - "type": "string", - "enum": [ - "asc", - "desc" - ], - "x-enumDescriptions": [ - "Returns resources in ascending order.", - "Returns resources in descending order." - ], - "description": "The order in which paginated resources are returned." - }, - "EnvironmentFilePageObjectResource": { - "type": "string", - "enum": [ - "page" - ], - "default": "page", - "x-stainless-const": true, - "description": "The object type for a page of files in an execution environment." - }, - "EnvironmentFileResource": { - "type": "object", - "properties": { - "object": { "type": "string", "enum": [ - "agent.environment.file" + "inline" ], - "default": "agent.environment.file", + "default": "inline", "x-stainless-const": true, - "description": "The object type. Always `agent.environment.file`." + "description": "The type of the object. Always `inline`." }, - "environment_id": { + "name": { "type": "string", - "minLength": 0, - "description": "The ID of the environment containing this file." + "minLength": 1, + "maxLength": 64, + "description": "The plugin name declared in `.codex-plugin/plugin.json`." }, - "path": { + "description": { "type": "string", "minLength": 0, - "description": "The absolute file path inside the environment's workspace." - }, - "size_bytes": { - "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The file size in bytes." - } - }, - "required": [ - "object", - "environment_id", - "path", - "size_bytes" - ], - "additionalProperties": false, - "description": "A live file in an execution environment." - }, - "EnvironmentFileListResource": { - "type": "object", - "properties": { - "object": { - "$ref": "#/components/schemas/EnvironmentFilePageObjectResource", - "description": "The object type. Always `page`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EnvironmentFileResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Files available on the current page." - }, - "next": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The opaque cursor to use when requesting the next page, if any." + "maxLength": 1048576, + "description": "The plugin description declared in `.codex-plugin/plugin.json`." }, - "has_more": { - "type": "boolean", - "description": "Whether more files follow this page." + "source": { + "$ref": "#/components/schemas/InlineCapabilitySourceParam", + "description": "The inline ZIP archive." } }, "required": [ - "object", - "data", - "next", - "has_more" + "type", + "name", + "description", + "source" ], "additionalProperties": false, - "description": "A paginated list of live execution environment files." + "description": "Supplies a plugin ZIP directly in the session request." + }, + "HostedPluginParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedPluginParamInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "inline": "#/components/schemas/HostedPluginParamInline" + } + }, + "x-oai-discriminator-values": [ + "inline" + ], + "description": "A plugin installed in an OpenAI-hosted environment." }, "HostedEnvironmentFileParamFileId": { "type": "object", @@ -7872,68 +13238,347 @@ "maxLength": 6990508, "description": "The standard-base64-encoded file contents." }, - "path": { + "path": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "description": "The absolute destination path inside `/workspace`." + } + }, + "required": [ + "type", + "data", + "path" + ], + "additionalProperties": false, + "description": "A file supplied directly as standard-base64 data." + }, + "HostedEnvironmentFileParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedEnvironmentFileParamFileId" + }, + { + "$ref": "#/components/schemas/HostedEnvironmentFileParamInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "file_id": "#/components/schemas/HostedEnvironmentFileParamFileId", + "inline": "#/components/schemas/HostedEnvironmentFileParamInline" + } + }, + "x-oai-discriminator-values": [ + "file_id", + "inline" + ], + "description": "A file materialized in an OpenAI-hosted execution environment." + }, + "ContainerSizeParam": { + "type": "string", + "enum": [ + "small", + "medium", + "large" + ], + "description": "The CPU and memory tier for a new OpenAI-hosted session environment." + }, + "EnvironmentParamOpenaiHosted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "openai_hosted" + ], + "default": "openai_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `openai_hosted`." + }, + "packages": { + "anyOf": [ + { + "$ref": "#/components/schemas/EnvironmentPackagesParam" + }, + { + "type": "null" + } + ], + "description": "Packages to install in the environment. Defaults to empty package lists." + }, + "setup_commands": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/SetupCommandParam" + }, + "minItems": 0, + "maxItems": 16, + "description": "Ordered, confidential setup commands. Command bodies are never returned." + }, + "network": { + "anyOf": [ + { + "$ref": "#/components/schemas/NetworkPolicyParam" + }, + { + "type": "null" + } + ], + "description": "Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled." + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopParam" + }, + { + "type": "null" + } + ], + "description": "Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled." + }, + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Environment variables made available to the agent." + }, + "capability_directories": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + }, + "skills": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedSkillParam" + }, + "minItems": 0, + "maxItems": 200, + "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." + }, + "plugins": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedPluginParam" + }, + "minItems": 0, + "maxItems": 32, + "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." + }, + "files": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileParam" + }, + "minItems": 0, + "maxItems": 50, + "description": "Files available before the agent starts. Defaults to an empty list." + }, + "environment_id": { + "type": "string", + "minLength": 9, + "maxLength": 256, + "description": "An existing prewarmed environment. Cannot be combined with a template or inline configuration." + }, + "environment_template_id": { + "type": "string", + "minLength": 0, + "maxLength": 64, + "description": "A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy." + }, + "container_size": { + "$ref": "#/components/schemas/ContainerSizeParam", + "description": "The hosted container size. Omission selects the medium tier." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "An existing OpenAI-hosted environment or new inline/template-based hosted configuration.", + "not": { + "required": [ + "environment_id" + ], + "anyOf": [ + { + "required": [ + "packages" + ] + }, + { + "required": [ + "setup_commands" + ] + }, + { + "required": [ + "network" + ] + }, + { + "required": [ + "desktop" + ] + }, + { + "required": [ + "env" + ] + }, + { + "required": [ + "capability_directories" + ] + }, + { + "required": [ + "skills" + ] + }, + { + "required": [ + "plugins" + ] + }, + { + "required": [ + "files" + ] + }, + { + "required": [ + "environment_template_id" + ] + }, + { + "required": [ + "container_size" + ] + } + ] + } + }, + "EnvironmentParamSelfHosted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "self_hosted" + ], + "default": "self_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `self_hosted`." + }, + "capability_directories": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + }, + "workspace_directory": { "type": "string", - "minLength": 1, - "maxLength": 4096, - "description": "The absolute destination path inside `/workspace`." + "minLength": 0, + "maxLength": 1048576, + "description": "Absolute project directory inside the self-hosted environment." } }, "required": [ "type", - "data", - "path" + "workspace_directory" ], "additionalProperties": false, - "description": "A file supplied directly as standard-base64 data." + "description": "An application-hosted environment configured inline." }, - "HostedEnvironmentFileParam": { + "EnvironmentParam": { "oneOf": [ { - "$ref": "#/components/schemas/HostedEnvironmentFileParamFileId" + "$ref": "#/components/schemas/EnvironmentParamNone" }, { - "$ref": "#/components/schemas/HostedEnvironmentFileParamInline" + "$ref": "#/components/schemas/EnvironmentParamOpenaiHosted" + }, + { + "$ref": "#/components/schemas/EnvironmentParamSelfHosted" } ], "discriminator": { "propertyName": "type", "mapping": { - "file_id": "#/components/schemas/HostedEnvironmentFileParamFileId", - "inline": "#/components/schemas/HostedEnvironmentFileParamInline" + "none": "#/components/schemas/EnvironmentParamNone", + "openai_hosted": "#/components/schemas/EnvironmentParamOpenaiHosted", + "self_hosted": "#/components/schemas/EnvironmentParamSelfHosted" } }, "x-oai-discriminator-values": [ - "file_id", - "inline" - ], - "description": "A file materialized in an OpenAI-hosted execution environment." - }, - "SubagentObjectResource": { - "type": "string", - "enum": [ - "agent.session.subagent" + "none", + "openai_hosted", + "self_hosted" ], - "default": "agent.session.subagent", - "x-stainless-const": true, - "description": "The object type for a subagent." + "description": "The execution environment and optional reusable template for a session." }, - "OutputTextResource": { + "InputContentParamInputText": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "output_text" + "input_text" ], - "default": "output_text", + "default": "input_text", "x-stainless-const": true, - "description": "The content type. Always `output_text`." + "description": "The type of the object. Always `input_text`." }, "text": { "type": "string", "minLength": 0, - "description": "The text produced by the agent." + "maxLength": 1048576, + "description": "The text sent to the model." } }, "required": [ @@ -7941,2369 +13586,2361 @@ "text" ], "additionalProperties": false, - "description": "A text content part produced by the agent." + "description": "Text input to the model." }, - "EncryptedContentResource": { + "InputContentParamInputImage": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "encrypted_content" + "input_image" ], - "default": "encrypted_content", + "default": "input_image", "x-stainless-const": true, - "description": "The content type. Always `encrypted_content`." + "description": "The type of the object. Always `input_image`." }, - "encrypted_content": { + "image_url": { "type": "string", "minLength": 0, - "description": "The encrypted content payload." + "maxLength": 1048576, + "description": "The URL of the image sent to the model." } }, "required": [ "type", - "encrypted_content" + "image_url" ], "additionalProperties": false, - "description": "Encrypted content exchanged between agents." + "description": "Image input to the model." }, - "AgentContentResource": { + "InputContentParam": { "oneOf": [ { - "$ref": "#/components/schemas/OutputTextResource" + "$ref": "#/components/schemas/InputContentParamInputText" }, { - "$ref": "#/components/schemas/EncryptedContentResource" + "$ref": "#/components/schemas/InputContentParamInputImage" } ], "discriminator": { "propertyName": "type", "mapping": { - "output_text": "#/components/schemas/OutputTextResource", - "encrypted_content": "#/components/schemas/EncryptedContentResource" + "input_text": "#/components/schemas/InputContentParamInputText", + "input_image": "#/components/schemas/InputContentParamInputImage" } }, "x-oai-discriminator-values": [ - "output_text", - "encrypted_content" - ], - "description": "A plaintext or encrypted content part exchanged between agents." - }, - "SubagentStatusResource": { - "type": "string", - "enum": [ - "active", - "closed" - ], - "x-enumDescriptions": [ - "The subagent remains available, including while idle between turns.", - "The subagent is closed." + "input_text", + "input_image" ], - "description": "The current status of a subagent." + "description": "Content included in an input message." }, - "SubagentResource": { + "InputMessageParam": { "type": "object", "properties": { - "id": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the subagent." - }, - "object": { - "$ref": "#/components/schemas/SubagentObjectResource", - "description": "The object type. Always `agent.session.subagent`." + "enum": [ + "message" + ], + "default": "message", + "x-stainless-const": true, + "description": "The type of the input item. Always `message`." }, - "session_id": { + "role": { "type": "string", - "minLength": 0, - "description": "The ID of the session that owns the subagent." - }, - "name": { - "type": [ - "string", - "null" + "enum": [ + "user" ], - "minLength": 0, - "description": "The runner-assigned nickname, or null when unavailable." + "default": "user", + "x-stainless-const": true, + "description": "The role of the message author. Always `user`." }, - "instructions": { - "type": [ - "array", - "null" - ], + "content": { + "type": "array", "items": { - "$ref": "#/components/schemas/AgentContentResource" + "$ref": "#/components/schemas/InputContentParam" }, "minItems": 0, - "maxItems": 2000, - "description": "Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available." - }, - "parent_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent that created this subagent." - }, - "status": { - "$ref": "#/components/schemas/SubagentStatusResource", - "description": "The current status of the subagent." - }, - "opened_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it." - }, - "closed_at": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "description": "The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume." + "maxItems": 16384, + "description": "The content of the message." } }, "required": [ - "id", - "object", - "session_id", - "name", - "instructions", - "parent_agent_id", - "status", - "opened_at", - "closed_at" + "role", + "content" ], "additionalProperties": false, - "description": "A subagent created within a session." - }, - "SessionMessageRoleResource": { - "type": "string", - "enum": [ - "user", - "assistant" - ], - "description": "The author of a session message." + "description": "A user message submitted to a session." }, - "MessageContentResourceInputText": { + "AutomationTargetParamNewSession": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_text" + "new_session" ], - "default": "input_text", + "default": "new_session", "x-stainless-const": true, - "description": "The type of the object. Always `input_text`." + "description": "The type of the object. Always `new_session`." }, - "text": { + "agent": { + "$ref": "#/components/schemas/SessionAgentConfigParam", + "description": "Inline agent configuration. Provide exactly one of agent and agent_id." + }, + "agent_id": { "type": "string", "minLength": 0, - "description": "The text supplied by the user." - } - }, - "required": [ - "type", - "text" - ], - "additionalProperties": false, - "description": "Text supplied by the user." - }, - "MessageContentResourceInputImage": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "input_image" + "maxLength": 64, + "description": "A saved agent ID. Provide exactly one of agent and agent_id." + }, + "environment": { + "$ref": "#/components/schemas/EnvironmentParam", + "description": "The execution environment for each new session." + }, + "input": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputMessageParam" + }, + "minItems": 0, + "maxItems": 16384, + "description": "Initial user messages submitted with each new session." + }, + "vault_ids": { + "type": [ + "array", + "null" ], - "default": "input_image", - "x-stainless-const": true, - "description": "The type of the object. Always `input_image`." + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "The IDs of vaults made available to each new session." }, - "image_url": { - "type": "string", - "minLength": 0, - "description": "The URL of the image supplied by the user, which may be a base64-encoded data URL." + "metadata": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Metadata attached to each new session." } }, "required": [ "type", - "image_url" + "environment", + "input" ], "additionalProperties": false, - "description": "An image supplied by the user." + "description": "Create a session for each invocation." }, - "MessageContentResourceOutputText": { + "AutomationTargetParamExistingSession": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "output_text" + "existing_session" ], - "default": "output_text", + "default": "existing_session", "x-stainless-const": true, - "description": "The type of the object. Always `output_text`." + "description": "The type of the object. Always `existing_session`." }, - "text": { + "session_id": { "type": "string", "minLength": 0, - "description": "The text produced by the assistant." + "maxLength": 1048576, + "description": "The session receiving each invocation." + }, + "instructions": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "Instructions delivered as an automation notification." } }, "required": [ "type", - "text" + "session_id", + "instructions" ], "additionalProperties": false, - "description": "Text produced by the assistant." + "description": "Deliver instructions to an existing session." }, - "MessageContentResource": { + "AutomationTargetParam": { "oneOf": [ { - "$ref": "#/components/schemas/MessageContentResourceInputText" - }, - { - "$ref": "#/components/schemas/MessageContentResourceInputImage" + "$ref": "#/components/schemas/AutomationTargetParamNewSession" }, { - "$ref": "#/components/schemas/MessageContentResourceOutputText" + "$ref": "#/components/schemas/AutomationTargetParamExistingSession" } ], "discriminator": { "propertyName": "type", "mapping": { - "input_text": "#/components/schemas/MessageContentResourceInputText", - "input_image": "#/components/schemas/MessageContentResourceInputImage", - "output_text": "#/components/schemas/MessageContentResourceOutputText" + "new_session": "#/components/schemas/AutomationTargetParamNewSession", + "existing_session": "#/components/schemas/AutomationTargetParamExistingSession" } }, "x-oai-discriminator-values": [ - "input_text", - "input_image", - "output_text" - ], - "description": "A content part in a session message." - }, - "OutputItemStatusResource": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" - ], - "x-enumDescriptions": [ - "The item is in progress.", - "The item is complete.", - "The item stopped before completing." - ], - "description": "The status of an agent output item." - }, - "MessagePhaseResource": { - "type": "string", - "enum": [ - "commentary", - "final_answer" - ], - "x-enumDescriptions": [ - "Commentary produced while the agent works.", - "The agent's final answer." + "new_session", + "existing_session" ], - "description": "The phase of an assistant message." + "description": "The session an automation invocation targets." }, - "MessageItemResource": { + "CreateAutomationParamsPeriodic": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "message" + "periodic" ], - "default": "message", + "default": "periodic", "x-stainless-const": true, - "description": "The item type. Always `message`." - }, - "id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of this item, or null for legacy user messages whose ID was not recorded." + "description": "The type of the object. Always `periodic`." }, - "turn_id": { + "name": { "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." + "minLength": 1, + "maxLength": 256, + "description": "A human-readable name for the automation." }, - "role": { - "$ref": "#/components/schemas/SessionMessageRoleResource", - "description": "The role of the message author." + "target": { + "$ref": "#/components/schemas/AutomationTargetParam" }, - "content": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MessageContentResource" + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 }, - "minItems": 0, - "maxItems": 2000, - "description": "The content of the message. User messages contain input text or images; assistant messages contain output text." - }, - "status": { - "$ref": "#/components/schemas/OutputItemStatusResource", - "description": "The status of the message. User messages are always `completed`." + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 }, - "phase": { - "anyOf": [ - { - "$ref": "#/components/schemas/MessagePhaseResource" - }, - { - "type": "null" - } - ], - "description": "The phase of an assistant message. Null for user messages." - } - }, - "required": [ - "type", - "id", - "turn_id", - "role", - "content", - "status", - "phase" - ], - "additionalProperties": false, - "description": "A user or assistant message recorded in a session." - }, - "SummaryTextResource": { - "type": "object", - "properties": { - "type": { + "expression": { "type": "string", - "enum": [ - "summary_text" - ], - "default": "summary_text", - "x-stainless-const": true, - "description": "The content type. Always `summary_text`." + "minLength": 1, + "maxLength": 256, + "description": "A standard five-field cron expression defining scheduled occurrences." }, - "text": { + "timezone": { "type": "string", - "minLength": 0, - "description": "The reasoning summary text." + "minLength": 1, + "maxLength": 128, + "description": "The IANA timezone used to interpret the cron expression." } }, "required": [ "type", - "text" + "name", + "target", + "expression", + "timezone" ], - "additionalProperties": false, - "description": "A reasoning summary content part." + "additionalProperties": false }, - "ReasoningItemResource": { + "CreateAutomationParamsOnce": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "reasoning" + "once" ], - "default": "reasoning", + "default": "once", "x-stainless-const": true, - "description": "The item type. Always `reasoning`." + "description": "The type of the object. Always `once`." }, - "id": { + "name": { "type": "string", - "minLength": 0, - "description": "The ID of the reasoning item." + "minLength": 1, + "maxLength": 256, + "description": "A human-readable name for the automation." }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." + "target": { + "$ref": "#/components/schemas/AutomationTargetParam" }, - "summary": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SummaryTextResource" + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 }, - "minItems": 0, - "maxItems": 2000, - "description": "The reasoning summaries produced by the agent." + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 }, - "status": { - "anyOf": [ - { - "$ref": "#/components/schemas/OutputItemStatusResource" - }, - { - "type": "null" - } - ], - "description": "The status of the reasoning item." + "run_at": { + "type": "integer", + "format": "int64", + "description": "A future Unix timestamp in seconds." } }, "required": [ "type", - "id", - "turn_id", - "summary", - "status" + "name", + "target", + "run_at" ], - "additionalProperties": false, - "description": "A reasoning item produced by the agent." + "additionalProperties": false }, - "FunctionCallStatusResource": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "failed", - "incomplete" + "CreateAutomationParams": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateAutomationParamsPeriodic" + }, + { + "$ref": "#/components/schemas/CreateAutomationParamsOnce" + } ], - "x-enumDescriptions": [ - "The call is in progress.", - "The call completed successfully.", - "The call failed.", - "The call stopped before completing." + "discriminator": { + "propertyName": "type", + "mapping": { + "periodic": "#/components/schemas/CreateAutomationParamsPeriodic", + "once": "#/components/schemas/CreateAutomationParamsOnce" + } + }, + "x-oai-discriminator-values": [ + "periodic", + "once" ], - "description": "The status of a tool call." + "description": "Creates an automation without invoking it immediately." }, - "FunctionCallItemResource": { + "UpdateAutomationParams": { "type": "object", "properties": { - "type": { + "name": { "type": "string", - "enum": [ - "function_call" - ], - "default": "function_call", - "x-stainless-const": true, - "description": "The item type. Always `function_call`." + "minLength": 1, + "maxLength": 256 + }, + "target": { + "$ref": "#/components/schemas/AutomationTargetParam", + "description": "Replaces the complete target, retaining its type and any creator session." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Replaces all metadata; omit to leave unchanged." }, - "id": { + "expression": { "type": "string", - "minLength": 0, - "description": "The ID of the function call item." + "minLength": 1, + "maxLength": 256, + "description": "Only accepted for periodic automations." }, - "turn_id": { + "timezone": { "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." + "minLength": 1, + "maxLength": 128, + "description": "Only accepted for periodic automations." }, - "call_id": { + "run_at": { + "type": "integer", + "format": "int64", + "description": "A future Unix timestamp in seconds; accepted only before a one-time scheduled invocation exists." + } + }, + "additionalProperties": false, + "description": "Updates configuration; timing fields must match the stored automation type." + }, + "DeletedAutomationResource": { + "type": "object", + "properties": { + "id": { "type": "string", "minLength": 0, - "description": "The ID used to submit the function result." + "description": "The deleted automation ID." }, - "name": { + "object": { "type": "string", - "minLength": 0, - "description": "The name of the function to call." - }, - "arguments": { - "description": "The arguments to pass to the function." + "enum": [ + "agent.automation.deleted" + ], + "default": "agent.automation.deleted", + "x-stainless-const": true, + "description": "Always `agent.automation.deleted`." }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the function call." + "deleted": { + "type": "boolean", + "description": "Always true." } }, "required": [ - "type", "id", - "turn_id", - "call_id", - "name", - "arguments", - "status" + "object", + "deleted" ], - "additionalProperties": false, - "description": "A function call produced by the agent." + "additionalProperties": false }, - "InputContentResourceInputText": { + "AutomationInvocationSourceResourceManual": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_text" + "manual" ], - "default": "input_text", + "default": "manual", "x-stainless-const": true, - "description": "The type of the object. Always `input_text`." - }, - "text": { - "type": "string", - "minLength": 0, - "description": "The text supplied to the agent." + "description": "The type of the object. Always `manual`." } }, "required": [ - "type", - "text" + "type" ], - "additionalProperties": false, - "description": "Text input recorded in a session item." + "additionalProperties": false }, - "InputContentResourceInputImage": { + "AutomationInvocationSourceResourceAutomation": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_image" + "automation" ], - "default": "input_image", + "default": "automation", "x-stainless-const": true, - "description": "The type of the object. Always `input_image`." + "description": "The type of the object. Always `automation`." }, - "image_url": { - "type": "string", - "minLength": 0, - "description": "The URL of the image supplied to the agent, which may be a base64-encoded data URL." + "automation": { + "$ref": "#/components/schemas/AutomationResource", + "description": "The automation snapshot for this occurrence, excluding confidential values." } }, "required": [ "type", - "image_url" + "automation" ], - "additionalProperties": false, - "description": "Image input recorded in a session item." + "additionalProperties": false }, - "InputContentResource": { + "AutomationInvocationSourceResource": { "oneOf": [ { - "$ref": "#/components/schemas/InputContentResourceInputText" + "$ref": "#/components/schemas/AutomationInvocationSourceResourceManual" }, { - "$ref": "#/components/schemas/InputContentResourceInputImage" + "$ref": "#/components/schemas/AutomationInvocationSourceResourceAutomation" } ], "discriminator": { "propertyName": "type", "mapping": { - "input_text": "#/components/schemas/InputContentResourceInputText", - "input_image": "#/components/schemas/InputContentResourceInputImage" + "manual": "#/components/schemas/AutomationInvocationSourceResourceManual", + "automation": "#/components/schemas/AutomationInvocationSourceResourceAutomation" } }, "x-oai-discriminator-values": [ - "input_text", - "input_image" - ], - "description": "User-provided content recorded in a session item." + "manual", + "automation" + ] }, - "FunctionCallOutputResource": { - "oneOf": [ - { + "AutomationInvocationStatusResource": { + "type": "string", + "enum": [ + "queued", + "completed", + "failed", + "skipped" + ] + }, + "AutomationInvocationErrorResource": { + "type": "object", + "properties": { + "code": { "type": "string", - "minLength": 0 + "minLength": 0, + "description": "A machine-readable error code." }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/InputContentResource" - }, - "minItems": 0, - "maxItems": 2000 + "message": { + "type": "string", + "minLength": 0, + "description": "A public explanation of the delivery failure." } + }, + "required": [ + "code", + "message" ], - "description": "The text or model-input content supplied as a function result." + "additionalProperties": false }, - "FunctionCallOutputItemResource": { + "AutomationInvocationResource": { "type": "object", "properties": { "id": { "type": "string", "minLength": 0, - "description": "The ID of the function call output item." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." + "description": "The invocation ID." }, - "type": { + "object": { "type": "string", "enum": [ - "function_call_output" + "agent.automation.invocation" ], - "default": "function_call_output", + "default": "agent.automation.invocation", "x-stainless-const": true, - "description": "The item type. Always `function_call_output`." + "description": "Always `agent.automation.invocation`." }, - "call_id": { + "automation_id": { "type": "string", "minLength": 0, - "description": "The ID of the function call that produced this output." + "description": "The automation that owns the invocation." + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "The creation time as a Unix timestamp in seconds." + }, + "source": { + "$ref": "#/components/schemas/AutomationInvocationSourceResource", + "description": "Whether the invocation was manual or scheduled." + }, + "scheduled_at": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "description": "The intended occurrence as a Unix timestamp in seconds, or null for manual runs." + }, + "session_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The target or newly created session ID, or null before one is available." }, "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the function call." + "$ref": "#/components/schemas/AutomationInvocationStatusResource", + "description": "Delivery status; completed does not mean the agent's work has finished." }, - "output": { + "skip_reason": { + "type": [ + "string", + "null" + ], + "enum": [ + "pending_delivery", + null + ], + "default": "pending_delivery", + "x-stainless-const": true, + "description": "Why an occurrence was skipped, or null when it was not skipped." + }, + "error": { "anyOf": [ { - "$ref": "#/components/schemas/FunctionCallOutputResource" + "$ref": "#/components/schemas/AutomationInvocationErrorResource" }, { "type": "null" } ], - "description": "The function result, if the call succeeded." - }, - "error": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The error message, if the call failed." + "description": "The permanent delivery failure, or null when no failure occurred." } }, "required": [ "id", - "turn_id", - "type", - "call_id", + "object", + "automation_id", + "created_at", + "source", + "scheduled_at", + "session_id", "status", - "output", + "skip_reason", "error" ], "additionalProperties": false, - "description": "The result supplied for a function call." + "description": "One attempted delivery by an automation." }, - "AgentMessageItemResource": { + "EnvironmentTypeParam": { + "type": "string", + "enum": [ + "openai_hosted" + ], + "description": "The hosting type of an execution environment." + }, + "EnvironmentTypeResource": { + "type": "string", + "enum": [ + "openai_hosted", + "self_hosted" + ], + "description": "The kind of execution environment." + }, + "EnvironmentStatusResource": { + "type": "string", + "enum": [ + "pending", + "ready", + "connected", + "disconnected", + "suspended", + "expired", + "failed" + ], + "x-enumDescriptions": [ + "", + "Provisioning succeeded and the environment is available for attachment or use.", + "", + "", + "The sandbox is stopped and can be resumed from its private checkpoint.", + "", + "" + ], + "description": "The public lifecycle status of an execution environment." + }, + "HostedEnvironmentFileResourceFileId": { "type": "object", "properties": { + "type": { + "type": "string", + "enum": [ + "file_id" + ], + "default": "file_id", + "x-stainless-const": true, + "description": "The type of the object. Always `file_id`." + }, "id": { "type": "string", "minLength": 0, - "description": "The ID of the message." + "description": "The session-scoped ID of the file in the execution environment." }, - "turn_id": { + "file_id": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." + "description": "The ID of the uploaded file." }, + "path": { + "type": "string", + "minLength": 0, + "description": "The file's absolute path inside the environment." + }, + "size_bytes": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "The decoded file size in bytes." + } + }, + "required": [ + "type", + "id", + "file_id", + "path", + "size_bytes" + ], + "additionalProperties": false, + "description": "A file copied from the OpenAI Files API." + }, + "HostedEnvironmentFileResourceInline": { + "type": "object", + "properties": { "type": { "type": "string", "enum": [ - "agent_message" + "inline" ], - "default": "agent_message", + "default": "inline", "x-stainless-const": true, - "description": "The item type. Always `agent_message`." + "description": "The type of the object. Always `inline`." }, - "sender_agent_id": { + "id": { "type": "string", "minLength": 0, - "description": "The ID or name of the sending agent." + "description": "The session-scoped ID of the file in the execution environment." }, - "recipient_agent_id": { + "path": { "type": "string", "minLength": 0, - "description": "The ID or name of the receiving agent." + "description": "The file's absolute path inside the environment." }, - "content": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AgentContentResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The content exchanged between the agents." + "size_bytes": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "The decoded file size in bytes." } }, "required": [ - "id", - "turn_id", "type", - "sender_agent_id", - "recipient_agent_id", - "content" + "id", + "path", + "size_bytes" ], "additionalProperties": false, - "description": "A message exchanged between agent threads." + "description": "A file supplied inline when the session was created." }, - "McpCallItemResource": { + "HostedEnvironmentFileResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedEnvironmentFileResourceFileId" + }, + { + "$ref": "#/components/schemas/HostedEnvironmentFileResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "file_id": "#/components/schemas/HostedEnvironmentFileResourceFileId", + "inline": "#/components/schemas/HostedEnvironmentFileResourceInline" + } + }, + "x-oai-discriminator-values": [ + "file_id", + "inline" + ], + "description": "Metadata for a file materialized in an OpenAI-hosted execution environment." + }, + "HostedSkillResourceSkillReference": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "mcp_call" + "skill_reference" ], - "default": "mcp_call", + "default": "skill_reference", "x-stainless-const": true, - "description": "The item type. Always `mcp_call`." + "description": "The type of the object. Always `skill_reference`." }, - "id": { + "skill_id": { "type": "string", "minLength": 0, - "description": "The ID of the MCP call item." + "description": "The referenced skill ID." }, - "turn_id": { + "version": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." + "description": "The concrete skill version installed for this session." }, - "server_label": { + "name": { "type": "string", "minLength": 0, - "description": "The label of the MCP server." + "description": "The installed skill name." }, - "name": { + "description": { "type": "string", "minLength": 0, - "description": "The name of the MCP tool." - }, - "arguments": { - "description": "The arguments passed to the MCP tool." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the MCP tool call." - }, - "output": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "description": "The output returned by the MCP tool, if any." - }, - "error": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "description": "The error returned by the MCP tool, if any." + "description": "The installed skill description." } }, "required": [ "type", - "id", - "turn_id", - "server_label", + "skill_id", + "version", "name", - "arguments", - "status", - "output", - "error" + "description" ], "additionalProperties": false, - "description": "A call to a tool on an MCP server." + "description": "A skill installed from the Skills API." }, - "WebSearchActionResourceSearch": { + "HostedSkillResourceInline": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "search" + "inline" ], - "default": "search", + "default": "inline", "x-stainless-const": true, - "description": "The type of the object. Always `search`." + "description": "The type of the object. Always `inline`." }, - "query": { - "type": [ - "string", - "null" - ], + "name": { + "type": "string", "minLength": 0, - "description": "The search query, when a single query was used." + "description": "The installed skill name." }, - "queries": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "The search queries, when multiple queries were used." + "description": { + "type": "string", + "minLength": 0, + "description": "The installed skill description." } }, "required": [ "type", - "query", - "queries" + "name", + "description" ], "additionalProperties": false, - "description": "A search query or group of search queries." + "description": "A skill installed from an inline ZIP archive." }, - "WebSearchActionResourceOpenPage": { + "HostedSkillResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedSkillResourceSkillReference" + }, + { + "$ref": "#/components/schemas/HostedSkillResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "skill_reference": "#/components/schemas/HostedSkillResourceSkillReference", + "inline": "#/components/schemas/HostedSkillResourceInline" + } + }, + "x-oai-discriminator-values": [ + "skill_reference", + "inline" + ], + "description": "A skill installed in an OpenAI-hosted environment." + }, + "PublicEnvironmentResource": { "type": "object", "properties": { "type": { + "$ref": "#/components/schemas/EnvironmentTypeResource", + "description": "Whether the environment is hosted by OpenAI or by the application." + }, + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the environment." + }, + "object": { "type": "string", "enum": [ - "open_page" + "agent.environment" ], - "default": "open_page", + "default": "agent.environment", "x-stainless-const": true, - "description": "The type of the object. Always `open_page`." + "description": "The object type. Always `agent.environment`." }, - "url": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The URL of the page that was opened." + "status": { + "$ref": "#/components/schemas/EnvironmentStatusResource", + "description": "The current environment connection status." + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Files installed in the environment, without their contents." + }, + "skills": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedSkillResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Skills installed in the environment, without their archive contents." + }, + "plugins": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedPluginResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Plugins installed in the environment, without their archive contents." } }, "required": [ + "id", + "object", "type", - "url" + "status", + "files", + "skills", + "plugins" ], "additionalProperties": false, - "description": "Opens a web page." + "description": "Safe metadata for a first-class execution environment." }, - "WebSearchActionResourceFindInPage": { + "AgentEnvironmentListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "find_in_page" + "list" ], - "default": "find_in_page", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `find_in_page`." + "description": "The object type, which is always `list`." }, - "url": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PublicEnvironmentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The URL of the page that was searched." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "pattern": { + "last_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The text pattern that was searched for." + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type", - "url", - "pattern" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "Finds text within a web page." + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "WebSearchActionResourceOther": { + "CreateEnvironmentParamOpenaiHosted": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "other" + "openai_hosted" ], - "default": "other", + "default": "openai_hosted", "x-stainless-const": true, - "description": "The type of the object. Always `other`." - } - }, - "required": [ - "type" - ], - "additionalProperties": false, - "description": "Another web search action." - }, - "WebSearchActionResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/WebSearchActionResourceSearch" - }, - { - "$ref": "#/components/schemas/WebSearchActionResourceOpenPage" - }, - { - "$ref": "#/components/schemas/WebSearchActionResourceFindInPage" + "description": "The type of the object. Always `openai_hosted`." }, - { - "$ref": "#/components/schemas/WebSearchActionResourceOther" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "search": "#/components/schemas/WebSearchActionResourceSearch", - "open_page": "#/components/schemas/WebSearchActionResourceOpenPage", - "find_in_page": "#/components/schemas/WebSearchActionResourceFindInPage", - "other": "#/components/schemas/WebSearchActionResourceOther" - } - }, - "x-oai-discriminator-values": [ - "search", - "open_page", - "find_in_page", - "other" - ], - "description": "An action performed by the web search tool." - }, - "WebSearchCallItemResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "web_search_call" + "packages": { + "anyOf": [ + { + "$ref": "#/components/schemas/EnvironmentPackagesParam" + }, + { + "type": "null" + } ], - "default": "web_search_call", - "x-stainless-const": true, - "description": "The item type. Always `web_search_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the web search call." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." + "description": "Packages to install in the environment. Defaults to empty package lists." }, - "status": { - "$ref": "#/components/schemas/OutputItemStatusResource", - "description": "The status of the web search call." + "setup_commands": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/SetupCommandParam" + }, + "minItems": 0, + "maxItems": 16, + "description": "Ordered, confidential setup commands. Command bodies are never returned." }, - "action": { + "network": { "anyOf": [ { - "$ref": "#/components/schemas/WebSearchActionResource" + "$ref": "#/components/schemas/NetworkPolicyParam" }, { "type": "null" } ], - "description": "The action performed by the web search tool." - } - }, - "required": [ - "type", - "id", - "turn_id", - "status", - "action" - ], - "additionalProperties": false, - "description": "A web search call produced by the agent." - }, - "CommandExecutionItemResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "command_execution" - ], - "default": "command_execution", - "x-stainless-const": true, - "description": "The item type. Always `command_execution`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the command execution item." + "description": "Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled." }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopParam" + }, + { + "type": "null" + } + ], + "description": "Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled." }, - "command": { - "type": "string", - "minLength": 0, - "description": "The command that was executed." + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Environment variables made available to the agent." }, - "cwd": { + "capability_directories": { "type": [ - "string", + "array", "null" ], - "minLength": 0, - "description": "The working directory used to execute the command." + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the command execution." + "skills": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedSkillParam" + }, + "minItems": 0, + "maxItems": 200, + "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." }, - "output": { + "plugins": { "type": [ - "string", + "array", "null" ], - "minLength": 0, - "description": "The command output, if available." + "items": { + "$ref": "#/components/schemas/HostedPluginParam" + }, + "minItems": 0, + "maxItems": 32, + "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." }, - "exit_code": { + "files": { "type": [ - "integer", + "array", "null" ], - "format": "int64", - "description": "The process exit code, if the command completed." + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileParam" + }, + "minItems": 0, + "maxItems": 50, + "description": "Files available before the agent starts. Defaults to an empty list." }, - "duration_ms": { + "environment_template_id": { + "type": "string", + "minLength": 0, + "maxLength": 64, + "description": "A reusable hosted template applied before inline configuration. Omitted fields inherit the template; network overrides cannot broaden its policy." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Provision an OpenAI-hosted environment from inline configuration or a template." + }, + "CreateEnvironmentParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateEnvironmentParamOpenaiHosted" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "openai_hosted": "#/components/schemas/CreateEnvironmentParamOpenaiHosted" + } + }, + "x-oai-discriminator-values": [ + "openai_hosted" + ], + "description": "Configuration for a new prewarmed OpenAI-hosted environment." + }, + "CreateAgentEnvironmentParams": { + "type": "object", + "properties": { + "environment": { + "$ref": "#/components/schemas/CreateEnvironmentParam", + "description": "The required hosting type and its configuration." + }, + "vault_ids": { "type": [ - "integer", + "array", "null" ], - "format": "int64", - "description": "The command duration in milliseconds." + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 10, + "description": "The IDs of up to 10 vaults made available to an OpenAI-hosted environment." } }, "required": [ - "type", - "id", - "turn_id", - "command", - "cwd", - "status", - "output", - "exit_code", - "duration_ms" + "environment" ], "additionalProperties": false, - "description": "A command execution produced by the agent." + "description": "Parameters for creating an execution environment before its sessions." }, - "InterruptSubagentCallItemResource": { + "EnvironmentFilePageObjectResource": { + "type": "string", + "enum": [ + "page" + ], + "default": "page", + "x-stainless-const": true, + "description": "The object type for a page of files in an execution environment." + }, + "EnvironmentFileResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "interrupt_subagent_call" + "agent.environment.file" ], - "default": "interrupt_subagent_call", + "default": "agent.environment.file", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `interrupt_subagent_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." + "description": "The object type. Always `agent.environment.file`." }, - "turn_id": { + "environment_id": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." + "description": "The ID of the environment containing this file." }, - "sender_agent_id": { + "path": { "type": "string", "minLength": 0, - "description": "The ID of the agent requesting the interrupt." + "description": "The absolute file path inside the environment's workspace." }, - "recipient_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent to interrupt." + "size_bytes": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "The file size in bytes." } }, "required": [ - "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_id" + "object", + "environment_id", + "path", + "size_bytes" ], "additionalProperties": false, - "description": "A request to interrupt a subagent's current turn. The subagent remains available." + "description": "A live file in an execution environment." }, - "CreateSubagentCallItemResource": { + "EnvironmentFileListResource": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "create_subagent_call" - ], - "default": "create_subagent_call", - "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `create_subagent_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." - }, - "agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent that requested the subagent." + "object": { + "$ref": "#/components/schemas/EnvironmentFilePageObjectResource", + "description": "The object type. Always `page`." }, - "content": { + "data": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentContentResource" + "$ref": "#/components/schemas/EnvironmentFileResource" }, "minItems": 0, "maxItems": 2000, - "description": "The task given to the spawned agent." + "description": "Files available on the current page." }, - "model": { + "next": { "type": [ "string", "null" ], "minLength": 0, - "description": "The model requested for the spawned agent." + "description": "The opaque cursor to use when requesting the next page, if any." }, - "reasoning_effort": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The reasoning effort requested for the spawned agent." + "has_more": { + "type": "boolean", + "description": "Whether more files follow this page." } }, "required": [ - "type", - "id", - "turn_id", - "status", - "agent_id", - "content", - "model", - "reasoning_effort" + "object", + "data", + "next", + "has_more" ], "additionalProperties": false, - "description": "A request to spawn a subagent." + "description": "A paginated list of live execution environment files." }, - "SendSubagentInputCallItemResource": { + "SubagentObjectResource": { + "type": "string", + "enum": [ + "agent.session.subagent" + ], + "default": "agent.session.subagent", + "x-stainless-const": true, + "description": "The object type for a subagent." + }, + "OutputTextResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "send_subagent_input_call" + "output_text" ], - "default": "send_subagent_input_call", + "default": "output_text", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `send_subagent_input_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." + "description": "The content type. Always `output_text`." }, - "turn_id": { + "text": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." - }, - "sender_agent_id": { + "description": "The text produced by the agent." + } + }, + "required": [ + "type", + "text" + ], + "additionalProperties": false, + "description": "A text content part produced by the agent." + }, + "EncryptedContentResource": { + "type": "object", + "properties": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the agent sending the input." + "enum": [ + "encrypted_content" + ], + "default": "encrypted_content", + "x-stainless-const": true, + "description": "The content type. Always `encrypted_content`." }, - "recipient_agent_id": { + "encrypted_content": { "type": "string", "minLength": 0, - "description": "The ID of the agent receiving the input." - }, - "content": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AgentContentResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The input sent to the receiving agent." + "description": "The encrypted content payload." } }, "required": [ "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_id", - "content" + "encrypted_content" ], "additionalProperties": false, - "description": "A request to send input to another agent." + "description": "Encrypted content exchanged between agents." + }, + "AgentContentResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/OutputTextResource" + }, + { + "$ref": "#/components/schemas/EncryptedContentResource" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "output_text": "#/components/schemas/OutputTextResource", + "encrypted_content": "#/components/schemas/EncryptedContentResource" + } + }, + "x-oai-discriminator-values": [ + "output_text", + "encrypted_content" + ], + "description": "A plaintext or encrypted content part exchanged between agents." + }, + "SubagentStatusResource": { + "type": "string", + "enum": [ + "active", + "closed" + ], + "x-enumDescriptions": [ + "The subagent remains available, including while idle between turns.", + "The subagent is closed." + ], + "description": "The current status of a subagent." }, - "ResumeSubagentCallItemResource": { + "SubagentResource": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "resume_subagent_call" - ], - "default": "resume_subagent_call", - "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `resume_subagent_call`." - }, "id": { "type": "string", "minLength": 0, - "description": "The ID of the tool call item." + "description": "The ID of the subagent." }, - "turn_id": { + "object": { + "$ref": "#/components/schemas/SubagentObjectResource", + "description": "The object type. Always `agent.session.subagent`." + }, + "session_id": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." + "description": "The ID of the session that owns the subagent." }, - "sender_agent_id": { - "type": "string", + "name": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The ID of the agent requesting the resume." + "description": "The runner-assigned nickname, or null when unavailable." }, - "recipient_agent_id": { + "instructions": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/AgentContentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available." + }, + "parent_agent_id": { "type": "string", "minLength": 0, - "description": "The ID of the agent to resume." + "description": "The ID of the agent that created this subagent." + }, + "status": { + "$ref": "#/components/schemas/SubagentStatusResource", + "description": "The current status of the subagent." + }, + "opened_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it." + }, + "closed_at": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "description": "The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume." } }, "required": [ - "type", "id", - "turn_id", + "object", + "session_id", + "name", + "instructions", + "parent_agent_id", "status", - "sender_agent_id", - "recipient_agent_id" + "opened_at", + "closed_at" ], "additionalProperties": false, - "description": "A request to resume a subagent." + "description": "A subagent created within a session." }, - "WaitForSubagentsCallItemResource": { + "SessionMessageRoleResource": { + "type": "string", + "enum": [ + "user", + "assistant" + ], + "description": "The author of a session message." + }, + "MessageContentResourceInputText": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "wait_for_subagents_call" + "input_text" ], - "default": "wait_for_subagents_call", + "default": "input_text", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `wait_for_subagents_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." + "description": "The type of the object. Always `input_text`." }, - "sender_agent_id": { + "text": { "type": "string", "minLength": 0, - "description": "The ID of the agent waiting for results." - }, - "recipient_agent_ids": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "The IDs of the agents to wait for." + "description": "The text supplied by the user." } }, "required": [ "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_ids" + "text" ], "additionalProperties": false, - "description": "A request to wait for one or more subagents." + "description": "Text supplied by the user." }, - "CloseSubagentCallItemResource": { + "MessageContentResourceInputImage": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "close_subagent_call" + "input_image" ], - "default": "close_subagent_call", + "default": "input_image", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `close_subagent_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." - }, - "sender_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent requesting the close." + "description": "The type of the object. Always `input_image`." }, - "recipient_agent_id": { + "image_url": { "type": "string", "minLength": 0, - "description": "The ID of the agent to close." - } - }, - "required": [ - "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_id" - ], - "additionalProperties": false, - "description": "A request to close a subagent." - }, - "SessionTurnItemResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageItemResource" - }, - { - "$ref": "#/components/schemas/ReasoningItemResource" - }, - { - "$ref": "#/components/schemas/FunctionCallItemResource" - }, - { - "$ref": "#/components/schemas/FunctionCallOutputItemResource" - }, - { - "$ref": "#/components/schemas/AgentMessageItemResource" - }, - { - "$ref": "#/components/schemas/McpCallItemResource" - }, - { - "$ref": "#/components/schemas/WebSearchCallItemResource" - }, - { - "$ref": "#/components/schemas/CommandExecutionItemResource" - }, - { - "$ref": "#/components/schemas/CreateSubagentCallItemResource" - }, - { - "$ref": "#/components/schemas/SendSubagentInputCallItemResource" - }, - { - "$ref": "#/components/schemas/ResumeSubagentCallItemResource" - }, - { - "$ref": "#/components/schemas/WaitForSubagentsCallItemResource" - }, - { - "$ref": "#/components/schemas/InterruptSubagentCallItemResource" - }, - { - "$ref": "#/components/schemas/CloseSubagentCallItemResource" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "message": "#/components/schemas/MessageItemResource", - "reasoning": "#/components/schemas/ReasoningItemResource", - "function_call": "#/components/schemas/FunctionCallItemResource", - "function_call_output": "#/components/schemas/FunctionCallOutputItemResource", - "agent_message": "#/components/schemas/AgentMessageItemResource", - "mcp_call": "#/components/schemas/McpCallItemResource", - "web_search_call": "#/components/schemas/WebSearchCallItemResource", - "command_execution": "#/components/schemas/CommandExecutionItemResource", - "interrupt_subagent_call": "#/components/schemas/InterruptSubagentCallItemResource", - "create_subagent_call": "#/components/schemas/CreateSubagentCallItemResource", - "send_subagent_input_call": "#/components/schemas/SendSubagentInputCallItemResource", - "resume_subagent_call": "#/components/schemas/ResumeSubagentCallItemResource", - "wait_for_subagents_call": "#/components/schemas/WaitForSubagentsCallItemResource", - "close_subagent_call": "#/components/schemas/CloseSubagentCallItemResource" + "description": "The URL of the image supplied by the user, which may be a base64-encoded data URL." } }, - "x-oai-discriminator-values": [ - "message", - "reasoning", - "function_call", - "function_call_output", - "agent_message", - "mcp_call", - "web_search_call", - "command_execution", - "create_subagent_call", - "send_subagent_input_call", - "resume_subagent_call", - "wait_for_subagents_call", - "interrupt_subagent_call", - "close_subagent_call" + "required": [ + "type", + "image_url" ], - "description": "An item associated with a session turn." + "additionalProperties": false, + "description": "An image supplied by the user." }, - "SessionItemListResource": { + "MessageContentResourceOutputText": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "output_text" ], - "default": "list", + "default": "output_text", "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SessionTurnItemResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." - }, - "first_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "description": "The type of the object. Always `output_text`." }, - "last_id": { - "type": [ - "string", - "null" - ], + "text": { + "type": "string", "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." - }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "description": "The text produced by the assistant." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type", + "text" ], "additionalProperties": false, - "description": "A page of messages, reasoning, and tool calls from a session's item history." + "description": "Text produced by the assistant." }, - "TurnObjectResource": { - "type": "string", - "enum": [ - "agent.session.turn" + "MessageContentResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageContentResourceInputText" + }, + { + "$ref": "#/components/schemas/MessageContentResourceInputImage" + }, + { + "$ref": "#/components/schemas/MessageContentResourceOutputText" + } ], - "default": "agent.session.turn", - "x-stainless-const": true, - "description": "The object type for a turn." + "discriminator": { + "propertyName": "type", + "mapping": { + "input_text": "#/components/schemas/MessageContentResourceInputText", + "input_image": "#/components/schemas/MessageContentResourceInputImage", + "output_text": "#/components/schemas/MessageContentResourceOutputText" + } + }, + "x-oai-discriminator-values": [ + "input_text", + "input_image", + "output_text" + ], + "description": "A content part in a session message." }, - "TurnStatusResource": { + "OutputItemStatusResource": { "type": "string", "enum": [ - "queued", "in_progress", - "waiting", "completed", - "failed", - "cancelled" + "incomplete" ], "x-enumDescriptions": [ - "The turn is waiting to start.", - "The turn is in progress.", - "The turn is waiting for external input.", - "The turn completed successfully.", - "The turn failed.", - "The turn was cancelled." + "The item is in progress.", + "The item is complete.", + "The item stopped before completing." ], - "description": "The current status of a turn." + "description": "The status of an agent output item." }, - "SessionTurnErrorCodeResource": { + "MessagePhaseResource": { "type": "string", "enum": [ - "context_length_exceeded", - "session_budget_exceeded", - "usage_limit_exceeded", - "rate_limit_exceeded", - "server_overloaded", - "cyber_policy", - "connection_failed", - "server_error", - "authentication_error", - "invalid_request", - "resource_not_found", - "sandbox_error", - "executor_version_incompatible", - "active_turn_not_steerable", - "request_timeout", - "internal_error" + "commentary", + "final_answer" ], "x-enumDescriptions": [ - "The request exceeds the model's context window.", - "The session has reached its usage budget.", - "The organization has reached a usage, plan, or billing limit.", - "The request exceeds the available rate limit.", - "The model service is temporarily overloaded.", - "The request was rejected by a safety policy.", - "The request could not connect to the model service.", - "The model service encountered an unexpected error.", - "The API credentials are invalid or lack the required access.", - "The request contains invalid input or configuration.", - "The requested model or resource is unavailable.", - "The request could not complete in its execution environment.", - "The executor must be upgraded before it can run this turn.", - "The session cannot accept additional input while a request is running.", - "The request timed out before the model service responded.", - "An unexpected internal error prevented the session request from completing." + "Commentary produced while the agent works.", + "The agent's final answer." ], - "description": "Stable public categories for session request failures." + "description": "The phase of an assistant message." }, - "SessionTurnErrorResource": { + "MessageItemResource": { "type": "object", "properties": { - "code": { - "$ref": "#/components/schemas/SessionTurnErrorCodeResource", - "description": "A stable, machine-readable failure category." + "type": { + "type": "string", + "enum": [ + "message" + ], + "default": "message", + "x-stainless-const": true, + "description": "The item type. Always `message`." }, - "message": { + "id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of this item, or null for legacy user messages whose ID was not recorded." + }, + "turn_id": { "type": "string", "minLength": 0, - "description": "A customer-safe explanation of the failure." - } - }, - "required": [ - "code", - "message" - ], - "additionalProperties": false, - "description": "A customer-safe error describing why a session request failed." - }, - "InputTokensDetailsResource": { - "type": "object", - "properties": { - "cached_tokens": { - "type": "integer", - "format": "int64", - "description": "The number of input tokens retrieved from the prompt cache." - } - }, - "required": [ - "cached_tokens" - ], - "additionalProperties": false, - "description": "A breakdown of input token usage for a session or turn." - }, - "OutputTokensDetailsResource": { - "type": "object", - "properties": { - "reasoning_tokens": { - "type": "integer", - "format": "int64", - "description": "The number of output tokens used for reasoning." + "description": "The ID of the turn that contains this item." + }, + "role": { + "$ref": "#/components/schemas/SessionMessageRoleResource", + "description": "The role of the message author." + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MessageContentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The content of the message. User messages contain input text or images; assistant messages contain output text." + }, + "status": { + "$ref": "#/components/schemas/OutputItemStatusResource", + "description": "The status of the message. User messages are always `completed`." + }, + "phase": { + "anyOf": [ + { + "$ref": "#/components/schemas/MessagePhaseResource" + }, + { + "type": "null" + } + ], + "description": "The phase of an assistant message. Null for user messages." } }, "required": [ - "reasoning_tokens" + "type", + "id", + "turn_id", + "role", + "content", + "status", + "phase" ], "additionalProperties": false, - "description": "A breakdown of output token usage for a session or turn." + "description": "A user or assistant message recorded in a session." }, - "TokenUsageResource": { + "SummaryTextResource": { "type": "object", "properties": { - "input_tokens": { - "type": "integer", - "format": "int64", - "description": "The number of input tokens used by the agent." - }, - "input_tokens_details": { - "$ref": "#/components/schemas/InputTokensDetailsResource", - "description": "A breakdown of the agent's input token usage." - }, - "output_tokens": { - "type": "integer", - "format": "int64", - "description": "The number of output tokens generated by the agent." - }, - "output_tokens_details": { - "$ref": "#/components/schemas/OutputTokensDetailsResource", - "description": "A breakdown of the agent's output token usage." + "type": { + "type": "string", + "enum": [ + "summary_text" + ], + "default": "summary_text", + "x-stainless-const": true, + "description": "The content type. Always `summary_text`." }, - "total_tokens": { - "type": "integer", - "format": "int64", - "description": "The total number of input and output tokens used by the agent." + "text": { + "type": "string", + "minLength": 0, + "description": "The reasoning summary text." } }, "required": [ - "input_tokens", - "input_tokens_details", - "output_tokens", - "output_tokens_details", - "total_tokens" + "type", + "text" ], "additionalProperties": false, - "description": "Recorded token usage for a session or turn. Usage is best effort and may change." + "description": "A reasoning summary content part." }, - "TurnResource": { + "ReasoningItemResource": { "type": "object", "properties": { - "id": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the turn." - }, - "object": { - "$ref": "#/components/schemas/TurnObjectResource", - "description": "The object type. Always `agent.session.turn`." + "enum": [ + "reasoning" + ], + "default": "reasoning", + "x-stainless-const": true, + "description": "The item type. Always `reasoning`." }, - "session_id": { + "id": { "type": "string", "minLength": 0, - "description": "The ID of the session that owns the turn." + "description": "The ID of the reasoning item." }, - "agent_id": { + "turn_id": { "type": "string", "minLength": 0, - "description": "The ID of the agent that ran the turn." + "description": "The ID of the turn that contains this item." }, - "subagent_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the subagent that ran the turn, if applicable." + "summary": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SummaryTextResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The reasoning summaries produced by the agent." }, "status": { - "$ref": "#/components/schemas/TurnStatusResource", - "description": "The current status of the turn." - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable." - }, - "started_at": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "description": "The Unix timestamp, in seconds, when the turn started." - }, - "completed_at": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "description": "The Unix timestamp, in seconds, when the turn reached a terminal state." - }, - "error": { - "anyOf": [ - { - "$ref": "#/components/schemas/SessionTurnErrorResource" - }, - { - "type": "null" - } - ], - "description": "A customer-safe error. Non-null only for a failed turn." - }, - "usage": { "anyOf": [ { - "$ref": "#/components/schemas/TokenUsageResource" + "$ref": "#/components/schemas/OutputItemStatusResource" }, { "type": "null" } ], - "description": "Best-effort token usage for the turn, or null if unknown. Recorded usage may change." + "description": "The status of the reasoning item." } }, "required": [ + "type", "id", - "object", - "session_id", - "agent_id", - "subagent_id", - "status", - "created_at", - "started_at", - "completed_at", - "error", - "usage" + "turn_id", + "summary", + "status" ], "additionalProperties": false, - "description": "The canonical public representation of a session turn." + "description": "A reasoning item produced by the agent." }, - "SessionTurnListResource": { + "FunctionCallStatusResource": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "failed", + "incomplete" + ], + "x-enumDescriptions": [ + "The call is in progress.", + "The call completed successfully.", + "The call failed.", + "The call stopped before completing." + ], + "description": "The status of a tool call." + }, + "FunctionCallItemResource": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "function_call" ], - "default": "list", + "default": "function_call", "x-stainless-const": true, - "description": "The object type, which is always `list`." + "description": "The item type. Always `function_call`." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TurnResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the function call item." }, - "first_id": { - "type": [ - "string", - "null" - ], + "turn_id": { + "type": "string", "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "description": "The ID of the turn that contains this item." }, - "last_id": { - "type": [ - "string", - "null" - ], + "call_id": { + "type": "string", "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "description": "The ID used to submit the function result." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "name": { + "type": "string", + "minLength": 0, + "description": "The name of the function to call." + }, + "arguments": { + "description": "The arguments to pass to the function." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the function call." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type", + "id", + "turn_id", + "call_id", + "name", + "arguments", + "status" ], "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." - }, - "ReasoningEffortResource": { - "type": "string", - "enum": [ - "none", - "minimal", - "low", - "medium", - "high", - "xhigh", - "max" - ], - "description": "The amount of reasoning effort used by an agent." + "description": "A function call produced by the agent." }, - "ReasoningSummaryResource": { - "type": "string", - "enum": [ - "concise", - "detailed", - "auto" - ], - "x-enumDescriptions": [ - "Returns a concise reasoning summary when supported.", - "Returns a detailed reasoning summary when supported.", - "Automatically selects the most detailed summary supported by the model." + "FunctionCallOutputResource": { + "oneOf": [ + { + "type": "string", + "minLength": 0 + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputContentResource" + }, + "minItems": 0, + "maxItems": 2000 + } ], - "description": "The reasoning summary format requested from an agent." + "description": "The text or model-input content supplied as a function result." }, - "ReasoningResource": { + "FunctionCallOutputItemResource": { "type": "object", "properties": { - "effort": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningEffortResource" - }, - { - "type": "null" - } + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the function call output item." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "type": { + "type": "string", + "enum": [ + "function_call_output" ], - "description": "The requested reasoning effort, or `null` when the model selects its own default." + "default": "function_call_output", + "x-stainless-const": true, + "description": "The item type. Always `function_call_output`." }, - "summary": { + "call_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the function call that produced this output." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the function call." + }, + "output": { "anyOf": [ { - "$ref": "#/components/schemas/ReasoningSummaryResource" + "$ref": "#/components/schemas/FunctionCallOutputResource" }, { "type": "null" } ], - "description": "The requested reasoning summary format, or `null` when summaries are disabled." + "description": "The function result, if the call succeeded." + }, + "error": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The error message, if the call failed." } }, "required": [ - "effort", - "summary" + "id", + "turn_id", + "type", + "call_id", + "status", + "output", + "error" ], "additionalProperties": false, - "description": "The reasoning configuration used by an agent." + "description": "The result supplied for a function call." }, - "TextFormatResourceText": { + "AgentMessageItemResource": { "type": "object", "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the message." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, "type": { "type": "string", "enum": [ - "text" + "agent_message" ], - "default": "text", + "default": "agent_message", "x-stainless-const": true, - "description": "The type of the object. Always `text`." + "description": "The item type. Always `agent_message`." + }, + "sender_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID or name of the sending agent." + }, + "recipient_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID or name of the receiving agent." + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AgentContentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The content exchanged between the agents." } }, "required": [ - "type" + "id", + "turn_id", + "type", + "sender_agent_id", + "recipient_agent_id", + "content" ], "additionalProperties": false, - "description": "Generates ordinary text without a structured-output constraint." + "description": "A message exchanged between agent threads." }, - "TextFormatResourceJsonSchema": { + "McpCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "json_schema" + "mcp_call" ], - "default": "json_schema", + "default": "mcp_call", "x-stainless-const": true, - "description": "The type of the object. Always `json_schema`." + "description": "The item type. Always `mcp_call`." }, - "schema": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "The JSON Schema that generated text must match." - } - }, - "required": [ - "type", - "schema" - ], - "additionalProperties": false, - "description": "Constrains generated text to a JSON Schema." - }, - "TextFormatResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/TextFormatResourceText" + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the MCP call item." }, - { - "$ref": "#/components/schemas/TextFormatResourceJsonSchema" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "text": "#/components/schemas/TextFormatResourceText", - "json_schema": "#/components/schemas/TextFormatResourceJsonSchema" - } - }, - "x-oai-discriminator-values": [ - "text", - "json_schema" - ], - "description": "The effective output format for generated text." - }, - "VerbosityResource": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ], - "description": "The amount of text produced by an agent." - }, - "TextResource": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/TextFormatResource", - "description": "The effective output format. Defaults to ordinary text." + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." }, - "verbosity": { - "$ref": "#/components/schemas/VerbosityResource", - "description": "The amount of text produced by the agent. Defaults to `medium`." + "server_label": { + "type": "string", + "minLength": 0, + "description": "The label of the MCP server." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The name of the MCP tool." + }, + "arguments": { + "description": "The arguments passed to the MCP tool." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the MCP tool call." + }, + "output": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "description": "The output returned by the MCP tool, if any." + }, + "error": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "description": "The error returned by the MCP tool, if any." } }, "required": [ - "format", - "verbosity" + "type", + "id", + "turn_id", + "server_label", + "name", + "arguments", + "status", + "output", + "error" ], "additionalProperties": false, - "description": "The text configuration used by an agent." - }, - "ServiceTierResource": { - "type": "string", - "enum": [ - "auto", - "default", - "flex", - "priority", - "fast" - ], - "description": "The service-tier policy configured for an agent." + "description": "A call to a tool on an MCP server." }, - "PersistedAgentToolResourceFunction": { + "ComputerScreenshotResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "function" + "computer_screenshot" ], - "default": "function", + "default": "computer_screenshot", "x-stainless-const": true, - "description": "The type of the object. Always `function`." - }, - "name": { - "type": "string", - "minLength": 0, - "description": "The name of the function." + "description": "The content type. Always `computer_screenshot`." }, - "description": { + "image_url": { "type": "string", "minLength": 0, - "description": "A description of what the function does." - }, - "parameters": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "A JSON Schema object describing the function's arguments." - }, - "defer_loading": { - "type": "boolean", - "description": "Whether the function is deferred and discovered through tool search." + "description": "The complete JPEG image as a base64 data URL." } }, "required": [ "type", - "name", - "description", - "parameters", - "defer_loading" + "image_url" ], "additionalProperties": false, - "description": "A function defined by the application." + "description": "A browser screenshot emitted by the model during computer use." }, - "PersistedAgentToolResourceToolSearch": { + "ComputerUseCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "tool_search" + "computer_use_call" ], - "default": "tool_search", + "default": "computer_use_call", "x-stainless-const": true, - "description": "The type of the object. Always `tool_search`." + "description": "The item type. Always `computer_use_call`." + }, + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the activity item." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "title": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "A model-generated description of the activity, when available." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The execution status of the activity." + }, + "output": { + "anyOf": [ + { + "$ref": "#/components/schemas/ComputerScreenshotResource" + }, + { + "type": "null" + } + ], + "description": "The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot." } }, "required": [ - "type" + "type", + "id", + "turn_id", + "title", + "status", + "output" ], "additionalProperties": false, - "description": "Discovers deferred function tools and loads them into the model context." + "description": "One execution of the platform-provided computer-use capability." }, - "PersistedAgentToolResourceProgrammaticToolCalling": { + "BrowserAuthenticationFieldResource": { "type": "object", "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The field ID to submit as field_id in a fields entry." + }, + "label": { + "type": "string", + "minLength": 0, + "description": "The label to display beside the control." + }, "type": { "type": "string", - "enum": [ - "programmatic_tool_calling" - ], - "default": "programmatic_tool_calling", - "x-stainless-const": true, - "description": "The type of the object. Always `programmatic_tool_calling`." + "minLength": 0, + "description": "The rendering type, such as email, password, or text." }, - "enabled": { + "required": { "type": "boolean", - "description": "Whether tools can be called from model-generated code." + "description": "Whether this control requires a nonempty value." } }, "required": [ + "id", + "label", "type", - "enabled" + "required" ], "additionalProperties": false, - "description": "Enables calling tools from model-generated code." + "description": "A control in a registered browser-login form." }, - "PersistedMcpTransportResourceHttp": { + "BrowserAuthenticationOptionResource": { "type": "object", "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "http" - ], - "default": "http", - "x-stainless-const": true, - "description": "The type of the object. Always `http`." + "minLength": 0, + "description": "The option ID to submit as selected_option." }, - "server_url": { + "label": { "type": "string", "minLength": 0, - "description": "The URL of the MCP server." + "description": "The method label to display." }, - "headers": { - "type": "object", - "additionalProperties": { - "type": "string", - "minLength": 0 - }, - "propertyNames": { + "field_ids": { + "type": "array", + "items": { "type": "string", "minLength": 0 }, - "minProperties": 0, - "description": "Non-secret HTTP headers sent to the MCP server." + "minItems": 0, + "maxItems": 2000, + "description": "IDs from the registered fields that this method accepts." } }, "required": [ - "type", - "server_url", - "headers" + "id", + "label", + "field_ids" ], "additionalProperties": false, - "description": "Connects to an MCP server over HTTP." + "description": "A sign-in method and the fields that belong to it." }, - "PersistedMcpTransportResourceStdio": { + "BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "stdio" + "browser_authentication" ], - "default": "stdio", + "default": "browser_authentication", "x-stainless-const": true, - "description": "The type of the object. Always `stdio`." + "description": "The type of the object. Always `browser_authentication`." }, - "command": { - "type": "string", + "reason": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The command used to start the MCP server." + "description": "Why the agent needs the user to sign in." }, - "args": { + "credential_origin": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The registered form or frame origin where values will be entered." + }, + "fields": { "type": "array", "items": { - "type": "string", - "minLength": 0 + "$ref": "#/components/schemas/BrowserAuthenticationFieldResource" }, "minItems": 0, "maxItems": 2000, - "description": "Arguments passed to the MCP server command." - }, - "cwd": { - "type": "string", - "minLength": 0, - "description": "The working directory used to start the MCP server." + "description": "Controls to render. All submitted values are sensitive." }, - "env_vars": { + "options": { "type": "array", "items": { - "type": "string", - "minLength": 0 + "$ref": "#/components/schemas/BrowserAuthenticationOptionResource" }, "minItems": 0, "maxItems": 2000, - "description": "Environment variable names inherited from the execution environment." + "description": "Sign-in methods. Empty for a plain form." } }, "required": [ "type", - "command", - "args", - "cwd", - "env_vars" + "reason", + "credential_origin", + "fields", + "options" ], "additionalProperties": false, - "description": "Starts an MCP server as a local process." + "description": "A registered form awaiting the application's response." }, - "PersistedMcpTransportResource": { + "BrowserAuthenticationHistoryRequestKindResource": { "oneOf": [ { - "$ref": "#/components/schemas/PersistedMcpTransportResourceHttp" - }, - { - "$ref": "#/components/schemas/PersistedMcpTransportResourceStdio" + "$ref": "#/components/schemas/BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication" } ], "discriminator": { "propertyName": "type", "mapping": { - "http": "#/components/schemas/PersistedMcpTransportResourceHttp", - "stdio": "#/components/schemas/PersistedMcpTransportResourceStdio" + "browser_authentication": "#/components/schemas/BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication" } }, "x-oai-discriminator-values": [ - "http", - "stdio" - ], - "description": "A credential-free transport used to connect to an MCP server." + "browser_authentication" + ] }, - "McpConnectionOriginResource": { - "type": "string", - "enum": [ - "service", - "environment" + "BrowserAuthenticationRequestItemResource": { + "type": "object", + "properties": { + "turn_id": { + "type": "string", + "minLength": 0 + }, + "request_id": { + "type": "string", + "minLength": 0 + }, + "request": { + "$ref": "#/components/schemas/BrowserAuthenticationHistoryRequestKindResource" + }, + "id": { + "type": "string", + "minLength": 0, + "description": "The stable history item ID." + }, + "type": { + "type": "string", + "enum": [ + "computer_use_approval_request" + ], + "default": "computer_use_approval_request", + "x-stainless-const": true, + "description": "The item type. Always computer_use_approval_request." + } + }, + "required": [ + "turn_id", + "request_id", + "request", + "id", + "type" ], - "description": "Where outbound MCP HTTP connections originate." + "additionalProperties": false, + "description": "A credential-free history record of the emitted login request." }, - "PersistedAgentToolResourceMcp": { + "ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "mcp" + "browser_authentication" ], - "default": "mcp", - "x-stainless-const": true, - "description": "The type of the object. Always `mcp`." + "default": "browser_authentication", + "x-stainless-const": true }, - "server_label": { + "action": { "type": "string", - "minLength": 0, - "description": "A label used to identify the MCP server in tool calls." + "enum": [ + "submit" + ], + "default": "submit", + "x-stainless-const": true }, - "credential_id": { + "selected_option": { "type": [ "string", "null" ], "minLength": 0, - "description": "The vault credential selected for this MCP server, if any." - }, - "transport": { - "$ref": "#/components/schemas/PersistedMcpTransportResource", - "description": "The credential-free transport used to connect to the MCP server." - }, - "request_metadata": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "Metadata included with requests to this MCP server." - }, - "allowed_tools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "The MCP tools the agent may call, or null when all server tools are allowed." - }, - "required": { - "type": "boolean", - "description": "Whether this MCP server must initialize before the first turn." - }, - "connection_origin": { - "$ref": "#/components/schemas/McpConnectionOriginResource", - "description": "Where outbound MCP HTTP connections originate." + "description": "The chosen sign-in method, or null when no options were offered." } }, "required": [ "type", - "server_label", - "credential_id", - "transport", - "request_metadata", - "allowed_tools", - "required", - "connection_origin" + "action", + "selected_option" ], - "additionalProperties": false, - "description": "Tools provided by a remote MCP server without stored credentials." - }, - "WebSearchModeResource": { - "type": "string", - "enum": [ - "disabled", - "cached", - "live" - ], - "description": "The source used for web search results." + "additionalProperties": false }, - "WebSearchContextSizeResource": { - "type": "string", - "enum": [ - "low", - "medium", - "high" + "ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "browser_authentication" + ], + "default": "browser_authentication", + "x-stainless-const": true + }, + "action": { + "type": "string", + "enum": [ + "cancel" + ], + "default": "cancel", + "x-stainless-const": true + } + }, + "required": [ + "type", + "action" ], - "description": "The amount of web search context made available to the model." + "additionalProperties": false }, - "WebSearchLocationResource": { + "ComputerUseApprovalResponseKindResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource" + }, + { + "$ref": "#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource" + } + ], + "discriminator": { + "propertyName": "action", + "mapping": { + "submit": "#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource", + "cancel": "#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource" + } + }, + "x-oai-discriminator-values": [ + "submit", + "cancel" + ] + }, + "ComputerUseApprovalRequestResultItemResource": { "type": "object", "properties": { - "country": { - "type": [ - "string", - "null" - ], + "id": { + "type": "string", "minLength": 0, - "description": "The two-letter ISO country code, such as `US`." + "description": "The stable history item ID." }, - "region": { - "type": [ - "string", - "null" + "type": { + "type": "string", + "enum": [ + "computer_use_approval_request_result" ], - "minLength": 0, - "description": "The region or state name." + "default": "computer_use_approval_request_result", + "x-stainless-const": true }, - "city": { - "type": [ - "string", - "null" - ], + "turn_id": { + "type": "string", "minLength": 0, - "description": "The city name." + "description": "The ID of the turn that contains this item." }, - "timezone": { - "type": [ - "string", - "null" - ], + "request_id": { + "type": "string", "minLength": 0, - "description": "The IANA timezone, such as `America/Los_Angeles`." + "description": "The registered request answered by this item." + }, + "response": { + "$ref": "#/components/schemas/ComputerUseApprovalResponseKindResource", + "description": "The admitted response, without submitted credential values." } }, "required": [ - "country", - "region", - "city", - "timezone" + "id", + "type", + "turn_id", + "request_id", + "response" ], "additionalProperties": false, - "description": "Approximate user location used to localize web search results." + "description": "A credential-free record of an admitted response, not proof of completion." }, - "PersistedAgentToolResourceWebSearch": { + "WebSearchActionResourceSearch": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "web_search" + "search" ], - "default": "web_search", + "default": "search", "x-stainless-const": true, - "description": "The type of the object. Always `web_search`." - }, - "mode": { - "$ref": "#/components/schemas/WebSearchModeResource", - "description": "The source used for web search results." + "description": "The type of the object. Always `search`." }, - "context_size": { - "$ref": "#/components/schemas/WebSearchContextSizeResource", - "description": "The amount of search context made available to the model. Defaults to `medium`." + "query": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The search query, when a single query was used." }, - "allowed_domains": { + "queries": { "type": [ "array", "null" @@ -10314,1290 +15951,1196 @@ }, "minItems": 0, "maxItems": 2000, - "description": "Allowed search domains, or `null` when the search is unrestricted." - }, - "location": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchLocationResource" - }, - { - "type": "null" - } - ], - "description": "Approximate location used to localize search results, if provided." + "description": "The search queries, when multiple queries were used." } }, "required": [ "type", - "mode", - "context_size", - "allowed_domains", - "location" + "query", + "queries" ], "additionalProperties": false, - "description": "Web search." - }, - "PersistedAgentToolResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/PersistedAgentToolResourceFunction" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolResourceToolSearch" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolResourceMcp" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolResourceWebSearch" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "function": "#/components/schemas/PersistedAgentToolResourceFunction", - "tool_search": "#/components/schemas/PersistedAgentToolResourceToolSearch", - "programmatic_tool_calling": "#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling", - "mcp": "#/components/schemas/PersistedAgentToolResourceMcp", - "web_search": "#/components/schemas/PersistedAgentToolResourceWebSearch" - } - }, - "x-oai-discriminator-values": [ - "function", - "tool_search", - "programmatic_tool_calling", - "mcp", - "web_search" - ], - "description": "A credential-free tool available to a reusable agent." + "description": "A search query or group of search queries." }, - "MultiAgentConfigResource": { + "WebSearchActionResourceOpenPage": { "type": "object", "properties": { - "enabled": { - "type": "boolean", - "description": "Whether subagent tools are enabled. Defaults to false." + "type": { + "type": "string", + "enum": [ + "open_page" + ], + "default": "open_page", + "x-stainless-const": true, + "description": "The type of the object. Always `open_page`." }, - "max_concurrent_subagents": { + "url": { "type": [ - "integer", + "string", "null" ], - "format": "int64", - "minimum": 1, - "maximum": 4294967295, - "description": "Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled." + "minLength": 0, + "description": "The URL of the page that was opened." } }, "required": [ - "enabled", - "max_concurrent_subagents" + "type", + "url" ], "additionalProperties": false, - "description": "The resolved configuration for creating and coordinating subagents." + "description": "Opens a web page." }, - "AgentResource": { + "WebSearchActionResourceFindInPage": { "type": "object", "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the reusable agent." - }, - "object": { + "type": { "type": "string", "enum": [ - "agent" + "find_in_page" ], - "default": "agent", + "default": "find_in_page", "x-stainless-const": true, - "description": "The object type. Always `agent`." - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the agent was created." - }, - "updated_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the agent was last updated." + "description": "The type of the object. Always `find_in_page`." }, - "name": { + "url": { "type": [ "string", "null" ], "minLength": 0, - "description": "A human-readable name for the agent, or null if it is unnamed." - }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string", - "minLength": 0 - }, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "Custom string key-value pairs attached to the agent." + "description": "The URL of the page that was searched." }, - "model": { - "type": "string", + "pattern": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The requested model name used for inference." - }, - "reasoning": { - "$ref": "#/components/schemas/ReasoningResource", - "description": "The resolved reasoning configuration, including the model default for an omitted effort." + "description": "The text pattern that was searched for." + } + }, + "required": [ + "type", + "url", + "pattern" + ], + "additionalProperties": false, + "description": "Finds text within a web page." + }, + "WebSearchActionResourceOther": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "other" + ], + "default": "other", + "x-stainless-const": true, + "description": "The type of the object. Always `other`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Another web search action." + }, + "WebSearchActionResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/WebSearchActionResourceSearch" }, - "text": { - "$ref": "#/components/schemas/TextResource", - "description": "The resolved configuration for text generated by the agent." + { + "$ref": "#/components/schemas/WebSearchActionResourceOpenPage" }, - "service_tier": { - "$ref": "#/components/schemas/ServiceTierResource", - "description": "The resolved service-tier policy used for model requests." + { + "$ref": "#/components/schemas/WebSearchActionResourceFindInPage" }, - "instructions": { - "type": [ - "string", - "null" + { + "$ref": "#/components/schemas/WebSearchActionResourceOther" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "search": "#/components/schemas/WebSearchActionResourceSearch", + "open_page": "#/components/schemas/WebSearchActionResourceOpenPage", + "find_in_page": "#/components/schemas/WebSearchActionResourceFindInPage", + "other": "#/components/schemas/WebSearchActionResourceOther" + } + }, + "x-oai-discriminator-values": [ + "search", + "open_page", + "find_in_page", + "other" + ], + "description": "An action performed by the web search tool." + }, + "WebSearchCallItemResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "web_search_call" ], + "default": "web_search_call", + "x-stainless-const": true, + "description": "The item type. Always `web_search_call`." + }, + "id": { + "type": "string", "minLength": 0, - "description": "Custom instructions appended to the agent's default base instructions." + "description": "The ID of the web search call." }, - "tools": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PersistedAgentToolResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Tools available to the agent." + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." }, - "multi_agent": { - "$ref": "#/components/schemas/MultiAgentConfigResource", - "description": "The resolved configuration for creating and coordinating subagents." + "status": { + "$ref": "#/components/schemas/OutputItemStatusResource", + "description": "The status of the web search call." }, - "x_agents_core": { + "action": { "anyOf": [ { - "$ref": "#/components/schemas/v1.SavedAgentCore" + "$ref": "#/components/schemas/WebSearchActionResource" }, { "type": "null" } - ] + ], + "description": "The action performed by the web search tool." } }, "required": [ + "type", "id", - "object", - "created_at", - "updated_at", - "name", - "metadata", - "model", - "reasoning", - "text", - "service_tier", - "instructions", - "tools", - "multi_agent" + "turn_id", + "status", + "action" ], "additionalProperties": false, - "description": "A reusable agent scoped to the caller's project." + "description": "A web search call produced by the agent." }, - "AgentListResource": { + "CommandExecutionItemResource": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "command_execution" ], - "default": "list", + "default": "command_execution", "x-stainless-const": true, - "description": "The object type, which is always `list`." + "description": "The item type. Always `command_execution`." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AgentResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the command execution item." }, - "first_id": { + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "command": { + "type": "string", + "minLength": 0, + "description": "The command that was executed." + }, + "cwd": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "description": "The working directory used to execute the command." }, - "last_id": { + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the command execution." + }, + "output": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "description": "The command output, if available." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." - }, - "ReasoningEffortParam": { - "type": "string", - "enum": [ - "none", - "minimal", - "low", - "medium", - "high", - "xhigh", - "max" - ], - "description": "The amount of reasoning effort the model should use." - }, - "ReasoningSummaryParam": { - "type": "string", - "enum": [ - "concise", - "detailed", - "auto" - ], - "x-enumDescriptions": [ - "Returns a concise reasoning summary when supported.", - "Returns a detailed reasoning summary when supported.", - "Automatically selects the most detailed summary supported by the model." - ], - "description": "The reasoning summary format requested from the model." - }, - "ReasoningParam": { - "type": "object", - "properties": { - "effort": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningEffortParam" - }, - { - "type": "null" - } + "exit_code": { + "type": [ + "integer", + "null" ], - "description": "The amount of reasoning effort the model should use. Omission lets the model select it." + "format": "int64", + "description": "The process exit code, if the command completed." }, - "summary": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningSummaryParam" - }, - { - "type": "null" - } + "duration_ms": { + "type": [ + "integer", + "null" ], - "description": "Controls whether the response includes a reasoning summary." + "format": "int64", + "description": "The command duration in milliseconds." } }, + "required": [ + "type", + "id", + "turn_id", + "command", + "cwd", + "status", + "output", + "exit_code", + "duration_ms" + ], "additionalProperties": false, - "description": "Reasoning configuration for the agent." + "description": "A command execution produced by the agent." }, - "TextFormatParamText": { + "InterruptSubagentCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "text" + "interrupt_subagent_call" ], - "default": "text", + "default": "interrupt_subagent_call", "x-stainless-const": true, - "description": "The type of the object. Always `text`." + "description": "The item type. Always `interrupt_subagent_call`." + }, + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the tool call item." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." + }, + "sender_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent requesting the interrupt." + }, + "recipient_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent to interrupt." } }, "required": [ - "type" + "type", + "id", + "turn_id", + "status", + "sender_agent_id", + "recipient_agent_id" ], "additionalProperties": false, - "description": "Generates ordinary text without a structured-output constraint." + "description": "A request to interrupt a subagent's current turn. The subagent remains available." }, - "TextFormatParamJsonSchema": { + "CreateSubagentCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "json_schema" + "create_subagent_call" ], - "default": "json_schema", + "default": "create_subagent_call", "x-stainless-const": true, - "description": "The type of the object. Always `json_schema`." + "description": "The item type. Always `create_subagent_call`." }, - "schema": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the tool call item." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." + }, + "agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent that requested the subagent." + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AgentContentResource" }, - "minProperties": 0, - "maxProperties": 1024, - "description": "The JSON Schema that generated text must match." - } - }, - "required": [ - "type", - "schema" - ], - "additionalProperties": false, - "description": "Constrains generated text to a JSON Schema." - }, - "TextFormatParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/TextFormatParamText" + "minItems": 0, + "maxItems": 2000, + "description": "The task given to the spawned agent." }, - { - "$ref": "#/components/schemas/TextFormatParamJsonSchema" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "text": "#/components/schemas/TextFormatParamText", - "json_schema": "#/components/schemas/TextFormatParamJsonSchema" - } - }, - "x-oai-discriminator-values": [ - "text", - "json_schema" - ], - "description": "The output format for generated text." - }, - "VerbosityParam": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ], - "x-enumDescriptions": [ - "Produces less text.", - "Uses the default amount of text.", - "Produces more text." - ], - "description": "The amount of text the model should produce." - }, - "TextParam": { - "type": "object", - "properties": { - "format": { - "anyOf": [ - { - "$ref": "#/components/schemas/TextFormatParam" - }, - { - "type": "null" - } + "model": { + "type": [ + "string", + "null" ], - "description": "The output format. Omission uses ordinary text (`{\"type\": \"text\"}`)." + "minLength": 0, + "description": "The model requested for the spawned agent." }, - "verbosity": { - "anyOf": [ - { - "$ref": "#/components/schemas/VerbosityParam" - }, - { - "type": "null" - } + "reasoning_effort": { + "type": [ + "string", + "null" ], - "description": "The amount of text the model should produce. Defaults to `medium`, matching Responses." + "minLength": 0, + "description": "The reasoning effort requested for the spawned agent." } }, - "additionalProperties": false, - "description": "Configuration for text generated by the agent." - }, - "ServiceTierParam": { - "type": "string", - "enum": [ - "auto", - "default", - "flex", - "priority", - "fast" - ], - "x-enumDescriptions": [ - "Selects the service tier automatically.", - "Uses the default service tier.", - "Uses the flex service tier.", - "Uses the priority service tier.", - "Uses the fast service tier." + "required": [ + "type", + "id", + "turn_id", + "status", + "agent_id", + "content", + "model", + "reasoning_effort" ], - "description": "The service tier used for model requests." + "additionalProperties": false, + "description": "A request to spawn a subagent." }, - "PersistedAgentToolConfigParamFunction": { + "SendSubagentInputCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "function" + "send_subagent_input_call" ], - "default": "function", + "default": "send_subagent_input_call", "x-stainless-const": true, - "description": "The type of the object. Always `function`." + "description": "The item type. Always `send_subagent_input_call`." }, - "name": { + "id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The name of the function." + "description": "The ID of the tool call item." }, - "description": { + "turn_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "A description of what the function does." + "description": "The ID of the turn that contains this item." }, - "parameters": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "A JSON Schema object describing the function's arguments." + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." }, - "defer_loading": { - "type": "boolean", - "default": false, - "description": "Whether this function is deferred and discovered through tool search. Defaults to `false`." + "sender_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent sending the input." + }, + "recipient_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent receiving the input." + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AgentContentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The input sent to the receiving agent." } }, "required": [ "type", - "name", - "description", - "parameters" + "id", + "turn_id", + "status", + "sender_agent_id", + "recipient_agent_id", + "content" ], "additionalProperties": false, - "description": "A function defined by the application." + "description": "A request to send input to another agent." }, - "PersistedAgentToolConfigParamToolSearch": { + "ResumeSubagentCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "tool_search" + "resume_subagent_call" ], - "default": "tool_search", + "default": "resume_subagent_call", "x-stainless-const": true, - "description": "The type of the object. Always `tool_search`." - } - }, - "required": [ - "type" - ], - "additionalProperties": false, - "description": "Discovers deferred function tools and loads them into the model context." - }, - "PersistedAgentToolConfigParamProgrammaticToolCalling": { - "type": "object", - "properties": { - "type": { + "description": "The item type. Always `resume_subagent_call`." + }, + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the tool call item." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." + }, + "sender_agent_id": { "type": "string", - "enum": [ - "programmatic_tool_calling" - ], - "default": "programmatic_tool_calling", - "x-stainless-const": true, - "description": "The type of the object. Always `programmatic_tool_calling`." + "minLength": 0, + "description": "The ID of the agent requesting the resume." }, - "enabled": { - "type": "boolean", - "default": true, - "description": "Whether tools can be called from model-generated code. Defaults to `true`." + "recipient_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent to resume." } }, "required": [ - "type" + "type", + "id", + "turn_id", + "status", + "sender_agent_id", + "recipient_agent_id" ], "additionalProperties": false, - "description": "Enables calling tools from model-generated code." + "description": "A request to resume a subagent." }, - "PersistedMcpTransportConfigParamHttp": { + "WaitForSubagentsCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "http" + "wait_for_subagents_call" ], - "default": "http", + "default": "wait_for_subagents_call", "x-stainless-const": true, - "description": "The type of the object. Always `http`." + "description": "The item type. Always `wait_for_subagents_call`." }, - "server_url": { + "id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The URL of the MCP server." + "description": "The ID of the tool call item." }, - "headers": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." + }, + "sender_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent waiting for results." + }, + "recipient_agent_ids": { + "type": "array", + "items": { "type": "string", - "minLength": 1, - "maxLength": 256 + "minLength": 0 }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Non-secret HTTP headers sent to the MCP server." + "minItems": 0, + "maxItems": 2000, + "description": "The IDs of the agents to wait for." } }, "required": [ "type", - "server_url" + "id", + "turn_id", + "status", + "sender_agent_id", + "recipient_agent_ids" ], "additionalProperties": false, - "description": "Connects to an MCP server over HTTP." + "description": "A request to wait for one or more subagents." }, - "PersistedMcpTransportConfigParamStdio": { + "CloseSubagentCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "stdio" + "close_subagent_call" ], - "default": "stdio", + "default": "close_subagent_call", "x-stainless-const": true, - "description": "The type of the object. Always `stdio`." + "description": "The item type. Always `close_subagent_call`." }, - "command": { + "id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The command used to start the MCP server." + "description": "The ID of the tool call item." }, - "args": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Arguments passed to the MCP server command." + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." }, - "cwd": { + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." + }, + "sender_agent_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The working directory used to start the MCP server." + "description": "The ID of the agent requesting the close." }, - "env_vars": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Environment variable names to inherit from the selected execution environment." + "recipient_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent to close." } }, "required": [ "type", - "command", - "cwd" + "id", + "turn_id", + "status", + "sender_agent_id", + "recipient_agent_id" ], "additionalProperties": false, - "description": "Starts an MCP server as a local process." + "description": "A request to close a subagent." }, - "PersistedMcpTransportConfigParam": { + "SessionTurnItemResource": { "oneOf": [ { - "$ref": "#/components/schemas/PersistedMcpTransportConfigParamHttp" + "$ref": "#/components/schemas/MessageItemResource" }, { - "$ref": "#/components/schemas/PersistedMcpTransportConfigParamStdio" + "$ref": "#/components/schemas/ReasoningItemResource" + }, + { + "$ref": "#/components/schemas/FunctionCallItemResource" + }, + { + "$ref": "#/components/schemas/FunctionCallOutputItemResource" + }, + { + "$ref": "#/components/schemas/AgentMessageItemResource" + }, + { + "$ref": "#/components/schemas/McpCallItemResource" + }, + { + "$ref": "#/components/schemas/ComputerUseCallItemResource" + }, + { + "$ref": "#/components/schemas/BrowserAuthenticationRequestItemResource" + }, + { + "$ref": "#/components/schemas/ComputerUseApprovalRequestResultItemResource" + }, + { + "$ref": "#/components/schemas/WebSearchCallItemResource" + }, + { + "$ref": "#/components/schemas/CommandExecutionItemResource" + }, + { + "$ref": "#/components/schemas/CreateSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/SendSubagentInputCallItemResource" + }, + { + "$ref": "#/components/schemas/ResumeSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/WaitForSubagentsCallItemResource" + }, + { + "$ref": "#/components/schemas/InterruptSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/CloseSubagentCallItemResource" } ], "discriminator": { "propertyName": "type", "mapping": { - "http": "#/components/schemas/PersistedMcpTransportConfigParamHttp", - "stdio": "#/components/schemas/PersistedMcpTransportConfigParamStdio" + "message": "#/components/schemas/MessageItemResource", + "reasoning": "#/components/schemas/ReasoningItemResource", + "function_call": "#/components/schemas/FunctionCallItemResource", + "function_call_output": "#/components/schemas/FunctionCallOutputItemResource", + "agent_message": "#/components/schemas/AgentMessageItemResource", + "mcp_call": "#/components/schemas/McpCallItemResource", + "computer_use_call": "#/components/schemas/ComputerUseCallItemResource", + "computer_use_approval_request": "#/components/schemas/BrowserAuthenticationRequestItemResource", + "computer_use_approval_request_result": "#/components/schemas/ComputerUseApprovalRequestResultItemResource", + "web_search_call": "#/components/schemas/WebSearchCallItemResource", + "command_execution": "#/components/schemas/CommandExecutionItemResource", + "interrupt_subagent_call": "#/components/schemas/InterruptSubagentCallItemResource", + "create_subagent_call": "#/components/schemas/CreateSubagentCallItemResource", + "send_subagent_input_call": "#/components/schemas/SendSubagentInputCallItemResource", + "resume_subagent_call": "#/components/schemas/ResumeSubagentCallItemResource", + "wait_for_subagents_call": "#/components/schemas/WaitForSubagentsCallItemResource", + "close_subagent_call": "#/components/schemas/CloseSubagentCallItemResource" } }, "x-oai-discriminator-values": [ - "http", - "stdio" - ], - "description": "A credential-free transport used to connect to an MCP server." - }, - "McpConnectionOriginParam": { - "type": "string", - "enum": [ - "service", - "environment" - ], - "x-enumDescriptions": [ - "Uses the Managed Agents service network.", - "Uses the session's execution environment." + "message", + "reasoning", + "function_call", + "function_call_output", + "agent_message", + "mcp_call", + "computer_use_call", + "computer_use_approval_request", + "computer_use_approval_request_result", + "web_search_call", + "command_execution", + "create_subagent_call", + "send_subagent_input_call", + "resume_subagent_call", + "wait_for_subagents_call", + "interrupt_subagent_call", + "close_subagent_call" ], - "description": "Where outbound MCP HTTP connections originate." + "description": "An item associated with a session turn." }, - "PersistedAgentToolConfigParamMcp": { + "SessionItemListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "mcp" + "list" ], - "default": "mcp", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `mcp`." + "description": "The object type, which is always `list`." }, - "server_label": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "A label used to identify the MCP server in tool calls." + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionTurnItemResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." }, - "credential_id": { + "first_id": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 1048576, - "description": "The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL." - }, - "transport": { - "$ref": "#/components/schemas/PersistedMcpTransportConfigParam", - "description": "The credential-free transport used to connect to the MCP server." - }, - "request_metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Metadata included with requests to this MCP server." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "allowed_tools": { + "last_id": { "type": [ - "array", + "string", "null" ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "The MCP tools the agent may call. All server tools are allowed when omitted." + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, - "required": { + "has_more": { "type": "boolean", - "default": false, - "description": "Whether this MCP server must initialize before the first turn. Defaults to `false`." - }, - "connection_origin": { - "anyOf": [ - { - "$ref": "#/components/schemas/McpConnectionOriginParam" - }, - { - "type": "null" - } - ], - "description": "Selects where outbound MCP HTTP connections originate." + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type", - "server_label", - "transport" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "Tools provided by a remote MCP server without stored credentials." + "description": "A page of messages, reasoning, and tool calls from a session's item history." }, - "WebSearchModeParam": { + "TurnObjectResource": { "type": "string", "enum": [ - "disabled", - "cached", - "live" + "agent.session.turn" + ], + "default": "agent.session.turn", + "x-stainless-const": true, + "description": "The object type for a turn." + }, + "TurnStatusResource": { + "type": "string", + "enum": [ + "queued", + "in_progress", + "waiting", + "completed", + "failed", + "cancelled" ], "x-enumDescriptions": [ - "Disables web search.", - "Uses cached search results.", - "Searches the live web." + "The turn is waiting to start.", + "The turn is in progress.", + "The turn is waiting for external input.", + "The turn completed successfully.", + "The turn failed.", + "The turn was cancelled." ], - "description": "The source used for web search results." + "description": "The current status of a turn." }, - "WebSearchContextSizeParam": { + "SessionTurnErrorCodeResource": { "type": "string", "enum": [ - "low", - "medium", - "high" + "context_length_exceeded", + "session_budget_exceeded", + "usage_limit_exceeded", + "project_spend_limit_exceeded", + "organization_spend_limit_exceeded", + "organization_usage_limit_exceeded", + "billing_not_active", + "credit_balance_exhausted", + "rate_limit_exceeded", + "flex_unavailable", + "server_overloaded", + "cyber_policy", + "misalignment_policy_violation", + "connection_failed", + "server_error", + "authentication_error", + "invalid_request", + "resource_not_found", + "sandbox_error", + "executor_version_incompatible", + "active_turn_not_steerable", + "request_timeout", + "internal_error" ], - "description": "The amount of web search context made available to the model." + "x-enumDescriptions": [ + "The request exceeds the model's context window.", + "The session has reached its usage budget.", + "The organization has reached a usage, plan, or billing limit.", + "The project has reached its enforced spend limit.", + "The organization has reached its enforced spend limit.", + "The organization has reached its OpenAI-assigned usage limit.", + "Billing is not active for the account.", + "The organization has no API credits remaining.", + "The request exceeds the available rate limit.", + "Flex processing is temporarily unavailable.", + "The model service is temporarily overloaded.", + "The request was rejected by a safety policy.", + "The request was blocked by the safety systems.", + "The request could not connect to the model service.", + "The model service encountered an unexpected error.", + "The API credentials are invalid or lack the required access.", + "The request contains invalid input or configuration.", + "The requested model or resource is unavailable.", + "The request could not complete in its execution environment.", + "The executor must be upgraded before it can run this turn.", + "The session cannot accept additional input while a request is running.", + "The request timed out before the model service responded.", + "An unexpected internal error prevented the session request from completing." + ], + "description": "Stable public categories for session request failures." }, - "WebSearchLocationParam": { + "SessionTurnErrorResource": { "type": "object", "properties": { - "country": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The two-letter ISO country code, such as `US`." - }, - "region": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The region or state name." - }, - "city": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The city name." + "code": { + "$ref": "#/components/schemas/SessionTurnErrorCodeResource", + "description": "A stable, machine-readable failure category." }, - "timezone": { - "type": [ - "string", - "null" - ], + "message": { + "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The IANA timezone, such as `America/Los_Angeles`." + "description": "A customer-safe explanation of the failure." } }, + "required": [ + "code", + "message" + ], "additionalProperties": false, - "description": "Approximate user location used to localize web search results." + "description": "A customer-safe error describing why a session request failed." }, - "PersistedAgentToolConfigParamWebSearch": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "web_search" - ], - "default": "web_search", - "x-stainless-const": true, - "description": "The type of the object. Always `web_search`." - }, - "mode": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchModeParam" - }, - { - "type": "null" - } - ], - "description": "The source used for web search results. Defaults to `live`." - }, - "context_size": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchContextSizeParam" - }, - { - "type": "null" - } - ], - "description": "The amount of search context made available to the model. Defaults to `medium`." - }, - "allowed_domains": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Domains the search may include." - }, - "location": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchLocationParam" - }, - { - "type": "null" - } - ], - "description": "Approximate location used to localize search results." + "InputTokensDetailsResource-2": { + "type": "object", + "properties": { + "cached_tokens": { + "type": "integer", + "format": "int64", + "description": "The number of input tokens retrieved from the prompt cache." } }, "required": [ - "type" + "cached_tokens" ], "additionalProperties": false, - "description": "Web search." + "description": "A breakdown of input token usage for a session or turn." }, - "PersistedAgentToolConfigParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamFunction" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamToolSearch" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamMcp" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamWebSearch" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "function": "#/components/schemas/PersistedAgentToolConfigParamFunction", - "tool_search": "#/components/schemas/PersistedAgentToolConfigParamToolSearch", - "programmatic_tool_calling": "#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling", - "mcp": "#/components/schemas/PersistedAgentToolConfigParamMcp", - "web_search": "#/components/schemas/PersistedAgentToolConfigParamWebSearch" + "OutputTokensDetailsResource-2": { + "type": "object", + "properties": { + "reasoning_tokens": { + "type": "integer", + "format": "int64", + "description": "The number of output tokens used for reasoning." } }, - "x-oai-discriminator-values": [ - "function", - "tool_search", - "programmatic_tool_calling", - "mcp", - "web_search" + "required": [ + "reasoning_tokens" ], - "description": "A tool that can be stored on a reusable agent without session credentials." + "additionalProperties": false, + "description": "A breakdown of output token usage for a session or turn." }, - "MultiAgentConfigCurrentParam": { + "TokenUsageResource": { "type": "object", "properties": { - "enabled": { - "type": "boolean", - "description": "Whether subagent tools are enabled." + "input_tokens": { + "type": "integer", + "format": "int64", + "description": "The number of input tokens used by the agent." }, - "max_concurrent_subagents": { + "input_tokens_details": { + "$ref": "#/components/schemas/InputTokensDetailsResource-2", + "description": "A breakdown of the agent's input token usage." + }, + "output_tokens": { "type": "integer", "format": "int64", - "minimum": 1, - "maximum": 4294967295, - "description": "Maximum number of subagents that may run concurrently. Defaults to 6." + "description": "The number of output tokens generated by the agent." + }, + "output_tokens_details": { + "$ref": "#/components/schemas/OutputTokensDetailsResource-2", + "description": "A breakdown of the agent's output token usage." + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "description": "The total number of input and output tokens used by the agent." } }, "required": [ - "enabled" + "input_tokens", + "input_tokens_details", + "output_tokens", + "output_tokens_details", + "total_tokens" ], "additionalProperties": false, - "description": "Explicit configuration for creating and coordinating subagents." + "description": "Recorded token usage for a session or turn. Usage is best effort and may change." }, - "CreateAgentParams": { + "TurnResource": { "type": "object", "properties": { - "metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 512 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 64 - }, - "minProperties": 0, - "maxProperties": 16, - "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map." + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn." }, - "name": { - "type": [ - "string", - "null" - ], + "object": { + "$ref": "#/components/schemas/TurnObjectResource", + "description": "The object type. Always `agent.session.turn`." + }, + "session_id": { + "type": "string", "minLength": 0, - "maxLength": 128, - "description": "A human-readable name for the agent. Omission or null leaves the agent unnamed." + "description": "The ID of the session that owns the turn." }, - "model": { + "agent_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The model to use for the agent. The requested model name is preserved." + "description": "The ID of the agent that ran the turn." }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningParam" - }, - { - "type": "null" - } + "subagent_id": { + "type": [ + "string", + "null" ], - "description": "Configuration for model reasoning. Omission uses the model's default effort." + "minLength": 0, + "description": "The ID of the subagent that ran the turn, if applicable." }, - "text": { - "anyOf": [ - { - "$ref": "#/components/schemas/TextParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for generated text. Defaults to the `text` format and medium verbosity." + "status": { + "$ref": "#/components/schemas/TurnStatusResource", + "description": "The current status of the turn." }, - "service_tier": { - "anyOf": [ - { - "$ref": "#/components/schemas/ServiceTierParam" - }, - { - "type": "null" - } - ], - "description": "The service tier used for model requests. Defaults to `auto`." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable." }, - "instructions": { + "started_at": { "type": [ - "string", + "integer", "null" ], - "minLength": 0, - "maxLength": 1048576, - "description": "Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions." + "format": "int64", + "description": "The Unix timestamp, in seconds, when the turn started." }, - "tools": { + "completed_at": { "type": [ - "array", + "integer", "null" ], - "items": { - "$ref": "#/components/schemas/PersistedAgentToolConfigParam" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Tools available to the agent. Defaults to an empty list." + "format": "int64", + "description": "The Unix timestamp, in seconds, when the turn reached a terminal state." }, - "multi_agent": { + "error": { "anyOf": [ { - "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" + "$ref": "#/components/schemas/SessionTurnErrorResource" }, { "type": "null" } ], - "description": "Configuration for creating and coordinating subagents. Subagent tools are disabled by default." + "description": "A customer-safe error. Non-null only for a failed turn." }, - "x_agents_core": { + "usage": { "anyOf": [ { - "$ref": "#/components/schemas/v1.SavedAgentCoreInput" + "$ref": "#/components/schemas/TokenUsageResource" }, { "type": "null" } - ] + ], + "description": "Best-effort token usage for the turn, or null if unknown. Recorded usage may change." } }, "required": [ - "model" + "id", + "object", + "session_id", + "agent_id", + "subagent_id", + "status", + "created_at", + "started_at", + "completed_at", + "error", + "usage" ], "additionalProperties": false, - "description": "Parameters for creating a reusable agent." + "description": "The canonical public representation of a session turn." }, - "UpdateAgentParams": { + "SessionTurnListResource": { "type": "object", - "properties": { - "model": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The model to use for the agent. The requested model name is preserved." - }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort." - }, - "text": { - "anyOf": [ - { - "$ref": "#/components/schemas/TextParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for text generated by the agent." - }, - "service_tier": { - "anyOf": [ - { - "$ref": "#/components/schemas/ServiceTierParam" - }, - { - "type": "null" - } + "properties": { + "object": { + "type": "string", + "enum": [ + "list" ], - "description": "The service tier used for model requests." + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." }, - "instructions": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TurnResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 1048576, - "description": "Additional instructions appended to the agent's default base instructions. Omit to leave unchanged." - }, - "multi_agent": { - "anyOf": [ - { - "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for creating and coordinating subagents." - }, - "metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 512 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 64 - }, - "minProperties": 0, - "maxProperties": 16, - "description": "Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "name": { + "last_id": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 128, - "description": "A replacement name. Omit to leave unchanged, or pass null to clear it." + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, - "tools": { - "type": [ - "array", - "null" + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." + }, + "PersistedAgentToolResourceFunction": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" ], - "items": { - "$ref": "#/components/schemas/PersistedAgentToolConfigParam" + "default": "function", + "x-stainless-const": true, + "description": "The type of the object. Always `function`." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The name of the function." + }, + "description": { + "type": "string", + "minLength": 0, + "description": "A description of what the function does." + }, + "parameters": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 }, - "minItems": 0, - "maxItems": 2000, - "description": "Tools available to the agent." + "minProperties": 0, + "description": "A JSON Schema object describing the function's arguments." }, - "x_agents_core": { - "anyOf": [ - { - "$ref": "#/components/schemas/v1.SavedAgentCoreInput" - }, - { - "type": "null" - } - ] + "defer_loading": { + "type": "boolean", + "description": "Whether the function is deferred and discovered through tool search." } }, + "required": [ + "type", + "name", + "description", + "parameters", + "defer_loading" + ], "additionalProperties": false, - "description": "Fields to replace on an existing reusable agent." + "description": "A function defined by the application." }, - "DeletedAgentResource": { + "PersistedAgentToolResourceToolSearch": { "type": "object", "properties": { - "id": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the deleted agent." - }, - "object": { + "enum": [ + "tool_search" + ], + "default": "tool_search", + "x-stainless-const": true, + "description": "The type of the object. Always `tool_search`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Discovers deferred function tools and loads them into the model context." + }, + "PersistedAgentToolResourceProgrammaticToolCalling": { + "type": "object", + "properties": { + "type": { "type": "string", "enum": [ - "agent.deleted" + "programmatic_tool_calling" ], - "default": "agent.deleted", + "default": "programmatic_tool_calling", "x-stainless-const": true, - "description": "The object type. Always `agent.deleted`." + "description": "The type of the object. Always `programmatic_tool_calling`." }, - "deleted": { + "enabled": { "type": "boolean", - "description": "Whether the agent was deleted. Always `true`." + "description": "Whether tools can be called from model-generated code." } }, "required": [ - "id", - "object", - "deleted" + "type", + "enabled" ], "additionalProperties": false, - "description": "A deleted reusable agent." + "description": "Enables calling tools from model-generated code." }, - "EnvironmentPackagesResource": { + "PersistedMcpTransportResourceHttp": { "type": "object", "properties": { - "python": { - "type": "array", - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Python packages installed in the environment." + "type": { + "type": "string", + "enum": [ + "http" + ], + "default": "http", + "x-stainless-const": true, + "description": "The type of the object. Always `http`." }, - "system": { - "type": "array", - "items": { + "server_url": { + "type": "string", + "minLength": 0, + "description": "The URL of the MCP server." + }, + "headers": { + "type": "object", + "additionalProperties": { "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 0 }, - "minItems": 0, - "maxItems": 16384, - "description": "System packages installed in the environment." - }, - "npm": { - "type": "array", - "items": { + "propertyNames": { "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 0 }, - "minItems": 0, - "maxItems": 16384, - "description": "npm packages installed globally in the environment." + "minProperties": 0, + "description": "Non-secret HTTP headers sent to the MCP server." } }, "required": [ - "python", - "system", - "npm" + "type", + "server_url", + "headers" ], "additionalProperties": false, - "description": "Packages installed in an OpenAI-hosted environment." - }, - "NetworkAccessResource": { - "type": "string", - "enum": [ - "enabled", - "disabled", - "restricted" - ], - "x-enumDescriptions": [ - "Allows unrestricted network access.", - "Disables network access.", - "Allows access only to configured domains." - ], - "description": "The network access mode for an OpenAI-hosted environment." + "description": "Connects to an MCP server over HTTP." }, - "NetworkPolicyResource": { + "PersistedMcpTransportResourceStdio": { "type": "object", "properties": { - "access": { - "$ref": "#/components/schemas/NetworkAccessResource", - "description": "The environment's network access mode." + "type": { + "type": "string", + "enum": [ + "stdio" + ], + "default": "stdio", + "x-stainless-const": true, + "description": "The type of the object. Always `stdio`." }, - "allowed_domains": { + "command": { + "type": "string", + "minLength": 0, + "description": "The command used to start the MCP server." + }, + "args": { "type": "array", "items": { "type": "string", @@ -11605,286 +17148,399 @@ }, "minItems": 0, "maxItems": 2000, - "description": "Domains the environment may access when network access is restricted." + "description": "Arguments passed to the MCP server command." + }, + "cwd": { + "type": "string", + "minLength": 0, + "description": "The working directory used to start the MCP server." + }, + "env_vars": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Environment variable names inherited from the execution environment." } }, "required": [ - "access", - "allowed_domains" + "type", + "command", + "args", + "cwd", + "env_vars" ], "additionalProperties": false, - "description": "Network access for an OpenAI-hosted environment." + "description": "Starts an MCP server as a local process." }, - "HostedTemplateSkillResourceSkillReference": { + "PersistedMcpTransportResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/PersistedMcpTransportResourceHttp" + }, + { + "$ref": "#/components/schemas/PersistedMcpTransportResourceStdio" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "http": "#/components/schemas/PersistedMcpTransportResourceHttp", + "stdio": "#/components/schemas/PersistedMcpTransportResourceStdio" + } + }, + "x-oai-discriminator-values": [ + "http", + "stdio" + ], + "description": "A credential-free transport used to connect to an MCP server." + }, + "PersistedAgentToolResourceMcp": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "skill_reference" + "mcp" ], - "default": "skill_reference", + "default": "mcp", "x-stainless-const": true, - "description": "The type of the object. Always `skill_reference`." + "description": "The type of the object. Always `mcp`." }, - "skill_id": { + "server_label": { "type": "string", "minLength": 0, - "description": "The referenced skill ID." + "description": "A label used to identify the MCP server in tool calls." }, - "version": { + "credential_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The requested version selector, including `latest`." + "description": "The vault credential selected for this MCP server, if any." + }, + "transport": { + "$ref": "#/components/schemas/PersistedMcpTransportResource", + "description": "The credential-free transport used to connect to the MCP server." + }, + "request_metadata": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Metadata included with requests to this MCP server." + }, + "allowed_tools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "The MCP tools the agent may call, or null when all server tools are allowed." + }, + "required": { + "type": "boolean", + "description": "Whether this MCP server must initialize before the first turn." + }, + "connection_origin": { + "$ref": "#/components/schemas/McpConnectionOriginResource", + "description": "Where outbound MCP HTTP connections originate." } }, "required": [ "type", - "skill_id", - "version" + "server_label", + "credential_id", + "transport", + "request_metadata", + "allowed_tools", + "required", + "connection_origin" ], "additionalProperties": false, - "description": "A skill resolved afresh from the Skills API whenever a session starts." + "description": "Tools provided by a remote MCP server without stored credentials." }, - "HostedTemplateSkillResourceInline": { + "PersistedAgentToolResourceWebSearch": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "web_search" ], - "default": "inline", + "default": "web_search", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "description": "The type of the object. Always `web_search`." }, - "name": { - "type": "string", - "minLength": 0, - "description": "The skill name declared in `SKILL.md`." + "mode": { + "$ref": "#/components/schemas/WebSearchModeResource", + "description": "The source used for web search results." }, - "description": { - "type": "string", - "minLength": 0, - "description": "The skill description declared in `SKILL.md`." + "context_size": { + "$ref": "#/components/schemas/WebSearchContextSizeResource", + "description": "The amount of search context made available to the model. Defaults to `medium`." + }, + "allowed_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Allowed search domains, or `null` when the search is unrestricted." + }, + "location": { + "anyOf": [ + { + "$ref": "#/components/schemas/WebSearchLocationResource" + }, + { + "type": "null" + } + ], + "description": "Approximate location used to localize search results, if provided." } }, "required": [ "type", - "name", - "description" + "mode", + "context_size", + "allowed_domains", + "location" ], "additionalProperties": false, - "description": "Safe metadata for an inline skill archive." - }, - "HostedTemplateSkillResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/HostedTemplateSkillResourceSkillReference" - }, - { - "$ref": "#/components/schemas/HostedTemplateSkillResourceInline" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "skill_reference": "#/components/schemas/HostedTemplateSkillResourceSkillReference", - "inline": "#/components/schemas/HostedTemplateSkillResourceInline" - } - }, - "x-oai-discriminator-values": [ - "skill_reference", - "inline" - ], - "description": "Safe metadata for a skill configured by an environment template." + "description": "Web search." }, - "HostedTemplateFileResourceFileId": { + "PersistedAgentToolResourceComputerUse": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "file_id" + "computer_use" ], - "default": "file_id", + "default": "computer_use", "x-stainless-const": true, - "description": "The type of the object. Always `file_id`." + "description": "The type of the object. Always `computer_use`." }, - "file_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the uploaded file." - }, - "path": { - "type": "string", - "minLength": 0, - "description": "The file's absolute path inside the environment." + "include_screenshots": { + "type": "boolean", + "description": "Whether computer tool outputs include screenshots." } }, "required": [ "type", - "file_id", - "path" + "include_screenshots" ], "additionalProperties": false, - "description": "A project-scoped Files API reference resolved separately for each session." + "description": "Browser use in an OpenAI-hosted session." }, - "HostedTemplateFileResourceInline": { + "PersistedAgentToolResourceAutomations": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "automations" ], - "default": "inline", + "default": "automations", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." - }, - "path": { - "type": "string", - "minLength": 0, - "description": "The file's absolute path inside the environment." - }, - "size_bytes": { - "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The decoded size of the inline file in bytes." + "description": "The type of the object. Always `automations`." } }, "required": [ - "type", - "path", - "size_bytes" + "type" ], "additionalProperties": false, - "description": "Metadata for confidential inline file contents." + "description": "Lets the agent manage its own scheduled wakeups." }, - "HostedTemplateFileResource": { + "PersistedAgentToolResource": { "oneOf": [ { - "$ref": "#/components/schemas/HostedTemplateFileResourceFileId" + "$ref": "#/components/schemas/PersistedAgentToolResourceFunction" }, { - "$ref": "#/components/schemas/HostedTemplateFileResourceInline" + "$ref": "#/components/schemas/PersistedAgentToolResourceToolSearch" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolResourceMcp" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolResourceWebSearch" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolResourceComputerUse" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolResourceAutomations" } ], "discriminator": { "propertyName": "type", "mapping": { - "file_id": "#/components/schemas/HostedTemplateFileResourceFileId", - "inline": "#/components/schemas/HostedTemplateFileResourceInline" + "function": "#/components/schemas/PersistedAgentToolResourceFunction", + "tool_search": "#/components/schemas/PersistedAgentToolResourceToolSearch", + "programmatic_tool_calling": "#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling", + "mcp": "#/components/schemas/PersistedAgentToolResourceMcp", + "web_search": "#/components/schemas/PersistedAgentToolResourceWebSearch", + "computer_use": "#/components/schemas/PersistedAgentToolResourceComputerUse", + "automations": "#/components/schemas/PersistedAgentToolResourceAutomations" } }, "x-oai-discriminator-values": [ - "file_id", - "inline" + "function", + "tool_search", + "programmatic_tool_calling", + "mcp", + "web_search", + "computer_use", + "automations" ], - "description": "Safe metadata for a file configured by an environment template." + "description": "A credential-free tool available to a reusable agent." }, - "EnvironmentTemplateResource": { + "AgentResource": { "type": "object", "properties": { "id": { "type": "string", "minLength": 0, - "description": "The ID of the reusable environment template." - }, - "name": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "An optional human-readable display name for the template." + "description": "The ID of the reusable agent." }, "object": { "type": "string", "enum": [ - "agent.environment.template" + "agent" ], - "default": "agent.environment.template", + "default": "agent", "x-stainless-const": true, - "description": "The object type. Always `agent.environment.template`." + "description": "The object type. Always `agent`." }, "created_at": { "type": "integer", "format": "int64", - "description": "The Unix timestamp, in seconds, when the template was created." + "description": "The Unix timestamp, in seconds, when the agent was created." }, "updated_at": { "type": "integer", "format": "int64", - "description": "The Unix timestamp, in seconds, when the template was last updated." - }, - "packages": { - "$ref": "#/components/schemas/EnvironmentPackagesResource", - "description": "Packages installed in each fresh OpenAI-hosted environment." + "description": "The Unix timestamp, in seconds, when the agent was last updated." }, - "network": { - "$ref": "#/components/schemas/NetworkPolicyResource", - "description": "Runtime network access for each OpenAI-hosted environment." + "name": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "A human-readable name for the agent, or null if it is unnamed." }, - "capability_directories": { - "type": "array", - "items": { + "metadata": { + "type": "object", + "additionalProperties": { "type": "string", "minLength": 0 }, - "minItems": 0, - "maxItems": 2000, - "description": "Directories that expose capabilities to the agent." - }, - "skills": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedTemplateSkillResource" + "propertyNames": { + "type": "string", + "minLength": 0 }, - "minItems": 0, - "maxItems": 200, - "description": "Safe skill metadata, preserving unresolved version selectors." + "minProperties": 0, + "description": "Custom string key-value pairs attached to the agent." }, - "plugins": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedPluginResource" - }, - "minItems": 0, - "maxItems": 32, - "description": "Safe plugin metadata, excluding inline archive contents." + "model": { + "type": "string", + "minLength": 0, + "description": "The requested model name used for inference." }, - "files": { + "reasoning": { + "$ref": "#/components/schemas/ReasoningResource", + "description": "The resolved reasoning configuration, including the model default for an omitted effort." + }, + "text": { + "$ref": "#/components/schemas/TextResource", + "description": "The resolved configuration for text generated by the agent." + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTierResource", + "description": "The resolved service-tier policy used for model requests." + }, + "instructions": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "Custom instructions appended to the agent's default base instructions." + }, + "tools": { "type": "array", "items": { - "$ref": "#/components/schemas/HostedTemplateFileResource" + "$ref": "#/components/schemas/PersistedAgentToolResource" }, "minItems": 0, - "maxItems": 50, - "description": "Safe file metadata, excluding contents and session-scoped file IDs." + "maxItems": 2000, + "description": "Tools available to the agent." + }, + "multi_agent": { + "$ref": "#/components/schemas/MultiAgentConfigResource", + "description": "The resolved configuration for creating and coordinating subagents." + }, + "compaction": { + "$ref": "#/components/schemas/CompactionResource", + "description": "The effective context compaction settings." + }, + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigResource", + "description": "The effective experimental settings for the agent." + }, + "x_agents_core": { + "anyOf": [ + { + "$ref": "#/components/schemas/v1.SavedAgentCore" + }, + { + "type": "null" + } + ] } }, "required": [ "id", - "name", "object", "created_at", "updated_at", - "packages", - "network", - "capability_directories", - "skills", - "plugins", - "files" + "name", + "metadata", + "model", + "reasoning", + "text", + "service_tier", + "instructions", + "tools", + "multi_agent" ], "additionalProperties": false, - "description": "Reusable configuration that provisions a fresh OpenAI-hosted environment for each session." + "description": "A reusable agent scoped to the caller's project." }, - "EnvironmentTemplateListResource": { + "AgentListResource": { "type": "object", "properties": { "object": { @@ -11899,7 +17555,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/EnvironmentTemplateResource" + "$ref": "#/components/schemas/AgentResource" }, "minItems": 0, "maxItems": 2000, @@ -11932,379 +17588,281 @@ "first_id", "last_id", "has_more" - ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." - }, - "EnvironmentPackagesParam": { - "type": "object", - "properties": { - "python": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Python packages to install. Defaults to an empty list." - }, - "system": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "System packages to install. Defaults to an empty list." - }, - "npm": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "npm packages to install globally. Defaults to an empty list." - } - }, - "additionalProperties": false, - "description": "Packages to install in an OpenAI-hosted environment." - }, - "SetupCommandParam": { - "type": "object", - "properties": { - "command": { - "type": "string", - "minLength": 0, - "maxLength": 65536, - "description": "The shell command to execute." - }, - "cwd": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 4096, - "description": "The absolute working directory. Defaults to `/workspace`." - } - }, - "required": [ - "command" - ], - "additionalProperties": false, - "description": "A confidential setup command executed before the hosted agent starts." - }, - "NetworkAccessParam": { - "type": "string", - "enum": [ - "enabled", - "disabled", - "restricted" - ], - "x-enumDescriptions": [ - "Allows unrestricted network access, matching an omitted network policy.", - "Disables network access.", - "Allows access only to configured domains." - ], - "description": "The network access mode for an OpenAI-hosted environment." - }, - "NetworkPolicyParam": { - "type": "object", - "properties": { - "access": { - "$ref": "#/components/schemas/NetworkAccessParam", - "description": "The environment's network access mode." - }, - "allowed_domains": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Domains the environment may access when network access is restricted." + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." + }, + "ExperimentalConfigParam": { + "type": "object", + "properties": { + "time_awareness": { + "type": "boolean", + "default": false, + "description": "Whether to give the model periodic current-time reminders. Defaults to false." } }, - "required": [ - "access" - ], "additionalProperties": false, - "description": "Network access for an OpenAI-hosted environment." + "description": "Experimental agent settings. These features may change." }, - "HostedSkillParamSkillReference": { + "PersistedAgentToolConfigParamFunction": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "skill_reference" + "function" ], - "default": "skill_reference", + "default": "function", "x-stainless-const": true, - "description": "The type of the object. Always `skill_reference`." + "description": "The type of the object. Always `function`." }, - "skill_id": { + "name": { "type": "string", - "minLength": 1, - "maxLength": 64, - "description": "The ID of the skill created through `/v1/skills`." + "minLength": 0, + "maxLength": 1048576, + "description": "The name of the function." }, - "version": { - "type": [ - "string", - "null" - ], + "description": { + "type": "string", "minLength": 0, "maxLength": 1048576, - "description": "The skill version, a positive integer or `latest`; omission selects the default." + "description": "A description of what the function does." + }, + "parameters": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "A JSON Schema object describing the function's arguments." + }, + "defer_loading": { + "type": "boolean", + "default": false, + "description": "Whether this function is deferred and discovered through tool search. Defaults to `false`." } }, "required": [ "type", - "skill_id" + "name", + "description", + "parameters" ], "additionalProperties": false, - "description": "References a skill uploaded through the Skills API." + "description": "A function defined by the application." }, - "InlineCapabilitySourceParamBase64": { + "PersistedAgentToolConfigParamToolSearch": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "base64" + "tool_search" ], - "default": "base64", + "default": "tool_search", "x-stainless-const": true, - "description": "The type of the object. Always `base64`." - }, - "media_type": { + "description": "The type of the object. Always `tool_search`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Discovers deferred function tools and loads them into the model context." + }, + "PersistedAgentToolConfigParamProgrammaticToolCalling": { + "type": "object", + "properties": { + "type": { "type": "string", "enum": [ - "application/zip" + "programmatic_tool_calling" ], - "default": "application/zip", + "default": "programmatic_tool_calling", "x-stainless-const": true, - "x-enumDescriptions": [ - "A ZIP archive." - ], - "description": "The archive media type, always `application/zip`." + "description": "The type of the object. Always `programmatic_tool_calling`." }, - "data": { - "type": "string", - "minLength": 1, - "maxLength": 70254592, - "description": "Standard-base64 encoded ZIP archive bytes." + "enabled": { + "type": "boolean", + "default": true, + "description": "Whether tools can be called from model-generated code. Defaults to `true`." } }, "required": [ - "type", - "media_type", - "data" + "type" ], "additionalProperties": false, - "description": "Provides ZIP bytes encoded with standard base64." - }, - "InlineCapabilitySourceParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/InlineCapabilitySourceParamBase64" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "base64": "#/components/schemas/InlineCapabilitySourceParamBase64" - } - }, - "x-oai-discriminator-values": [ - "base64" - ], - "description": "The encoded ZIP archive for an inline skill or plugin." + "description": "Enables calling tools from model-generated code." }, - "HostedSkillParamInline": { + "PersistedMcpTransportConfigParamHttp": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "http" ], - "default": "inline", + "default": "http", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." - }, - "name": { - "type": "string", - "minLength": 1, - "maxLength": 64, - "description": "The skill name declared in `SKILL.md`." + "description": "The type of the object. Always `http`." }, - "description": { + "server_url": { "type": "string", "minLength": 0, "maxLength": 1048576, - "description": "The skill description declared in `SKILL.md`." + "description": "The URL of the MCP server." }, - "source": { - "$ref": "#/components/schemas/InlineCapabilitySourceParam", - "description": "The inline ZIP archive." + "headers": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Non-secret HTTP headers sent to the MCP server." } }, "required": [ "type", - "name", - "description", - "source" + "server_url" ], "additionalProperties": false, - "description": "Supplies a skill ZIP directly in the session request." - }, - "HostedSkillParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/HostedSkillParamSkillReference" - }, - { - "$ref": "#/components/schemas/HostedSkillParamInline" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "skill_reference": "#/components/schemas/HostedSkillParamSkillReference", - "inline": "#/components/schemas/HostedSkillParamInline" - } - }, - "x-oai-discriminator-values": [ - "skill_reference", - "inline" - ], - "description": "A skill installed in an OpenAI-hosted environment." + "description": "Connects to an MCP server over HTTP." }, - "HostedPluginParamInline": { + "PersistedMcpTransportConfigParamStdio": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "stdio" ], - "default": "inline", + "default": "stdio", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "description": "The type of the object. Always `stdio`." }, - "name": { + "command": { "type": "string", - "minLength": 1, - "maxLength": 64, - "description": "The plugin name declared in `.codex-plugin/plugin.json`." + "minLength": 0, + "maxLength": 1048576, + "description": "The command used to start the MCP server." }, - "description": { + "args": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Arguments passed to the MCP server command." + }, + "cwd": { "type": "string", "minLength": 0, "maxLength": 1048576, - "description": "The plugin description declared in `.codex-plugin/plugin.json`." + "description": "The working directory used to start the MCP server." }, - "source": { - "$ref": "#/components/schemas/InlineCapabilitySourceParam", - "description": "The inline ZIP archive." + "env_vars": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Environment variable names to inherit from the selected execution environment." } }, "required": [ "type", - "name", - "description", - "source" + "command", + "cwd" ], "additionalProperties": false, - "description": "Supplies a plugin ZIP directly in the session request." + "description": "Starts an MCP server as a local process." }, - "HostedPluginParam": { + "PersistedMcpTransportConfigParam": { "oneOf": [ { - "$ref": "#/components/schemas/HostedPluginParamInline" + "$ref": "#/components/schemas/PersistedMcpTransportConfigParamHttp" + }, + { + "$ref": "#/components/schemas/PersistedMcpTransportConfigParamStdio" } ], "discriminator": { "propertyName": "type", "mapping": { - "inline": "#/components/schemas/HostedPluginParamInline" + "http": "#/components/schemas/PersistedMcpTransportConfigParamHttp", + "stdio": "#/components/schemas/PersistedMcpTransportConfigParamStdio" } }, "x-oai-discriminator-values": [ - "inline" + "http", + "stdio" ], - "description": "A plugin installed in an OpenAI-hosted environment." + "description": "A credential-free transport used to connect to an MCP server." }, - "CreateEnvironmentTemplateParams": { + "PersistedAgentToolConfigParamMcp": { "type": "object", "properties": { - "packages": { - "anyOf": [ - { - "$ref": "#/components/schemas/EnvironmentPackagesParam" - }, - { - "type": "null" - } + "type": { + "type": "string", + "enum": [ + "mcp" ], - "description": "Packages to install in the environment. Defaults to empty package lists." + "default": "mcp", + "x-stainless-const": true, + "description": "The type of the object. Always `mcp`." }, - "setup_commands": { + "server_label": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "A label used to identify the MCP server in tool calls." + }, + "credential_id": { "type": [ - "array", + "string", "null" ], - "items": { - "$ref": "#/components/schemas/SetupCommandParam" - }, - "minItems": 0, - "maxItems": 16, - "description": "Ordered, confidential setup commands. Command bodies are never returned." + "minLength": 0, + "maxLength": 1048576, + "description": "The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL." }, - "network": { - "anyOf": [ - { - "$ref": "#/components/schemas/NetworkPolicyParam" - }, - { - "type": "null" - } - ], - "description": "Network access policy for the environment. Defaults to enabled." + "transport": { + "$ref": "#/components/schemas/PersistedMcpTransportConfigParam", + "description": "The credential-free transport used to connect to the MCP server." }, - "env": { + "request_metadata": { "type": [ "object", "null" ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, + "additionalProperties": {}, "propertyNames": { "type": "string", "minLength": 1, @@ -12312,9 +17870,9 @@ }, "minProperties": 0, "maxProperties": 1024, - "description": "Environment variables made available to the agent." + "description": "Metadata included with requests to this MCP server." }, - "capability_directories": { + "allowed_tools": { "type": [ "array", "null" @@ -12326,123 +17884,68 @@ }, "minItems": 0, "maxItems": 16384, - "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." - }, - "skills": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedSkillParam" - }, - "minItems": 0, - "maxItems": 200, - "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." - }, - "plugins": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedPluginParam" - }, - "minItems": 0, - "maxItems": 32, - "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." + "description": "The MCP tools the agent may call. All server tools are allowed when omitted." }, - "files": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileParam" - }, - "minItems": 0, - "maxItems": 50, - "description": "Files available before the agent starts. Defaults to an empty list." + "required": { + "type": "boolean", + "default": false, + "description": "Whether this MCP server must initialize before the first turn. Defaults to `false`." }, - "name": { - "type": [ - "string", - "null" + "connection_origin": { + "anyOf": [ + { + "$ref": "#/components/schemas/McpConnectionOriginParam" + }, + { + "type": "null" + } ], - "minLength": 1, - "maxLength": 256, - "description": "An optional human-readable display name for the template." + "description": "Selects where outbound MCP HTTP connections originate." } }, + "required": [ + "type", + "server_label", + "transport" + ], "additionalProperties": false, - "description": "Parameters for creating a reusable, project-scoped OpenAI-hosted environment template." + "description": "Tools provided by a remote MCP server without stored credentials." }, - "UpdateEnvironmentTemplateParams": { + "PersistedAgentToolConfigParamWebSearch": { "type": "object", "properties": { - "name": { - "type": [ - "string", - "null" + "type": { + "type": "string", + "enum": [ + "web_search" ], - "minLength": 1, - "maxLength": 256, - "description": "A replacement human-readable display name, or `null` to clear the name." + "default": "web_search", + "x-stainless-const": true, + "description": "The type of the object. Always `web_search`." }, - "packages": { + "mode": { "anyOf": [ { - "$ref": "#/components/schemas/EnvironmentPackagesParam" + "$ref": "#/components/schemas/WebSearchModeParam" }, { "type": "null" } ], - "description": "Packages installed before the runtime network policy applies." - }, - "setup_commands": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/SetupCommandParam" - }, - "minItems": 0, - "maxItems": 16, - "description": "Replacement confidential setup commands, never included in returned resources." + "description": "The source used for web search results. Defaults to `live`." }, - "network": { + "context_size": { "anyOf": [ { - "$ref": "#/components/schemas/NetworkPolicyParam" + "$ref": "#/components/schemas/WebSearchContextSizeParam" }, { "type": "null" } ], - "description": "Network access available after setup completes." - }, - "env": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Replacement confidential environment values." + "description": "The amount of search context made available to the model. Defaults to `medium`." }, - "capability_directories": { + "allowed_domains": { "type": [ "array", "null" @@ -12454,521 +17957,422 @@ }, "minItems": 0, "maxItems": 16384, - "description": "Directories that expose capabilities to the agent." - }, - "skills": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedSkillParam" - }, - "minItems": 0, - "maxItems": 200, - "description": "Replacement skill configuration installed for each new session." - }, - "plugins": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedPluginParam" - }, - "minItems": 0, - "maxItems": 32, - "description": "Replacement plugin configuration installed for each new session." - }, - "files": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileParam" - }, - "minItems": 0, - "maxItems": 50, - "description": "Replacement file configuration materialized for each new session." - } - }, - "additionalProperties": false, - "description": "Fields to replace on an existing reusable OpenAI-hosted environment template." - }, - "DeletedEnvironmentTemplateResource": { - "type": "object", - "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the deleted environment template." - }, - "object": { - "type": "string", - "enum": [ - "agent.environment.template.deleted" - ], - "default": "agent.environment.template.deleted", - "x-stainless-const": true, - "description": "The object type. Always `agent.environment.template.deleted`." + "description": "Domains the search may include." }, - "deleted": { - "type": "boolean", - "description": "Whether the environment template was deleted. Always `true`." + "location": { + "anyOf": [ + { + "$ref": "#/components/schemas/WebSearchLocationParam" + }, + { + "type": "null" + } + ], + "description": "Approximate location used to localize search results." } }, "required": [ - "id", - "object", - "deleted" + "type" ], "additionalProperties": false, - "description": "A deleted reusable environment template." - }, - "SessionStatusResource": { - "type": "string", - "enum": [ - "idle", - "in_progress", - "requires_action", - "failed" - ], - "x-enumDescriptions": [ - "The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.", - "The session is processing a turn.", - "The session is waiting for one or more required actions.", - "The session failed." - ], - "description": "The current status of a session." + "description": "Web search." }, - "SessionRequiredActionResourceFunctionCall": { + "PersistedAgentToolConfigParamComputerUse": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "function_call" + "computer_use" ], - "default": "function_call", + "default": "computer_use", "x-stainless-const": true, - "description": "The type of the object. Always `function_call`." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that requested the function call." - }, - "call_id": { - "type": "string", - "minLength": 0, - "description": "The ID to include when submitting the function result." - }, - "name": { - "type": "string", - "minLength": 0, - "description": "The function name." + "description": "The type of the object. Always `computer_use`." }, - "arguments": { - "description": "The arguments supplied by the model." + "include_screenshots": { + "type": "boolean", + "default": false, + "description": "Whether computer tool outputs include screenshots. Defaults to `false`." } }, "required": [ - "type", - "turn_id", - "call_id", - "name", - "arguments" + "type" ], "additionalProperties": false, - "description": "Run a function tool and submit its result." + "description": "Browser use in an OpenAI-hosted session." }, - "SessionRequiredActionResourceEnvironmentConnection": { + "PersistedAgentToolConfigParamAutomations": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "environment_connection" + "automations" ], - "default": "environment_connection", + "default": "automations", "x-stainless-const": true, - "description": "The type of the object. Always `environment_connection`." - }, - "environment_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the environment to reconnect." + "description": "The type of the object. Always `automations`." } }, "required": [ - "type", - "environment_id" + "type" ], "additionalProperties": false, - "description": "Reconnect a session environment." + "description": "Lets the agent manage its own scheduled wakeups." }, - "SessionRequiredActionResource": { + "PersistedAgentToolConfigParam": { "oneOf": [ { - "$ref": "#/components/schemas/SessionRequiredActionResourceFunctionCall" + "$ref": "#/components/schemas/PersistedAgentToolConfigParamFunction" }, { - "$ref": "#/components/schemas/SessionRequiredActionResourceEnvironmentConnection" + "$ref": "#/components/schemas/PersistedAgentToolConfigParamToolSearch" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamMcp" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamWebSearch" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamComputerUse" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamAutomations" } ], "discriminator": { "propertyName": "type", "mapping": { - "function_call": "#/components/schemas/SessionRequiredActionResourceFunctionCall", - "environment_connection": "#/components/schemas/SessionRequiredActionResourceEnvironmentConnection" + "function": "#/components/schemas/PersistedAgentToolConfigParamFunction", + "tool_search": "#/components/schemas/PersistedAgentToolConfigParamToolSearch", + "programmatic_tool_calling": "#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling", + "mcp": "#/components/schemas/PersistedAgentToolConfigParamMcp", + "web_search": "#/components/schemas/PersistedAgentToolConfigParamWebSearch", + "computer_use": "#/components/schemas/PersistedAgentToolConfigParamComputerUse", + "automations": "#/components/schemas/PersistedAgentToolConfigParamAutomations" } }, "x-oai-discriminator-values": [ - "function_call", - "environment_connection" + "function", + "tool_search", + "programmatic_tool_calling", + "mcp", + "web_search", + "computer_use", + "automations" ], - "description": "An action that must be completed before a session can continue." + "description": "A tool that can be stored on a reusable agent without session credentials." }, - "AgentToolResourceFunction": { + "CreateAgentParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "function" + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigParam", + "default": { + "time_awareness": false + }, + "description": "Experimental agent settings. All experimental features default to disabled." + }, + "metadata": { + "type": [ + "object", + "null" ], - "default": "function", - "x-stainless-const": true, - "description": "The type of the object. Always `function`." + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map." }, "name": { - "type": "string", + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The name of the function." + "maxLength": 128, + "description": "A human-readable name for the agent. Omission or null leaves the agent unnamed." }, - "description": { + "model": { "type": "string", "minLength": 0, - "description": "A description of what the function does." - }, - "parameters": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "A JSON Schema object describing the function's arguments." + "maxLength": 1048576, + "description": "The model to use for the agent. The requested model name is preserved." }, - "defer_loading": { - "type": "boolean", - "description": "Whether the function is deferred and discovered through tool search." - } - }, - "required": [ - "type", - "name", - "description", - "parameters", - "defer_loading" - ], - "additionalProperties": false, - "description": "A function defined by the application." - }, - "AgentToolResourceProgrammaticToolCalling": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "programmatic_tool_calling" + "reasoning": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningParam" + }, + { + "type": "null" + } ], - "default": "programmatic_tool_calling", - "x-stainless-const": true, - "description": "The type of the object. Always `programmatic_tool_calling`." + "description": "Configuration for model reasoning. Omission uses the model's default effort." }, - "enabled": { - "type": "boolean", - "description": "Whether tools can be called from model-generated code." - } - }, - "required": [ - "type", - "enabled" - ], - "additionalProperties": false, - "description": "Enables calling tools from model-generated code." - }, - "McpTransportResourceHttp": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "http" + "text": { + "anyOf": [ + { + "$ref": "#/components/schemas/TextParam" + }, + { + "type": "null" + } ], - "default": "http", - "x-stainless-const": true, - "description": "The type of the object. Always `http`." + "description": "Configuration for generated text. Defaults to the `text` format and medium verbosity." }, - "server_url": { - "type": "string", - "minLength": 0, - "description": "The URL of the MCP server." - } - }, - "required": [ - "type", - "server_url" - ], - "additionalProperties": false, - "description": "Connects to an MCP server over HTTP." - }, - "McpTransportResourceStdio": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "stdio" + "service_tier": { + "anyOf": [ + { + "$ref": "#/components/schemas/ServiceTierParam" + }, + { + "type": "null" + } ], - "default": "stdio", - "x-stainless-const": true, - "description": "The type of the object. Always `stdio`." + "description": "The service tier used for model requests. Defaults to `auto`." }, - "command": { - "type": "string", + "instructions": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The command used to start the MCP server." + "maxLength": 1048576, + "description": "Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions." }, - "args": { - "type": "array", + "tools": { + "type": [ + "array", + "null" + ], "items": { - "type": "string", - "minLength": 0 + "$ref": "#/components/schemas/PersistedAgentToolConfigParam" }, "minItems": 0, "maxItems": 2000, - "description": "Arguments passed to the MCP server command." + "description": "Tools available to the agent. Defaults to an empty list. The tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON." }, - "cwd": { - "type": "string", - "minLength": 0, - "description": "The working directory used to start the MCP server." + "multi_agent": { + "anyOf": [ + { + "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for creating and coordinating subagents. Subagent tools are disabled by default." }, - "env_vars": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Environment variable names inherited from the execution environment." + "compaction": { + "anyOf": [ + { + "$ref": "#/components/schemas/CompactionParam" + }, + { + "type": "null" + } + ], + "description": "Context compaction settings. Omission or null enables background compaction." + }, + "x_agents_core": { + "anyOf": [ + { + "$ref": "#/components/schemas/v1.SavedAgentCoreInput" + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "command", - "args", - "cwd", - "env_vars" + "model" ], "additionalProperties": false, - "description": "Starts an MCP server as a local process." - }, - "McpTransportResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/McpTransportResourceHttp" - }, - { - "$ref": "#/components/schemas/McpTransportResourceStdio" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "http": "#/components/schemas/McpTransportResourceHttp", - "stdio": "#/components/schemas/McpTransportResourceStdio" - } - }, - "x-oai-discriminator-values": [ - "http", - "stdio" - ], - "description": "The transport used to connect to an MCP server." + "description": "Parameters for creating a reusable agent." }, - "AgentToolResourceMcp": { + "UpdateAgentParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "mcp" - ], - "default": "mcp", - "x-stainless-const": true, - "description": "The type of the object. Always `mcp`." + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigOverridesParam", + "default": {}, + "description": "Experimental settings to merge by key. Omitted settings keep their current values." }, - "server_label": { + "model": { "type": "string", "minLength": 0, - "description": "A label used to identify the MCP server in tool calls." + "maxLength": 1048576, + "description": "The model to use for the agent. The requested model name is preserved." }, - "credential_id": { + "reasoning": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort." + }, + "text": { + "anyOf": [ + { + "$ref": "#/components/schemas/TextParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for text generated by the agent." + }, + "service_tier": { + "anyOf": [ + { + "$ref": "#/components/schemas/ServiceTierParam" + }, + { + "type": "null" + } + ], + "description": "The service tier used for model requests." + }, + "instructions": { "type": [ "string", "null" ], "minLength": 0, - "description": "The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL." + "maxLength": 1048576, + "description": "Additional instructions appended to the agent's default base instructions. Omit to leave unchanged." }, - "transport": { - "$ref": "#/components/schemas/McpTransportResource", - "description": "The transport used to connect to the MCP server." + "multi_agent": { + "anyOf": [ + { + "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for creating and coordinating subagents." }, - "request_metadata": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "Metadata included with requests to this MCP server." + "compaction": { + "anyOf": [ + { + "$ref": "#/components/schemas/CompactionParam" + }, + { + "type": "null" + } + ], + "description": "Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction." }, - "allowed_tools": { + "metadata": { "type": [ - "array", + "object", "null" ], - "items": { + "additionalProperties": { "type": "string", - "minLength": 0 + "minLength": 0, + "maxLength": 512 }, - "minItems": 0, - "maxItems": 2000, - "description": "The MCP tools the agent may call." - }, - "required": { - "type": "boolean", - "description": "Whether this MCP server must initialize before the first turn." + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." }, - "connection_origin": { - "$ref": "#/components/schemas/McpConnectionOriginResource", - "description": "Where outbound MCP HTTP connections originate." - } - }, - "required": [ - "type", - "server_label", - "credential_id", - "transport", - "request_metadata", - "allowed_tools", - "required", - "connection_origin" - ], - "additionalProperties": false, - "description": "Tools provided by a remote MCP server." - }, - "AgentToolResourceWebSearch": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "web_search" + "name": { + "type": [ + "string", + "null" ], - "default": "web_search", - "x-stainless-const": true, - "description": "The type of the object. Always `web_search`." - }, - "mode": { - "$ref": "#/components/schemas/WebSearchModeResource", - "description": "The source used for web search results." - }, - "context_size": { - "$ref": "#/components/schemas/WebSearchContextSizeResource", - "description": "The amount of search context made available to the model. Defaults to `medium`." + "minLength": 0, + "maxLength": 128, + "description": "A replacement name. Omit to leave unchanged, or pass null to clear it." }, - "allowed_domains": { + "tools": { "type": [ "array", "null" ], "items": { - "type": "string", - "minLength": 0 + "$ref": "#/components/schemas/PersistedAgentToolConfigParam" }, "minItems": 0, "maxItems": 2000, - "description": "Allowed search domains, or `null` when the search is unrestricted." + "description": "Replaces the tool list. Omit to leave it unchanged, or pass null to clear it. The replacement must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON." }, - "location": { + "x_agents_core": { "anyOf": [ { - "$ref": "#/components/schemas/WebSearchLocationResource" + "$ref": "#/components/schemas/v1.SavedAgentCoreInput" }, { "type": "null" } - ], - "description": "Approximate location used to localize search results, if provided." + ] } }, - "required": [ - "type", - "mode", - "context_size", - "allowed_domains", - "location" - ], "additionalProperties": false, - "description": "Web search." + "description": "Fields to replace on an existing reusable agent." }, - "AgentToolResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/AgentToolResourceFunction" - }, - { - "$ref": "#/components/schemas/AgentToolResourceProgrammaticToolCalling" + "DeletedAgentResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the deleted agent." }, - { - "$ref": "#/components/schemas/AgentToolResourceMcp" + "object": { + "type": "string", + "enum": [ + "agent.deleted" + ], + "default": "agent.deleted", + "x-stainless-const": true, + "description": "The object type. Always `agent.deleted`." }, - { - "$ref": "#/components/schemas/AgentToolResourceWebSearch" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "function": "#/components/schemas/AgentToolResourceFunction", - "programmatic_tool_calling": "#/components/schemas/AgentToolResourceProgrammaticToolCalling", - "mcp": "#/components/schemas/AgentToolResourceMcp", - "web_search": "#/components/schemas/AgentToolResourceWebSearch" + "deleted": { + "type": "boolean", + "description": "Whether the agent was deleted. Always `true`." } }, - "x-oai-discriminator-values": [ - "function", - "programmatic_tool_calling", - "mcp", - "web_search" + "required": [ + "id", + "object", + "deleted" ], - "description": "A tool available to the agent." + "additionalProperties": false, + "description": "A deleted reusable agent." }, - "SessionAgentResource": { + "EnvironmentTemplateResource": { "type": "object", "properties": { "id": { "type": "string", "minLength": 0, - "description": "The ID of the agent." + "description": "The ID of the reusable environment template." }, "name": { "type": [ @@ -12976,927 +18380,1072 @@ "null" ], "minLength": 0, - "description": "The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value." + "description": "An optional human-readable display name for the template." }, - "model": { + "object": { "type": "string", - "minLength": 0, - "description": "The model used by the agent." + "enum": [ + "agent.environment.template" + ], + "default": "agent.environment.template", + "x-stainless-const": true, + "description": "The object type. Always `agent.environment.template`." }, - "reasoning": { - "$ref": "#/components/schemas/ReasoningResource", - "description": "The agent's reasoning configuration." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the template was created." }, - "text": { - "$ref": "#/components/schemas/TextResource", - "description": "Configuration for text generated by the agent." + "updated_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the template was last updated." }, - "service_tier": { - "$ref": "#/components/schemas/ServiceTierResource", - "description": "The effective service-tier policy for model requests. Defaults to `auto`." + "packages": { + "$ref": "#/components/schemas/EnvironmentPackagesResource", + "description": "Packages installed in each fresh OpenAI-hosted environment." }, - "instructions": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "Custom instructions appended to the agent's default base instructions." + "network": { + "$ref": "#/components/schemas/NetworkPolicyResource", + "description": "Runtime network access for each OpenAI-hosted environment." }, - "tools": { + "desktop": { + "$ref": "#/components/schemas/DesktopResource", + "description": "Desktop configuration for each OpenAI-hosted environment." + }, + "capability_directories": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentToolResource" + "type": "string", + "minLength": 0 }, "minItems": 0, "maxItems": 2000, - "description": "Tools available to the agent." + "description": "Directories that expose capabilities to the agent." }, - "multi_agent": { - "$ref": "#/components/schemas/MultiAgentConfigResource", - "description": "Configuration for creating and coordinating subagents." + "skills": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedTemplateSkillResource" + }, + "minItems": 0, + "maxItems": 200, + "description": "Safe skill metadata, preserving unresolved version selectors." }, - "x_agents_core": { - "anyOf": [ - { - "$ref": "#/components/schemas/v1.AgentsCore" - }, - { - "type": "null" - } - ] + "plugins": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedPluginResource" + }, + "minItems": 0, + "maxItems": 32, + "description": "Safe plugin metadata, excluding inline archive contents." + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedTemplateFileResource" + }, + "minItems": 0, + "maxItems": 50, + "description": "Safe file metadata, excluding contents and session-scoped file IDs." } }, "required": [ "id", "name", - "model", - "reasoning", - "text", - "service_tier", - "instructions", - "tools", - "multi_agent" + "object", + "created_at", + "updated_at", + "packages", + "network", + "desktop", + "capability_directories", + "skills", + "plugins", + "files" ], "additionalProperties": false, - "description": "The effective agent configuration for a session." + "description": "Reusable configuration that provisions a fresh OpenAI-hosted environment for each session." }, - "EnvironmentResourceNone": { + "EnvironmentTemplateListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "none" + "list" ], - "default": "none", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `none`." + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EnvironmentTemplateResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "The session talks to CCA without selecting or provisioning an execution environment." + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "EnvironmentResourceOpenaiHosted": { + "CreateEnvironmentTemplateParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "openai_hosted" + "packages": { + "anyOf": [ + { + "$ref": "#/components/schemas/EnvironmentPackagesParam" + }, + { + "type": "null" + } ], - "default": "openai_hosted", - "x-stainless-const": true, - "description": "The type of the object. Always `openai_hosted`." + "description": "Packages to install in the environment. Defaults to empty package lists." }, - "id": { - "type": "string", - "minLength": 0, - "description": "The public ID of the environment." + "setup_commands": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/SetupCommandParam" + }, + "minItems": 0, + "maxItems": 16, + "description": "Ordered, confidential setup commands. Command bodies are never returned." }, - "packages": { - "$ref": "#/components/schemas/EnvironmentPackagesResource", - "description": "Packages installed in the environment." + "network": { + "anyOf": [ + { + "$ref": "#/components/schemas/NetworkPolicyParam" + }, + { + "type": "null" + } + ], + "description": "Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled." + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopParam" + }, + { + "type": "null" + } + ], + "description": "Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled." }, - "network": { - "$ref": "#/components/schemas/NetworkPolicyResource", - "description": "The effective network access policy for the environment." + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Environment variables made available to the agent." }, "capability_directories": { - "type": "array", + "type": [ + "array", + "null" + ], "items": { "type": "string", - "minLength": 0 + "minLength": 0, + "maxLength": 1048576 }, "minItems": 0, - "maxItems": 2000, - "description": "Directories that contain capabilities exposed to the agent." + "maxItems": 16384, + "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." }, "skills": { - "type": "array", + "type": [ + "array", + "null" + ], "items": { - "$ref": "#/components/schemas/HostedSkillResource" + "$ref": "#/components/schemas/HostedSkillParam" }, "minItems": 0, - "maxItems": 2000, - "description": "Skills installed in the environment, excluding their archive contents." + "maxItems": 200, + "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." }, "plugins": { - "type": "array", + "type": [ + "array", + "null" + ], "items": { - "$ref": "#/components/schemas/HostedPluginResource" + "$ref": "#/components/schemas/HostedPluginParam" }, "minItems": 0, - "maxItems": 2000, - "description": "Plugins installed in the environment, excluding their archive contents." + "maxItems": 32, + "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." }, "files": { - "type": "array", + "type": [ + "array", + "null" + ], "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileResource" + "$ref": "#/components/schemas/HostedEnvironmentFileParam" }, "minItems": 0, "maxItems": 50, - "description": "Files available in the environment, excluding their contents." + "description": "Files available before the agent starts. Defaults to an empty list." + }, + "name": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 256, + "description": "An optional human-readable display name for the template." } }, - "required": [ - "type", - "id", - "packages", - "network", - "capability_directories", - "skills", - "plugins", - "files" - ], "additionalProperties": false, - "description": "An environment hosted by OpenAI." + "description": "Parameters for creating a reusable, project-scoped OpenAI-hosted environment template." }, - "EnvironmentResourceSelfHosted": { + "UpdateEnvironmentTemplateParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "self_hosted" + "name": { + "type": [ + "string", + "null" ], - "default": "self_hosted", - "x-stainless-const": true, - "description": "The type of the object. Always `self_hosted`." - }, - "remote_url": { - "type": "string", - "minLength": 0, - "description": "Pass this URL unchanged to `codex exec-server --remote` when connecting this environment." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The public ID of the environment." + "minLength": 1, + "maxLength": 256, + "description": "A replacement human-readable display name, or `null` to clear the name." }, - "workspace_directory": { - "type": "string", - "minLength": 0, - "description": "The absolute project directory inside the environment. Defaults to `/workspace`." + "packages": { + "anyOf": [ + { + "$ref": "#/components/schemas/EnvironmentPackagesParam" + }, + { + "type": "null" + } + ], + "description": "Packages installed before the runtime network policy applies." }, - "capability_directories": { - "type": "array", + "setup_commands": { + "type": [ + "array", + "null" + ], "items": { - "type": "string", - "minLength": 0 + "$ref": "#/components/schemas/SetupCommandParam" }, "minItems": 0, - "maxItems": 2000, - "description": "Directories that contain capabilities exposed to the agent." - } - }, - "required": [ - "type", - "remote_url", - "id", - "workspace_directory", - "capability_directories" - ], - "additionalProperties": false, - "description": "An environment hosted by the application." - }, - "EnvironmentResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/EnvironmentResourceNone" + "maxItems": 16, + "description": "Replacement confidential setup commands, never included in returned resources." }, - { - "$ref": "#/components/schemas/EnvironmentResourceOpenaiHosted" + "network": { + "anyOf": [ + { + "$ref": "#/components/schemas/NetworkPolicyParam" + }, + { + "type": "null" + } + ], + "description": "Network access available after setup completes. Omit to preserve the current policy, or pass `null` to reset to the default policy." }, - { - "$ref": "#/components/schemas/EnvironmentResourceSelfHosted" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "none": "#/components/schemas/EnvironmentResourceNone", - "openai_hosted": "#/components/schemas/EnvironmentResourceOpenaiHosted", - "self_hosted": "#/components/schemas/EnvironmentResourceSelfHosted" - } - }, - "x-oai-discriminator-values": [ - "none", - "openai_hosted", - "self_hosted" - ], - "description": "The execution environment for a session." - }, - "SessionResource": { - "type": "object", - "properties": { - "metadata": { - "type": "object", + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopParam" + }, + { + "type": "null" + } + ], + "description": "Replacement desktop configuration, or null to disable the desktop." + }, + "env": { + "type": [ + "object", + "null" + ], "additionalProperties": { "type": "string", - "minLength": 0 + "minLength": 0, + "maxLength": 1048576 }, "propertyNames": { "type": "string", - "minLength": 0 + "minLength": 1, + "maxLength": 256 }, "minProperties": 0, - "description": "Custom string key-value pairs attached to the session." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session." + "maxProperties": 1024, + "description": "Replacement confidential environment values." }, - "object": { - "type": "string", - "enum": [ - "agent.session" + "capability_directories": { + "type": [ + "array", + "null" ], - "default": "agent.session", - "x-stainless-const": true, - "description": "The object type. Always `agent.session`." - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the session was created." - }, - "last_active_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the session was last active." - }, - "status": { - "$ref": "#/components/schemas/SessionStatusResource", - "description": "The current status of the session." + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Directories that expose capabilities to the agent." }, - "required_actions": { - "type": "array", + "skills": { + "type": [ + "array", + "null" + ], "items": { - "$ref": "#/components/schemas/SessionRequiredActionResource" + "$ref": "#/components/schemas/HostedSkillParam" }, "minItems": 0, - "maxItems": 2000, - "description": "Actions that must be completed before the session can continue." + "maxItems": 200, + "description": "Replacement skill configuration installed for each new session." }, - "error": { + "plugins": { "type": [ - "string", + "array", "null" ], - "minLength": 0, - "description": "The error that caused the session to fail, if any." - }, - "agent": { - "$ref": "#/components/schemas/SessionAgentResource", - "description": "The agent running in the session." - }, - "environment": { - "$ref": "#/components/schemas/EnvironmentResource", - "description": "The execution environment for the session." + "items": { + "$ref": "#/components/schemas/HostedPluginParam" + }, + "minItems": 0, + "maxItems": 32, + "description": "Replacement plugin configuration installed for each new session." }, - "vault_ids": { - "type": "array", + "files": { + "type": [ + "array", + "null" + ], "items": { - "type": "string", - "minLength": 0 + "$ref": "#/components/schemas/HostedEnvironmentFileParam" }, "minItems": 0, - "maxItems": 2000, - "description": "The IDs of vaults made available to the session." + "maxItems": 50, + "description": "Replacement file configuration materialized for each new session." + } + }, + "additionalProperties": false, + "description": "Fields to replace on an existing reusable OpenAI-hosted environment template." + }, + "DeletedEnvironmentTemplateResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the deleted environment template." }, - "usage": { - "anyOf": [ - { - "$ref": "#/components/schemas/TokenUsageResource" - }, - { - "type": "null" - } + "object": { + "type": "string", + "enum": [ + "agent.environment.template.deleted" ], - "description": "Best-effort token usage for the session, or null if unknown. Recorded usage may change." + "default": "agent.environment.template.deleted", + "x-stainless-const": true, + "description": "The object type. Always `agent.environment.template.deleted`." }, - "x_agents_core": { - "anyOf": [ - { - "$ref": "#/components/schemas/v1.SessionCore" - }, - { - "type": "null" - } - ] + "deleted": { + "type": "boolean", + "description": "Whether the environment template was deleted. Always `true`." } }, "required": [ - "metadata", "id", "object", - "created_at", - "last_active_at", - "status", - "required_actions", - "error", - "agent", - "environment", - "vault_ids", - "usage" + "deleted" ], "additionalProperties": false, - "description": "A Managed Agents session." + "description": "A deleted reusable environment template." }, - "SessionListResource": { + "SessionReviewResource": { + "type": "string", + "enum": [ + "none", + "auto_review" + ], + "description": "The configured action review mode." + }, + "SessionStatusResource": { + "type": "string", + "enum": [ + "idle", + "in_progress", + "requires_action", + "failed" + ], + "x-enumDescriptions": [ + "The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.", + "The session is processing a turn.", + "The session is waiting for one or more required actions.", + "The session failed." + ], + "description": "The current status of a session." + }, + "ComputerUseApprovalRequestKindResourceBrowserAuthentication": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "browser_authentication" ], - "default": "list", + "default": "browser_authentication", "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SessionResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." + "description": "The type of the object. Always `browser_authentication`." }, - "first_id": { + "reason": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "description": "Why the agent needs the user to sign in." }, - "last_id": { + "credential_origin": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "description": "The registered form or frame origin where values will be entered." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "fields": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BrowserAuthenticationFieldResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Controls to render. All submitted values are sensitive." + }, + "options": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BrowserAuthenticationOptionResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Sign-in methods. Empty for a plain form." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type", + "reason", + "credential_origin", + "fields", + "options" ], "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "description": "A registered form awaiting the application's response." }, - "AgentToolConfigParamFunction": { + "ComputerUseApprovalRequestKindResourceBrowserOriginAccess": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "function" + "browser_origin_access" ], - "default": "function", + "default": "browser_origin_access", "x-stainless-const": true, - "description": "The type of the object. Always `function`." + "description": "The type of the object. Always `browser_origin_access`." }, - "name": { - "type": "string", + "reason": { + "type": [ + "string", + "null" + ], "minLength": 0, - "maxLength": 1048576, - "description": "The name of the function." + "description": "The browser's explanation for this request, or null when unavailable." }, - "description": { + "origin": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "A description of what the function does." - }, - "parameters": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "A JSON Schema object describing the function's arguments." - }, - "defer_loading": { - "type": "boolean", - "default": false, - "description": "Whether this function is deferred and discovered through tool search. Defaults to `false`." + "description": "The origin the browser needs permission to access." } }, "required": [ "type", - "name", - "description", - "parameters" + "reason", + "origin" ], "additionalProperties": false, - "description": "A function defined by the application." + "description": "A browser origin awaiting the application's approval decision." }, - "AgentToolConfigParamToolSearch": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "tool_search" - ], - "default": "tool_search", - "x-stainless-const": true, - "description": "The type of the object. Always `tool_search`." + "ComputerUseApprovalRequestKindResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserAuthentication" + }, + { + "$ref": "#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserOriginAccess" } - }, - "required": [ - "type" ], - "additionalProperties": false, - "description": "Discovers deferred function tools and loads them into the model context." - }, - "AgentToolConfigParamProgrammaticToolCalling": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "programmatic_tool_calling" - ], - "default": "programmatic_tool_calling", - "x-stainless-const": true, - "description": "The type of the object. Always `programmatic_tool_calling`." - }, - "enabled": { - "type": "boolean", - "default": true, - "description": "Whether tools can be called from model-generated code. Defaults to `true`." + "discriminator": { + "propertyName": "type", + "mapping": { + "browser_authentication": "#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserAuthentication", + "browser_origin_access": "#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserOriginAccess" } }, - "required": [ - "type" - ], - "additionalProperties": false, - "description": "Enables calling tools from model-generated code." + "x-oai-discriminator-values": [ + "browser_authentication", + "browser_origin_access" + ] }, - "McpTransportConfigParamHttp": { + "SessionRequiredActionResourceComputerUseApprovalRequest": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "http" + "computer_use_approval_request" ], - "default": "http", + "default": "computer_use_approval_request", "x-stainless-const": true, - "description": "The type of the object. Always `http`." + "description": "The type of the object. Always `computer_use_approval_request`." }, - "server_url": { + "turn_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The URL of the MCP server." + "description": "The turn that requested approval." }, - "authorization": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The authorization value sent to the MCP server, if any." + "request_id": { + "type": "string", + "minLength": 0, + "description": "The registered request ID to echo when responding." }, - "headers": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Additional HTTP headers sent to the MCP server." + "request": { + "$ref": "#/components/schemas/ComputerUseApprovalRequestKindResource", + "description": "The information needed to render the request." } }, "required": [ "type", - "server_url" + "turn_id", + "request_id", + "request" ], "additionalProperties": false, - "description": "Connects to an MCP server over HTTP." + "description": "Respond to a computer-use request." }, - "McpTransportConfigParamStdio": { + "SessionRequiredActionResourceFunctionCall": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "stdio" + "function_call" ], - "default": "stdio", + "default": "function_call", "x-stainless-const": true, - "description": "The type of the object. Always `stdio`." + "description": "The type of the object. Always `function_call`." }, - "command": { + "turn_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The command used to start the MCP server." + "description": "The ID of the turn that requested the function call." }, - "args": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Arguments passed to the MCP server command." + "call_id": { + "type": "string", + "minLength": 0, + "description": "The ID to include when submitting the function result." }, - "cwd": { + "name": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The working directory used to start the MCP server." + "description": "The function name." }, - "env": { - "type": [ - "object", - "null" + "arguments": { + "description": "The arguments supplied by the model." + } + }, + "required": [ + "type", + "turn_id", + "call_id", + "name", + "arguments" + ], + "additionalProperties": false, + "description": "Run a function tool and submit its result." + }, + "SessionRequiredActionResourceEnvironmentConnection": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "environment_connection" ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Environment variables set for the MCP server process." + "default": "environment_connection", + "x-stainless-const": true, + "description": "The type of the object. Always `environment_connection`." }, - "env_vars": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Environment variable names to inherit from the selected execution environment." + "environment_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the environment to reconnect." } }, "required": [ "type", - "command", - "cwd" + "environment_id" ], "additionalProperties": false, - "description": "Starts an MCP server as a local process." + "description": "Reconnect a session environment." }, - "McpTransportConfigParam": { + "SessionRequiredActionResource": { "oneOf": [ { - "$ref": "#/components/schemas/McpTransportConfigParamHttp" + "$ref": "#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest" }, { - "$ref": "#/components/schemas/McpTransportConfigParamStdio" + "$ref": "#/components/schemas/SessionRequiredActionResourceFunctionCall" + }, + { + "$ref": "#/components/schemas/SessionRequiredActionResourceEnvironmentConnection" } ], "discriminator": { "propertyName": "type", "mapping": { - "http": "#/components/schemas/McpTransportConfigParamHttp", - "stdio": "#/components/schemas/McpTransportConfigParamStdio" + "computer_use_approval_request": "#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest", + "function_call": "#/components/schemas/SessionRequiredActionResourceFunctionCall", + "environment_connection": "#/components/schemas/SessionRequiredActionResourceEnvironmentConnection" } }, "x-oai-discriminator-values": [ - "http", - "stdio" + "computer_use_approval_request", + "function_call", + "environment_connection" ], - "description": "The transport used to connect to an MCP server." + "description": "An action that must be completed before a session can continue." }, - "AgentToolConfigParamMcp": { + "SessionAgentResource": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "mcp" - ], - "default": "mcp", - "x-stainless-const": true, - "description": "The type of the object. Always `mcp`." - }, - "server_label": { + "id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "A label used to identify the MCP server in tool calls." + "description": "The ID of the agent." }, - "credential_id": { + "name": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 1048576, - "description": "The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL." + "description": "The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value." }, - "transport": { - "$ref": "#/components/schemas/McpTransportConfigParam", - "description": "The transport used to connect to the MCP server." + "model": { + "type": "string", + "minLength": 0, + "description": "The model used by the agent." }, - "request_metadata": { + "reasoning": { + "$ref": "#/components/schemas/ReasoningResource", + "description": "The agent's reasoning configuration." + }, + "text": { + "$ref": "#/components/schemas/TextResource", + "description": "Configuration for text generated by the agent." + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTierResource", + "description": "The effective service-tier policy for model requests. Defaults to `auto`." + }, + "instructions": { "type": [ - "object", + "string", "null" ], - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 + "minLength": 0, + "description": "Custom instructions appended to the agent's default base instructions." + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AgentToolResource" }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Metadata included with requests to this MCP server." + "minItems": 0, + "maxItems": 2000, + "description": "Tools available to the agent." }, - "allowed_tools": { - "type": [ - "array", - "null" + "multi_agent": { + "$ref": "#/components/schemas/MultiAgentConfigResource", + "description": "Configuration for creating and coordinating subagents." + }, + "compaction": { + "$ref": "#/components/schemas/CompactionResource", + "description": "The effective context compaction settings." + }, + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigResource", + "description": "The effective experimental settings for the agent." + }, + "x_agents_core": { + "anyOf": [ + { + "$ref": "#/components/schemas/v1.AgentsCore" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "name", + "model", + "reasoning", + "text", + "service_tier", + "instructions", + "tools", + "multi_agent" + ], + "additionalProperties": false, + "description": "The effective agent configuration for a session." + }, + "EnvironmentResourceNone": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "none" + ], + "default": "none", + "x-stainless-const": true, + "description": "The type of the object. Always `none`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "The session talks to CCA without selecting or provisioning an execution environment." + }, + "EnvironmentResourceOpenaiHosted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "openai_hosted" ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "The MCP tools the agent may call. All server tools are allowed when omitted." + "default": "openai_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `openai_hosted`." }, - "required": { - "type": "boolean", - "default": false, - "description": "Whether this MCP server must initialize before the first turn. Defaults to `false`." + "id": { + "type": "string", + "minLength": 0, + "description": "The public ID of the environment." }, - "connection_origin": { + "container_size": { "anyOf": [ { - "$ref": "#/components/schemas/McpConnectionOriginParam" + "$ref": "#/components/schemas/ContainerSizeResource" }, { "type": "null" } ], - "description": "Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment." + "description": "The effective CPU and memory tier, or null when unknown or outside the public tiers." + }, + "packages": { + "$ref": "#/components/schemas/EnvironmentPackagesResource", + "description": "Packages installed in the environment." + }, + "network": { + "$ref": "#/components/schemas/NetworkPolicyResource", + "description": "The effective network access policy for the environment." + }, + "desktop": { + "$ref": "#/components/schemas/DesktopResource", + "description": "The effective desktop configuration." + }, + "capability_directories": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Directories that contain capabilities exposed to the agent." + }, + "skills": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedSkillResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Skills installed in the environment, excluding their archive contents." + }, + "plugins": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedPluginResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Plugins installed in the environment, excluding their archive contents." + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileResource" + }, + "minItems": 0, + "maxItems": 50, + "description": "Files available in the environment, excluding their contents." } }, "required": [ "type", - "server_label", - "transport" + "id", + "packages", + "network", + "desktop", + "capability_directories", + "skills", + "plugins", + "files" ], "additionalProperties": false, - "description": "Tools provided by a remote MCP server." + "description": "An environment hosted by OpenAI." }, - "AgentToolConfigParamWebSearch": { + "EnvironmentResourceSelfHosted": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "web_search" + "self_hosted" ], - "default": "web_search", + "default": "self_hosted", "x-stainless-const": true, - "description": "The type of the object. Always `web_search`." + "description": "The type of the object. Always `self_hosted`." }, - "mode": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchModeParam" - }, - { - "type": "null" - } - ], - "description": "The source used for web search results. Defaults to `live`." + "remote_url": { + "type": "string", + "minLength": 0, + "description": "Pass this URL unchanged to `codex exec-server --remote` when connecting this environment." }, - "context_size": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchContextSizeParam" - }, - { - "type": "null" - } - ], - "description": "The amount of search context made available to the model. Defaults to `medium`." + "id": { + "type": "string", + "minLength": 0, + "description": "The public ID of the environment." }, - "allowed_domains": { - "type": [ - "array", - "null" - ], + "workspace_directory": { + "type": "string", + "minLength": 0, + "description": "The absolute project directory inside the environment. Defaults to `/workspace`." + }, + "capability_directories": { + "type": "array", "items": { "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 0 }, "minItems": 0, - "maxItems": 16384, - "description": "Domains the search may include." - }, - "location": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchLocationParam" - }, - { - "type": "null" - } - ], - "description": "Approximate location used to localize search results." + "maxItems": 2000, + "description": "Directories that contain capabilities exposed to the agent." } }, "required": [ - "type" + "type", + "remote_url", + "id", + "workspace_directory", + "capability_directories" ], "additionalProperties": false, - "description": "Web search." + "description": "An environment hosted by the application." }, - "AgentToolConfigParam": { + "EnvironmentResource": { "oneOf": [ { - "$ref": "#/components/schemas/AgentToolConfigParamFunction" - }, - { - "$ref": "#/components/schemas/AgentToolConfigParamToolSearch" - }, - { - "$ref": "#/components/schemas/AgentToolConfigParamProgrammaticToolCalling" + "$ref": "#/components/schemas/EnvironmentResourceNone" }, { - "$ref": "#/components/schemas/AgentToolConfigParamMcp" + "$ref": "#/components/schemas/EnvironmentResourceOpenaiHosted" }, { - "$ref": "#/components/schemas/AgentToolConfigParamWebSearch" + "$ref": "#/components/schemas/EnvironmentResourceSelfHosted" } ], "discriminator": { "propertyName": "type", "mapping": { - "function": "#/components/schemas/AgentToolConfigParamFunction", - "tool_search": "#/components/schemas/AgentToolConfigParamToolSearch", - "programmatic_tool_calling": "#/components/schemas/AgentToolConfigParamProgrammaticToolCalling", - "mcp": "#/components/schemas/AgentToolConfigParamMcp", - "web_search": "#/components/schemas/AgentToolConfigParamWebSearch" + "none": "#/components/schemas/EnvironmentResourceNone", + "openai_hosted": "#/components/schemas/EnvironmentResourceOpenaiHosted", + "self_hosted": "#/components/schemas/EnvironmentResourceSelfHosted" } }, "x-oai-discriminator-values": [ - "function", - "tool_search", - "programmatic_tool_calling", - "mcp", - "web_search" + "none", + "openai_hosted", + "self_hosted" ], - "description": "A tool available to the agent." + "description": "The execution environment for a session." }, - "SessionAgentConfigParam": { + "SessionResource": { "type": "object", "properties": { - "model": { + "review": { + "$ref": "#/components/schemas/SessionReviewResource", + "description": "Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Custom string key-value pairs attached to the session." + }, + "id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The model to use for the agent. The requested model name is preserved." + "description": "The ID of the session." }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningParam" - }, - { - "type": "null" - } + "object": { + "type": "string", + "enum": [ + "agent.session" ], - "description": "Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort." + "default": "agent.session", + "x-stainless-const": true, + "description": "The object type. Always `agent.session`." }, - "text": { - "anyOf": [ - { - "$ref": "#/components/schemas/TextParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for text generated by the agent." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the session was created." }, - "service_tier": { - "anyOf": [ - { - "$ref": "#/components/schemas/ServiceTierParam" - }, - { - "type": "null" - } - ], - "description": "The service tier used for model requests." + "last_active_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the session was last active." + }, + "status": { + "$ref": "#/components/schemas/SessionStatusResource", + "description": "The current status of the session." }, - "instructions": { + "required_actions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionRequiredActionResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Actions that must be completed before the session can continue." + }, + "error": { + "description": "The error that caused the session to fail, if any.", "type": [ "string", "null" ], - "minLength": 0, - "maxLength": 1048576, - "description": "Additional instructions appended to the agent's default base instructions. Omit to leave unchanged." + "minLength": 0 }, - "multi_agent": { + "agent": { + "$ref": "#/components/schemas/SessionAgentResource", + "description": "The agent running in the session." + }, + "environment": { + "$ref": "#/components/schemas/EnvironmentResource", + "description": "The execution environment for the session." + }, + "vault_ids": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "The IDs of vaults made available to the session." + }, + "usage": { "anyOf": [ { - "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" + "$ref": "#/components/schemas/TokenUsageResource" }, { "type": "null" } ], - "description": "Configuration for creating and coordinating subagents." - }, - "tools": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/AgentToolConfigParam" - }, - "minItems": 0, - "maxItems": 16384, - "description": "Tools available to the agent. Omit to inherit, or pass null to clear them." + "description": "Best-effort token usage for the session, or null if unknown. Recorded usage may change." }, "x_agents_core": { "anyOf": [ { - "$ref": "#/components/schemas/v1.AgentsCore" + "$ref": "#/components/schemas/v1.SessionCore" }, { "type": "null" @@ -13904,175 +19453,146 @@ ] } }, - "additionalProperties": false, - "description": "Agent configuration for a session. Omitted fields inherit from `agent_id` when supplied. Supplied objects and arrays replace the whole field; null resets nullable fields." - }, - "EnvironmentParamNone": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "none" - ], - "default": "none", - "x-stainless-const": true, - "description": "The type of the object. Always `none`." - } - }, "required": [ - "type" + "metadata", + "id", + "object", + "created_at", + "last_active_at", + "status", + "required_actions", + "error", + "agent", + "environment", + "vault_ids", + "usage" ], "additionalProperties": false, - "description": "Runs the agent without an execution environment." + "description": "A Managed Agents session." }, - "EnvironmentParamOpenaiHosted": { + "SessionListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "openai_hosted" + "list" ], - "default": "openai_hosted", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `openai_hosted`." - }, - "packages": { - "anyOf": [ - { - "$ref": "#/components/schemas/EnvironmentPackagesParam" - }, - { - "type": "null" - } - ], - "description": "Packages to install in the environment. Defaults to empty package lists." + "description": "The object type, which is always `list`." }, - "setup_commands": { - "type": [ - "array", - "null" - ], + "data": { + "type": "array", "items": { - "$ref": "#/components/schemas/SetupCommandParam" + "$ref": "#/components/schemas/SessionResource" }, "minItems": 0, - "maxItems": 16, - "description": "Ordered, confidential setup commands. Command bodies are never returned." - }, - "network": { - "anyOf": [ - { - "$ref": "#/components/schemas/NetworkPolicyParam" - }, - { - "type": "null" - } - ], - "description": "Network access policy for the environment. Defaults to enabled." - }, - "env": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Environment variables made available to the agent." + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." }, - "capability_directories": { + "first_id": { "type": [ - "array", + "string", "null" ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "skills": { + "last_id": { "type": [ - "array", + "string", "null" ], - "items": { - "$ref": "#/components/schemas/HostedSkillParam" - }, - "minItems": 0, - "maxItems": 200, - "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, - "plugins": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedPluginParam" - }, - "minItems": 0, - "maxItems": 32, - "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." + }, + "SessionReviewParam": { + "type": "string", + "enum": [ + "none", + "auto_review" + ], + "x-enumDescriptions": [ + "Keep the existing execution behavior without automatic action review.", + "Review eligible actions automatically. Deny manual approval fallbacks." + ], + "description": "Review applied to eligible actions in a session." + }, + "CreateSessionInputParam": { + "oneOf": [ + { + "type": "string", + "minLength": 1, + "maxLength": 1048576 }, - "files": { - "type": [ - "array", - "null" - ], + { + "type": "array", "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileParam" + "$ref": "#/components/schemas/InputMessageParam" }, "minItems": 0, - "maxItems": 50, - "description": "Files available before the agent starts. Defaults to an empty list." - }, - "environment_template_id": { - "type": "string", - "minLength": 0, - "maxLength": 64, - "description": "A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy." + "maxItems": 16384 } - }, - "required": [ - "type" ], - "additionalProperties": false, - "description": "An OpenAI-hosted environment, optionally based on a reusable template." + "description": "Initial input submitted when creating a session." }, - "EnvironmentParamSelfHosted": { + "CreateAgentSessionParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "self_hosted" + "review": { + "$ref": "#/components/schemas/SessionReviewParam", + "description": "Action review mode. Omit to use none." + }, + "metadata": { + "type": [ + "object", + "null" ], - "default": "self_hosted", - "x-stainless-const": true, - "description": "The type of the object. Always `self_hosted`." + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map." }, - "workspace_directory": { + "agent": { + "$ref": "#/components/schemas/SessionAgentConfigParam", + "description": "Agent configuration. With `agent_id`, supplied fields override the saved agent for this session. Without `agent_id`, `model` is required." + }, + "agent_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "Absolute project directory inside the self-hosted environment." + "maxLength": 64, + "description": "The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged." }, - "capability_directories": { + "environment": { + "$ref": "#/components/schemas/EnvironmentParam", + "description": "An inline execution environment or a reference to an environment template." + }, + "vault_ids": { "type": [ "array", "null" @@ -14084,255 +19604,256 @@ }, "minItems": 0, "maxItems": 16384, - "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." - } - }, - "required": [ - "type", - "workspace_directory" - ], - "additionalProperties": false, - "description": "An application-hosted environment configured inline." - }, - "EnvironmentParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/EnvironmentParamNone" + "description": "The IDs of vaults made available to the session." }, - { - "$ref": "#/components/schemas/EnvironmentParamOpenaiHosted" + "input": { + "anyOf": [ + { + "$ref": "#/components/schemas/CreateSessionInputParam" + }, + { + "type": "null" + } + ], + "description": "Initial input to submit when the session is created. A string is shorthand for a single user message. Required when `environment.type` is `none`, or when `stream` is `true` for an environment that is not `self_hosted`; optional for self-hosted and non-streaming execution environments." }, - { - "$ref": "#/components/schemas/EnvironmentParamSelfHosted" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "none": "#/components/schemas/EnvironmentParamNone", - "openai_hosted": "#/components/schemas/EnvironmentParamOpenaiHosted", - "self_hosted": "#/components/schemas/EnvironmentParamSelfHosted" + "stream": { + "type": "boolean", + "default": false, + "description": "Whether to stream session events as server-sent events. Defaults to `false`." + }, + "x_agents_core": { + "anyOf": [ + { + "$ref": "#/components/schemas/v1.SessionExecutionInput" + }, + { + "type": "null" + } + ] } }, - "x-oai-discriminator-values": [ - "none", - "openai_hosted", - "self_hosted" + "required": [ + "environment" ], - "description": "The execution environment and optional reusable template for a session." + "additionalProperties": false, + "description": "Parameters for creating a Managed Agents session." }, - "InputContentParamInputText": { + "SessionEventAgentSessionTurnReasoningSummaryTextDelta": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_text" + "agent.session.turn.reasoning_summary_text.delta" ], - "default": "input_text", + "default": "agent.session.turn.reasoning_summary_text.delta", "x-stainless-const": true, - "description": "The type of the object. Always `input_text`." + "description": "The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`." }, - "text": { + "event_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The text sent to the model." - } - }, - "required": [ - "type", - "text" - ], - "additionalProperties": false, - "description": "Text input to the model." - }, - "InputContentParamInputImage": { - "type": "object", - "properties": { - "type": { + "description": "The unique ID of the event." + }, + "session_id": { "type": "string", - "enum": [ - "input_image" + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" ], - "default": "input_image", - "x-stainless-const": true, - "description": "The type of the object. Always `input_image`." + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "image_url": { + "item_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The URL of the image sent to the model." + "description": "The ID of the reasoning item." + }, + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." + }, + "summary_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the summary content part." + }, + "delta": { + "type": "string", + "minLength": 0, + "description": "The summary text that was appended." } }, "required": [ "type", - "image_url" + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "summary_index", + "delta" ], "additionalProperties": false, - "description": "Image input to the model." - }, - "InputContentParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/InputContentParamInputText" - }, - { - "$ref": "#/components/schemas/InputContentParamInputImage" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "input_text": "#/components/schemas/InputContentParamInputText", - "input_image": "#/components/schemas/InputContentParamInputImage" - } - }, - "x-oai-discriminator-values": [ - "input_text", - "input_image" - ], - "description": "Content included in an input message." + "description": "Emitted when text is appended to a reasoning summary." }, - "InputMessageParam": { + "SessionEventAgentSessionTurnReasoningSummaryPartDone": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "message" + "agent.session.turn.reasoning_summary_part.done" ], - "default": "message", + "default": "agent.session.turn.reasoning_summary_part.done", "x-stainless-const": true, - "description": "The type of the input item. Always `message`." + "description": "The type of the object. Always `agent.session.turn.reasoning_summary_part.done`." }, - "role": { + "event_id": { "type": "string", - "enum": [ - "user" + "minLength": 0, + "description": "The unique ID of the event." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" ], - "default": "user", - "x-stainless-const": true, - "description": "The role of the message author. Always `user`." + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "content": { - "type": "array", - "items": { - "$ref": "#/components/schemas/InputContentParam" - }, - "minItems": 0, - "maxItems": 16384, - "description": "The content of the message." - } - }, - "required": [ - "role", - "content" - ], - "additionalProperties": false, - "description": "A user message submitted to a session." - }, - "CreateSessionInputParam": { - "oneOf": [ - { + "item_id": { "type": "string", - "minLength": 1, - "maxLength": 1048576 + "minLength": 0, + "description": "The ID of the reasoning item." }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/InputMessageParam" - }, - "minItems": 0, - "maxItems": 16384 + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." + }, + "summary_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the summary part." + }, + "part": { + "$ref": "#/components/schemas/SummaryTextResource", + "description": "The completed summary part." + }, + "status": { + "type": [ + "string", + "null" + ], + "enum": [ + "incomplete", + null + ], + "description": "Present as `incomplete` when summary generation was interrupted.", + "x-stainless-const": true } + }, + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "summary_index", + "part", + "status" ], - "description": "Initial input submitted when creating a session." + "additionalProperties": false, + "description": "Emitted when a reasoning summary part is complete." }, - "CreateAgentSessionParams": { + "SessionEventAgentSessionTurnReasoningSummaryTextDone": { "type": "object", "properties": { - "metadata": { - "type": [ - "object", - "null" + "type": { + "type": "string", + "enum": [ + "agent.session.turn.reasoning_summary_text.done" ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 512 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 64 - }, - "minProperties": 0, - "maxProperties": 16, - "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map." - }, - "agent": { - "$ref": "#/components/schemas/SessionAgentConfigParam", - "description": "Agent configuration. With `agent_id`, supplied fields override the saved agent for this session. Without `agent_id`, `model` is required." + "default": "agent.session.turn.reasoning_summary_text.done", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.turn.reasoning_summary_text.done`." }, - "agent_id": { + "event_id": { "type": "string", "minLength": 0, - "maxLength": 64, - "description": "The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged." + "description": "The unique ID of the event." }, - "environment": { - "$ref": "#/components/schemas/EnvironmentParam", - "description": "An inline execution environment or a reference to an environment template." + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." }, - "vault_ids": { + "turn_id": { "type": [ - "array", + "string", "null" ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "The IDs of vaults made available to the session." + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "input": { - "anyOf": [ - { - "$ref": "#/components/schemas/CreateSessionInputParam" - }, - { - "type": "null" - } - ], - "description": "Initial input to submit when the session is created. A string is shorthand for a single user message. Required when `environment.type` is `none`, or when `stream` is `true` for an environment that is not `self_hosted`; optional for self-hosted and non-streaming execution environments." + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the reasoning item." }, - "stream": { - "type": "boolean", - "default": false, - "description": "Whether to stream session events as server-sent events. Defaults to `false`." + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." }, - "x_agents_core": { - "anyOf": [ - { - "$ref": "#/components/schemas/v1.SessionExecutionInput" - }, - { - "type": "null" - } - ] + "summary_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the summary content part." + }, + "text": { + "type": "string", + "minLength": 0, + "description": "The complete reasoning summary text." } }, "required": [ - "environment" + "type", + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "summary_index", + "text" ], "additionalProperties": false, - "description": "Parameters for creating a Managed Agents session." + "description": "Emitted when a reasoning summary content part is complete." }, "SessionErrorResource": { "type": "object", @@ -14429,6 +19950,8 @@ "ready", "connected", "disconnected", + "suspended", + "expired", "failed" ], "x-enumDescriptions": [ @@ -14436,6 +19959,8 @@ "The environment is ready to connect.", "The environment is connected.", "The environment is disconnected.", + "The environment is stopped and can be resumed from its private checkpoint.", + "The environment and its private checkpoint have expired.", "The environment failed to connect." ], "description": "The connection status of a session environment." @@ -14493,29 +20018,164 @@ "type": "null" } ], - "description": "The error reported while preparing the environment, if any." + "description": "The error reported while preparing the environment, if any." + } + }, + "required": [ + "id", + "type", + "status", + "error" + ], + "additionalProperties": false, + "description": "The current state of a session environment." + }, + "SessionEventAgentSessionEnvironmentReady": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "agent.session.environment.ready" + ], + "default": "agent.session.environment.ready", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.environment.ready`." + }, + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." + }, + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." + } + }, + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "environment" + ], + "additionalProperties": false, + "description": "Emitted when a hosted session environment is ready to connect." + }, + "SessionEventAgentSessionEnvironmentSuspended": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "agent.session.environment.suspended" + ], + "default": "agent.session.environment.suspended", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.environment.suspended`." + }, + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." + }, + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." + } + }, + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "environment" + ], + "additionalProperties": false, + "description": "Emitted after an idle hosted session environment is checkpointed and stopped." + }, + "SessionEventAgentSessionEnvironmentExpired": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "agent.session.environment.expired" + ], + "default": "agent.session.environment.expired", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.environment.expired`." + }, + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." + }, + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." } }, "required": [ - "id", "type", - "status", - "error" + "event_id", + "session_id", + "turn_id", + "environment" ], "additionalProperties": false, - "description": "The current state of a session environment." + "description": "Emitted after a suspended hosted session environment and its checkpoint expire." }, - "SessionEventAgentSessionEnvironmentReady": { + "SessionEventAgentSessionEnvironmentReset": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.environment.ready" + "agent.session.environment.reset" ], - "default": "agent.session.environment.ready", + "default": "agent.session.environment.reset", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.environment.ready`." + "description": "The type of the object. Always `agent.session.environment.reset`." }, "event_id": { "type": "string", @@ -14533,11 +20193,18 @@ "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "description": "The associated turn, when applicable." }, - "environment": { - "$ref": "#/components/schemas/SessionEnvironmentStateResource", - "description": "The current environment state." + "environment_id": { + "type": "string", + "minLength": 0, + "description": "The stable environment ID, retained across sandbox replacements." + }, + "reset_count": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "Monotonically increasing reset number. Repeated notifications share this number." } }, "required": [ @@ -14545,10 +20212,11 @@ "event_id", "session_id", "turn_id", - "environment" + "environment_id", + "reset_count" ], "additionalProperties": false, - "description": "Emitted when a hosted session environment is ready to connect." + "description": "Emitted after a hosted sandbox is replaced. Conversation history survives; changes to the previous sandbox's files and processes do not." }, "SessionEventAgentOutputCommandExecutionOutputDelta": { "type": "object", @@ -15414,6 +21082,12 @@ { "$ref": "#/components/schemas/McpCallItemResource" }, + { + "$ref": "#/components/schemas/ComputerUseCallItemResource" + }, + { + "$ref": "#/components/schemas/BrowserAuthenticationRequestItemResource" + }, { "$ref": "#/components/schemas/WebSearchCallItemResource" }, @@ -15446,6 +21120,8 @@ "reasoning": "#/components/schemas/ReasoningItemResource", "function_call": "#/components/schemas/FunctionCallItemResource", "mcp_call": "#/components/schemas/McpCallItemResource", + "computer_use_call": "#/components/schemas/ComputerUseCallItemResource", + "computer_use_approval_request": "#/components/schemas/BrowserAuthenticationRequestItemResource", "web_search_call": "#/components/schemas/WebSearchCallItemResource", "command_execution": "#/components/schemas/CommandExecutionItemResource", "interrupt_subagent_call": "#/components/schemas/InterruptSubagentCallItemResource", @@ -15461,6 +21137,8 @@ "reasoning", "function_call", "mcp_call", + "computer_use_call", + "computer_use_approval_request", "web_search_call", "command_execution", "create_subagent_call", @@ -15793,234 +21471,19 @@ "text" ], "additionalProperties": false, - "description": "Emitted when an output text content part is complete." - }, - "SessionEventAgentSessionTurnReasoningSummaryPartAdded": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.turn.reasoning_summary_part.added" - ], - "default": "agent.session.turn.reasoning_summary_part.added", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.reasoning_summary_part.added`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the reasoning item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "summary_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the summary content part." - }, - "part": { - "$ref": "#/components/schemas/SummaryTextResource", - "description": "The initial summary part." - } - }, - "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "summary_index", - "part" - ], - "additionalProperties": false, - "description": "Emitted when a reasoning summary content part is added." - }, - "SessionEventAgentSessionTurnReasoningSummaryPartDone": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.turn.reasoning_summary_part.done" - ], - "default": "agent.session.turn.reasoning_summary_part.done", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.reasoning_summary_part.done`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the reasoning item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "summary_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the summary part." - }, - "part": { - "$ref": "#/components/schemas/SummaryTextResource", - "description": "The completed summary part." - }, - "status": { - "type": [ - "string", - "null" - ], - "enum": [ - "incomplete", - null - ], - "description": "Present as `incomplete` when summary generation was interrupted.", - "x-stainless-const": true - } - }, - "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "summary_index", - "part", - "status" - ], - "additionalProperties": false, - "description": "Emitted when a reasoning summary part is complete." - }, - "SessionEventAgentSessionTurnReasoningSummaryTextDelta": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.turn.reasoning_summary_text.delta" - ], - "default": "agent.session.turn.reasoning_summary_text.delta", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the reasoning item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "summary_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the summary content part." - }, - "delta": { - "type": "string", - "minLength": 0, - "description": "The summary text that was appended." - } - }, - "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "summary_index", - "delta" - ], - "additionalProperties": false, - "description": "Emitted when text is appended to a reasoning summary." + "description": "Emitted when an output text content part is complete." }, - "SessionEventAgentSessionTurnReasoningSummaryTextDone": { + "SessionEventAgentSessionTurnReasoningSummaryPartAdded": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.reasoning_summary_text.done" + "agent.session.turn.reasoning_summary_part.added" ], - "default": "agent.session.turn.reasoning_summary_text.done", + "default": "agent.session.turn.reasoning_summary_part.added", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.reasoning_summary_text.done`." + "description": "The type of the object. Always `agent.session.turn.reasoning_summary_part.added`." }, "event_id": { "type": "string", @@ -16059,10 +21522,9 @@ "maximum": 4294967295, "description": "The index of the summary content part." }, - "text": { - "type": "string", - "minLength": 0, - "description": "The complete reasoning summary text." + "part": { + "$ref": "#/components/schemas/SummaryTextResource", + "description": "The initial summary part." } }, "required": [ @@ -16073,10 +21535,10 @@ "item_id", "output_index", "summary_index", - "text" + "part" ], "additionalProperties": false, - "description": "Emitted when a reasoning summary content part is complete." + "description": "Emitted when a reasoning summary content part is added." }, "SessionEvent": { "oneOf": [ @@ -16086,6 +21548,15 @@ { "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentReady" }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentSuspended" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentExpired" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentReset" + }, { "$ref": "#/components/schemas/SessionEventAgentOutputCommandExecutionOutputDelta" }, @@ -16174,8 +21645,14 @@ "discriminator": { "propertyName": "type", "mapping": { + "agent.session.turn.reasoning_summary_text.delta": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDelta", + "agent.session.turn.reasoning_summary_part.done": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartDone", + "agent.session.turn.reasoning_summary_text.done": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDone", "error": "#/components/schemas/SessionEventError", "agent.session.environment.ready": "#/components/schemas/SessionEventAgentSessionEnvironmentReady", + "agent.session.environment.suspended": "#/components/schemas/SessionEventAgentSessionEnvironmentSuspended", + "agent.session.environment.expired": "#/components/schemas/SessionEventAgentSessionEnvironmentExpired", + "agent.session.environment.reset": "#/components/schemas/SessionEventAgentSessionEnvironmentReset", "agent.output.command_execution_output.delta": "#/components/schemas/SessionEventAgentOutputCommandExecutionOutputDelta", "agent.session.created": "#/components/schemas/SessionEventAgentSessionCreated", "agent.session.turn.created": "#/components/schemas/SessionEventAgentSessionTurnCreated", @@ -16200,15 +21677,15 @@ "agent.session.turn.content_part.done": "#/components/schemas/SessionEventAgentSessionTurnContentPartDone", "agent.session.turn.output_text.delta": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDelta", "agent.session.turn.output_text.done": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDone", - "agent.session.turn.reasoning_summary_part.added": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartAdded", - "agent.session.turn.reasoning_summary_part.done": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartDone", - "agent.session.turn.reasoning_summary_text.delta": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDelta", - "agent.session.turn.reasoning_summary_text.done": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDone" + "agent.session.turn.reasoning_summary_part.added": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartAdded" } }, "x-oai-discriminator-values": [ "error", "agent.session.environment.ready", + "agent.session.environment.suspended", + "agent.session.environment.expired", + "agent.session.environment.reset", "agent.output.command_execution_output.delta", "agent.session.created", "agent.session.turn.created", @@ -16240,9 +21717,75 @@ ], "description": "An event emitted by a Managed Agents session." }, + "UpdateSessionReasoningParam": { + "type": "object", + "properties": { + "effort": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningEffortParam" + }, + { + "type": "null" + } + ], + "description": "Omit to keep the current effort. Null selects the model's default effort." + } + }, + "additionalProperties": false, + "description": "Reasoning effort for subsequent turns. The reasoning summary stays unchanged." + }, + "UpdateSessionAgentParam": { + "type": "object", + "properties": { + "tools": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/AgentToolConfigParam" + }, + "minItems": 0, + "maxItems": 16384, + "description": "Replaces the session tools. Functions and MCP servers change on the next model call. Built-in tools change by the next turn. Omit to keep the current tools, or pass null or an empty array to clear them." + }, + "model": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The model for subsequent turns. Omit to keep the current model." + }, + "reasoning": { + "$ref": "#/components/schemas/UpdateSessionReasoningParam", + "description": "Reasoning settings to update. Omit to keep the current effort." + }, + "service_tier": { + "anyOf": [ + { + "$ref": "#/components/schemas/ServiceTierParam" + }, + { + "type": "null" + } + ], + "description": "Omit to keep the current tier. Null resets it to auto." + } + }, + "additionalProperties": false, + "description": "Agent settings that can change after session creation." + }, "UpdateAgentSessionParams": { "type": "object", "properties": { + "review": { + "$ref": "#/components/schemas/SessionReviewParam", + "description": "Default action review for new root turns. Existing turns and their subagents keep their review mode." + }, + "agent": { + "$ref": "#/components/schemas/UpdateSessionAgentParam", + "description": "Agent settings to update on this session. Omitted fields stay unchanged." + }, "metadata": { "type": [ "object", @@ -16358,87 +21901,301 @@ "additionalProperties": false, "description": "An immutable file published by a completed hosted session turn." }, - "SessionArtifactListResource": { + "SessionArtifactListResource": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionArtifactResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." + }, + "DeletedSessionArtifactResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the deleted session artifact." + }, + "object": { + "type": "string", + "enum": [ + "agent.session.artifact.deleted" + ], + "default": "agent.session.artifact.deleted", + "x-stainless-const": true, + "description": "The object type. Always `agent.session.artifact.deleted`." + }, + "deleted": { + "type": "boolean", + "description": "Whether the session artifact was deleted. Always `true`." + } + }, + "required": [ + "id", + "object", + "deleted" + ], + "additionalProperties": false, + "description": "Confirmation that an immutable session artifact was deleted." + }, + "BrowserAuthenticationFieldValueParam": { + "type": "object", + "properties": { + "field_id": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The field ID from the required action." + }, + "value": { + "type": "string", + "minLength": 0, + "maxLength": 16384, + "description": "The value to enter into the registered control." + } + }, + "required": [ + "field_id", + "value" + ], + "additionalProperties": false, + "description": "One user-entered value, including non-password fields such as an email address." + }, + "ComputerUseApprovalResponseParamBrowserAuthenticationSubmitParam": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "browser_authentication" + ], + "default": "browser_authentication", + "x-stainless-const": true + }, + "action": { + "type": "string", + "enum": [ + "submit" + ], + "default": "submit", + "x-stainless-const": true + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BrowserAuthenticationFieldValueParam" + }, + "minItems": 0, + "maxItems": 6, + "description": "Values for up to six active fields in the required action. The submitted field-value mapping and selected option must fit within 120 KiB of JSON." + }, + "selected_option": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The chosen method. Required when the required action contains options." + } + }, + "required": [ + "type", + "action", + "fields" + ], + "additionalProperties": false + }, + "ComputerUseApprovalResponseParamBrowserAuthenticationCancelParam": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "browser_authentication" + ], + "default": "browser_authentication", + "x-stainless-const": true + }, + "action": { + "type": "string", + "enum": [ + "cancel" + ], + "default": "cancel", + "x-stainless-const": true + } + }, + "required": [ + "type", + "action" + ], + "additionalProperties": false + }, + "ComputerUseApprovalResponseParamBrowserAuthentication": { + "oneOf": [ + { + "$ref": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthenticationSubmitParam" + }, + { + "$ref": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthenticationCancelParam" + } + ], + "discriminator": { + "propertyName": "action", + "mapping": { + "submit": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthenticationSubmitParam", + "cancel": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthenticationCancelParam" + } + }, + "x-oai-discriminator-values": [ + "submit", + "cancel" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "browser_authentication" + ] + } + }, + "required": [ + "type" + ] + }, + "BrowserOriginAccessDecisionParam": { + "type": "string", + "enum": [ + "approve", + "deny", + "cancel" + ], + "x-enumDescriptions": [ + "Allow the browser to access this origin.", + "Deny access to this origin.", + "Dismiss this request without approving access." + ], + "description": "The user's decision for a browser origin access request." + }, + "ComputerUseApprovalResponseParamBrowserOriginAccessParam": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" - ], - "default": "list", - "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SessionArtifactResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." - }, - "first_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." - }, - "last_id": { - "type": [ - "string", - "null" + "browser_origin_access" ], - "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "default": "browser_origin_access", + "x-stainless-const": true }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "decision": { + "$ref": "#/components/schemas/BrowserOriginAccessDecisionParam", + "description": "Whether to allow, deny, or cancel the requested origin access." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type", + "decision" ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "additionalProperties": false }, - "DeletedSessionArtifactResource": { + "ComputerUseApprovalResponseParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthentication" + }, + { + "$ref": "#/components/schemas/ComputerUseApprovalResponseParamBrowserOriginAccessParam" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "browser_authentication": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthentication", + "browser_origin_access": "#/components/schemas/ComputerUseApprovalResponseParamBrowserOriginAccessParam" + } + }, + "x-oai-discriminator-values": [ + "browser_authentication", + "browser_origin_access" + ] + }, + "SessionInputParamAgentSessionInputComputerUseApprovalRequestResult": { "type": "object", "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the deleted session artifact." - }, - "object": { + "type": { "type": "string", "enum": [ - "agent.session.artifact.deleted" + "agent.session.input.computer_use_approval_request_result" ], - "default": "agent.session.artifact.deleted", + "default": "agent.session.input.computer_use_approval_request_result", "x-stainless-const": true, - "description": "The object type. Always `agent.session.artifact.deleted`." + "description": "The type of the object. Always `agent.session.input.computer_use_approval_request_result`." }, - "deleted": { - "type": "boolean", - "description": "Whether the session artifact was deleted. Always `true`." + "request_id": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The registered request ID from the required action." + }, + "response": { + "$ref": "#/components/schemas/ComputerUseApprovalResponseParam", + "description": "The response for this request type." } }, "required": [ - "id", - "object", - "deleted" + "type", + "request_id", + "response" ], "additionalProperties": false, - "description": "Confirmation that an immutable session artifact was deleted." + "description": "Responds to a pending Computer Use approval request." }, "SessionInputParamAgentSessionInputMessage": { "type": "object", @@ -16566,6 +22323,9 @@ }, "SessionInputParam": { "oneOf": [ + { + "$ref": "#/components/schemas/SessionInputParamAgentSessionInputComputerUseApprovalRequestResult" + }, { "$ref": "#/components/schemas/SessionInputParamAgentSessionInputMessage" }, @@ -16579,12 +22339,14 @@ "discriminator": { "propertyName": "type", "mapping": { + "agent.session.input.computer_use_approval_request_result": "#/components/schemas/SessionInputParamAgentSessionInputComputerUseApprovalRequestResult", "agent.session.input.message": "#/components/schemas/SessionInputParamAgentSessionInputMessage", "agent.session.input.cancel": "#/components/schemas/SessionInputParamAgentSessionInputCancel", "agent.session.input.tool_result": "#/components/schemas/SessionInputParamAgentSessionInputToolResult" } }, "x-oai-discriminator-values": [ + "agent.session.input.computer_use_approval_request_result", "agent.session.input.message", "agent.session.input.cancel", "agent.session.input.tool_result" @@ -16610,6 +22372,105 @@ "additionalProperties": false, "description": "Input events submitted to an existing session." }, + "SessionTurnTraceResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The root turn ID. Use this ID as the pagination anchor." + }, + "object": { + "type": "string", + "enum": [ + "agent.session.trace" + ], + "default": "agent.session.trace", + "x-stainless-const": true, + "description": "The object type, which is always `agent.session.trace`." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The session that owns this trace." + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp in seconds when the root turn was created." + }, + "otlp": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "An OTLP JSON ExportTraceServiceRequest containing resourceSpans. Only currently published data is returned; later trace updates are not awaited." + } + }, + "required": [ + "id", + "object", + "session_id", + "created_at", + "otlp" + ], + "additionalProperties": false + }, + "SessionTraceListResource": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionTurnTraceResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." + }, "VaultStatusParam": { "type": "string", "enum": [ @@ -16686,7 +22547,7 @@ "created_at" ], "additionalProperties": false, - "description": "A collection of credentials that agent tools can use to authenticate to MCP servers." + "description": "A collection of credentials for MCP servers and OpenAI-hosted environments." }, "VaultListResource": { "type": "object", @@ -16772,6 +22633,38 @@ "additionalProperties": false, "description": "Parameters for creating a vault to store credentials used by agent tools." }, + "UpdateVaultParams": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Replaces all metadata. Omit to leave unchanged, or pass {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." + }, + "name": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 1048576, + "description": "A replacement name. Omit to leave unchanged, or pass null to clear it. The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming." + } + }, + "additionalProperties": false, + "description": "Fields to replace on an active vault." + }, "DeletedVaultResource": { "type": "object", "properties": { @@ -16969,37 +22862,138 @@ }, "required": [ "type", - "mcp_server_url", - "expires_at", - "refresh" + "mcp_server_url", + "expires_at", + "refresh" + ], + "additionalProperties": false, + "description": "Public metadata for an OAuth credential; tokens and client secrets are never returned." + }, + "VaultCredentialAuthResourceStaticBearer": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "static_bearer" + ], + "default": "static_bearer", + "x-stainless-const": true, + "description": "The type of the object. Always `static_bearer`." + }, + "mcp_server_url": { + "type": "string", + "minLength": 0, + "description": "The HTTPS MCP server URL authorized by this credential." + } + }, + "required": [ + "type", + "mcp_server_url" + ], + "additionalProperties": false, + "description": "Metadata for a bearer-token credential, without automatic OAuth refresh." + }, + "VaultCredentialNetworkingResourceUnrestricted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "unrestricted" + ], + "default": "unrestricted", + "x-stainless-const": true, + "description": "The type of the object. Always `unrestricted`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`." + }, + "VaultCredentialNetworkingResourceLimited": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "limited" + ], + "default": "limited", + "x-stainless-const": true, + "description": "The type of the object. Always `limited`." + }, + "allowed_hosts": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 1, + "maxItems": 16, + "description": "The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported." + } + }, + "required": [ + "type", + "allowed_hosts" ], "additionalProperties": false, - "description": "Public metadata for an OAuth credential; tokens and client secrets are never returned." + "description": "Allows substitution only for the listed hosts. The environment network policy must also allow these hosts." }, - "VaultCredentialAuthResourceStaticBearer": { + "VaultCredentialNetworkingResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/VaultCredentialNetworkingResourceUnrestricted" + }, + { + "$ref": "#/components/schemas/VaultCredentialNetworkingResourceLimited" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "unrestricted": "#/components/schemas/VaultCredentialNetworkingResourceUnrestricted", + "limited": "#/components/schemas/VaultCredentialNetworkingResourceLimited" + } + }, + "x-oai-discriminator-values": [ + "unrestricted", + "limited" + ], + "description": "Destination permissions for an environment-variable credential. These do not grant network access to the environment." + }, + "VaultCredentialAuthResourceEnvironmentVariable": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "static_bearer" + "environment_variable" ], - "default": "static_bearer", + "default": "environment_variable", "x-stainless-const": true, - "description": "The type of the object. Always `static_bearer`." + "description": "The type of the object. Always `environment_variable`." }, - "mcp_server_url": { + "secret_name": { "type": "string", "minLength": 0, - "description": "The HTTPS MCP server URL authorized by this credential." + "description": "The environment variable name that receives the placeholder in the sandbox." + }, + "networking": { + "$ref": "#/components/schemas/VaultCredentialNetworkingResource", + "description": "The destinations where the proxy can substitute the secret, subject to the environment network policy." } }, "required": [ "type", - "mcp_server_url" + "secret_name", + "networking" ], "additionalProperties": false, - "description": "Metadata for a bearer-token credential, without automatic OAuth refresh." + "description": "Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource." }, "VaultCredentialAuthResource": { "oneOf": [ @@ -17008,20 +23002,25 @@ }, { "$ref": "#/components/schemas/VaultCredentialAuthResourceStaticBearer" + }, + { + "$ref": "#/components/schemas/VaultCredentialAuthResourceEnvironmentVariable" } ], "discriminator": { "propertyName": "type", "mapping": { "mcp_oauth": "#/components/schemas/VaultCredentialAuthResourceMcpOauth", - "static_bearer": "#/components/schemas/VaultCredentialAuthResourceStaticBearer" + "static_bearer": "#/components/schemas/VaultCredentialAuthResourceStaticBearer", + "environment_variable": "#/components/schemas/VaultCredentialAuthResourceEnvironmentVariable" } }, "x-oai-discriminator-values": [ "mcp_oauth", - "static_bearer" + "static_bearer", + "environment_variable" ], - "description": "The MCP server and authentication configuration of a vault credential, excluding secrets." + "description": "The authentication configuration of a vault credential, excluding secrets." }, "VaultCredentialResource": { "type": "object", @@ -17052,7 +23051,20 @@ }, "auth": { "$ref": "#/components/schemas/VaultCredentialAuthResource", - "description": "The authentication method and non-secret configuration for the MCP server." + "description": "The authentication method and non-secret configuration of the credential." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Application-defined key-value pairs associated with this credential." }, "created_at": { "type": "integer", @@ -17071,11 +23083,12 @@ "vault_id", "name", "auth", + "metadata", "created_at", "updated_at" ], "additionalProperties": false, - "description": "Metadata for a stored MCP server credential. Secret values are never returned." + "description": "Metadata for a stored credential. Secret values are never returned." }, "VaultCredentialListResource": { "type": "object", @@ -17366,6 +23379,116 @@ "additionalProperties": false, "description": "A bearer token for an MCP server, without automatic OAuth refresh." }, + "VaultCredentialNetworkingParamUnrestricted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "unrestricted" + ], + "default": "unrestricted", + "x-stainless-const": true, + "description": "The type of the object. Always `unrestricted`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`." + }, + "VaultCredentialNetworkingParamLimited": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "limited" + ], + "default": "limited", + "x-stainless-const": true, + "description": "The type of the object. Always `limited`." + }, + "allowed_hosts": { + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 1, + "maxItems": 16, + "description": "The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported." + } + }, + "required": [ + "type", + "allowed_hosts" + ], + "additionalProperties": false, + "description": "Allows substitution only for the listed hosts. The environment network policy must also allow these hosts." + }, + "VaultCredentialNetworkingParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/VaultCredentialNetworkingParamUnrestricted" + }, + { + "$ref": "#/components/schemas/VaultCredentialNetworkingParamLimited" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "unrestricted": "#/components/schemas/VaultCredentialNetworkingParamUnrestricted", + "limited": "#/components/schemas/VaultCredentialNetworkingParamLimited" + } + }, + "x-oai-discriminator-values": [ + "unrestricted", + "limited" + ], + "description": "Destination permissions for an environment-variable credential. These do not grant network access to the environment." + }, + "CreateVaultCredentialAuthParamEnvironmentVariable": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "environment_variable" + ], + "default": "environment_variable", + "x-stainless-const": true, + "description": "The type of the object. Always `environment_variable`." + }, + "secret_name": { + "type": "string", + "minLength": 1, + "maxLength": 1048576, + "description": "The environment variable name that receives the placeholder, such as `SERVICE_API_KEY`. Use ASCII letters, digits, and underscores, starting with a letter or underscore. Names starting with `CODEX_` and managed proxy or certificate variable names are reserved." + }, + "secret_value": { + "type": "string", + "minLength": 1, + "maxLength": 1048576, + "description": "The write-only secret to store. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes." + }, + "networking": { + "$ref": "#/components/schemas/VaultCredentialNetworkingParam", + "description": "The destinations where the proxy can substitute this secret. The environment network policy must also allow them." + } + }, + "required": [ + "type", + "secret_name", + "secret_value", + "networking" + ], + "additionalProperties": false, + "description": "An HTTP credential for OpenAI-hosted environments only. The sandbox receives an environment variable containing a placeholder, not the secret. Use the placeholder unchanged in outgoing requests. The egress proxy replaces the placeholder with the secret for allowed HTTPS destinations on ports 443 and 8443. Sandbox code cannot read the real secret or use it for local computation, such as signing a request." + }, "CreateVaultCredentialAuthParam": { "oneOf": [ { @@ -17373,20 +23496,25 @@ }, { "$ref": "#/components/schemas/CreateVaultCredentialAuthParamStaticBearer" + }, + { + "$ref": "#/components/schemas/CreateVaultCredentialAuthParamEnvironmentVariable" } ], "discriminator": { "propertyName": "type", "mapping": { "mcp_oauth": "#/components/schemas/CreateVaultCredentialAuthParamMcpOauth", - "static_bearer": "#/components/schemas/CreateVaultCredentialAuthParamStaticBearer" + "static_bearer": "#/components/schemas/CreateVaultCredentialAuthParamStaticBearer", + "environment_variable": "#/components/schemas/CreateVaultCredentialAuthParamEnvironmentVariable" } }, "x-oai-discriminator-values": [ "mcp_oauth", - "static_bearer" + "static_bearer", + "environment_variable" ], - "description": "Authentication credentials for an MCP server used by agent tools." + "description": "Authentication credentials for an MCP server or an OpenAI-hosted environment." }, "CreateVaultCredentialParams": { "type": "object", @@ -17399,7 +23527,23 @@ }, "auth": { "$ref": "#/components/schemas/CreateVaultCredentialAuthParam", - "description": "The authentication method and secret values to store for the MCP server." + "description": "The authentication method and write-only secret values to store." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Defaults to an empty map." } }, "required": [ @@ -17407,7 +23551,7 @@ "name" ], "additionalProperties": false, - "description": "Parameters for storing a credential that authorizes access to an MCP server." + "description": "Parameters for storing a credential for an MCP server or an OpenAI-hosted environment." }, "RotateMcpOauthTokenEndpointAuthParamClientSecretBasic": { "type": "object", @@ -17597,6 +23741,32 @@ "additionalProperties": false, "description": "Replace the bearer token for the credential's MCP server." }, + "RotateVaultCredentialAuthParamEnvironmentVariable": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "environment_variable" + ], + "default": "environment_variable", + "x-stainless-const": true, + "description": "The type of the object. Always `environment_variable`." + }, + "secret_value": { + "type": "string", + "minLength": 1, + "maxLength": 1048576, + "description": "The write-only replacement secret. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes." + } + }, + "required": [ + "type", + "secret_value" + ], + "additionalProperties": false, + "description": "Replace the secret for an OpenAI-hosted environment credential. The environment variable name and networking configuration remain unchanged." + }, "RotateVaultCredentialAuthParam": { "oneOf": [ { @@ -17604,20 +23774,25 @@ }, { "$ref": "#/components/schemas/RotateVaultCredentialAuthParamStaticBearer" + }, + { + "$ref": "#/components/schemas/RotateVaultCredentialAuthParamEnvironmentVariable" } ], "discriminator": { "propertyName": "type", "mapping": { "mcp_oauth": "#/components/schemas/RotateVaultCredentialAuthParamMcpOauth", - "static_bearer": "#/components/schemas/RotateVaultCredentialAuthParamStaticBearer" + "static_bearer": "#/components/schemas/RotateVaultCredentialAuthParamStaticBearer", + "environment_variable": "#/components/schemas/RotateVaultCredentialAuthParamEnvironmentVariable" } }, "x-oai-discriminator-values": [ "mcp_oauth", - "static_bearer" + "static_bearer", + "environment_variable" ], - "description": "Updates to a vault credential without changing its authentication method or MCP server." + "description": "Updates to a vault credential without changing its authentication method or destination configuration." }, "RotateVaultCredentialParams": { "type": "object", @@ -17625,13 +23800,32 @@ "auth": { "$ref": "#/components/schemas/RotateVaultCredentialAuthParam", "description": "Replacement values for the credential's existing authentication method." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Replaces all metadata. Omit to preserve it, or pass {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." } }, - "required": [ - "auth" - ], "additionalProperties": false, - "description": "Secret, expiry, and OAuth refresh scope updates for an existing vault credential." + "description": "Metadata, secret, expiry, and OAuth refresh scope updates for an existing vault credential. Supply at least one of `auth` or `metadata`.", + "minProperties": 1, + "examples": [ + { + "metadata": {} + } + ] }, "DeletedVaultCredentialResource": { "type": "object", @@ -17935,7 +24129,7 @@ { "id": "responses-streaming", "title": "Streaming events", - "description": "When you [create a Response](https://developers.openai.com/api/reference/resources/responses/methods/create) with\n`stream` set to `true`, the server will emit server-sent events to the\nclient as the Response is generated. This section contains the events that\nare emitted by the server.\n\n[Learn more about streaming responses](https://developers.openai.com/api/docs/guides/streaming-responses).\n", + "description": "When you [create a Response](https://developers.openai.com/api/reference/resources/responses/methods/create) with\n`stream` set to `true`, the server will emit server-sent events to the\nclient as the Response is generated. This section contains the events that\nare emitted by the server.\n\nWhen processing a `compaction_trigger`, `response.compaction.compacting`\nreports newly sampled summary output at most once every 30 seconds. It\ncarries no summary content and does not modify the compaction output item.\nThe existing `response.output_item.added` and `response.output_item.done`\nevents mark that item's lifecycle; `response.output_item.done` carries its\nfinal encrypted content. A short compaction may finish without emitting a\nprogress event.\n\n[Learn more about streaming responses](https://developers.openai.com/api/docs/guides/streaming-responses).\n", "navigationGroup": "responses", "sections": [ { @@ -17973,6 +24167,11 @@ "key": "ResponseOutputItemDoneEvent", "path": "" }, + { + "type": "object", + "key": "ResponseCompactionCompactingEvent", + "path": "" + }, { "type": "object", "key": "ResponseContentPartAddedEvent", @@ -18229,7 +24428,7 @@ { "id": "responses-websocket-shared-events", "title": "Server events", - "description": "These events use the same payloads over WebSocket and\n[HTTP streaming](https://developers.openai.com/api/reference/resources/responses/streaming-events).\n", + "description": "These events use the same payloads over WebSocket and\n[HTTP streaming](https://developers.openai.com/api/reference/resources/responses/streaming-events).\nCompaction progress follows the same cadence and output-item lifecycle\ndescribed in HTTP streaming.\n", "navigationGroup": "responses", "sections": [ { @@ -18267,6 +24466,11 @@ "key": "ResponseOutputItemDoneEvent", "path": "" }, + { + "type": "object", + "key": "ResponseCompactionCompactingEvent", + "path": "" + }, { "type": "object", "key": "ResponseContentPartAddedEvent", @@ -18479,6 +24683,24 @@ } ] }, + { + "id": "safety-cases", + "title": "Safety Cases", + "description": "Retrieve details about a safety warning or deactivation using the case ID\nfrom a `safety.warning_issued` or `safety.deactivation_issued` webhook event.\nCases belong to an organization and require an API key with `api.safety.read`.\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "Getsafetycase", + "path": "retrieve" + }, + { + "type": "object", + "key": "SafetyCaseResource", + "path": "object" + } + ] + }, { "id": "safety-alerts", "title": "Safety Alerts", @@ -18588,6 +24810,16 @@ "key": "WebhookLiveTransportIncoming", "path": "" }, + { + "type": "object", + "key": "WebhookSafetyWarningIssued", + "path": "" + }, + { + "type": "object", + "key": "WebhookSafetyDeactivationIssued", + "path": "" + }, { "type": "object", "key": "WebhookSafetyAlertCreated", @@ -19329,6 +25561,11 @@ "key": "LiveInputAudioUnmuteParam", "path": "" }, + { + "type": "object", + "key": "LiveOutputAudioFixturePlayParam", + "path": "" + }, { "type": "object", "key": "LiveInstructionsAppendParam", @@ -19344,6 +25581,21 @@ "key": "LiveCommentaryAppendParam", "path": "" }, + { + "type": "object", + "key": "LiveDecisionCreateParam", + "path": "" + }, + { + "type": "object", + "key": "LiveDecisionItemCreateParam", + "path": "" + }, + { + "type": "object", + "key": "LiveDecisionItemDeleteParam", + "path": "" + }, { "type": "object", "key": "LiveResponseItemCreateParam", @@ -19367,6 +25619,21 @@ "description": "Live server events. Responses delegation lifecycle events arrive inside response.event, not as top-level response events. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) to design frontend instructions and delegation policy; see [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt) for tools and business rules.", "navigationGroup": "live", "sections": [ + { + "type": "object", + "key": "LiveTransportRinging", + "path": "" + }, + { + "type": "object", + "key": "LiveTransportAnswered", + "path": "" + }, + { + "type": "object", + "key": "LiveTransportFailed", + "path": "" + }, { "type": "object", "key": "LiveSessionStarted", @@ -19387,6 +25654,16 @@ "key": "LiveInputAudioUnmuted", "path": "" }, + { + "type": "object", + "key": "LiveOutputAudioFixturePlaying", + "path": "" + }, + { + "type": "object", + "key": "LiveOutputAudioFixturePlayed", + "path": "" + }, { "type": "object", "key": "LiveInstructionsAppended", @@ -19422,6 +25699,21 @@ "key": "LiveDelegationCreated", "path": "" }, + { + "type": "object", + "key": "LiveDecisionEvent", + "path": "" + }, + { + "type": "object", + "key": "LiveDecisionItemCreated", + "path": "" + }, + { + "type": "object", + "key": "LiveDecisionItemDeleted", + "path": "" + }, { "type": "object", "key": "LiveResponseEvent", @@ -19450,5 +25742,18 @@ ] } ] + }, + "x-openai-structured-output-limits": { + "version": 1, + "max_object_properties": 5000, + "max_nesting_depth": 10, + "max_enum_values": 1000, + "max_string_characters": 120000, + "large_enum_threshold": 250, + "max_large_enum_string_characters": 15000, + "string_length_unit": "unicode_code_points", + "non_string_enum_characters": false, + "property_count_scope": "root_or_definition", + "references": "count_definition_once" } } diff --git a/contracts/agents-api/sessions-events.md b/contracts/agents-api/sessions-events.md index db1414183..1f5fda736 100644 --- a/contracts/agents-api/sessions-events.md +++ b/contracts/agents-api/sessions-events.md @@ -130,7 +130,7 @@ Turn and Item lists take `after`, `limit` and `order` ([list rules](./wire-seman **Turns.** Session Turn routes hold root Turns only, ordered by creation time then ID; a child Turn ID returns 404 there. A failed Turn's `error` has an official `code` and a fixed message for that code, never raw engine diagnostics; [Differences from OpenAI](./index.md#differences-from-openai) lists the codes Core reports. Stream snapshots report the same `error` as reads. Administrators read the failure category through [Session diagnostics](./session-diagnostics.md). -**Items.** Items are ordered by the time they were first observed, then by their position in the Session, then by ID. Updates and retries never move an Item or change its `output_index`, a zero-based position among the Turn's output Items; input Items have none. Reads use the stored history index and never rebuild it from native journals. The Items list includes Items that are still in progress or incomplete. +**Items.** Items are ordered by the time they were first observed, then by their position in the Session, then by ID. Updates and retries never move an Item or change its `output_index`, a zero-based position among the Turn's output Items; input Items have none. Reads use the stored history index and never rebuild it from native journals. The Items list includes Items that are still in progress or incomplete. `GET /agents/sessions/{session_id}/turns/{turn_id}/items` lists only the Items of that root Turn with the same paging, ordering and cursor rules; a Turn that does not exist in the Session returns 404. | Item `type` | Content | | --- | --- | diff --git a/contracts/agents-api/source-files.md b/contracts/agents-api/source-files.md index bf29d2c78..f383cd783 100644 --- a/contracts/agents-api/source-files.md +++ b/contracts/agents-api/source-files.md @@ -4,7 +4,7 @@ title: "Files and Skills" Files (`/v1/files`) and Skills (`/v1/skills`) are Project resources with their own lifecycle, independent of Sessions. A File holds uploaded bytes that Environments copy by ID. A Skill holds immutable, versioned bundles that Templates and Sessions reference. Every API key of a Project shares them. -These routes follow the SDK pinned in [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json): the [Files resource](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/files.py), [create parameters](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/file_create_params.py), [FileObject](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/file_object.py) and the [Skills resource](https://github.com/openai/openai-python/tree/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/skills). They need a Project API key and no `OpenAI-Beta` header. A missing ID and another Project's ID return the same 404. +These routes follow the SDK pinned in [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json): the [Files resource](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/files.py), [create parameters](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/file_create_params.py), [FileObject](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/file_object.py) and the [Skills resource](https://github.com/openai/openai-python/tree/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/skills). They need a Project API key and no `OpenAI-Beta` header. A missing ID and another Project's ID return the same 404. ## Files @@ -75,7 +75,7 @@ A copy into a workspace reads a consistent snapshot of the File and can finish a ### Upload a bundle -Send one ZIP as a `files` part, or a directory as repeated `files[]` parts whose filenames are relative paths such as `report/SKILL.md`. SDK 3.13.0 sends no part when `files` is a single file rather than a list, so upload a single ZIP with plain HTTP: +Send one ZIP as a `files` part, or a directory as repeated `files[]` parts whose filenames are relative paths such as `report/SKILL.md`. With plain HTTP: ```sh curl "$OPENAI_BASE_URL/skills" -H "Authorization: Bearer $OPENAI_API_KEY" -F files=@report.zip diff --git a/contracts/agents-api/upstream-routes.json b/contracts/agents-api/upstream-routes.json index 1f305b93a..a88b4f646 100644 --- a/contracts/agents-api/upstream-routes.json +++ b/contracts/agents-api/upstream-routes.json @@ -1,7 +1,8 @@ { - "openapi_commit": "046a2a0f325bf11f97966f2729219f27281ba71e", + "openapi_commit": "820f97adaafea8cadf1e24e19bd3f98463dcb347", "generator": "scripts/generate-public-api.py", "routes": [ + "DELETE /agents/automations/{}", "DELETE /agents/environments/templates/{}", "DELETE /agents/sessions/{}", "DELETE /agents/sessions/{}/artifacts/{}", @@ -12,6 +13,11 @@ "DELETE /vaults/{}", "DELETE /vaults/{}/credentials/{}", "GET /agents", + "GET /agents/automations", + "GET /agents/automations/{}", + "GET /agents/automations/{}/invocations", + "GET /agents/automations/{}/invocations/{}", + "GET /agents/environments", "GET /agents/environments/templates", "GET /agents/environments/templates/{}", "GET /agents/environments/{}", @@ -29,8 +35,10 @@ "GET /agents/sessions/{}/subagents/{}/turns", "GET /agents/sessions/{}/subagents/{}/turns/{}", "GET /agents/sessions/{}/subagents/{}/turns/{}/items", + "GET /agents/sessions/{}/traces", "GET /agents/sessions/{}/turns", "GET /agents/sessions/{}/turns/{}", + "GET /agents/sessions/{}/turns/{}/items", "GET /agents/{}", "GET /files", "GET /files/{}", @@ -46,6 +54,12 @@ "GET /vaults/{}/credentials", "GET /vaults/{}/credentials/{}", "POST /agents", + "POST /agents/automations", + "POST /agents/automations/{}", + "POST /agents/automations/{}/invocations", + "POST /agents/automations/{}/pause", + "POST /agents/automations/{}/resume", + "POST /agents/environments", "POST /agents/environments/templates", "POST /agents/environments/templates/{}", "POST /agents/environments/{}/files", @@ -58,6 +72,7 @@ "POST /skills/{}", "POST /skills/{}/versions", "POST /vaults", + "POST /vaults/{}", "POST /vaults/{}/credentials", "POST /vaults/{}/credentials/{}" ] diff --git a/contracts/agents-api/upstream.json b/contracts/agents-api/upstream.json index 253e00627..e543754d9 100644 --- a/contracts/agents-api/upstream.json +++ b/contracts/agents-api/upstream.json @@ -1,14 +1,14 @@ { "repository": "https://github.com/openai/openai-python", - "commit": "d7c41efee1b0802b79f3f88a678ef2052b06e9ce", - "sdk_version": "3.13.0", + "commit": "9b3458a2ef563493111a0a4265d4e9e7e14fe840", + "sdk_version": "3.45.0", "resource_path": "src/openai/resources/beta/agents", "type_path": "src/openai/types/beta", "beta_header": "agents=v1", "openapi": { "repository": "https://github.com/openai/openai-openapi", - "commit": "046a2a0f325bf11f97966f2729219f27281ba71e", + "commit": "820f97adaafea8cadf1e24e19bd3f98463dcb347", "path": "openapi.json", - "sha256": "c96d974b164ff4750fa5ea5a1727f7ce6691540e257c177db02b660b0db58f26" + "sha256": "06c5f20ebc804f94be239f9c27d1b194b9ada656901c3916eb4ad1a9c8e2945f" } } diff --git a/contracts/agents-api/upstream/openapi.json b/contracts/agents-api/upstream/openapi.json index f966c2530..a397b1bd9 100644 --- a/contracts/agents-api/upstream/openapi.json +++ b/contracts/agents-api/upstream/openapi.json @@ -85,6 +85,10 @@ "name": "Moderations", "description": "Given text and/or image inputs, classifies if those inputs are potentially harmful." }, + { + "name": "Responses", + "description": "Create and manage model responses." + }, { "name": "Audit Logs", "description": "List user actions and configuration changes within this organization." @@ -97,7 +101,8 @@ "tags": [ "Assistants" ], - "summary": "Returns a list of assistants.", + "summary": "List assistants", + "description": "Returns a list of assistants.", "deprecated": true, "parameters": [ { @@ -156,7 +161,6 @@ } }, "x-oaiMeta": { - "name": "List assistants", "group": "assistants", "examples": { "request": { @@ -164,7 +168,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistants = client.beta.assistants.list(\n order=\"desc\",\n limit=\"20\",\n)\nprint(my_assistants.data)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistants = await openai.beta.assistants.list({\n order: \"desc\",\n limit: \"20\",\n });\n\n console.log(myAssistants.data);\n}\n\nmain();" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698982736,\n \"name\": \"Coding Tutor\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc456\",\n \"object\": \"assistant\",\n \"created_at\": 1698982718,\n \"name\": \"My Assistant\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc789\",\n \"object\": \"assistant\",\n \"created_at\": 1698982643,\n \"name\": null,\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n }\n ],\n \"first_id\": \"asst_abc123\",\n \"last_id\": \"asst_abc789\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698982736,\n \"name\": \"Coding Tutor\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc456\",\n \"object\": \"assistant\",\n \"created_at\": 1698982718,\n \"name\": \"My Assistant\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc789\",\n \"object\": \"assistant\",\n \"created_at\": 1698982643,\n \"name\": null,\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": null,\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n }\n ],\n \"first_id\": \"asst_abc123\",\n \"last_id\": \"asst_abc789\",\n \"has_more\": false\n}\n" } } }, @@ -173,7 +177,8 @@ "tags": [ "Assistants" ], - "summary": "Create an assistant with a model and instructions.", + "summary": "Create assistant", + "description": "Create an assistant with a model and instructions.", "deprecated": true, "requestBody": { "required": true, @@ -201,26 +206,25 @@ } }, "x-oaiMeta": { - "name": "Create assistant", "group": "assistants", "examples": [ { "title": "Code Interpreter", "request": { - "curl": "curl \"https://api.openai.com/v1/assistants\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"name\": \"Math Tutor\",\n \"tools\": [{\"type\": \"code_interpreter\"}],\n \"model\": \"gpt-5\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.create(\n instructions=\"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n name=\"Math Tutor\",\n tools=[{\"type\": \"code_interpreter\"}],\n model=\"gpt-5\",\n)\nprint(my_assistant)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.create({\n instructions:\n \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n name: \"Math Tutor\",\n tools: [{ type: \"code_interpreter\" }],\n model: \"gpt-5\",\n });\n\n console.log(myAssistant);\n}\n\nmain();" + "curl": "curl \"https://api.openai.com/v1/assistants\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"name\": \"Math Tutor\",\n \"tools\": [{\"type\": \"code_interpreter\"}],\n \"model\": \"gpt-4.1\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.create(\n instructions=\"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n name=\"Math Tutor\",\n tools=[{\"type\": \"code_interpreter\"}],\n model=\"gpt-4.1\",\n)\nprint(my_assistant)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.create({\n instructions:\n \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n name: \"Math Tutor\",\n tools: [{ type: \"code_interpreter\" }],\n model: \"gpt-4.1\",\n });\n\n console.log(myAssistant);\n}\n\nmain();" }, - "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698984975,\n \"name\": \"Math Tutor\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698984975,\n \"name\": \"Math Tutor\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" }, { "title": "Files", "request": { - "curl": "curl https://api.openai.com/v1/assistants \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [{\"type\": \"file_search\"}],\n \"tool_resources\": {\"file_search\": {\"vector_store_ids\": [\"vs_123\"]}},\n \"model\": \"gpt-5\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.create(\n instructions=\"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n name=\"HR Helper\",\n tools=[{\"type\": \"file_search\"}],\n tool_resources={\"file_search\": {\"vector_store_ids\": [\"vs_123\"]}},\n model=\"gpt-5\"\n)\nprint(my_assistant)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.create({\n instructions:\n \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n name: \"HR Helper\",\n tools: [{ type: \"file_search\" }],\n tool_resources: {\n file_search: {\n vector_store_ids: [\"vs_123\"]\n }\n },\n model: \"gpt-5\"\n });\n\n console.log(myAssistant);\n}\n\nmain();" + "curl": "curl https://api.openai.com/v1/assistants \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [{\"type\": \"file_search\"}],\n \"tool_resources\": {\"file_search\": {\"vector_store_ids\": [\"vs_123\"]}},\n \"model\": \"gpt-4.1\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.create(\n instructions=\"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n name=\"HR Helper\",\n tools=[{\"type\": \"file_search\"}],\n tool_resources={\"file_search\": {\"vector_store_ids\": [\"vs_123\"]}},\n model=\"gpt-4.1\"\n)\nprint(my_assistant)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.create({\n instructions:\n \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n name: \"HR Helper\",\n tools: [{ type: \"file_search\" }],\n tool_resources: {\n file_search: {\n vector_store_ids: [\"vs_123\"]\n }\n },\n model: \"gpt-4.1\"\n });\n\n console.log(myAssistant);\n}\n\nmain();" }, - "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009403,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": [\"vs_123\"]\n }\n },\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009403,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": [\"vs_123\"]\n }\n },\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" } ] } @@ -232,7 +236,8 @@ "tags": [ "Assistants" ], - "summary": "Retrieves an assistant.", + "summary": "Retrieve assistant", + "description": "Retrieves an assistant.", "deprecated": true, "parameters": [ { @@ -261,7 +266,6 @@ } }, "x-oaiMeta": { - "name": "Retrieve assistant", "group": "assistants", "examples": { "request": { @@ -269,7 +273,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_assistant = client.beta.assistants.retrieve(\"asst_abc123\")\nprint(my_assistant)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myAssistant = await openai.beta.assistants.retrieve(\n \"asst_abc123\"\n );\n\n console.log(myAssistant);\n}\n\nmain();" }, - "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009709,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + "response": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009709,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" } } }, @@ -278,7 +282,8 @@ "tags": [ "Assistants" ], - "summary": "Modifies an assistant.", + "summary": "Modify assistant", + "description": "Modifies an assistant.", "deprecated": true, "parameters": [ { @@ -317,15 +322,14 @@ } }, "x-oaiMeta": { - "name": "Modify assistant", "group": "assistants", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/assistants/asst_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n \"tools\": [{\"type\": \"file_search\"}],\n \"model\": \"gpt-5\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_updated_assistant = client.beta.assistants.update(\n \"asst_abc123\",\n instructions=\"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n name=\"HR Helper\",\n tools=[{\"type\": \"file_search\"}],\n model=\"gpt-5\"\n)\n\nprint(my_updated_assistant)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myUpdatedAssistant = await openai.beta.assistants.update(\n \"asst_abc123\",\n {\n instructions:\n \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n name: \"HR Helper\",\n tools: [{ type: \"file_search\" }],\n model: \"gpt-5\"\n }\n );\n\n console.log(myUpdatedAssistant);\n}\n\nmain();" + "curl": "curl https://api.openai.com/v1/assistants/asst_abc123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n \"tools\": [{\"type\": \"file_search\"}],\n \"model\": \"gpt-4.1\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmy_updated_assistant = client.beta.assistants.update(\n \"asst_abc123\",\n instructions=\"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n name=\"HR Helper\",\n tools=[{\"type\": \"file_search\"}],\n model=\"gpt-4.1\"\n)\n\nprint(my_updated_assistant)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const myUpdatedAssistant = await openai.beta.assistants.update(\n \"asst_abc123\",\n {\n instructions:\n \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n name: \"HR Helper\",\n tools: [{ type: \"file_search\" }],\n model: \"gpt-4.1\"\n }\n );\n\n console.log(myUpdatedAssistant);\n}\n\nmain();" }, - "response": "{\n \"id\": \"asst_123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009709,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": []\n }\n },\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + "response": "{\n \"id\": \"asst_123\",\n \"object\": \"assistant\",\n \"created_at\": 1699009709,\n \"name\": \"HR Helper\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": []\n }\n },\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" } } }, @@ -334,7 +338,8 @@ "tags": [ "Assistants" ], - "summary": "Delete an assistant.", + "summary": "Delete assistant", + "description": "Delete an assistant.", "deprecated": true, "parameters": [ { @@ -363,7 +368,6 @@ } }, "x-oaiMeta": { - "name": "Delete assistant", "group": "assistants", "examples": { "request": { @@ -382,7 +386,8 @@ "tags": [ "Audio" ], - "summary": "Generates audio from the input text.\n\nReturns the audio file content, or a stream of audio events.\n", + "summary": "Create speech", + "description": "Generates audio from the input text.\n\nReturns the audio file content, or a stream of audio events.\n\nThe `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, `gpt-4o-mini-tts-2025-03-20`, and\n`gpt-4o-mini-tts-2025-12-15` models are deprecated and scheduled to shut down\non January 6, 2027. These examples use the existing Speech API; for new\nintegrations, migrate to `gpt-realtime-2.1-mini` through the\n[Realtime API](https://developers.openai.com/api/docs/guides/realtime). See the\n[deprecation schedule](https://developers.openai.com/api/docs/deprecations) for migration details.\n", "requestBody": { "required": true, "content": { @@ -411,6 +416,42 @@ "format": "binary" } }, + "audio/mpeg": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "audio/aac": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "audio/opus": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "audio/flac": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "audio/pcm": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "audio/wav": { + "schema": { + "type": "string", + "format": "binary" + } + }, "text/event-stream": { "schema": { "$ref": "#/components/schemas/CreateSpeechResponseStreamEvent" @@ -418,15 +459,61 @@ } } }, + "400": { + "description": "Invalid speech request, input, output format, or voice.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authentication failed because the API key is missing or revoked, or the client IP is not authorized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "403": { + "description": "Access to a personal API organization is blocked by the organization policy.", + "content": { + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The voice or speech audio could not be processed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create speech", "group": "audio", "examples": [ { @@ -454,7 +541,8 @@ "tags": [ "Audio" ], - "summary": "Transcribes audio into the input language.\n\nReturns a transcription object in `json`, `diarized_json`, or `verbose_json`\nformat, or a stream of transcript events.\n", + "summary": "Create transcription", + "description": "Transcribes audio into the input language.\n\nReturns a transcription object in `json`, `diarized_json`, or `verbose_json`\nformat, plain text in `text`, `srt`, or `vtt` format, or a stream of\ntranscript events. Supported formats depend on the model.\n", "requestBody": { "required": true, "content": { @@ -471,7 +559,7 @@ "content": { "application/json": { "schema": { - "oneOf": [ + "anyOf": [ { "$ref": "#/components/schemas/CreateTranscriptionResponseJson" }, @@ -484,6 +572,11 @@ ] } }, + "text/plain": { + "schema": { + "type": "string" + } + }, "text/event-stream": { "schema": { "$ref": "#/components/schemas/CreateTranscriptionResponseStreamEvent" @@ -491,15 +584,81 @@ } } }, + "400": { + "description": "Invalid audio input or request parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authentication failed because the API key is missing or revoked, or the client IP is not authorized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "403": { + "description": "Access to a personal API organization is blocked by the organization policy.", + "content": { + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "413": { + "description": "The audio request exceeds the supported size limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The audio could not be processed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "502": { + "description": "The upstream audio service connection failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create transcription", "group": "audio", "examples": [ { @@ -547,7 +706,7 @@ "javascript": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const transcription = await openai.audio.transcriptions.create({\n file: fs.createReadStream(\"audio.mp3\"),\n model: \"whisper-1\",\n response_format: \"verbose_json\",\n timestamp_granularities: [\"word\"]\n });\n\n console.log(transcription.text);\n}\nmain();\n", "csharp": "using System;\n\nusing OpenAI.Audio;\n\nstring audioFilePath = \"audio.mp3\";\n\nAudioClient client = new(\n model: \"whisper-1\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nAudioTranscriptionOptions options = new()\n{\n ResponseFormat = AudioTranscriptionFormat.Verbose,\n TimestampGranularities = AudioTimestampGranularities.Word,\n};\n\nAudioTranscription transcription = client.TranscribeAudio(audioFilePath, options);\n\nConsole.WriteLine($\"{transcription.Text}\");\n" }, - "response": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"words\": [\n {\n \"word\": \"The\",\n \"start\": 0.0,\n \"end\": 0.23999999463558197\n },\n ...\n {\n \"word\": \"volleyball\",\n \"start\": 7.400000095367432,\n \"end\": 7.900000095367432\n }\n ],\n \"usage\": {\n \"type\": \"duration\",\n \"seconds\": 9\n }\n}\n" + "response": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 0.5,\n \"text\": \"Hello.\",\n \"words\": [\n {\n \"word\": \"Hello\",\n \"start\": 0.0,\n \"end\": 0.5\n }\n ],\n \"usage\": {\n \"type\": \"duration\",\n \"seconds\": 1\n }\n}\n" }, { "title": "Segment timestamps", @@ -557,7 +716,7 @@ "javascript": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const transcription = await openai.audio.transcriptions.create({\n file: fs.createReadStream(\"audio.mp3\"),\n model: \"whisper-1\",\n response_format: \"verbose_json\",\n timestamp_granularities: [\"segment\"]\n });\n\n console.log(transcription.text);\n}\nmain();\n", "csharp": "using System;\n\nusing OpenAI.Audio;\n\nstring audioFilePath = \"audio.mp3\";\n\nAudioClient client = new(\n model: \"whisper-1\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nAudioTranscriptionOptions options = new()\n{\n ResponseFormat = AudioTranscriptionFormat.Verbose,\n TimestampGranularities = AudioTimestampGranularities.Segment,\n};\n\nAudioTranscription transcription = client.TranscribeAudio(audioFilePath, options);\n\nConsole.WriteLine($\"{transcription.Text}\");\n" }, - "response": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"segments\": [\n {\n \"id\": 0,\n \"seek\": 0,\n \"start\": 0.0,\n \"end\": 3.319999933242798,\n \"text\": \" The beach was a popular spot on a hot summer day.\",\n \"tokens\": [\n 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530\n ],\n \"temperature\": 0.0,\n \"avg_logprob\": -0.2860786020755768,\n \"compression_ratio\": 1.2363636493682861,\n \"no_speech_prob\": 0.00985979475080967\n },\n ...\n ],\n \"usage\": {\n \"type\": \"duration\",\n \"seconds\": 9\n }\n}\n" + "response": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 3.32,\n \"text\": \"The beach was a popular spot on a hot summer day.\",\n \"segments\": [\n {\n \"id\": 0,\n \"seek\": 0,\n \"start\": 0.0,\n \"end\": 3.319999933242798,\n \"text\": \" The beach was a popular spot on a hot summer day.\",\n \"tokens\": [\n 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530\n ],\n \"temperature\": 0.0,\n \"avg_logprob\": -0.2860786020755768,\n \"compression_ratio\": 1.2363636493682861,\n \"no_speech_prob\": 0.00985979475080967\n }\n ],\n \"usage\": {\n \"type\": \"duration\",\n \"seconds\": 4\n }\n}\n" } ] } @@ -566,10 +725,12 @@ "/audio/translations": { "post": { "operationId": "createTranslation", + "deprecated": true, "tags": [ "Audio" ], - "summary": "Translates audio into English.", + "summary": "Create translation", + "description": "Translates audio into English.\n\nThis endpoint supports only `whisper-1`. The endpoint and model are deprecated\nand scheduled to shut down on February 26, 2027. Migrate to\n`/v1/realtime/translations`, which requires a separate integration. See the\n[deprecation schedule](https://developers.openai.com/api/docs/deprecations)\nfor details.\n", "requestBody": { "required": true, "content": { @@ -595,18 +756,89 @@ } ] } + }, + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid audio input or request parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authentication failed because the API key is missing or revoked, or the client IP is not authorized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "403": { + "description": "Access to a personal API organization is blocked by the organization policy.", + "content": { + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "413": { + "description": "The audio request exceeds the supported size limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The audio could not be processed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "502": { + "description": "The upstream audio service connection failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create translation", "group": "audio", "examples": { "request": { @@ -626,8 +858,8 @@ "tags": [ "Audio" ], - "summary": "Upload a voice consent recording.", - "description": "Upload a consent recording that authorizes creation of a custom voice.\n\nSee the [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.\n", + "summary": "Create voice consent", + "description": "Upload a voice consent recording.", "requestBody": { "required": true, "content": { @@ -648,10 +880,29 @@ } } } + }, + "400": { + "description": "Invalid consent recording or consent phrase.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable to this caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create voice consent", "group": "audio", "examples": { "request": { @@ -665,8 +916,8 @@ "tags": [ "Audio" ], - "summary": "Returns a list of voice consent recordings.", - "description": "List consent recordings available to your organization for creating custom voices.\n\nSee the [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.\n", + "summary": "List voice consents", + "description": "Returns a list of voice consent recordings.", "parameters": [ { "in": "query", @@ -698,10 +949,29 @@ } } } + }, + "400": { + "description": "Invalid pagination parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or the pagination cursor was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List voice consents", "group": "audio", "examples": { "request": { @@ -717,8 +987,8 @@ "tags": [ "Audio" ], - "summary": "Retrieves a voice consent recording.", - "description": "Retrieve consent recording metadata used for creating custom voices.\n\nSee the [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.\n", + "summary": "Retrieve voice consent", + "description": "Retrieves a voice consent recording.", "parameters": [ { "in": "path", @@ -740,10 +1010,29 @@ } } } + }, + "400": { + "description": "Invalid consent recording ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or the consent recording was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve voice consent", "group": "audio", "examples": { "request": { @@ -757,8 +1046,8 @@ "tags": [ "Audio" ], - "summary": "Updates a voice consent recording (metadata only).", - "description": "Update consent recording metadata used for creating custom voices. This endpoint updates metadata only and does not replace the underlying audio.\n\nSee the [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.\n", + "summary": "Update voice consent", + "description": "Updates a voice consent recording (metadata only).", "parameters": [ { "in": "path", @@ -790,10 +1079,29 @@ } } } + }, + "400": { + "description": "Invalid consent recording ID or update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or the consent recording was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update voice consent", "group": "audio", "examples": { "request": { @@ -807,8 +1115,8 @@ "tags": [ "Audio" ], - "summary": "Deletes a voice consent recording.", - "description": "Delete a consent recording that was uploaded for creating custom voices.\n\nSee the [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.\n", + "summary": "Delete voice consent", + "description": "Deletes a voice consent recording.", "parameters": [ { "in": "path", @@ -830,10 +1138,29 @@ } } } + }, + "400": { + "description": "Invalid consent recording ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or the consent recording was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete voice consent", "group": "audio", "examples": { "request": { @@ -849,11 +1176,16 @@ "tags": [ "Audio" ], - "summary": "Creates a custom voice.", - "description": "Create a custom voice you can use for audio output (for example, in Text-to-Speech and the Realtime API). This requires an audio sample and a previously uploaded consent recording.\n\nSee the [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.\n", + "summary": "Create voice", + "description": "Creates a voice from a text prompt or from a consent recording and an audio sample.\n\nFor prompt-based creation, send `type: \"prompt\"` with a `name` and `prompt` as JSON or multipart form data. For creation from an audio sample, send `type: \"audio_sample\"` with a `name`, `audio_sample`, and `consent` recording ID as multipart form data. The type defaults to `audio_sample` when omitted.\n\nReturns the saved voice's metadata. Voices created from text prompts are supported only in Live, not in Realtime or the speech endpoint. The response does not include preview audio.\n", "requestBody": { "required": true, "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVoicePromptRequest" + } + }, "multipart/form-data": { "schema": { "$ref": "#/components/schemas/CreateVoiceRequest" @@ -871,22 +1203,114 @@ } } } + }, + "400": { + "description": "Invalid voice request, prompt, script hint, model, consent recording, or audio sample.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or the consent recording was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The audio sample could not be processed or the voice could not be created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create voice", "group": "audio", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/audio/voices \\\n -X POST \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F \"name=My new voice\" \\\n -F \"consent=cons_1234\" \\\n -F \"audio_sample=@$HOME/audio_sample.wav;type=audio/x-wav\"\n" + "curl": "curl https://api.openai.com/v1/audio/voices \\\n -X POST \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"type\": \"prompt\",\n \"name\": \"Warm narrator\",\n \"prompt\": \"A warm, calm narrator with a clear, measured delivery.\",\n \"model\": \"auto\"\n }'\n" + } + } + } + } + }, + "/audio/voices/{voice_id}": { + "delete": { + "operationId": "deleteVoice", + "tags": [ + "Audio" + ], + "summary": "Delete voice", + "description": "Deletes a voice created from a text prompt or an audio sample.\n\nRequires voice write permission and access to the voice's project. Access to voices created from recordings is limited to eligible customers. See the [custom voices guide](https://developers.openai.com/api/docs/guides/custom-voices).\n\nDeleting a voice does not delete its consent recording. Deleting an already deleted voice returns a 404 error.\n", + "parameters": [ + { + "in": "path", + "name": "voice_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the voice to delete." + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VoiceDeletedResource" + } + } + } + }, + "400": { + "description": "Invalid voice ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or the voice was not found in the requested project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } } + }, + "x-oaiMeta": { + "group": "audio", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/audio/voices/voice_1234 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" + }, + "response": "{\n \"id\": \"voice_1234\",\n \"object\": \"audio.voice.deleted\",\n \"deleted\": true\n}\n" + } } } }, "/batches": { "post": { - "summary": "Creates and executes a batch from an uploaded file of requests", + "summary": "Create batch", + "description": "Creates and executes a batch from an uploaded file of requests", "operationId": "createBatch", "tags": [ "Batch" @@ -911,10 +1335,49 @@ } } } + }, + "400": { + "description": "The request is invalid or the account cannot create a batch.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request was rejected because a rate limit was exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error prevented the batch from being created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "503": { + "description": "The batch could not be created because the service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create batch", "group": "batch", "examples": { "request": { @@ -922,7 +1385,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.create(\n input_file_id=\"file-abc123\",\n endpoint=\"/v1/chat/completions\",\n completion_window=\"24h\"\n)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.create({\n input_file_id: \"file-abc123\",\n endpoint: \"/v1/chat/completions\",\n completion_window: \"24h\"\n });\n\n console.log(batch);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"validating\",\n \"output_file_id\": null,\n \"error_file_id\": null,\n \"created_at\": 1711471533,\n \"in_progress_at\": null,\n \"expires_at\": null,\n \"finalizing_at\": null,\n \"completed_at\": null,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 0,\n \"completed\": 0,\n \"failed\": 0\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" + "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"validating\",\n \"output_file_id\": null,\n \"error_file_id\": null,\n \"created_at\": 1711471533,\n \"in_progress_at\": null,\n \"expires_at\": null,\n \"finalizing_at\": null,\n \"completed_at\": null,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 0,\n \"completed\": 0,\n \"failed\": 0\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\"\n }\n}\n" } } }, @@ -931,7 +1394,8 @@ "tags": [ "Batch" ], - "summary": "List your organization's batches.", + "summary": "List batches", + "description": "List your organization's batches.", "parameters": [ { "in": "query", @@ -963,10 +1427,39 @@ } } } + }, + "400": { + "description": "Invalid pagination parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "No batch was found with the specified pagination cursor.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request was rejected because a rate limit was exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List batches", "group": "batch", "examples": { "request": { @@ -974,7 +1467,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.list()\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.batches.list();\n\n for await (const batch of list) {\n console.log(batch);\n }\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly job\",\n }\n },\n { ... },\n ],\n \"first_id\": \"batch_abc123\",\n \"last_id\": \"batch_abc456\",\n \"has_more\": true\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly job\"\n }\n }\n ],\n \"first_id\": \"batch_abc123\",\n \"last_id\": \"batch_abc123\",\n \"has_more\": false\n}\n" } } } @@ -985,7 +1478,8 @@ "tags": [ "Batch" ], - "summary": "Retrieves a batch.", + "summary": "Retrieve batch", + "description": "Retrieves a batch.", "parameters": [ { "in": "path", @@ -1007,10 +1501,39 @@ } } } + }, + "400": { + "description": "Invalid batch ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "No batch was found with the specified ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request was rejected because a rate limit was exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve batch", "group": "batch", "examples": { "request": { @@ -1018,7 +1541,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.retrieve(\"batch_abc123\")\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.retrieve(\"batch_abc123\");\n\n console.log(batch);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" + "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\"\n }\n}\n" } } } @@ -1029,7 +1552,8 @@ "tags": [ "Batch" ], - "summary": "Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.", + "summary": "Cancel batch", + "description": "Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.", "parameters": [ { "in": "path", @@ -1051,10 +1575,49 @@ } } } + }, + "400": { + "description": "Invalid batch ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "No batch was found with the specified ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The batch's current status does not allow cancellation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request was rejected because a rate limit was exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Cancel batch", "group": "batch", "examples": { "request": { @@ -1062,7 +1625,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.batches.cancel(\"batch_abc123\")\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const batch = await openai.batches.cancel(\"batch_abc123\");\n\n console.log(batch);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"cancelling\",\n \"output_file_id\": null,\n \"error_file_id\": null,\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": null,\n \"completed_at\": null,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": 1711475133,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 23,\n \"failed\": 1\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" + "response": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"cancelling\",\n \"output_file_id\": null,\n \"error_file_id\": null,\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": null,\n \"completed_at\": null,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": 1711475133,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 23,\n \"failed\": 1\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\"\n }\n}\n" } } } @@ -1073,7 +1636,8 @@ "tags": [ "Chat" ], - "summary": "List stored Chat Completions. Only Chat Completions that have been stored\nwith the `store` parameter set to `true` will be returned.\n", + "summary": "List Chat Completions", + "description": "List stored Chat Completions. Only Chat Completions that have been stored\nwith the `store` parameter set to `true` will be returned.\n", "parameters": [ { "name": "model", @@ -1137,10 +1701,32 @@ } } } + }, + "400": { + "description": "Invalid pagination or filter parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "An internal error prevented the request from being completed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List Chat Completions", "group": "chat", "path": "list", "examples": { @@ -1157,7 +1743,8 @@ "tags": [ "Chat" ], - "summary": "**Starting a new project?** We recommend trying [Responses](https://developers.openai.com/api/reference/resources/responses)\nto take advantage of the latest OpenAI platform features. Compare\n[Chat Completions with Responses](https://developers.openai.com/api/docs/guides/migrate-to-responses?api-mode=responses).\n\n---\n\nCreates a model response for the given chat conversation. Learn more in the\n[text generation](https://developers.openai.com/api/docs/guides/text), [vision](https://developers.openai.com/api/docs/guides/images-vision),\nand [audio](https://developers.openai.com/api/docs/guides/audio) guides.\n\nParameter support can differ depending on the model used to generate the\nresponse, particularly for newer reasoning models. Parameters that are only\nsupported for reasoning models are noted below. For the current state of\nunsupported parameters in reasoning models,\n[refer to the reasoning guide](https://developers.openai.com/api/docs/guides/reasoning).\n\nReturns a chat completion object, or a streamed sequence of chat completion\nchunk objects if the request is streamed.\n", + "summary": "Create chat completion", + "description": "**Starting a new project?** We recommend trying [Responses](https://developers.openai.com/api/reference/resources/responses)\nto take advantage of the latest OpenAI platform features. Compare\n[Chat Completions with Responses](https://developers.openai.com/api/docs/guides/migrate-to-responses?api-mode=responses).\n\n---\n\nCreates a model response for the given chat conversation. Learn more in the\n[text generation](https://developers.openai.com/api/docs/guides/text), [vision](https://developers.openai.com/api/docs/guides/images-vision),\nand [audio](https://developers.openai.com/api/docs/guides/audio) guides.\n\nParameter support can differ depending on the model used to generate the\nresponse, particularly for newer reasoning models. Parameters that are only\nsupported for reasoning models are noted below. For the current state of\nunsupported parameters in reasoning models,\n[refer to the reasoning guide](https://developers.openai.com/api/docs/guides/reasoning).\n\nReturns a chat completion object, or a streamed sequence of chat completion\nchunk objects if the request is streamed.\n", "requestBody": { "required": true, "content": { @@ -1170,7 +1757,7 @@ }, "responses": { "200": { - "description": "OK", + "description": "Returns a Chat Completion object for a non-streaming request.\n\nIf `stream` is `true`, returns server-sent events (`text/event-stream`).\nSuccessful chunk frames contain a JSON Chat Completion chunk matching\n`CreateChatCompletionStreamResponse`. On normal completion, the final\nframe is:\n\n```text\ndata: [DONE]\n\n```\n\nThe final frame ends with a blank line. `[DONE]` is literal text, not a\nJSON chunk, and this frame has no `event: done` field.\n\nIf a failure occurs after streaming has started, a data frame may\ncontain a JSON object with an `error` field instead of a completion\nchunk. The streaming schema describes successful JSON chunks, not\nerror frames or the completion marker. An interrupted stream may end\nwithout the marker.\n", "content": { "application/json": { "schema": { @@ -1184,15 +1771,71 @@ } } }, + "400": { + "description": "Invalid chat completion request or incompatible request parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authentication failed because the API key is missing or revoked, or the client IP is not authorized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "403": { + "description": "Access to a personal API organization is blocked by the organization policy.", + "content": { + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "404": { + "description": "The requested model or a referenced resource was not found or is unavailable to this caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The chat completion could not be processed due to an internal error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create chat completion", "group": "chat", "path": "create", "examples": [ @@ -1224,7 +1867,7 @@ "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n model: \"gpt-6-astra\",\n messages: [\n {\"role\": \"developer\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n stream: true,\n });\n\n for await (const chunk of completion) {\n console.log(chunk.choices[0].delta.content);\n }\n}\n\nmain();\n", "csharp": "using System;\nusing System.ClientModel;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nusing OpenAI.Chat;\n\nChatClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nList messages =\n[\n new SystemChatMessage(\"You are a helpful assistant.\"),\n new UserChatMessage(\"Hello!\")\n];\n\nAsyncCollectionResult completionUpdates = client.CompleteChatStreamingAsync(messages);\n\nawait foreach (StreamingChatCompletionUpdate completionUpdate in completionUpdates)\n{\n if (completionUpdate.ContentUpdate.Count > 0)\n {\n Console.Write(completionUpdate.ContentUpdate[0].Text);\n }\n}\n" }, - "response": "{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n....\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n" + "response": "data: {\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\"logprobs\":null,\"finish_reason\":null}]}\n\n: Intermediate chat completion chunks omitted.\n\ndata: {\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n" }, { "title": "Functions", @@ -1239,12 +1882,12 @@ { "title": "Logprobs", "request": { - "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"reasoning_effort\": \"none\",\n \"logprobs\": true,\n \"top_logprobs\": 2\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ncompletion = client.chat.completions.create(\n model=\"gpt-6-astra\",\n messages=[\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n reasoning_effort=\"none\",\n logprobs=True,\n top_logprobs=2\n)\n\nprint(completion.choices[0].message)\nprint(completion.choices[0].logprobs)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n messages: [{ role: \"user\", content: \"Hello!\" }],\n model: \"gpt-6-astra\",\n reasoning_effort: \"none\",\n logprobs: true,\n top_logprobs: 2,\n });\n\n console.log(completion.choices[0]);\n}\n\nmain();\n", - "csharp": "using System;\nusing System.Collections.Generic;\n\nusing OpenAI.Chat;\n\nChatClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nList messages =\n[\n new UserChatMessage(\"Hello!\")\n];\n\nChatCompletionOptions options = new()\n{\n ReasoningEffortLevel = ChatReasoningEffortLevel.None,\n IncludeLogProbabilities = true,\n TopLogProbabilityCount = 2\n};\n\nChatCompletion completion = client.CompleteChat(messages, options);\n\nConsole.WriteLine(completion.Content[0].Text);\n" + "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-sol\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"reasoning_effort\": \"none\",\n \"logprobs\": true,\n \"top_logprobs\": 2\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ncompletion = client.chat.completions.create(\n model=\"gpt-6-sol\",\n messages=[\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n reasoning_effort=\"none\",\n logprobs=True,\n top_logprobs=2\n)\n\nprint(completion.choices[0].message)\nprint(completion.choices[0].logprobs)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const completion = await openai.chat.completions.create({\n messages: [{ role: \"user\", content: \"Hello!\" }],\n model: \"gpt-6-sol\",\n reasoning_effort: \"none\",\n logprobs: true,\n top_logprobs: 2,\n });\n\n console.log(completion.choices[0]);\n}\n\nmain();\n", + "csharp": "using System;\nusing System.Collections.Generic;\n\nusing OpenAI.Chat;\n\nChatClient client = new(\n model: \"gpt-6-sol\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nList messages =\n[\n new UserChatMessage(\"Hello!\")\n];\n\nChatCompletionOptions options = new()\n{\n ReasoningEffortLevel = ChatReasoningEffortLevel.None,\n IncludeLogProbabilities = true,\n TopLogProbabilityCount = 2\n};\n\nChatCompletion completion = client.CompleteChat(messages, options);\n\nConsole.WriteLine(completion.Content[0].Text);\n" }, - "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1702685778,\n \"model\": \"gpt-6-astra\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"Hello! How can I assist you today?\"\n },\n \"logprobs\": {\n \"content\": [\n {\n \"token\": \"Hello\",\n \"logprob\": -0.31725305,\n \"bytes\": [72, 101, 108, 108, 111],\n \"top_logprobs\": [\n {\n \"token\": \"Hello\",\n \"logprob\": -0.31725305,\n \"bytes\": [72, 101, 108, 108, 111]\n },\n {\n \"token\": \"Hi\",\n \"logprob\": -1.3190403,\n \"bytes\": [72, 105]\n }\n ]\n },\n {\n \"token\": \"!\",\n \"logprob\": -0.02380986,\n \"bytes\": [\n 33\n ],\n \"top_logprobs\": [\n {\n \"token\": \"!\",\n \"logprob\": -0.02380986,\n \"bytes\": [33]\n },\n {\n \"token\": \" there\",\n \"logprob\": -3.787621,\n \"bytes\": [32, 116, 104, 101, 114, 101]\n }\n ]\n },\n {\n \"token\": \" How\",\n \"logprob\": -0.000054669687,\n \"bytes\": [32, 72, 111, 119],\n \"top_logprobs\": [\n {\n \"token\": \" How\",\n \"logprob\": -0.000054669687,\n \"bytes\": [32, 72, 111, 119]\n },\n {\n \"token\": \"<|end|>\",\n \"logprob\": -10.953937,\n \"bytes\": null\n }\n ]\n },\n {\n \"token\": \" can\",\n \"logprob\": -0.015801601,\n \"bytes\": [32, 99, 97, 110],\n \"top_logprobs\": [\n {\n \"token\": \" can\",\n \"logprob\": -0.015801601,\n \"bytes\": [32, 99, 97, 110]\n },\n {\n \"token\": \" may\",\n \"logprob\": -4.161023,\n \"bytes\": [32, 109, 97, 121]\n }\n ]\n },\n {\n \"token\": \" I\",\n \"logprob\": -3.7697225e-6,\n \"bytes\": [\n 32,\n 73\n ],\n \"top_logprobs\": [\n {\n \"token\": \" I\",\n \"logprob\": -3.7697225e-6,\n \"bytes\": [32, 73]\n },\n {\n \"token\": \" assist\",\n \"logprob\": -13.596657,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116]\n }\n ]\n },\n {\n \"token\": \" assist\",\n \"logprob\": -0.04571125,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116],\n \"top_logprobs\": [\n {\n \"token\": \" assist\",\n \"logprob\": -0.04571125,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116]\n },\n {\n \"token\": \" help\",\n \"logprob\": -3.1089056,\n \"bytes\": [32, 104, 101, 108, 112]\n }\n ]\n },\n {\n \"token\": \" you\",\n \"logprob\": -5.4385737e-6,\n \"bytes\": [32, 121, 111, 117],\n \"top_logprobs\": [\n {\n \"token\": \" you\",\n \"logprob\": -5.4385737e-6,\n \"bytes\": [32, 121, 111, 117]\n },\n {\n \"token\": \" today\",\n \"logprob\": -12.807695,\n \"bytes\": [32, 116, 111, 100, 97, 121]\n }\n ]\n },\n {\n \"token\": \" today\",\n \"logprob\": -0.0040071653,\n \"bytes\": [32, 116, 111, 100, 97, 121],\n \"top_logprobs\": [\n {\n \"token\": \" today\",\n \"logprob\": -0.0040071653,\n \"bytes\": [32, 116, 111, 100, 97, 121]\n },\n {\n \"token\": \"?\",\n \"logprob\": -5.5247097,\n \"bytes\": [63]\n }\n ]\n },\n {\n \"token\": \"?\",\n \"logprob\": -0.0008108172,\n \"bytes\": [63],\n \"top_logprobs\": [\n {\n \"token\": \"?\",\n \"logprob\": -0.0008108172,\n \"bytes\": [63]\n },\n {\n \"token\": \"?\\n\",\n \"logprob\": -7.184561,\n \"bytes\": [63, 10]\n }\n ]\n }\n ]\n },\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 9,\n \"total_tokens\": 18,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": null\n}\n" + "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1702685778,\n \"model\": \"gpt-6-sol\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"Hello! How can I assist you today?\"\n },\n \"logprobs\": {\n \"content\": [\n {\n \"token\": \"Hello\",\n \"logprob\": -0.31725305,\n \"bytes\": [72, 101, 108, 108, 111],\n \"top_logprobs\": [\n {\n \"token\": \"Hello\",\n \"logprob\": -0.31725305,\n \"bytes\": [72, 101, 108, 108, 111]\n },\n {\n \"token\": \"Hi\",\n \"logprob\": -1.3190403,\n \"bytes\": [72, 105]\n }\n ]\n },\n {\n \"token\": \"!\",\n \"logprob\": -0.02380986,\n \"bytes\": [\n 33\n ],\n \"top_logprobs\": [\n {\n \"token\": \"!\",\n \"logprob\": -0.02380986,\n \"bytes\": [33]\n },\n {\n \"token\": \" there\",\n \"logprob\": -3.787621,\n \"bytes\": [32, 116, 104, 101, 114, 101]\n }\n ]\n },\n {\n \"token\": \" How\",\n \"logprob\": -0.000054669687,\n \"bytes\": [32, 72, 111, 119],\n \"top_logprobs\": [\n {\n \"token\": \" How\",\n \"logprob\": -0.000054669687,\n \"bytes\": [32, 72, 111, 119]\n },\n {\n \"token\": \"<|end|>\",\n \"logprob\": -10.953937,\n \"bytes\": null\n }\n ]\n },\n {\n \"token\": \" can\",\n \"logprob\": -0.015801601,\n \"bytes\": [32, 99, 97, 110],\n \"top_logprobs\": [\n {\n \"token\": \" can\",\n \"logprob\": -0.015801601,\n \"bytes\": [32, 99, 97, 110]\n },\n {\n \"token\": \" may\",\n \"logprob\": -4.161023,\n \"bytes\": [32, 109, 97, 121]\n }\n ]\n },\n {\n \"token\": \" I\",\n \"logprob\": -3.7697225e-6,\n \"bytes\": [\n 32,\n 73\n ],\n \"top_logprobs\": [\n {\n \"token\": \" I\",\n \"logprob\": -3.7697225e-6,\n \"bytes\": [32, 73]\n },\n {\n \"token\": \" assist\",\n \"logprob\": -13.596657,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116]\n }\n ]\n },\n {\n \"token\": \" assist\",\n \"logprob\": -0.04571125,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116],\n \"top_logprobs\": [\n {\n \"token\": \" assist\",\n \"logprob\": -0.04571125,\n \"bytes\": [32, 97, 115, 115, 105, 115, 116]\n },\n {\n \"token\": \" help\",\n \"logprob\": -3.1089056,\n \"bytes\": [32, 104, 101, 108, 112]\n }\n ]\n },\n {\n \"token\": \" you\",\n \"logprob\": -5.4385737e-6,\n \"bytes\": [32, 121, 111, 117],\n \"top_logprobs\": [\n {\n \"token\": \" you\",\n \"logprob\": -5.4385737e-6,\n \"bytes\": [32, 121, 111, 117]\n },\n {\n \"token\": \" today\",\n \"logprob\": -12.807695,\n \"bytes\": [32, 116, 111, 100, 97, 121]\n }\n ]\n },\n {\n \"token\": \" today\",\n \"logprob\": -0.0040071653,\n \"bytes\": [32, 116, 111, 100, 97, 121],\n \"top_logprobs\": [\n {\n \"token\": \" today\",\n \"logprob\": -0.0040071653,\n \"bytes\": [32, 116, 111, 100, 97, 121]\n },\n {\n \"token\": \"?\",\n \"logprob\": -5.5247097,\n \"bytes\": [63]\n }\n ]\n },\n {\n \"token\": \"?\",\n \"logprob\": -0.0008108172,\n \"bytes\": [63],\n \"top_logprobs\": [\n {\n \"token\": \"?\",\n \"logprob\": -0.0008108172,\n \"bytes\": [63]\n },\n {\n \"token\": \"?\\n\",\n \"logprob\": -7.184561,\n \"bytes\": [63, 10]\n }\n ]\n }\n ],\n \"refusal\": null\n },\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 9,\n \"total_tokens\": 18,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n }\n}\n" } ] } @@ -1256,7 +1899,8 @@ "tags": [ "Chat" ], - "summary": "Get a stored chat completion. Only Chat Completions that have been created\nwith the `store` parameter set to `true` will be returned.\n", + "summary": "Get chat completion", + "description": "Get a stored chat completion. Only Chat Completions that have been created\nwith the `store` parameter set to `true` will be returned.\n", "parameters": [ { "in": "path", @@ -1278,10 +1922,32 @@ } } } + }, + "404": { + "description": "No stored chat completion was found with the specified ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "An internal error prevented the request from being completed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Get chat completion", "group": "chat", "examples": { "request": { @@ -1297,7 +1963,8 @@ "tags": [ "Chat" ], - "summary": "Modify a stored chat completion. Only Chat Completions that have been\ncreated with the `store` parameter set to `true` can be modified. Currently,\nthe only supported modification is to update the `metadata` field.\n", + "summary": "Update chat completion", + "description": "Modify a stored chat completion. Only Chat Completions that have been\ncreated with the `store` parameter set to `true` can be modified. Currently,\nthe only supported modification is to update the `metadata` field.\n", "parameters": [ { "in": "path", @@ -1337,10 +2004,42 @@ } } } + }, + "400": { + "description": "Invalid metadata update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "No stored chat completion was found with the specified ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "An internal error prevented the request from being completed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update chat completion", "group": "chat", "examples": { "request": { @@ -1356,7 +2055,8 @@ "tags": [ "Chat" ], - "summary": "Delete a stored chat completion. Only Chat Completions that have been\ncreated with the `store` parameter set to `true` can be deleted.\n", + "summary": "Delete chat completion", + "description": "Delete a stored chat completion. Only Chat Completions that have been\ncreated with the `store` parameter set to `true` can be deleted.\n", "parameters": [ { "in": "path", @@ -1378,10 +2078,32 @@ } } } + }, + "404": { + "description": "No stored chat completion was found with the specified ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "An internal error prevented the request from being completed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete chat completion", "group": "chat", "examples": { "request": { @@ -1399,7 +2121,8 @@ "tags": [ "Chat" ], - "summary": "Get the messages in a stored chat completion. Only Chat Completions that\nhave been created with the `store` parameter set to `true` will be\nreturned.\n", + "summary": "Get chat messages", + "description": "Get the messages in a stored chat completion. Only Chat Completions that\nhave been created with the `store` parameter set to `true` will be\nreturned.\n", "parameters": [ { "in": "path", @@ -1454,10 +2177,42 @@ } } } + }, + "400": { + "description": "Invalid message pagination parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "No stored chat completion was found with the specified ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "An internal error prevented the request from being completed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Get chat messages", "group": "chat", "examples": { "request": { @@ -1475,7 +2230,8 @@ "tags": [ "Completions" ], - "summary": "Creates a completion for the provided prompt and parameters.\n\nReturns a completion object, or a sequence of completion objects if the request is streamed.\n", + "summary": "Create completion", + "description": "Creates a completion for the provided prompt and parameters.\n\nReturns a completion object, or a sequence of completion objects if the request is streamed.\n", "requestBody": { "required": true, "content": { @@ -1494,18 +2250,79 @@ "schema": { "$ref": "#/components/schemas/CreateCompletionResponse" } + }, + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/CreateCompletionResponse" + } + } + } + }, + "400": { + "description": "Invalid completion request or incompatible request parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authentication failed because the API key is missing or revoked, or the client IP is not authorized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "403": { + "description": "Access to a personal API organization is blocked by the organization policy.", + "content": { + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "404": { + "description": "The requested model was not found, is unavailable, or does not support this endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The completion could not be processed due to an internal error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create completion", "group": "completions", "legacy": true, "examples": [ @@ -1525,7 +2342,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nfor chunk in client.completions.create(\n model=\"gpt-3.5-turbo-instruct\",\n prompt=\"Say this is a test\",\n max_tokens=7,\n temperature=0,\n stream=True\n):\n print(chunk.choices[0].text)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.completions.create({\n model: \"gpt-3.5-turbo-instruct\",\n prompt: \"Say this is a test.\",\n stream: true,\n });\n\n for await (const chunk of stream) {\n console.log(chunk.choices[0].text)\n }\n}\nmain();" }, - "response": "{\n \"id\": \"cmpl-7iA7iJjj8V2zOkCGvWF2hAkDWBQZe\",\n \"object\": \"text_completion\",\n \"created\": 1690759702,\n \"choices\": [\n {\n \"text\": \"This\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": null\n }\n ],\n \"model\": \"gpt-3.5-turbo-instruct\"\n \"system_fingerprint\": \"fp_44709d6fcb\",\n}\n" + "response": "{\n \"id\": \"cmpl-7iA7iJjj8V2zOkCGvWF2hAkDWBQZe\",\n \"object\": \"text_completion\",\n \"created\": 1690759702,\n \"choices\": [\n {\n \"text\": \"This\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": null\n }\n ],\n \"model\": \"gpt-3.5-turbo-instruct\",\n \"system_fingerprint\": \"fp_44709d6fcb\"\n}\n" } ] } @@ -1533,8 +2350,8 @@ }, "/containers": { "get": { - "summary": "List Containers", - "description": "Lists containers.", + "summary": "List containers", + "description": "List Containers", "operationId": "ListContainers", "parameters": [ { @@ -1589,12 +2406,21 @@ } } }, + "404": { + "description": "The container specified by `after` was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List containers", "group": "containers", "path": "get", "examples": { @@ -1606,8 +2432,8 @@ } }, "post": { - "summary": "Create Container", - "description": "Creates a container.", + "summary": "Create container", + "description": "Create Container", "operationId": "CreateContainer", "parameters": [], "requestBody": { @@ -1630,12 +2456,21 @@ } } }, + "400": { + "description": "The container configuration or supplied skill is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Create container", "group": "containers", "path": "post", "examples": { @@ -1649,8 +2484,8 @@ }, "/containers/{container_id}": { "get": { - "summary": "Retrieve Container", - "description": "Retrieves a container.", + "summary": "Retrieve container", + "description": "Retrieve Container", "operationId": "RetrieveContainer", "parameters": [ { @@ -1673,12 +2508,21 @@ } } }, + "404": { + "description": "The container was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve container", "group": "containers", "path": "get", "examples": { @@ -1691,8 +2535,8 @@ }, "delete": { "operationId": "DeleteContainer", - "summary": "Delete Container", - "description": "Delete a container.", + "summary": "Delete a container", + "description": "Delete Container", "parameters": [ { "name": "container_id", @@ -1706,17 +2550,52 @@ ], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "container.deleted" + ] + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + } + }, + "required": [ + "object", + "deleted", + "id" + ] + } + } + } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "Delete a container", - "group": "containers", - "path": "delete", - "examples": { + "404": { + "description": "The container was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + } + }, + "x-oaiMeta": { + "group": "containers", + "path": "delete", + "examples": { "request": { "curl": "curl -X DELETE https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" }, @@ -1727,8 +2606,8 @@ }, "/containers/{container_id}/files": { "post": { - "summary": "Create a Container File\n\nYou can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.\n", - "description": "Creates a container file.\n", + "summary": "Create container file", + "description": "Create a Container File\n\nYou can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.\n", "operationId": "CreateContainerFile", "parameters": [ { @@ -1766,12 +2645,31 @@ } } }, + "400": { + "description": "The file input is invalid, or the container file limit would be exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The container was not found or has expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Create container file", "group": "containers", "path": "post", "examples": { @@ -1783,8 +2681,8 @@ } }, "get": { - "summary": "List Container files", - "description": "Lists container files.", + "summary": "List container files", + "description": "List Container files", "operationId": "ListContainerFiles", "parameters": [ { @@ -1838,12 +2736,21 @@ } } }, + "404": { + "description": "The container was not found or has expired, or the file specified by `after` was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List container files", "group": "containers", "path": "get", "examples": { @@ -1857,8 +2764,8 @@ }, "/containers/{container_id}/files/{file_id}": { "get": { - "summary": "Retrieve Container File", - "description": "Retrieves a container file.", + "summary": "Retrieve container file", + "description": "Retrieve Container File", "operationId": "RetrieveContainerFile", "parameters": [ { @@ -1889,12 +2796,21 @@ } } }, + "404": { + "description": "The container was not found or has expired, or the file was not found in the container.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve container file", "group": "containers", "path": "get", "examples": { @@ -1907,8 +2823,8 @@ }, "delete": { "operationId": "DeleteContainerFile", - "summary": "Delete Container File", - "description": "Delete a container file.", + "summary": "Delete a container file", + "description": "Delete Container File", "parameters": [ { "name": "container_id", @@ -1929,14 +2845,49 @@ ], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "container.file.deleted" + ] + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + } + }, + "required": [ + "object", + "deleted", + "id" + ] + } + } + } + }, + "404": { + "description": "The container was not found or has expired, or the file was not found in the container.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Delete a container file", "group": "containers", "path": "delete", "examples": { @@ -1950,8 +2901,8 @@ }, "/containers/{container_id}/files/{file_id}/content": { "get": { - "summary": "Retrieve Container File Content", - "description": "Retrieves a container file content.", + "summary": "Retrieve container file content", + "description": "Retrieve Container File Content", "operationId": "RetrieveContainerFileContent", "parameters": [ { @@ -1973,14 +2924,31 @@ ], "responses": { "200": { - "description": "Success" + "description": "Success", + "content": { + "*/*": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "The container was not found or has expired, or the file was not found in the container.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve container file content", "group": "containers", "path": "get", "examples": { @@ -1998,7 +2966,8 @@ "tags": [ "Conversations" ], - "summary": "Create items in a conversation with the given ID.", + "summary": "Create items", + "description": "Create items in a conversation with the given ID.", "parameters": [ { "in": "path", @@ -2056,12 +3025,41 @@ } } }, + "400": { + "description": "The items are invalid, are already in the conversation, or the conversation is locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The conversation was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The conversation update could not be finalized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create items", "group": "conversations", "path": "create-item", "examples": { @@ -2080,7 +3078,8 @@ "tags": [ "Conversations" ], - "summary": "List all items for a conversation with the given ID.", + "summary": "List items", + "description": "List all items for a conversation with the given ID.", "parameters": [ { "in": "path", @@ -2146,12 +3145,31 @@ } } }, + "400": { + "description": "The stored encrypted item content could not be validated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The conversation or the item specified by `after` was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List items", "group": "conversations", "path": "list-items", "examples": { @@ -2172,7 +3190,8 @@ "tags": [ "Conversations" ], - "summary": "Get a single item from a conversation with the given IDs.", + "summary": "Retrieve an item", + "description": "Get a single item from a conversation with the given IDs.", "parameters": [ { "in": "path", @@ -2218,12 +3237,21 @@ } } }, + "404": { + "description": "The conversation or the item in that conversation was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve an item", "group": "conversations", "path": "get-item", "examples": { @@ -2242,7 +3270,8 @@ "tags": [ "Conversations" ], - "summary": "Delete an item from a conversation with the given IDs.", + "summary": "Delete an item", + "description": "Delete an item from a conversation with the given IDs.", "parameters": [ { "in": "path", @@ -2276,12 +3305,41 @@ } } }, + "400": { + "description": "The item cannot be removed while the conversation is locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The conversation or the item in that conversation was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The conversation update could not be finalized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete an item", "group": "conversations", "path": "delete-item", "examples": { @@ -2302,7 +3360,8 @@ "tags": [ "Embeddings" ], - "summary": "Creates an embedding vector representing the input text.", + "summary": "Create embeddings", + "description": "Creates an embedding vector representing the input text.", "requestBody": { "required": true, "content": { @@ -2324,24 +3383,70 @@ } } }, + "400": { + "description": "Invalid embedding input or request parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authentication failed because the API key is missing or revoked, or the client IP is not authorized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, + "403": { + "description": "Access to a personal API organization is blocked by the organization policy.", + "content": { + "text/plain": { + "schema": { + "type": "string", + "description": "JSON-encoded error text containing an error object and the HTTP status." + } + } + } + }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The embedding request could not be processed due to an internal error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create embeddings", "group": "embeddings", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/embeddings \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"input\": \"The food was delicious and the waiter...\",\n \"model\": \"text-embedding-ada-002\",\n \"encoding_format\": \"float\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.embeddings.create(\n model=\"text-embedding-ada-002\",\n input=\"The food was delicious and the waiter...\",\n encoding_format=\"float\"\n)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const embedding = await openai.embeddings.create({\n model: \"text-embedding-ada-002\",\n input: \"The quick brown fox jumped over the lazy dog\",\n encoding_format: \"float\",\n });\n\n console.log(embedding);\n}\n\nmain();\n", - "csharp": "using System;\n\nusing OpenAI.Embeddings;\n\nEmbeddingClient client = new(\n model: \"text-embedding-3-small\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nOpenAIEmbedding embedding = client.GenerateEmbedding(input: \"The quick brown fox jumped over the lazy dog\");\nReadOnlyMemory vector = embedding.ToFloats();\n\nfor (int i = 0; i < vector.Length; i++)\n{\n Console.WriteLine($\" [{i,4}] = {vector.Span[i]}\");\n}\n" + "curl": "curl https://api.openai.com/v1/embeddings \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"input\": \"Hello world\",\n \"model\": \"text-embedding-3-small\",\n \"encoding_format\": \"float\",\n \"dimensions\": 3\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.embeddings.create(\n model=\"text-embedding-3-small\",\n input=\"Hello world\",\n encoding_format=\"float\",\n dimensions=3\n)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const embedding = await openai.embeddings.create({\n model: \"text-embedding-3-small\",\n input: \"Hello world\",\n encoding_format: \"float\",\n dimensions: 3,\n });\n\n console.log(embedding);\n}\n\nmain();\n", + "csharp": "using System;\n\nusing OpenAI.Embeddings;\n\nEmbeddingClient client = new(\n model: \"text-embedding-3-small\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nEmbeddingGenerationOptions options = new() { Dimensions = 3 };\nOpenAIEmbedding embedding = client.GenerateEmbedding(input: \"Hello world\", options: options);\nReadOnlyMemory vector = embedding.ToFloats();\n\nfor (int i = 0; i < vector.Length; i++)\n{\n Console.WriteLine($\" [{i,4}] = {vector.Span[i]}\");\n}\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n }\n ],\n \"model\": \"text-embedding-ada-002\",\n \"usage\": {\n \"prompt_tokens\": 8,\n \"total_tokens\": 8\n }\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"embedding\",\n \"embedding\": [\n 0.26726124,\n 0.53452248,\n 0.80178373\n ],\n \"index\": 0\n }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": 2,\n \"total_tokens\": 2\n }\n}\n" } } } @@ -2352,7 +3457,8 @@ "tags": [ "Evals" ], - "summary": "List evaluations for a project.\n", + "summary": "List evals", + "description": "List evaluations for a project.\n", "parameters": [ { "name": "after", @@ -2418,7 +3524,6 @@ } }, "x-oaiMeta": { - "name": "List evals", "group": "evals", "path": "list", "examples": { @@ -2436,7 +3541,8 @@ "tags": [ "Evals" ], - "summary": "Create the structure of an evaluation that can be used to test a model's performance.\nAn evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources.\nFor more information, see the [Evals guide](https://developers.openai.com/api/docs/guides/evals).\n", + "summary": "Create eval", + "description": "Create the structure of an evaluation that can be used to test a model's performance.\nAn evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources.\nFor more information, see the [Evals guide](https://developers.openai.com/api/docs/guides/evals).\n", "requestBody": { "required": true, "content": { @@ -2458,12 +3564,21 @@ } } }, + "400": { + "description": "The evaluation input or grader configuration is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Create eval", "group": "evals", "path": "post", "examples": { @@ -2472,7 +3587,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\neval_obj = client.evals.create(\n name=\"Sentiment\",\n data_source_config={\n \"type\": \"stored_completions\",\n \"metadata\": {\"usecase\": \"chatbot\"}\n },\n testing_criteria=[\n {\n \"type\": \"label_model\",\n \"model\": \"o3-mini\",\n \"input\": [\n {\"role\": \"developer\", \"content\": \"Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'\"},\n {\"role\": \"user\", \"content\": \"Statement: {{item.input}}\"}\n ],\n \"passing_labels\": [\"positive\"],\n \"labels\": [\"positive\", \"neutral\", \"negative\"],\n \"name\": \"Example label grader\"\n }\n ]\n)\nprint(eval_obj)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst evalObj = await openai.evals.create({\n name: \"Sentiment\",\n data_source_config: {\n type: \"stored_completions\",\n metadata: { usecase: \"chatbot\" }\n },\n testing_criteria: [\n {\n type: \"label_model\",\n model: \"o3-mini\",\n input: [\n { role: \"developer\", content: \"Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'\" },\n { role: \"user\", content: \"Statement: {{item.input}}\" }\n ],\n passing_labels: [\"positive\"],\n labels: [\"positive\", \"neutral\", \"negative\"],\n name: \"Example label grader\"\n }\n ]\n});\nconsole.log(evalObj);\n" }, - "response": "{\n \"object\": \"eval\",\n \"id\": \"eval_67b7fa9a81a88190ab4aa417e397ea21\",\n \"data_source_config\": {\n \"type\": \"stored_completions\",\n \"metadata\": {\n \"usecase\": \"chatbot\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\"\n },\n \"sample\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"item\",\n \"sample\"\n ]\n },\n \"testing_criteria\": [\n {\n \"name\": \"Example label grader\",\n \"type\": \"label_model\",\n \"model\": \"o3-mini\",\n \"input\": [\n {\n \"type\": \"message\",\n \"role\": \"developer\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Classify the sentiment of the following statement as one of positive, neutral, or negative\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Statement: {{item.input}}\"\n }\n }\n ],\n \"passing_labels\": [\n \"positive\"\n ],\n \"labels\": [\n \"positive\",\n \"neutral\",\n \"negative\"\n ]\n }\n ],\n \"name\": \"Sentiment\",\n \"created_at\": 1740110490,\n \"metadata\": {\n \"description\": \"An eval for sentiment analysis\"\n }\n}\n" + "response": "{\n \"object\": \"eval\",\n \"id\": \"eval_67b7fa9a81a88190ab4aa417e397ea21\",\n \"data_source_config\": {\n \"type\": \"stored_completions\",\n \"metadata\": {\n \"usecase\": \"chatbot\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\"\n },\n \"sample\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"item\",\n \"sample\"\n ]\n }\n },\n \"testing_criteria\": [\n {\n \"name\": \"Example label grader\",\n \"type\": \"label_model\",\n \"model\": \"o3-mini\",\n \"input\": [\n {\n \"type\": \"message\",\n \"role\": \"developer\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Classify the sentiment of the following statement as one of positive, neutral, or negative\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Statement: {{item.input}}\"\n }\n }\n ],\n \"passing_labels\": [\n \"positive\"\n ],\n \"labels\": [\n \"positive\",\n \"neutral\",\n \"negative\"\n ]\n }\n ],\n \"name\": \"Sentiment\",\n \"created_at\": 1740110490,\n \"metadata\": {\n \"description\": \"An eval for sentiment analysis\"\n }\n}\n" } } } @@ -2483,7 +3598,8 @@ "tags": [ "Evals" ], - "summary": "Get an evaluation by ID.\n", + "summary": "Get an eval", + "description": "Get an evaluation by ID.\n", "parameters": [ { "name": "eval_id", @@ -2506,12 +3622,21 @@ } } }, + "404": { + "description": "The evaluation was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Get an eval", "group": "evals", "path": "get", "examples": { @@ -2520,7 +3645,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\neval_obj = client.evals.retrieve(\"eval_67abd54d9b0081909a86353f6fb9317a\")\nprint(eval_obj)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst evalObj = await openai.evals.retrieve(\"eval_67abd54d9b0081909a86353f6fb9317a\");\nconsole.log(evalObj);\n" }, - "response": "{\n \"object\": \"eval\",\n \"id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"data_source_config\": {\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"input\": {\n \"type\": \"string\"\n },\n \"ground_truth\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"input\",\n \"ground_truth\"\n ]\n }\n },\n \"required\": [\n \"item\"\n ]\n }\n },\n \"testing_criteria\": [\n {\n \"name\": \"String check\",\n \"id\": \"String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2\",\n \"type\": \"string_check\",\n \"input\": \"{{item.input}}\",\n \"reference\": \"{{item.ground_truth}}\",\n \"operation\": \"eq\"\n }\n ],\n \"name\": \"External Data Eval\",\n \"created_at\": 1739314509,\n \"metadata\": {},\n}\n" + "response": "{\n \"object\": \"eval\",\n \"id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"data_source_config\": {\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"input\": {\n \"type\": \"string\"\n },\n \"ground_truth\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"input\",\n \"ground_truth\"\n ]\n }\n },\n \"required\": [\n \"item\"\n ]\n }\n },\n \"testing_criteria\": [\n {\n \"name\": \"String check\",\n \"id\": \"String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2\",\n \"type\": \"string_check\",\n \"input\": \"{{item.input}}\",\n \"reference\": \"{{item.ground_truth}}\",\n \"operation\": \"eq\"\n }\n ],\n \"name\": \"External Data Eval\",\n \"created_at\": 1739314509,\n \"metadata\": {}\n}\n" } } }, @@ -2529,7 +3654,8 @@ "tags": [ "Evals" ], - "summary": "Update certain properties of an evaluation.\n", + "summary": "Update an eval", + "description": "Update certain properties of an evaluation.\n", "parameters": [ { "name": "eval_id", @@ -2572,12 +3698,31 @@ } } }, + "400": { + "description": "The evaluation name or metadata is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The evaluation was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Update an eval", "group": "evals", "path": "update", "examples": { @@ -2586,7 +3731,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nupdated_eval = client.evals.update(\n \"eval_67abd54d9b0081909a86353f6fb9317a\",\n name=\"Updated Eval\",\n metadata={\"description\": \"Updated description\"}\n)\nprint(updated_eval)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst updatedEval = await openai.evals.update(\n \"eval_67abd54d9b0081909a86353f6fb9317a\",\n {\n name: \"Updated Eval\",\n metadata: { description: \"Updated description\" }\n }\n);\nconsole.log(updatedEval);\n" }, - "response": "{\n \"object\": \"eval\",\n \"id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"data_source_config\": {\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"input\": {\n \"type\": \"string\"\n },\n \"ground_truth\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"input\",\n \"ground_truth\"\n ]\n }\n },\n \"required\": [\n \"item\"\n ]\n }\n },\n \"testing_criteria\": [\n {\n \"name\": \"String check\",\n \"id\": \"String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2\",\n \"type\": \"string_check\",\n \"input\": \"{{item.input}}\",\n \"reference\": \"{{item.ground_truth}}\",\n \"operation\": \"eq\"\n }\n ],\n \"name\": \"Updated Eval\",\n \"created_at\": 1739314509,\n \"metadata\": {\"description\": \"Updated description\"},\n}\n" + "response": "{\n \"object\": \"eval\",\n \"id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"data_source_config\": {\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"input\": {\n \"type\": \"string\"\n },\n \"ground_truth\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"input\",\n \"ground_truth\"\n ]\n }\n },\n \"required\": [\n \"item\"\n ]\n }\n },\n \"testing_criteria\": [\n {\n \"name\": \"String check\",\n \"id\": \"String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2\",\n \"type\": \"string_check\",\n \"input\": \"{{item.input}}\",\n \"reference\": \"{{item.ground_truth}}\",\n \"operation\": \"eq\"\n }\n ],\n \"name\": \"Updated Eval\",\n \"created_at\": 1739314509,\n \"metadata\": {\"description\": \"Updated description\"}\n}\n" } } }, @@ -2595,7 +3740,8 @@ "tags": [ "Evals" ], - "summary": "Delete an evaluation.\n", + "summary": "Delete an eval", + "description": "Delete an evaluation.\n", "parameters": [ { "name": "eval_id", @@ -2637,12 +3783,22 @@ } } }, + "400": { + "description": "The evaluation cannot be deleted while it has unfinished runs.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "404": { "description": "Evaluation not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/ErrorResponse" } } } @@ -2652,7 +3808,6 @@ } }, "x-oaiMeta": { - "name": "Delete an eval", "group": "evals", "examples": { "request": { @@ -2671,7 +3826,8 @@ "tags": [ "Evals" ], - "summary": "Get a list of runs for an evaluation.\n", + "summary": "Get eval runs", + "description": "Get a list of runs for an evaluation.\n", "parameters": [ { "name": "eval_id", @@ -2743,12 +3899,31 @@ } } }, + "400": { + "description": "The run list parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The evaluation or the run specified by `after` was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Get eval runs", "group": "evals", "path": "get-runs", "examples": { @@ -2757,7 +3932,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nruns = client.evals.runs.list(\"egroup_67abd54d9b0081909a86353f6fb9317a\")\nprint(runs)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst runs = await openai.evals.runs.list(\"egroup_67abd54d9b0081909a86353f6fb9317a\");\nconsole.log(runs);\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"eval.run\",\n \"id\": \"evalrun_67e0c7d31560819090d60c0780591042\",\n \"eval_id\": \"eval_67e0c726d560819083f19a957c4c640b\",\n \"report_url\": \"https://platform.openai.com/evaluations/eval_67e0c726d560819083f19a957c4c640b\",\n \"status\": \"completed\",\n \"model\": \"o3-mini\",\n \"name\": \"bulk_with_negative_examples_o3-mini\",\n \"created_at\": 1742784467,\n \"result_counts\": {\n \"total\": 1,\n \"errored\": 0,\n \"failed\": 0,\n \"passed\": 1\n },\n \"per_model_usage\": [\n {\n \"model_name\": \"o3-mini\",\n \"invocation_count\": 1,\n \"prompt_tokens\": 563,\n \"completion_tokens\": 874,\n \"total_tokens\": 1437,\n \"cached_tokens\": 0\n }\n ],\n \"per_testing_criteria_results\": [\n {\n \"testing_criteria\": \"Push Notification Summary Grader-1808cd0b-eeec-4e0b-a519-337e79f4f5d1\",\n \"passed\": 1,\n \"failed\": 0\n }\n ],\n \"data_source\": {\n \"type\": \"completions\",\n \"source\": {\n \"type\": \"file_content\",\n \"content\": [\n {\n \"item\": {\n \"notifications\": \"\\n- New message from Sarah: \\\"Can you call me later?\\\"\\n- Your package has been delivered!\\n- Flash sale: 20% off electronics for the next 2 hours!\\n\"\n }\n }\n ]\n },\n \"input_messages\": {\n \"type\": \"template\",\n \"template\": [\n {\n \"type\": \"message\",\n \"role\": \"developer\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"\\n\\n\\n\\nYou are a helpful assistant that takes in an array of push notifications and returns a collapsed summary of them.\\nThe push notification will be provided as follows:\\n\\n...notificationlist...\\n\\n\\nYou should return just the summary and nothing else.\\n\\n\\nYou should return a summary that is concise and snappy.\\n\\n\\nHere is an example of a good summary:\\n\\n- Traffic alert: Accident reported on Main Street.- Package out for delivery: Expected by 5 PM.- New friend suggestion: Connect with Emma.\\n\\n\\nTraffic alert, package expected by 5pm, suggestion for new friend (Emily).\\n\\n\\n\\nHere is an example of a bad summary:\\n\\n- Traffic alert: Accident reported on Main Street.- Package out for delivery: Expected by 5 PM.- New friend suggestion: Connect with Emma.\\n\\n\\nTraffic alert reported on main street. You have a package that will arrive by 5pm, Emily is a new friend suggested for you.\\n\\n\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"{{item.notifications}}\"\n }\n }\n ]\n },\n \"model\": \"o3-mini\",\n \"sampling_params\": null\n },\n \"error\": null,\n \"metadata\": {}\n }\n ],\n \"first_id\": \"evalrun_67e0c7d31560819090d60c0780591042\",\n \"last_id\": \"evalrun_67e0c7d31560819090d60c0780591042\",\n \"has_more\": true\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"eval.run\",\n \"id\": \"evalrun_67e0c7d31560819090d60c0780591042\",\n \"eval_id\": \"eval_67e0c726d560819083f19a957c4c640b\",\n \"report_url\": \"https://platform.openai.com/evaluations/eval_67e0c726d560819083f19a957c4c640b\",\n \"status\": \"completed\",\n \"model\": \"o3-mini\",\n \"name\": \"bulk_with_negative_examples_o3-mini\",\n \"created_at\": 1742784467,\n \"result_counts\": {\n \"total\": 1,\n \"errored\": 0,\n \"failed\": 0,\n \"passed\": 1\n },\n \"per_model_usage\": [\n {\n \"model_name\": \"o3-mini\",\n \"invocation_count\": 1,\n \"prompt_tokens\": 563,\n \"completion_tokens\": 874,\n \"total_tokens\": 1437,\n \"cached_tokens\": 0\n }\n ],\n \"per_testing_criteria_results\": [\n {\n \"testing_criteria\": \"Push Notification Summary Grader-1808cd0b-eeec-4e0b-a519-337e79f4f5d1\",\n \"passed\": 1,\n \"failed\": 0\n }\n ],\n \"data_source\": {\n \"type\": \"completions\",\n \"source\": {\n \"type\": \"file_content\",\n \"content\": [\n {\n \"item\": {\n \"notifications\": \"\\n- New message from Sarah: \\\"Can you call me later?\\\"\\n- Your package has been delivered!\\n- Flash sale: 20% off electronics for the next 2 hours!\\n\"\n }\n }\n ]\n },\n \"input_messages\": {\n \"type\": \"template\",\n \"template\": [\n {\n \"type\": \"message\",\n \"role\": \"developer\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"\\n\\n\\n\\nYou are a helpful assistant that takes in an array of push notifications and returns a collapsed summary of them.\\nThe push notification will be provided as follows:\\n\\n...notificationlist...\\n\\n\\nYou should return just the summary and nothing else.\\n\\n\\nYou should return a summary that is concise and snappy.\\n\\n\\nHere is an example of a good summary:\\n\\n- Traffic alert: Accident reported on Main Street.- Package out for delivery: Expected by 5 PM.- New friend suggestion: Connect with Emma.\\n\\n\\nTraffic alert, package expected by 5pm, suggestion for new friend (Emily).\\n\\n\\n\\nHere is an example of a bad summary:\\n\\n- Traffic alert: Accident reported on Main Street.- Package out for delivery: Expected by 5 PM.- New friend suggestion: Connect with Emma.\\n\\n\\nTraffic alert reported on main street. You have a package that will arrive by 5pm, Emily is a new friend suggested for you.\\n\\n\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"{{item.notifications}}\"\n }\n }\n ]\n },\n \"model\": \"o3-mini\"\n },\n \"error\": null,\n \"metadata\": {}\n }\n ],\n \"first_id\": \"evalrun_67e0c7d31560819090d60c0780591042\",\n \"last_id\": \"evalrun_67e0c7d31560819090d60c0780591042\",\n \"has_more\": true\n}\n" } } }, @@ -2766,7 +3941,8 @@ "tags": [ "Evals" ], - "summary": "Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation.\n", + "summary": "Create eval run", + "description": "Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation.\n", "parameters": [ { "in": "path", @@ -2804,17 +3980,36 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The evaluation or a referenced resource was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The evaluation run could not be created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create eval run", "group": "evals", "examples": { "request": { @@ -2833,7 +4028,8 @@ "tags": [ "Evals" ], - "summary": "Get an evaluation run by ID.\n", + "summary": "Get an eval run", + "description": "Get an evaluation run by ID.\n", "parameters": [ { "name": "eval_id", @@ -2865,12 +4061,31 @@ } } }, + "400": { + "description": "The evaluation run does not belong to the specified evaluation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The evaluation or evaluation run was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Get an eval run", "group": "evals", "path": "get", "examples": { @@ -2883,12 +4098,13 @@ } } }, - "post": { - "operationId": "cancelEvalRun", + "delete": { + "operationId": "deleteEvalRun", "tags": [ "Evals" ], - "summary": "Cancel an ongoing evaluation run.\n", + "summary": "Delete eval run", + "description": "Delete an eval run.\n", "parameters": [ { "name": "eval_id", @@ -2897,7 +4113,7 @@ "schema": { "type": "string" }, - "description": "The ID of the evaluation whose run you want to cancel." + "description": "The ID of the evaluation to delete the run from." }, { "name": "run_id", @@ -2906,16 +4122,50 @@ "schema": { "type": "string" }, - "description": "The ID of the run to cancel." + "description": "The ID of the run to delete." } ], "responses": { "200": { - "description": "The canceled eval run object", + "description": "Successfully deleted the eval run", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EvalRun" + "type": "object", + "properties": { + "object": { + "type": "string", + "example": "eval.run.deleted" + }, + "deleted": { + "type": "boolean", + "example": true + }, + "run_id": { + "type": "string", + "example": "evalrun_677469f564d48190807532a852da3afb" + } + } + } + } + } + }, + "400": { + "description": "The evaluation run cannot be deleted until it is finished.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Run not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } @@ -2925,25 +4175,27 @@ } }, "x-oaiMeta": { - "name": "Cancel eval run", "group": "evals", - "path": "post", + "path": "delete", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/cancel \\\n -X POST \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ncanceled_run = client.evals.runs.cancel(\n \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"evalrun_67abd54d60ec8190832b46859da808f7\"\n)\nprint(canceled_run)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst canceledRun = await openai.evals.runs.cancel(\n \"evalrun_67abd54d60ec8190832b46859da808f7\",\n { eval_id: \"eval_67abd54d9b0081909a86353f6fb9317a\" }\n);\nconsole.log(canceledRun);\n" + "curl": "curl https://api.openai.com/v1/evals/eval_123abc/runs/evalrun_abc456 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted = client.evals.runs.delete(\n \"eval_123abc\",\n \"evalrun_abc456\"\n)\nprint(deleted)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst deleted = await openai.evals.runs.delete(\n \"eval_123abc\",\n \"evalrun_abc456\"\n);\nconsole.log(deleted);\n" }, - "response": "{\n \"object\": \"eval.run\",\n \"id\": \"evalrun_67abd54d60ec8190832b46859da808f7\",\n \"eval_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"report_url\": \"https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7\",\n \"status\": \"canceled\",\n \"model\": \"gpt-6-astra\",\n \"name\": \"gpt-6-astra\",\n \"created_at\": 1743092069,\n \"result_counts\": {\n \"total\": 0,\n \"errored\": 0,\n \"failed\": 0,\n \"passed\": 0\n },\n \"per_model_usage\": null,\n \"per_testing_criteria_results\": null,\n \"data_source\": {\n \"type\": \"completions\",\n \"source\": {\n \"type\": \"file_content\",\n \"content\": [\n {\n \"item\": {\n \"input\": \"Tech Company Launches Advanced Artificial Intelligence Platform\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"Central Bank Increases Interest Rates Amid Inflation Concerns\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"International Summit Addresses Climate Change Strategies\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Major Retailer Reports Record-Breaking Holiday Sales\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"National Team Qualifies for World Championship Finals\",\n \"ground_truth\": \"Sports\"\n }\n },\n {\n \"item\": {\n \"input\": \"Stock Markets Rally After Positive Economic Data Released\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"Global Manufacturer Announces Merger with Competitor\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"Breakthrough in Renewable Energy Technology Unveiled\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"World Leaders Sign Historic Climate Agreement\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Professional Athlete Sets New Record in Championship Event\",\n \"ground_truth\": \"Sports\"\n }\n },\n {\n \"item\": {\n \"input\": \"Financial Institutions Adapt to New Regulatory Requirements\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"Tech Conference Showcases Advances in Artificial Intelligence\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"Global Markets Respond to Oil Price Fluctuations\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"International Cooperation Strengthened Through New Treaty\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Sports League Announces Revised Schedule for Upcoming Season\",\n \"ground_truth\": \"Sports\"\n }\n }\n ]\n },\n \"input_messages\": {\n \"type\": \"template\",\n \"template\": [\n {\n \"type\": \"message\",\n \"role\": \"developer\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\\n\\n# Steps\\n\\n1. Analyze the content of the news headline to understand its primary focus.\\n2. Extract the subject matter, identifying any key indicators or keywords.\\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\\n4. Ensure only one category is selected per headline.\\n\\n# Output Format\\n\\nRespond with the chosen category as a single word. For instance: \\\"Technology\\\", \\\"Markets\\\", \\\"World\\\", \\\"Business\\\", or \\\"Sports\\\".\\n\\n# Examples\\n\\n**Input**: \\\"Apple Unveils New iPhone Model, Featuring Advanced AI Features\\\" \\n**Output**: \\\"Technology\\\"\\n\\n**Input**: \\\"Global Stocks Mixed as Investors Await Central Bank Decisions\\\" \\n**Output**: \\\"Markets\\\"\\n\\n**Input**: \\\"War in Ukraine: Latest Updates on Negotiation Status\\\" \\n**Output**: \\\"World\\\"\\n\\n**Input**: \\\"Microsoft in Talks to Acquire Gaming Company for $2 Billion\\\" \\n**Output**: \\\"Business\\\"\\n\\n**Input**: \\\"Manchester United Secures Win in Premier League Football Match\\\" \\n**Output**: \\\"Sports\\\" \\n\\n# Notes\\n\\n- If the headline appears to fit into more than one category, choose the most dominant theme.\\n- Keywords or phrases such as \\\"stocks\\\", \\\"company acquisition\\\", \\\"match\\\", or technological brands can be good indicators for classification.\\n\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"{{item.input}}\"\n }\n }\n ]\n },\n \"model\": \"gpt-6-astra\",\n \"sampling_params\": {\n \"max_completions_tokens\": 2048\n }\n },\n \"error\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"object\": \"eval.run.deleted\",\n \"deleted\": true,\n \"run_id\": \"evalrun_abc456\"\n}\n" } } - }, - "delete": { - "operationId": "deleteEvalRun", + } + }, + "/evals/{eval_id}/runs/{run_id}/cancel": { + "post": { + "operationId": "cancelEvalRun", "tags": [ "Evals" ], - "summary": "Delete an eval run.\n", + "summary": "Cancel eval run", + "description": "Cancel an ongoing evaluation run.\n", "parameters": [ { "name": "eval_id", @@ -2952,7 +4204,7 @@ "schema": { "type": "string" }, - "description": "The ID of the evaluation to delete the run from." + "description": "The ID of the evaluation whose run you want to cancel." }, { "name": "run_id", @@ -2961,40 +4213,16 @@ "schema": { "type": "string" }, - "description": "The ID of the run to delete." + "description": "The ID of the run to cancel." } ], "responses": { "200": { - "description": "Successfully deleted the eval run", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "object": { - "type": "string", - "example": "eval.run.deleted" - }, - "deleted": { - "type": "boolean", - "example": true - }, - "run_id": { - "type": "string", - "example": "evalrun_677469f564d48190807532a852da3afb" - } - } - } - } - } - }, - "404": { - "description": "Run not found", + "description": "The canceled eval run object", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/EvalRun" } } } @@ -3004,16 +4232,15 @@ } }, "x-oaiMeta": { - "name": "Delete eval run", "group": "evals", - "path": "delete", + "path": "post", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/evals/eval_123abc/runs/evalrun_abc456 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted = client.evals.runs.delete(\n \"eval_123abc\",\n \"evalrun_abc456\"\n)\nprint(deleted)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst deleted = await openai.evals.runs.delete(\n \"eval_123abc\",\n \"evalrun_abc456\"\n);\nconsole.log(deleted);\n" + "curl": "curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/cancel \\\n -X POST \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\ncanceled_run = client.evals.runs.cancel(\n \"evalrun_67abd54d60ec8190832b46859da808f7\",\n eval_id=\"eval_67abd54d9b0081909a86353f6fb9317a\"\n)\nprint(canceled_run)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst canceledRun = await openai.evals.runs.cancel(\n \"evalrun_67abd54d60ec8190832b46859da808f7\",\n { eval_id: \"eval_67abd54d9b0081909a86353f6fb9317a\" }\n);\nconsole.log(canceledRun);\n" }, - "response": "{\n \"object\": \"eval.run.deleted\",\n \"deleted\": true,\n \"run_id\": \"evalrun_abc456\"\n}\n" + "response": "{\n \"object\": \"eval.run\",\n \"id\": \"evalrun_67abd54d60ec8190832b46859da808f7\",\n \"eval_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"report_url\": \"https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7\",\n \"status\": \"canceled\",\n \"model\": \"gpt-6-astra\",\n \"name\": \"gpt-6-astra\",\n \"created_at\": 1743092069,\n \"result_counts\": {\n \"total\": 0,\n \"errored\": 0,\n \"failed\": 0,\n \"passed\": 0\n },\n \"per_model_usage\": null,\n \"per_testing_criteria_results\": null,\n \"data_source\": {\n \"type\": \"completions\",\n \"source\": {\n \"type\": \"file_content\",\n \"content\": [\n {\n \"item\": {\n \"input\": \"Tech Company Launches Advanced Artificial Intelligence Platform\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"Central Bank Increases Interest Rates Amid Inflation Concerns\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"International Summit Addresses Climate Change Strategies\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Major Retailer Reports Record-Breaking Holiday Sales\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"National Team Qualifies for World Championship Finals\",\n \"ground_truth\": \"Sports\"\n }\n },\n {\n \"item\": {\n \"input\": \"Stock Markets Rally After Positive Economic Data Released\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"Global Manufacturer Announces Merger with Competitor\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"Breakthrough in Renewable Energy Technology Unveiled\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"World Leaders Sign Historic Climate Agreement\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Professional Athlete Sets New Record in Championship Event\",\n \"ground_truth\": \"Sports\"\n }\n },\n {\n \"item\": {\n \"input\": \"Financial Institutions Adapt to New Regulatory Requirements\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"Tech Conference Showcases Advances in Artificial Intelligence\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"Global Markets Respond to Oil Price Fluctuations\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"International Cooperation Strengthened Through New Treaty\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Sports League Announces Revised Schedule for Upcoming Season\",\n \"ground_truth\": \"Sports\"\n }\n }\n ]\n },\n \"input_messages\": {\n \"type\": \"template\",\n \"template\": [\n {\n \"type\": \"message\",\n \"role\": \"developer\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\\n\\n# Steps\\n\\n1. Analyze the content of the news headline to understand its primary focus.\\n2. Extract the subject matter, identifying any key indicators or keywords.\\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\\n4. Ensure only one category is selected per headline.\\n\\n# Output Format\\n\\nRespond with the chosen category as a single word. For instance: \\\"Technology\\\", \\\"Markets\\\", \\\"World\\\", \\\"Business\\\", or \\\"Sports\\\".\\n\\n# Examples\\n\\n**Input**: \\\"Apple Unveils New iPhone Model, Featuring Advanced AI Features\\\" \\n**Output**: \\\"Technology\\\"\\n\\n**Input**: \\\"Global Stocks Mixed as Investors Await Central Bank Decisions\\\" \\n**Output**: \\\"Markets\\\"\\n\\n**Input**: \\\"War in Ukraine: Latest Updates on Negotiation Status\\\" \\n**Output**: \\\"World\\\"\\n\\n**Input**: \\\"Microsoft in Talks to Acquire Gaming Company for $2 Billion\\\" \\n**Output**: \\\"Business\\\"\\n\\n**Input**: \\\"Manchester United Secures Win in Premier League Football Match\\\" \\n**Output**: \\\"Sports\\\" \\n\\n# Notes\\n\\n- If the headline appears to fit into more than one category, choose the most dominant theme.\\n- Keywords or phrases such as \\\"stocks\\\", \\\"company acquisition\\\", \\\"match\\\", or technological brands can be good indicators for classification.\\n\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"{{item.input}}\"\n }\n }\n ]\n },\n \"model\": \"gpt-6-astra\",\n \"sampling_params\": {\n \"max_completions_tokens\": 2048\n }\n },\n \"error\": null,\n \"metadata\": {}\n}\n" } } } @@ -3024,7 +4251,8 @@ "tags": [ "Evals" ], - "summary": "Get a list of output items for an evaluation run.\n", + "summary": "Get eval run output items", + "description": "Get a list of output items for an evaluation run.\n", "parameters": [ { "name": "eval_id", @@ -3102,12 +4330,31 @@ } } }, + "400": { + "description": "The output item list parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The evaluation or evaluation run was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Get eval run output items", "group": "evals", "path": "get", "examples": { @@ -3127,7 +4374,8 @@ "tags": [ "Evals" ], - "summary": "Get an evaluation run output item by ID.\n", + "summary": "Get an output item of an eval run", + "description": "Get an evaluation run output item by ID.\n", "parameters": [ { "name": "eval_id", @@ -3168,12 +4416,31 @@ } } }, + "400": { + "description": "The output item was not found, its identifier is invalid, or the run does not belong to the evaluation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The evaluation or evaluation run was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Get an output item of an eval run", "group": "evals", "path": "get", "examples": { @@ -3193,7 +4460,8 @@ "tags": [ "Files" ], - "summary": "Returns a list of files.", + "summary": "List files", + "description": "Returns a list of files.", "parameters": [ { "in": "query", @@ -3246,10 +4514,39 @@ } } } + }, + "400": { + "description": "The file listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The file specified by the after cursor was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List files", "group": "files", "examples": { "request": { @@ -3257,7 +4554,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.list()\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.files.list();\n\n for await (const file of list) {\n console.log(file);\n }\n}\n\nmain();" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 175,\n \"created_at\": 1613677385,\n \"expires_at\": 1677614202,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"expires_at\": 1677614202,\n \"filename\": \"puppy.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 175,\n \"created_at\": 1613677385,\n \"expires_at\": 1677614202,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n \"status\": \"processed\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"expires_at\": 1677614202,\n \"filename\": \"puppy.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"processed\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" } } }, @@ -3266,7 +4563,8 @@ "tags": [ "Files" ], - "summary": "Upload a file that can be used across various endpoints. Individual files\ncan be up to 512 MB, and each project can store up to 2.5 TB of files in\ntotal. There is no organization-wide storage limit. Uploads to this\nendpoint are rate-limited to 1,000 requests per minute per authenticated\nuser.\n\n- The Assistants API supports files up to 2 million tokens and of specific\n file types. See the [Assistants Tools guide](https://developers.openai.com/api/docs/guides/tools) for\n details.\n- The Fine-tuning API only supports `.jsonl` files. The input also has\n certain required formats for fine-tuning\n [chat](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) or\n [completions](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) models.\n- The Batch API only supports `.jsonl` files up to 200 MB in size. The input\n also has a specific required\n [format](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file).\n- For Retrieval or `file_search` ingestion, upload files here first. If\n you need to attach multiple uploaded files to the same vector store, use\n [`/vector_stores/{vector_store_id}/file_batches`](https://developers.openai.com/api/reference/resources/vector_stores/subresources/file_batches/methods/create)\n instead of attaching them one by one. Vector store attachment has separate\n limits from file upload, including 2,000 attached files per minute per\n organization.\n\nPlease [contact us](https://help.openai.com/) if you need to increase these\nstorage limits.\n", + "summary": "Upload file", + "description": "Upload a file that can be used across various endpoints. Individual files\ncan be up to 512 MB, and each project can store up to 2.5 TB of files in\ntotal. There is no organization-wide storage limit. Uploads to this\nendpoint are rate-limited to 1,000 requests per minute per authenticated\nuser.\n\n- The Assistants API supports files up to 2 million tokens and of specific\n file types. See the [Assistants Tools guide](https://developers.openai.com/api/docs/guides/tools) for\n details.\n- The Fine-tuning API only supports `.jsonl` files. The input also has\n certain required formats for fine-tuning\n [chat](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) or\n [completions](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) models.\n- The Batch API only supports `.jsonl` files up to 200 MB in size. The input\n also has a specific required\n [format](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file).\n- For Retrieval or `file_search` ingestion, upload files here first. If\n you need to attach multiple uploaded files to the same vector store, use\n [`/vector_stores/{vector_store_id}/file_batches`](https://developers.openai.com/api/reference/resources/vector_stores/subresources/file_batches/methods/create)\n instead of attaching them one by one. Vector store attachment has separate\n limits from file upload, including 2,000 attached files per minute per\n organization.\n\nPlease [contact us](https://help.openai.com/) if you need to increase these\nstorage limits.\n", "requestBody": { "required": true, "content": { @@ -3287,19 +4585,47 @@ } } } + }, + "400": { + "description": "The file upload request is invalid or exceeds a file size or storage quota limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The file could not be uploaded because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Upload file", "group": "files", - "description": "Uploads a file for later use across OpenAI APIs. Uploads to this endpoint are rate-limited to 1,000 requests per minute per authenticated user. For Retrieval or `file_search` ingestion, upload files here first. If you need to attach multiple uploaded files to the same vector store, use vector store file batches instead of attaching them one by one.\n", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F purpose=\"fine-tune\" \\\n -F file=\"@mydata.jsonl\"\n -F expires_after[anchor]=\"created_at\"\n -F expires_after[seconds]=2592000\n", + "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F purpose=\"fine-tune\" \\\n -F file=\"@mydata.jsonl\" \\\n -F 'expires_after[anchor]=created_at' \\\n -F 'expires_after[seconds]=2592000'\n", "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.create(\n file=open(\"mydata.jsonl\", \"rb\"),\n purpose=\"fine-tune\",\n expires_after={\n \"anchor\": \"created_at\",\n \"seconds\": 2592000\n }\n)\n", "javascript": "import fs from \"fs\";\nimport OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.create({\n file: fs.createReadStream(\"mydata.jsonl\"),\n purpose: \"fine-tune\",\n expires_after: {\n anchor: \"created_at\",\n seconds: 2592000\n }\n });\n\n console.log(file);\n}\n\nmain();" }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1677614202,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n}\n" + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1680202602,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"processed\"\n}\n" } } } @@ -3310,7 +4636,8 @@ "tags": [ "Files" ], - "summary": "Delete a file and remove it from all vector stores.", + "summary": "Delete file", + "description": "Delete a file and remove it from all vector stores.", "parameters": [ { "in": "path", @@ -3332,10 +4659,29 @@ } } } + }, + "404": { + "description": "The file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete file", "group": "files", "examples": { "request": { @@ -3352,7 +4698,8 @@ "tags": [ "Files" ], - "summary": "Returns information about a specific file.", + "summary": "Retrieve file", + "description": "Returns information about a specific file.", "parameters": [ { "in": "path", @@ -3374,10 +4721,29 @@ } } } + }, + "404": { + "description": "The file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve file", "group": "files", "examples": { "request": { @@ -3385,7 +4751,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.files.retrieve(\"file-abc123\")\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const file = await openai.files.retrieve(\"file-abc123\");\n\n console.log(file);\n}\n\nmain();" }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1677614202,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n}\n" + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1680202602,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"processed\"\n}\n" } } } @@ -3396,7 +4762,8 @@ "tags": [ "Files" ], - "summary": "Returns a response containing the contents of the specified file.", + "summary": "Retrieve file content", + "description": "Returns a response containing the contents of the specified file.", "parameters": [ { "in": "path", @@ -3411,17 +4778,57 @@ "responses": { "200": { "description": "OK", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "400": { + "description": "The file cannot be downloaded for its purpose or the account does not have permission to download it.", "content": { "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many file requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The file could not be downloaded because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Retrieve file content", "group": "files", "examples": { "request": { @@ -3439,7 +4846,8 @@ "tags": [ "Fine-tuning" ], - "summary": "Run a grader.\n", + "summary": "Run grader", + "description": "Run a grader.\n", "requestBody": { "required": true, "content": { @@ -3460,10 +4868,29 @@ } } } + }, + "400": { + "description": "The grader definition or request is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Run grader", "beta": true, "group": "graders", "examples": [ @@ -3498,7 +4925,8 @@ "tags": [ "Fine-tuning" ], - "summary": "Validate a grader.\n", + "summary": "Validate grader", + "description": "Validate a grader.\n", "requestBody": { "required": true, "content": { @@ -3519,10 +4947,29 @@ } } } + }, + "400": { + "description": "The grader definition or request is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Validate grader", "beta": true, "group": "graders", "examples": { @@ -3540,7 +4987,8 @@ "tags": [ "Fine-tuning" ], - "summary": "**NOTE:** This endpoint requires an [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).\n\nOrganization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.\n", + "summary": "List checkpoint permissions", + "description": "**NOTE:** This endpoint requires an [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).\n\nOrganization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.\n", "parameters": [ { "in": "path", @@ -3605,16 +5053,35 @@ } } } + }, + "400": { + "description": "The query parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List checkpoint permissions", "group": "fine-tuning", "examples": { "request": { "curl": "curl https://api.openai.com/v1/fine_tuning/checkpoints/ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd/permissions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"checkpoint.permission\",\n \"id\": \"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"created_at\": 1721764867,\n \"project_id\": \"proj_abGMw1llN8IrBb6SvvY5A1iH\"\n },\n {\n \"object\": \"checkpoint.permission\",\n \"id\": \"cp_enQCFmOTGj3syEpYVhBRLTSy\",\n \"created_at\": 1721764800,\n \"project_id\": \"proj_iqGMw1llN8IrBb6SvvY5A1oF\"\n },\n ],\n \"first_id\": \"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"last_id\": \"cp_enQCFmOTGj3syEpYVhBRLTSy\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"checkpoint.permission\",\n \"id\": \"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"created_at\": 1721764867,\n \"project_id\": \"proj_abGMw1llN8IrBb6SvvY5A1iH\"\n },\n {\n \"object\": \"checkpoint.permission\",\n \"id\": \"cp_enQCFmOTGj3syEpYVhBRLTSy\",\n \"created_at\": 1721764800,\n \"project_id\": \"proj_iqGMw1llN8IrBb6SvvY5A1oF\"\n }\n ],\n \"first_id\": \"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"last_id\": \"cp_enQCFmOTGj3syEpYVhBRLTSy\",\n \"has_more\": false\n}\n" } } }, @@ -3623,7 +5090,8 @@ "tags": [ "Fine-tuning" ], - "summary": "**NOTE:** Calling this endpoint requires an [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).\n\nThis enables organization owners to share fine-tuned models with other projects in their organization.\n", + "summary": "Create checkpoint permissions", + "description": "**NOTE:** Calling this endpoint requires an [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).\n\nThis enables organization owners to share fine-tuned models with other projects in their organization.\n", "parameters": [ { "in": "path", @@ -3656,10 +5124,39 @@ } } } + }, + "400": { + "description": "The request is invalid or checkpoint permissions cannot be changed for the requested projects or job state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The checkpoint or its fine-tuning job was not found, or the checkpoint cannot be shared.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create checkpoint permissions", "group": "fine-tuning", "examples": { "request": { @@ -3676,7 +5173,8 @@ "tags": [ "Fine-tuning" ], - "summary": "**NOTE:** This endpoint requires an [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).\n\nOrganization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint.\n", + "summary": "Delete checkpoint permission", + "description": "**NOTE:** This endpoint requires an [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).\n\nOrganization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint.\n", "parameters": [ { "in": "path", @@ -3709,10 +5207,39 @@ } } } + }, + "400": { + "description": "The checkpoint permission cannot be removed for the requested project or job state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The checkpoint, permission, associated project, or fine-tuning job was not found, or the checkpoint cannot be shared.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete checkpoint permission", "group": "fine-tuning", "examples": { "request": { @@ -3729,7 +5256,8 @@ "tags": [ "Fine-tuning" ], - "summary": "Creates a fine-tuning job which begins the process of creating a new model from a given dataset.\n\nResponse includes details of the enqueued job including job status and the name of the fine-tuned models once complete.\n\n[Learn more about fine-tuning](https://developers.openai.com/api/docs/guides/model-optimization)\n", + "summary": "Create fine-tuning job", + "description": "Creates a fine-tuning job which begins the process of creating a new model from a given dataset.\n\nResponse includes details of the enqueued job including job status and the name of the fine-tuned models once complete.\n\n[Learn more about fine-tuning](https://developers.openai.com/api/docs/guides/model-optimization)\n", "requestBody": { "required": true, "content": { @@ -3750,10 +5278,29 @@ } } } + }, + "400": { + "description": "The request is invalid or the organization does not meet the requirements to create a fine-tuning job.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "A request or fine-tuning job limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create fine-tuning job", "group": "fine-tuning", "examples": [ { @@ -3763,7 +5310,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n model=\"gpt-4o-mini\"\n)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\"\n });\n\n console.log(fineTune);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\",\n }\n }\n },\n \"metadata\": null\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n }\n },\n \"metadata\": null,\n \"error\": {},\n \"finished_at\": null,\n \"seed\": null,\n \"trained_tokens\": null,\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n}\n" }, { "title": "Epochs", @@ -3772,7 +5319,7 @@ "python": "from openai import OpenAI\nfrom openai.types.fine_tuning import SupervisedMethod, SupervisedHyperparameters\n\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n model=\"gpt-4o-mini\",\n method={\n \"type\": \"supervised\",\n \"supervised\": SupervisedMethod(\n hyperparameters=SupervisedHyperparameters(\n n_epochs=2\n )\n )\n }\n)\n", "javascript": "import OpenAI from \"openai\";\nimport { SupervisedMethod, SupervisedHyperparameters } from \"openai/resources/fine-tuning/methods\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\",\n model: \"gpt-4o-mini\",\n method: {\n type: \"supervised\",\n supervised: {\n hyperparameters: {\n n_epochs: 2\n }\n }\n }\n });\n\n console.log(fineTune);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": 2\n },\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": 2\n }\n }\n },\n \"metadata\": null,\n \"error\": {\n \"code\": null,\n \"message\": null,\n \"param\": null\n },\n \"finished_at\": null,\n \"seed\": 683058546,\n \"trained_tokens\": null,\n \"estimated_finish\": null,\n \"integrations\": [],\n \"user_provided_suffix\": null,\n \"usage_metrics\": null,\n \"shared_with_openai\": false\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": 2\n },\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": 2\n }\n }\n },\n \"metadata\": null,\n \"error\": {},\n \"finished_at\": null,\n \"seed\": 683058546,\n \"trained_tokens\": null,\n \"estimated_finish\": null,\n \"integrations\": [],\n \"user_provided_suffix\": null,\n \"usage_metrics\": null,\n \"shared_with_openai\": false\n}\n" }, { "title": "DPO", @@ -3780,7 +5327,7 @@ "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-abc123\",\n \"validation_file\": \"file-abc123\",\n \"model\": \"gpt-4o-mini\",\n \"method\": {\n \"type\": \"dpo\",\n \"dpo\": {\n \"hyperparameters\": {\n \"beta\": 0.1\n }\n }\n }\n }'\n", "python": "from openai import OpenAI\nfrom openai.types.fine_tuning import DpoMethod, DpoHyperparameters\n\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc\",\n validation_file=\"file-123\",\n model=\"gpt-4o-mini\",\n method={\n \"type\": \"dpo\",\n \"dpo\": DpoMethod(\n hyperparameters=DpoHyperparameters(beta=0.1)\n )\n }\n)\n" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc\",\n \"model\": \"gpt-4o-mini\",\n \"created_at\": 1746130590,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-abc\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-123\",\n \"training_file\": \"file-abc\",\n \"method\": {\n \"type\": \"dpo\",\n \"dpo\": {\n \"hyperparameters\": {\n \"beta\": 0.1,\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n }\n },\n \"metadata\": null,\n \"error\": {\n \"code\": null,\n \"message\": null,\n \"param\": null\n },\n \"finished_at\": null,\n \"hyperparameters\": null,\n \"seed\": 1036326793,\n \"estimated_finish\": null,\n \"integrations\": [],\n \"user_provided_suffix\": null,\n \"usage_metrics\": null,\n \"shared_with_openai\": false\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc\",\n \"model\": \"gpt-4o-mini\",\n \"created_at\": 1746130590,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-abc\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-123\",\n \"training_file\": \"file-abc\",\n \"method\": {\n \"type\": \"dpo\",\n \"dpo\": {\n \"hyperparameters\": {\n \"beta\": 0.1,\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n }\n },\n \"metadata\": null,\n \"error\": {},\n \"finished_at\": null,\n \"seed\": 1036326793,\n \"estimated_finish\": null,\n \"integrations\": [],\n \"user_provided_suffix\": null,\n \"usage_metrics\": null,\n \"shared_with_openai\": false,\n \"trained_tokens\": null\n}\n" }, { "title": "Reinforcement", @@ -3797,14 +5344,14 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.create(\n training_file=\"file-abc123\",\n validation_file=\"file-def456\",\n model=\"gpt-4o-mini\"\n)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.create({\n training_file: \"file-abc123\",\n validation_file: \"file-abc123\"\n });\n\n console.log(fineTune);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\",\n }\n }\n },\n \"metadata\": null\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n }\n },\n \"metadata\": null,\n \"error\": {},\n \"finished_at\": null,\n \"seed\": null,\n \"trained_tokens\": null,\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n}\n" }, { "title": "W&B Integration", "request": { "curl": "curl https://api.openai.com/v1/fine_tuning/jobs \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"training_file\": \"file-abc123\",\n \"validation_file\": \"file-abc123\",\n \"model\": \"gpt-4o-mini\",\n \"integrations\": [\n {\n \"type\": \"wandb\",\n \"wandb\": {\n \"project\": \"my-wandb-project\",\n \"name\": \"ft-run-display-name\"\n \"tags\": [\n \"first-experiment\", \"v2\"\n ]\n }\n }\n ]\n }'\n" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n \"integrations\": [\n {\n \"type\": \"wandb\",\n \"wandb\": {\n \"project\": \"my-wandb-project\",\n \"entity\": None,\n \"run_id\": \"ftjob-abc123\"\n }\n }\n ],\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\",\n }\n }\n },\n \"metadata\": null\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n \"integrations\": [\n {\n \"type\": \"wandb\",\n \"wandb\": {\n \"project\": \"my-wandb-project\",\n \"entity\": null,\n \"run_id\": \"ftjob-abc123\"\n }\n }\n ],\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n }\n },\n \"metadata\": null,\n \"error\": {},\n \"finished_at\": null,\n \"seed\": null,\n \"trained_tokens\": null,\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n}\n" } ] } @@ -3814,7 +5361,8 @@ "tags": [ "Fine-tuning" ], - "summary": "List your organization's fine-tuning jobs\n", + "summary": "List fine-tuning jobs", + "description": "List your organization's fine-tuning jobs\n", "parameters": [ { "name": "after", @@ -3840,15 +5388,17 @@ "name": "metadata", "required": false, "schema": { - "type": "object", - "nullable": true, + "type": [ + "object", + "null" + ], "additionalProperties": { "type": "string" } }, "style": "deepObject", "explode": true, - "description": "Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Alternatively, set `metadata=null` to indicate no metadata.\n" + "description": "Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Omitting the parameter or passing an empty object applies no metadata filter. An empty value, such as `metadata[k]=`, filters for that key with an empty string value.\nTo select jobs with null metadata, send the literal query string `metadata=null`. Nullable caller types do not specify how a client serializes null for a deep-object parameter. Use a raw query parameter if the client omits null. Do not combine the two query forms.\n" } ], "responses": { @@ -3861,18 +5411,37 @@ } } } + }, + "400": { + "description": "The query parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List fine-tuning jobs", "group": "fine-tuning", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/fine_tuning/jobs?limit=2&metadata[key]=value \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "curl": "curl \"https://api.openai.com/v1/fine_tuning/jobs?limit=2&metadata[key]=value\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.list()\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.fineTuning.jobs.list();\n\n for await (const fineTune of list) {\n console.log(fineTune);\n }\n}\n\nmain();" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"metadata\": {\n \"key\": \"value\"\n }\n },\n { ... },\n { ... }\n ], \"has_more\": true\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"error\": null,\n \"finished_at\": null,\n \"trained_tokens\": null,\n \"seed\": 42,\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n },\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"batch_size\": \"auto\",\n \"learning_rate_multiplier\": \"auto\",\n \"n_epochs\": \"auto\"\n }\n }\n },\n \"metadata\": {\n \"key\": \"value\"\n }\n }\n ],\n \"has_more\": false\n}\n" } } } @@ -3883,7 +5452,8 @@ "tags": [ "Fine-tuning" ], - "summary": "Get info about a fine-tuning job.\n\n[Learn more about fine-tuning](https://developers.openai.com/api/docs/guides/model-optimization)\n", + "summary": "Retrieve fine-tuning job", + "description": "Get info about a fine-tuning job.\n\n[Learn more about fine-tuning](https://developers.openai.com/api/docs/guides/model-optimization)\n", "parameters": [ { "in": "path", @@ -3906,10 +5476,29 @@ } } } + }, + "404": { + "description": "The fine-tuning job was not found or is not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve fine-tuning job", "group": "fine-tuning", "examples": { "request": { @@ -3917,7 +5506,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.retrieve(\"ftjob-abc123\")\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.retrieve(\"ftjob-abc123\");\n\n console.log(fineTune);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"davinci-002\",\n \"created_at\": 1692661014,\n \"finished_at\": 1692661190,\n \"fine_tuned_model\": \"ft:davinci-002:my-org:custom_suffix:7q8mpxmy\",\n \"organization_id\": \"org-123\",\n \"result_files\": [\n \"file-abc123\"\n ],\n \"status\": \"succeeded\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n },\n \"trained_tokens\": 5768,\n \"integrations\": [],\n \"seed\": 0,\n \"estimated_finish\": 0,\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n }\n }\n }\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"davinci-002\",\n \"created_at\": 1692661014,\n \"finished_at\": 1692661190,\n \"fine_tuned_model\": \"ft:davinci-002:my-org:custom_suffix:7q8mpxmy\",\n \"organization_id\": \"org-123\",\n \"result_files\": [\n \"file-abc123\"\n ],\n \"status\": \"succeeded\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n },\n \"trained_tokens\": 5768,\n \"integrations\": [],\n \"seed\": 0,\n \"estimated_finish\": 0,\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n }\n }\n },\n \"error\": {}\n}\n" } } } @@ -3928,7 +5517,8 @@ "tags": [ "Fine-tuning" ], - "summary": "Immediately cancel a fine-tune job.\n", + "summary": "Cancel fine-tuning", + "description": "Immediately cancel a fine-tune job.\n", "parameters": [ { "in": "path", @@ -3951,10 +5541,39 @@ } } } + }, + "400": { + "description": "The fine-tuning job cannot be cancelled in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The fine-tuning job was not found or is not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Cancel fine-tuning", "group": "fine-tuning", "examples": { "request": { @@ -3962,7 +5581,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.cancel(\"ftjob-abc123\")\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.cancel(\"ftjob-abc123\");\n\n console.log(fineTune);\n}\nmain();" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"cancelled\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\"\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"cancelled\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\",\n \"error\": {},\n \"finished_at\": null,\n \"seed\": null,\n \"trained_tokens\": null,\n \"hyperparameters\": null\n}\n" } } } @@ -3973,7 +5592,8 @@ "tags": [ "Fine-tuning" ], - "summary": "List checkpoints for a fine-tuning job.\n", + "summary": "List fine-tuning checkpoints", + "description": "List checkpoints for a fine-tuning job.\n", "parameters": [ { "in": "path", @@ -4015,10 +5635,39 @@ } } } + }, + "400": { + "description": "The query parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The fine-tuning job was not found or is not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List fine-tuning checkpoints", "group": "fine-tuning", "examples": { "request": { @@ -4035,7 +5684,8 @@ "tags": [ "Fine-tuning" ], - "summary": "Get status updates for a fine-tuning job.\n", + "summary": "List fine-tuning events", + "description": "Get status updates for a fine-tuning job.\n", "parameters": [ { "in": "path", @@ -4077,10 +5727,39 @@ } } } + }, + "400": { + "description": "The query parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The fine-tuning job was not found or is not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List fine-tuning events", "group": "fine-tuning", "examples": { "request": { @@ -4099,7 +5778,8 @@ "tags": [ "Fine-tuning" ], - "summary": "Pause a fine-tune job.\n", + "summary": "Pause fine-tuning", + "description": "Pause a fine-tune job.\n", "parameters": [ { "in": "path", @@ -4122,10 +5802,39 @@ } } } + }, + "400": { + "description": "The fine-tuning job cannot be paused in its current state or does not support pausing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The fine-tuning job was not found or is not accessible, or this operation is unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Pause fine-tuning", "group": "fine-tuning", "examples": { "request": { @@ -4133,7 +5842,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.pause(\"ftjob-abc123\")\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.pause(\"ftjob-abc123\");\n\n console.log(fineTune);\n}\nmain();" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"paused\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\"\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"o4-mini\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"pausing\",\n \"validation_file\": \"file-123\",\n \"training_file\": \"file-abc\",\n \"error\": {},\n \"finished_at\": null,\n \"seed\": null,\n \"trained_tokens\": null,\n \"method\": {\n \"type\": \"reinforcement\",\n \"reinforcement\": {\n \"grader\": {\n \"type\": \"string_check\",\n \"name\": \"Example string check grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"operation\": \"eq\"\n },\n \"hyperparameters\": {\n \"reasoning_effort\": \"medium\"\n }\n }\n }\n}\n" } } } @@ -4144,7 +5853,8 @@ "tags": [ "Fine-tuning" ], - "summary": "Resume a fine-tune job.\n", + "summary": "Resume fine-tuning", + "description": "Resume a fine-tune job.\n", "parameters": [ { "in": "path", @@ -4167,10 +5877,39 @@ } } } + }, + "400": { + "description": "The fine-tuning job cannot be resumed in its current state or does not support resuming.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The fine-tuning job was not found or is not accessible, or this operation is unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "A request or fine-tuning job limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Resume fine-tuning", "group": "fine-tuning", "examples": { "request": { @@ -4178,7 +5917,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.fine_tuning.jobs.resume(\"ftjob-abc123\")\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const fineTune = await openai.fineTuning.jobs.resume(\"ftjob-abc123\");\n\n console.log(fineTune);\n}\nmain();" }, - "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-abc123\",\n \"training_file\": \"file-abc123\"\n}\n" + "response": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"o4-mini\",\n \"created_at\": 1721764800,\n \"fine_tuned_model\": null,\n \"organization_id\": \"org-123\",\n \"result_files\": [],\n \"status\": \"queued\",\n \"validation_file\": \"file-123\",\n \"training_file\": \"file-abc\",\n \"error\": {},\n \"finished_at\": null,\n \"seed\": null,\n \"trained_tokens\": null,\n \"method\": {\n \"type\": \"reinforcement\",\n \"reinforcement\": {\n \"grader\": {\n \"type\": \"string_check\",\n \"name\": \"Example string check grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"operation\": \"eq\"\n },\n \"hyperparameters\": {\n \"reasoning_effort\": \"medium\"\n }\n }\n }\n}\n" } } } @@ -4189,8 +5928,8 @@ "tags": [ "Images" ], - "summary": "Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models and `dall-e-2`.", - "description": "You can call this endpoint with either:\n\n- `multipart/form-data`: use binary uploads via `image` (and optional `mask`).\n- `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.\n\nNote that JSON requests use `images` (array) instead of the multipart `image` field.\n", + "summary": "Create image edit", + "description": "Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models.", "requestBody": { "required": true, "content": { @@ -4267,15 +6006,54 @@ } } }, + "400": { + "description": "Invalid image request, including invalid parameters or input.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The project does not have access to the requested model.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "410": { + "description": "The requested DALL-E image endpoint is unavailable because it has been retired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The image could not be generated or processed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create image edit", "group": "images", "examples": [ { @@ -4305,7 +6083,8 @@ "tags": [ "Images" ], - "summary": "Creates an image given a prompt. [Learn more](https://developers.openai.com/api/docs/guides/images-vision).\n", + "summary": "Create image", + "description": "Creates an image given a prompt using a GPT Image model. [Learn more](https://developers.openai.com/api/docs/guides/images-vision).\n", "requestBody": { "required": true, "content": { @@ -4332,32 +6111,71 @@ } } }, + "400": { + "description": "Invalid image request, including invalid parameters or input.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The project does not have access to the requested model.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "410": { + "description": "The requested DALL-E image endpoint is unavailable because it has been retired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The image could not be generated or processed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create image", "group": "images", "examples": [ { "title": "Generate image", "request": { - "curl": "curl https://api.openai.com/v1/images/generations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-image-1.5\",\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 1,\n \"size\": \"1024x1024\"\n }'\n", - "python": "import base64\nfrom openai import OpenAI\nclient = OpenAI()\n\nimg = client.images.generate(\n model=\"gpt-image-1.5\",\n prompt=\"A cute baby sea otter\",\n n=1,\n size=\"1024x1024\"\n)\n\nimage_bytes = base64.b64decode(img.data[0].b64_json)\nwith open(\"output.png\", \"wb\") as f:\n f.write(image_bytes)\n", - "javascript": "import OpenAI from \"openai\";\nimport { writeFile } from \"fs/promises\";\n\nconst client = new OpenAI();\n\nconst img = await client.images.generate({\n model: \"gpt-image-1.5\",\n prompt: \"A cute baby sea otter\",\n n: 1,\n size: \"1024x1024\"\n});\n\nconst imageBuffer = Buffer.from(img.data[0].b64_json, \"base64\");\nawait writeFile(\"output.png\", imageBuffer);\n" + "curl": "curl https://api.openai.com/v1/images/generations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-image-2.5-flare\",\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 1,\n \"size\": \"1024x1024\"\n }'\n", + "python": "import base64\nfrom openai import OpenAI\nclient = OpenAI()\n\nimg = client.images.generate(\n model=\"gpt-image-2.5-flare\",\n prompt=\"A cute baby sea otter\",\n n=1,\n size=\"1024x1024\"\n)\n\nimage_bytes = base64.b64decode(img.data[0].b64_json)\nwith open(\"output.png\", \"wb\") as f:\n f.write(image_bytes)\n", + "javascript": "import OpenAI from \"openai\";\nimport { writeFile } from \"fs/promises\";\n\nconst client = new OpenAI();\n\nconst img = await client.images.generate({\n model: \"gpt-image-2.5-flare\",\n prompt: \"A cute baby sea otter\",\n n: 1,\n size: \"1024x1024\"\n});\n\nconst imageBuffer = Buffer.from(img.data[0].b64_json, \"base64\");\nawait writeFile(\"output.png\", imageBuffer);\n" }, "response": "{\n \"created\": 1713833628,\n \"data\": [\n {\n \"b64_json\": \"...\"\n }\n ],\n \"usage\": {\n \"total_tokens\": 100,\n \"input_tokens\": 50,\n \"output_tokens\": 50,\n \"input_tokens_details\": {\n \"text_tokens\": 10,\n \"image_tokens\": 40\n }\n }\n}\n" }, { "title": "Streaming", "request": { - "curl": "curl https://api.openai.com/v1/images/generations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-image-1.5\",\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"stream\": true\n }' \\\n --no-buffer\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nstream = client.images.generate(\n model=\"gpt-image-1.5\",\n prompt=\"A cute baby sea otter\",\n n=1,\n size=\"1024x1024\",\n stream=True\n)\n\nfor event in stream:\n print(event)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst client = new OpenAI();\n\nconst stream = await client.images.generate({\n model: \"gpt-image-1.5\",\n prompt: \"A cute baby sea otter\",\n n: 1,\n size: \"1024x1024\",\n stream: true,\n});\n\nfor await (const event of stream) {\n console.log(event);\n}\n" + "curl": "curl https://api.openai.com/v1/images/generations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-image-2.5-flare\",\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"stream\": true\n }' \\\n --no-buffer\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nstream = client.images.generate(\n model=\"gpt-image-2.5-flare\",\n prompt=\"A cute baby sea otter\",\n n=1,\n size=\"1024x1024\",\n stream=True\n)\n\nfor event in stream:\n print(event)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst client = new OpenAI();\n\nconst stream = await client.images.generate({\n model: \"gpt-image-2.5-flare\",\n prompt: \"A cute baby sea otter\",\n n: 1,\n size: \"1024x1024\",\n stream: true,\n});\n\nfor await (const event of stream) {\n console.log(event);\n}\n" }, "response": "event: image_generation.partial_image\ndata: {\"type\":\"image_generation.partial_image\",\"b64_json\":\"...\",\"partial_image_index\":0}\n\nevent: image_generation.completed\ndata: {\"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}}}\n" } @@ -4371,7 +6189,9 @@ "tags": [ "Images" ], - "summary": "Creates a variation of a given image. This endpoint only supports `dall-e-2`.", + "summary": "Create image variation", + "deprecated": true, + "description": "This endpoint is retired and no longer available. Use the image edits endpoint with a GPT Image model and a prompt to create a variation of an image. The request and response schemas below describe the legacy contract.", "requestBody": { "required": true, "content": { @@ -4392,10 +6212,80 @@ } } } + }, + "400": { + "description": "Invalid image or request, or the request cannot be processed for this account.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The project does not have access to the requested model.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "410": { + "description": "The image variations endpoint is no longer available.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The image rate limit was exceeded.", + "headers": { + "X-RateLimit-Limit-Images": { + "description": "The image limit for the rate-limit window.", + "schema": { + "type": "number" + } + }, + "X-RateLimit-Remaining-Images": { + "description": "The number of images remaining in the rate-limit window.", + "schema": { + "type": "number", + "minimum": 0 + } + }, + "X-RateLimit-Reset-Images": { + "description": "The number of seconds until the rate-limit window resets.", + "schema": { + "type": "integer" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The image variation could not be generated or processed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create image variation", "group": "images", "examples": { "request": { @@ -4412,8 +6302,8 @@ "/live/sessions": { "post": { "operationId": "create-live", - "summary": "Create a Live WebRTC session. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting).", - "description": "Send JSON containing session configuration and transport with type webrtc and the SDP offer. The request starts the session. Apply transport.sdp from the response as the remote answer and wait for session.started on the data channel before sending commands. Audio uses the negotiated media track; omit audio.format and do not send session.start on the data channel. Before integrating, follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) to write frontend conversation and delegation instructions and a separate backend prompt.", + "summary": "Create session", + "description": "Create a Live WebRTC session or place an outbound SIP call. Start with the\n[Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) for session configuration\nand [Telephony and SIP](https://developers.openai.com/api/docs/guides/voice-sip?api=live#place-an-outbound-call)\nfor trunk setup and call monitoring.\n\nSet transport.type to `webrtc` and supply an SDP offer, or set it to `sip`\nand supply an E.164 destination and trunk credentials.\nRinging is limited to 3 minutes and connected calls to 2 hours; these limits\nare not configurable in the request.\n\nReturns `201 Created` after session initialization. WebRTC responses include an\nSDP answer. SIP responses do not wait for the callee to answer. Attach a\nsideband connection using session.id to monitor SIP call progress.\n\nEach SIP request creates a new call. If a request times out or the connection\nfails, retry with caution: the original request may have succeeded, and a\nretry can place another call.", "tags": [ "Live" ], @@ -4422,48 +6312,159 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LiveCreateRequest" + "$ref": "#/components/schemas/LiveSessionCreateRequest" } } } }, "responses": { "201": { - "description": "Live session created with a WebRTC answer.", + "description": "Returns 201 Created with a WebRTC answer or an initialized outbound SIP session. A SIP response does not mean the callee has answered.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LiveCreateResponse" + "$ref": "#/components/schemas/LiveSessionCreateResponse" }, - "example": { - "session": { - "id": "live_123" + "examples": { + "webrtc": { + "summary": "WebRTC session created (201 Created)", + "value": { + "session": { + "id": "live_123" + }, + "transport": { + "type": "webrtc", + "sdp": "" + } + } }, - "transport": { - "type": "webrtc", - "sdp": "" + "sip": { + "summary": "Outbound SIP session initialized (201 Created)", + "value": { + "session": { + "id": "live_123" + }, + "transport": { + "type": "sip" + } + } } } } } + }, + "400": { + "description": "Invalid Live session request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "413": { + "description": "The Live session request exceeds the supported size limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "429": { + "description": "The session could not start because a rate or quota limit was exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error occurred. The response body is plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "502": { + "description": "The SIP gateway could not initialize the outbound call.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "503": { + "description": "The session is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + }, + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "504": { + "description": "SIP session initialization timed out. The error code is sip_setup_timeout.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create session", "group": "live", - "returns": "Returns 201 Created with the session identifier in session.id and SDP answer in transport.sdp.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/live/sessions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"session\":{\"model\":\"gpt-live-1\",\"instructions\":\"Be concise. Ask for clarification when needed.\"},\"transport\":{\"type\":\"webrtc\",\"sdp\":\"\"}}'" + "returns": "For WebRTC, returns 201 Created with the session identifier in session.id and SDP answer in transport.sdp. For SIP, returns 201 Created after session initialization with session.id and transport.type set to sip, without SDP or trunk credentials. This does not wait for the callee to answer. Attach to /v1/live/sessions/{session_id}/attach to monitor call progress.", + "examples": [ + { + "title": "Create a WebRTC session", + "request": { + "curl": "curl https://api.openai.com/v1/live/sessions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"session\":{\"model\":\"gpt-live-1\",\"instructions\":\"Be concise. Ask for clarification when needed.\"},\"transport\":{\"type\":\"webrtc\",\"sdp\":\"\"}}'" + }, + "response": "{\"session\":{\"id\":\"live_123\"},\"transport\":{\"type\":\"webrtc\",\"sdp\":\"\"}}" + }, + { + "title": "Place an outbound SIP call", + "request": { + "curl": "# Export SIP_USERNAME and SIP_PASSWORD in your environment first.\njq -n '{\n \"session\": {\n \"model\": \"gpt-live-1\",\n \"instructions\": \"Help the user schedule an appointment.\",\n \"audio\": { \"output\": { \"voice\": \"marin\" } },\n \"delegation\": { \"type\": \"client\" }\n },\n \"transport\": {\n \"type\": \"sip\",\n \"destination\": \"+14155550123\",\n \"trunk\": {\n \"provider_url\": \"sips:sip.example.com:5061\",\n \"auth\": {\n \"type\": \"digest\",\n \"username\": env.SIP_USERNAME,\n \"password\": env.SIP_PASSWORD\n },\n \"caller_number\": \"+14155550100\"\n }\n }\n }' | curl https://api.openai.com/v1/live/sessions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n --data-binary @-" + }, + "response": "{\"session\":{\"id\":\"live_123\"},\"transport\":{\"type\":\"sip\"}}" } - } + ] } } }, "/live/sessions/{session_id}/accept": { "post": { "operationId": "accept-live-session", - "summary": "Accept an incoming SIP call. Supply session with type live, the model, and startup configuration. Before accepting calls, follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) to write frontend conversation instructions and a separate backend prompt. SIP media format is negotiated; omit audio.format.", + "summary": "Accept call", "description": "Accept an incoming SIP call. Supply session with type live, the model, and startup configuration. Before accepting calls, follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) to write frontend conversation instructions and a separate backend prompt. SIP media format is negotiated; omit audio.format.", "tags": [ "Live" @@ -4492,10 +6493,69 @@ "responses": { "200": { "description": "Session accept request accepted." + }, + "400": { + "description": "Invalid request body or headers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The session or call was not found or is unavailable for this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The session or call can no longer accept this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The session could not start because a rate or quota limit was exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error occurred. The response body is plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "503": { + "description": "The session is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Accept call", "group": "live-sessions", "returns": "Returns 200 OK when the control request succeeds." } @@ -4504,8 +6564,8 @@ "/live/sessions/{session_id}/fork": { "post": { "operationId": "fork-live-session", - "summary": "Fork a stored Live session onto a new WebRTC connection.", - "description": "Resume the stored conversation using a new WebRTC connection. The model, voice, and frontend instructions are inherited. Omit session or send an empty object to inherit the remaining configuration. Only Responses delegation settings, storage, and frontend data-channel permissions can be overridden. Apply transport.sdp as the remote answer and wait for session.started before sending commands. Do not send session.start on the data channel or supply audio.format; WebRTC negotiates its media format.", + "summary": "Fork session", + "description": "Fork a stored Live session onto a new WebRTC connection.", "tags": [ "Live" ], @@ -4540,10 +6600,69 @@ } } } + }, + "400": { + "description": "Invalid Live session request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Invalid session ID.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "413": { + "description": "The Live session request exceeds the supported size limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The session could not start because a rate or quota limit was exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error occurred. The response body is plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "503": { + "description": "The session is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Fork session", "group": "live", "returns": "The new session identifier in session.id and SDP answer in transport.sdp.", "examples": { @@ -4557,7 +6676,7 @@ "/live/sessions/{session_id}/hangup": { "post": { "operationId": "hangup-live-session", - "summary": "End a SIP call identified by session_id.", + "summary": "Hang up session", "description": "End a SIP call identified by session_id.", "tags": [ "Live" @@ -4576,10 +6695,19 @@ "responses": { "200": { "description": "Session hangup request accepted." + }, + "404": { + "description": "The session or call was not found or is unavailable for this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Hang up session", "group": "live-sessions", "returns": "Returns 200 OK when the control request succeeds." } @@ -4588,7 +6716,7 @@ "/live/sessions/{session_id}/refer": { "post": { "operationId": "refer-live-session", - "summary": "Transfer a SIP call to another destination. Supply a nonblank target_uri for the SIP Refer-To header.", + "summary": "Transfer call", "description": "Transfer a SIP call to another destination. Supply a nonblank target_uri for the SIP Refer-To header.", "tags": [ "Live" @@ -4617,10 +6745,39 @@ "responses": { "200": { "description": "Session refer request accepted." + }, + "400": { + "description": "Invalid request body or headers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The session or call was not found or is unavailable for this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error occurred. The response body is plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } } }, "x-oaiMeta": { - "name": "Transfer call", "group": "live-sessions", "returns": "Returns 200 OK when the control request succeeds." } @@ -4629,7 +6786,7 @@ "/live/sessions/{session_id}/reject": { "post": { "operationId": "reject-live-session", - "summary": "Reject an incoming SIP call. Send a required SIP rejection status_code between 300 and 699.", + "summary": "Reject call", "description": "Reject an incoming SIP call. Send a required SIP rejection status_code between 300 and 699.", "tags": [ "Live" @@ -4658,10 +6815,49 @@ "responses": { "200": { "description": "Session reject request accepted." + }, + "400": { + "description": "Invalid request body or headers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The session or call was not found or is unavailable for this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The session or call can no longer accept this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error occurred. The response body is plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } } }, "x-oaiMeta": { - "name": "Reject call", "group": "live-sessions", "returns": "Returns 200 OK when the control request succeeds." } @@ -4673,7 +6869,8 @@ "tags": [ "Models" ], - "summary": "Lists the currently available models, and provides basic information about each one such as the owner and availability.", + "summary": "List models", + "description": "Lists the currently available models, and provides basic information about each one such as the owner and availability.", "responses": { "200": { "description": "OK", @@ -4684,10 +6881,19 @@ } } } + }, + "403": { + "description": "The API credential does not have permission to list models.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List models", "group": "models", "examples": { "request": { @@ -4696,7 +6902,7 @@ "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const list = await openai.models.list();\n\n for await (const model of list) {\n console.log(model);\n }\n}\nmain();", "csharp": "using System;\n\nusing OpenAI.Models;\n\nOpenAIModelClient client = new(\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nforeach (var model in client.GetModels().Value)\n{\n Console.WriteLine(model.Id);\n}\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"model-id-0\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"organization-owner\",\n \"shutdown_date\": null\n },\n {\n \"id\": \"model-id-1\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"organization-owner\",\n \"shutdown_date\": null\n },\n {\n \"id\": \"model-id-2\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\",\n \"shutdown_date\": \"2026-10-23\"\n },\n ]\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"model-id-0\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"organization-owner\",\n \"shutdown_date\": null\n },\n {\n \"id\": \"model-id-1\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"organization-owner\",\n \"shutdown_date\": null\n },\n {\n \"id\": \"model-id-2\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\",\n \"shutdown_date\": \"2026-10-23\"\n }\n ]\n}\n" } } } @@ -4707,7 +6913,8 @@ "tags": [ "Models" ], - "summary": "Retrieves a model instance, providing basic information about the model such as the owner and permissioning.", + "summary": "Retrieve model", + "description": "Retrieves a model instance, providing basic information about the model such as the owner and permissioning.", "parameters": [ { "in": "path", @@ -4730,10 +6937,29 @@ } } } + }, + "403": { + "description": "The API credential does not have permission to retrieve models.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The model was not found or is not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve model", "group": "models", "examples": { "request": { @@ -4751,7 +6977,8 @@ "tags": [ "Models" ], - "summary": "Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.", + "summary": "Delete a fine-tuned model", + "description": "Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.", "parameters": [ { "in": "path", @@ -4774,18 +7001,37 @@ } } } - } - }, - "x-oaiMeta": { - "name": "Delete a fine-tuned model", - "group": "models", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.models.delete(\"ft:gpt-4o-mini:acemeco:suffix:abc123\")\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const model = await openai.models.delete(\"ft:gpt-4o-mini:acemeco:suffix:abc123\");\n \n console.log(model);\n}\nmain();", - "csharp": "using System;\nusing System.ClientModel;\n\nusing OpenAI.Models;\n\nOpenAIModelClient client = new(\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nClientResult success = client.DeleteModel(\"ft:gpt-4o-mini:acemeco:suffix:abc123\");\nConsole.WriteLine(success);\n" - }, + }, + "403": { + "description": "Insufficient permissions to delete the model. Model deletion requires the Owner role in the organization and a credential that permits deletion.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The model was not found, is not accessible, or cannot be deleted through this endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "group": "models", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 \\\n -X DELETE \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nclient.models.delete(\"ft:gpt-4o-mini:acemeco:suffix:abc123\")\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const model = await openai.models.delete(\"ft:gpt-4o-mini:acemeco:suffix:abc123\");\n \n console.log(model);\n}\nmain();", + "csharp": "using System;\nusing System.ClientModel;\n\nusing OpenAI.Models;\n\nOpenAIModelClient client = new(\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nClientResult success = client.DeleteModel(\"ft:gpt-4o-mini:acemeco:suffix:abc123\");\nConsole.WriteLine(success);\n" + }, "response": "{\n \"id\": \"ft:gpt-4o-mini:acemeco:suffix:abc123\",\n \"object\": \"model\",\n \"deleted\": true\n}\n" } } @@ -4797,7 +7043,8 @@ "tags": [ "Moderations" ], - "summary": "Classifies if text and/or image inputs are potentially harmful. Learn\nmore in the [moderation guide](https://developers.openai.com/api/docs/guides/moderation).\n", + "summary": "Create moderation", + "description": "Classifies if text and/or image inputs are potentially harmful. Learn\nmore in the [moderation guide](https://developers.openai.com/api/docs/guides/moderation).\n", "requestBody": { "required": true, "content": { @@ -4819,26 +7066,54 @@ } } }, + "400": { + "description": "Invalid moderation input or unsupported request parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Access to the requested moderation model was denied.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, + "500": { + "description": "The moderation request could not be processed due to an internal error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "503": { "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Create moderation", "group": "moderations", "examples": [ { "title": "Single string", "request": { - "curl": "curl https://api.openai.com/v1/moderations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"input\": \"I want to kill them.\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nmoderation = client.moderations.create(input=\"I want to kill them.\")\nprint(moderation)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const moderation = await openai.moderations.create({ input: \"I want to kill them.\" });\n\n console.log(moderation);\n}\nmain();\n", - "csharp": "using System;\nusing System.ClientModel;\n\nusing OpenAI.Moderations;\n\nModerationClient client = new(\n model: \"omni-moderation-latest\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nClientResult moderation = client.ClassifyText(\"I want to kill them.\");\n" - }, - "response": "{\n \"id\": \"modr-AB8CjOTu2jiq12hp1AQPfeqFWaORR\",\n \"model\": \"text-moderation-007\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"sexual\": false,\n \"hate\": false,\n \"harassment\": true,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"hate/threatening\": false,\n \"violence/graphic\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"harassment/threatening\": true,\n \"violence\": true\n },\n \"category_scores\": {\n \"sexual\": 0.000011726012417057063,\n \"hate\": 0.22706663608551025,\n \"harassment\": 0.5215635299682617,\n \"self-harm\": 2.227119921371923e-6,\n \"sexual/minors\": 7.107352217872176e-8,\n \"hate/threatening\": 0.023547329008579254,\n \"violence/graphic\": 0.00003391829886822961,\n \"self-harm/intent\": 1.646940972932498e-6,\n \"self-harm/instructions\": 1.1198755256458526e-9,\n \"harassment/threatening\": 0.5694745779037476,\n \"violence\": 0.9971134662628174\n }\n }\n ]\n}\n" + "curl": "curl https://api.openai.com/v1/moderations \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"omni-moderation-latest\",\n \"input\": \"...text to classify goes here...\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nmoderation = client.moderations.create(\n model=\"omni-moderation-latest\",\n input=\"...text to classify goes here...\",\n)\nprint(moderation)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const moderation = await openai.moderations.create({\n model: \"omni-moderation-latest\",\n input: \"...text to classify goes here...\",\n });\n\n console.log(moderation);\n}\nmain();\n", + "csharp": "using System;\nusing System.ClientModel;\n\nusing OpenAI.Moderations;\n\nModerationClient client = new(\n model: \"omni-moderation-latest\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nClientResult moderation = client.ClassifyText(\"...text to classify goes here...\");\n" + } }, { "title": "Image and text", @@ -4860,17 +7135,19 @@ "AdminApiKeyAuth": [] } ], - "summary": "List organization API keys", + "summary": "List all organization and project API keys.", + "description": "List organization API keys", "operationId": "admin-api-keys-list", - "description": "Retrieve a paginated list of organization admin API keys.", "parameters": [ { "in": "query", "name": "after", "required": false, "schema": { - "type": "string", - "nullable": true, + "type": [ + "string", + "null" + ], "description": "Return keys with IDs that come after this ID in the pagination order." } }, @@ -4909,10 +7186,29 @@ } } } + }, + "400": { + "description": "The API key listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List all organization and project API keys.", "group": "administration", "examples": { "request": { @@ -4928,9 +7224,9 @@ "AdminApiKeyAuth": [] } ], - "summary": "Create an organization admin API key", + "summary": "Create admin API key", + "description": "Create an organization admin API key", "operationId": "admin-api-keys-create", - "description": "Create a new admin-level API key for the organization.", "requestBody": { "required": true, "content": { @@ -4967,10 +7263,39 @@ } } } + }, + "400": { + "description": "The API key creation request is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The created API key could not be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create admin API key", "group": "administration", "examples": { "request": { @@ -4988,9 +7313,9 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieve a single organization API key", + "summary": "Retrieve admin API key", + "description": "Retrieve a single organization API key", "operationId": "admin-api-keys-get", - "description": "Get details for a specific organization API key by its ID.", "parameters": [ { "in": "path", @@ -5012,16 +7337,35 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The API key was not found or is not available to this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve admin API key", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/admin_api_keys/key_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"organization.admin_api_key\",\n \"id\": \"key_abc\",\n \"name\": \"Main Admin Key\",\n \"redacted_value\": \"sk-admin...xyz\",\n \"created_at\": 1711471533,\n \"last_used_at\": 1711471534,\n \"owner\": {\n \"type\": \"user\",\n \"object\": \"organization.user\",\n \"id\": \"user_123\",\n \"name\": \"John Doe\",\n \"created_at\": 1711471533,\n \"role\": \"owner\"\n }\n}\n" + "response": "{\n \"object\": \"organization.admin_api_key\",\n \"id\": \"key_abc\",\n \"name\": \"Main Admin Key\",\n \"redacted_value\": \"sk-admin...xyz\",\n \"created_at\": 1711471533,\n \"expires_at\": null,\n \"last_used_at\": 1711471534,\n \"owner\": {\n \"type\": \"user\",\n \"object\": \"organization.user\",\n \"id\": \"user_123\",\n \"name\": \"John Doe\",\n \"created_at\": 1711471533,\n \"role\": \"owner\"\n }\n}\n" } } }, @@ -5031,9 +7375,9 @@ "AdminApiKeyAuth": [] } ], - "summary": "Delete an organization admin API key", + "summary": "Delete admin API key", + "description": "Delete an organization admin API key", "operationId": "admin-api-keys-delete", - "description": "Delete the specified admin API key.", "parameters": [ { "in": "path", @@ -5078,10 +7422,29 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The API key was not found or is not available to this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete admin API key", "group": "administration", "examples": { "request": { @@ -5099,7 +7462,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "List user actions and configuration changes within this organization.", + "summary": "List audit logs", + "description": "List user actions and configuration changes within this organization.", "operationId": "list-audit-logs", "tags": [ "Audit Logs" @@ -5240,18 +7604,37 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "No audit log was found with the specified pagination cursor.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List audit logs", "group": "audit-logs", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/audit_logs \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n-H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"audit_log-xxx_yyyymmdd\",\n \"type\": \"project.archived\",\n \"effective_at\": 1722461446,\n \"actor\": {\n \"type\": \"api_key\",\n \"api_key\": {\n \"type\": \"user\",\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n }\n }\n },\n \"project.archived\": {\n \"id\": \"proj_abc\"\n },\n },\n {\n \"id\": \"audit_log-yyy__20240101\",\n \"type\": \"api_key.updated\",\n \"effective_at\": 1720804190,\n \"actor\": {\n \"type\": \"session\",\n \"session\": {\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n },\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\",\n \"ja3\": \"a497151ce4338a12c4418c44d375173e\",\n \"ja4\": \"q13d0313h3_55b375c5d22e_c7319ce65786\",\n \"ip_address_details\": {\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"region\": \"California\",\n \"region_code\": \"CA\",\n \"asn\": \"1234\",\n \"latitude\": \"37.77490\",\n \"longitude\": \"-122.41940\"\n }\n }\n },\n \"api_key.updated\": {\n \"id\": \"key_xxxx\",\n \"data\": {\n \"scopes\": [\"resource_2.operation_2\"]\n }\n },\n }\n ],\n \"first_id\": \"audit_log-xxx__20240101\",\n \"last_id\": \"audit_log_yyy__20240101\",\n \"has_more\": true\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"audit_log-xxx_yyyymmdd\",\n \"type\": \"project.archived\",\n \"effective_at\": 1722461446,\n \"actor\": {\n \"type\": \"api_key\",\n \"api_key\": {\n \"type\": \"user\",\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n }\n }\n },\n \"project.archived\": {\n \"id\": \"proj_abc\"\n }\n },\n {\n \"id\": \"audit_log-yyy__20240101\",\n \"type\": \"api_key.updated\",\n \"effective_at\": 1720804190,\n \"actor\": {\n \"type\": \"session\",\n \"session\": {\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n },\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\",\n \"ja3\": \"a497151ce4338a12c4418c44d375173e\",\n \"ja4\": \"q13d0313h3_55b375c5d22e_c7319ce65786\",\n \"ip_address_details\": {\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"region\": \"California\",\n \"region_code\": \"CA\",\n \"asn\": \"1234\",\n \"latitude\": \"37.77490\",\n \"longitude\": \"-122.41940\"\n }\n }\n },\n \"api_key.updated\": {\n \"id\": \"key_xxxx\",\n \"data\": {\n \"scopes\": [\"resource_2.operation_2\"]\n }\n }\n }\n ],\n \"first_id\": \"audit_log-xxx__20240101\",\n \"last_id\": \"audit_log_yyy__20240101\",\n \"has_more\": true\n}\n" } } } @@ -5263,7 +7646,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "List uploaded certificates for this organization.", + "summary": "List organization certificates", + "description": "List uploaded certificates for this organization.", "operationId": "listOrganizationCertificates", "tags": [ "Certificates" @@ -5313,18 +7697,37 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List organization certificates", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/certificates \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n ],\n \"first_id\": \"cert_abc\",\n \"last_id\": \"cert_abc\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n }\n ],\n \"first_id\": \"cert_abc\",\n \"last_id\": \"cert_abc\",\n \"has_more\": false\n}\n" } } }, @@ -5334,7 +7737,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Upload a certificate to the organization. This does **not** automatically activate the certificate.\n\nOrganizations can upload up to 50 certificates.\n", + "summary": "Upload certificate", + "description": "Upload a certificate to the organization. This does **not** automatically activate the certificate.\n\nOrganizations can upload up to 50 certificates.\n", "operationId": "uploadCertificate", "tags": [ "Certificates" @@ -5361,12 +7765,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Upload certificate", "group": "administration", "examples": { "request": { @@ -5384,7 +7807,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Activate certificates at the organization level.\n\nYou can atomically and idempotently activate up to 10 certificates at a time.\n", + "summary": "Activate certificates for organization", + "description": "Activate certificates at the organization level.\n\nYou can atomically and idempotently activate up to 10 certificates at a time.\n", "operationId": "activateOrganizationCertificates", "tags": [ "Certificates" @@ -5411,18 +7835,57 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A certificate was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The certificate update could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Activate certificates for organization", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/certificates/activate \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n \"certificate_ids\": [\"cert_abc\", \"cert_def\"]\n}'\n" }, - "response": "{\n \"object\": \"organization.certificate.activation\",\n \"data\": [\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_def\",\n \"name\": \"My Example Certificate 2\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n ],\n}\n" + "response": "{\n \"object\": \"organization.certificate.activation\",\n \"data\": [\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_def\",\n \"name\": \"My Example Certificate 2\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n }\n ]\n}\n" } } } @@ -5434,7 +7897,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deactivate certificates at the organization level.\n\nYou can atomically and idempotently deactivate up to 10 certificates at a time.\n", + "summary": "Deactivate certificates for organization", + "description": "Deactivate certificates at the organization level.\n\nYou can atomically and idempotently deactivate up to 10 certificates at a time.\n", "operationId": "deactivateOrganizationCertificates", "tags": [ "Certificates" @@ -5461,18 +7925,57 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A certificate was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The certificate update could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Deactivate certificates for organization", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/certificates/deactivate \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n \"certificate_ids\": [\"cert_abc\", \"cert_def\"]\n}'\n" }, - "response": "{\n \"object\": \"organization.certificate.deactivation\",\n \"data\": [\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": false,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_def\",\n \"name\": \"My Example Certificate 2\",\n \"active\": false,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n ],\n}\n" + "response": "{\n \"object\": \"organization.certificate.deactivation\",\n \"data\": [\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": false,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n {\n \"object\": \"organization.certificate\",\n \"id\": \"cert_def\",\n \"name\": \"My Example Certificate 2\",\n \"active\": false,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n }\n ]\n}\n" } } } @@ -5484,7 +7987,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get a certificate that has been uploaded to the organization.\n\nYou can get a certificate regardless of whether it is active or not.\n", + "summary": "Get certificate", + "description": "Get a certificate that has been uploaded to the organization.\n\nYou can get a certificate regardless of whether it is active or not.\n", "operationId": "getCertificate", "tags": [ "Certificates" @@ -5526,12 +8030,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A certificate was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Get certificate", "group": "administration", "examples": { "request": { @@ -5547,7 +8080,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Modify a certificate. Note that only the name can be modified.\n", + "summary": "Modify certificate", + "description": "Modify a certificate. Note that only the name can be modified.\n", "operationId": "modifyCertificate", "tags": [ "Certificates" @@ -5585,12 +8119,51 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A certificate was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The certificate update could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Modify certificate", "group": "administration", "examples": { "request": { @@ -5606,7 +8179,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Delete a certificate from the organization.\n\nThe certificate must be inactive for the organization and all projects.\n", + "summary": "Delete certificate", + "description": "Delete a certificate from the organization.\n\nThe certificate must be inactive for the organization and all projects.\n", "operationId": "deleteCertificate", "tags": [ "Certificates" @@ -5633,12 +8207,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A certificate was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Delete certificate", "group": "administration", "examples": { "request": { @@ -5656,7 +8259,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get costs details for the organization.", + "summary": "Costs", + "description": "Get costs details for the organization.", "operationId": "usage-costs", "tags": [ "Usage" @@ -5732,7 +8336,7 @@ { "name": "group_by", "in": "query", - "description": "Group the costs by the specified fields. Support fields include `project_id`, `line_item`, `api_key_id` and any combination of them.", + "description": "Group the costs by the specified fields. Supported fields include `project_id`, `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining `user_id` with `project_id` grouping or the `project_ids` filter depends on the organization and requested time range. Unsupported combinations return HTTP 400. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null.", "required": false, "schema": { "type": "array", @@ -5740,8 +8344,10 @@ "type": "string", "enum": [ "project_id", + "user_id", "line_item", - "api_key_id" + "api_key_id", + "api_source" ] } } @@ -5776,12 +8382,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Costs", "group": "usage-costs", "examples": { "request": { @@ -5799,7 +8424,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves organization data retention controls.", + "summary": "Retrieve organization data retention", + "description": "Retrieves organization data retention controls.", "operationId": "retrieve-organization-data-retention", "tags": [ "Data retention" @@ -5814,10 +8440,29 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The organization was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve organization data retention", "group": "administration", "examples": { "request": { @@ -5833,7 +8478,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates organization data retention controls.", + "summary": "Update organization data retention", + "description": "Updates organization data retention controls.", "operationId": "update-organization-data-retention", "tags": [ "Data retention" @@ -5859,10 +8505,39 @@ } } } + }, + "400": { + "description": "The requested data retention setting or transition is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The organization was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update organization data retention", "group": "administration", "examples": { "request": { @@ -5880,7 +8555,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists all groups in the organization.", + "summary": "List groups", + "description": "Lists all groups in the organization.", "operationId": "list-groups", "tags": [ "Groups" @@ -5933,18 +8609,47 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List groups", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/groups?limit=20&order=asc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"group\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"is_scim_managed\": false\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"group\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"group_type\": \"group\",\n \"is_scim_managed\": false\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" } } }, @@ -5954,7 +8659,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Creates a new group in the organization.", + "summary": "Create group", + "description": "Creates a new group in the organization.", "operationId": "create-group", "tags": [ "Groups" @@ -5981,18 +8687,67 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "The organization has reached its maximum number of groups.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The group operation could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create group", "group": "administration", "examples": { "request": { "curl": "curl -X POST https://api.openai.com/v1/organization/groups \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Support Team\"\n }'\n" }, - "response": "{\n \"object\": \"group\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"is_scim_managed\": false\n}\n" + "response": "{\n \"object\": \"group\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"group_type\": \"group\",\n \"is_scim_managed\": false\n}\n" } } } @@ -6004,7 +8759,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a group.", + "summary": "Retrieve group", + "description": "Retrieves a group.", "operationId": "retrieve-group", "tags": [ "Groups" @@ -6031,12 +8787,51 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The group operation could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve group", "group": "administration", "examples": { "request": { @@ -6052,7 +8847,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates a group's information.", + "summary": "Update group", + "description": "Updates a group's information.", "operationId": "update-group", "tags": [ "Groups" @@ -6090,12 +8886,51 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The group operation could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update group", "group": "administration", "examples": { "request": { @@ -6111,7 +8946,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes a group from the organization.", + "summary": "Delete group", + "description": "Deletes a group from the organization.", "operationId": "delete-group", "tags": [ "Groups" @@ -6138,12 +8974,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Delete group", "group": "administration", "examples": { "request": { @@ -6161,7 +9026,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists the organization roles assigned to a group within the organization.", + "summary": "List group organization role assignments", + "description": "Lists the organization roles assigned to a group within the organization.", "operationId": "list-group-role-assignments", "tags": [ "Group organization role assignments" @@ -6221,18 +9087,47 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List group organization role assignments", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/groups/group_01J1F8ABCDXYZ/roles \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false,\n \"description\": \"Allows managing organization groups\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {}\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false,\n \"description\": \"Allows managing organization groups\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {},\n \"assignment_sources\": [\n {\n \"principal_id\": \"group_01J1F8ABCDXYZ\",\n \"principal_type\": \"group\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" } } }, @@ -6242,7 +9137,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Assigns an organization role to a group within the organization.", + "summary": "Assign organization role to group", + "description": "Assigns an organization role to a group within the organization.", "operationId": "assign-group-role", "tags": [ "Group organization role assignments" @@ -6280,12 +9176,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Assign organization role to group", "group": "administration", "examples": { "request": { @@ -6303,7 +9228,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves an organization role assigned to a group.", + "summary": "Retrieve group organization role", + "description": "Retrieves an organization role assigned to a group.", "operationId": "retrieve-group-role", "tags": [ "Group organization role assignments" @@ -6339,12 +9265,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve group organization role", "group": "administration", "examples": { "request": { @@ -6360,7 +9315,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Unassigns an organization role from a group within the organization.", + "summary": "Unassign organization role from group", + "description": "Unassigns an organization role from a group within the organization.", "operationId": "unassign-group-role", "tags": [ "Group organization role assignments" @@ -6396,12 +9352,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Unassign organization role from group", "group": "administration", "examples": { "request": { @@ -6419,7 +9404,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists the users assigned to a group.", + "summary": "List group users", + "description": "Lists the users assigned to a group.", "operationId": "list-group-users", "tags": [ "Group users" @@ -6481,12 +9467,51 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "502": { + "description": "The upstream group service returned an invalid pagination cursor.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List group users", "group": "administration", "examples": { "request": { @@ -6502,7 +9527,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Adds a user to a group.", + "summary": "Add group user", + "description": "Adds a user to a group.", "operationId": "add-group-user", "tags": [ "Group users" @@ -6540,12 +9566,51 @@ } } }, + "400": { + "description": "The request contains invalid parameters or an invalid body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller lacks the required permissions or is not using an admin API key.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The group or user was not found in the organization, or this endpoint is unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The request conflicts with the current state of the group.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Add group user", "group": "administration", "examples": { "request": { @@ -6563,7 +9628,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a user in a group.", + "summary": "Retrieve group user", + "description": "Retrieves a user in a group.", "operationId": "retrieve-group-user", "tags": [ "Group users" @@ -6599,12 +9665,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve group user", "group": "administration", "examples": { "request": { @@ -6620,7 +9715,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Removes a user from a group.", + "summary": "Remove group user", + "description": "Removes a user from a group.", "operationId": "remove-group-user", "tags": [ "Group users" @@ -6656,12 +9752,51 @@ } } }, + "400": { + "description": "The request contains invalid parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller lacks the required permissions or is not using an admin API key.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The group or user was not found in the organization, or this endpoint is unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The request conflicts with the current state of the group.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Remove group user", "group": "administration", "examples": { "request": { @@ -6679,7 +9814,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Returns a list of invites in the organization.", + "summary": "List invites", + "description": "Returns a list of invites in the organization.", "operationId": "list-invites", "tags": [ "Invites" @@ -6715,16 +9851,55 @@ } } } + }, + "400": { + "description": "The invite listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The invite specified by the after cursor was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List invites", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"created_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533\n }\n ],\n \"first_id\": \"invite-abc\",\n \"last_id\": \"invite-abc\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"created_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533,\n \"projects\": []\n }\n ],\n \"first_id\": \"invite-abc\",\n \"last_id\": \"invite-abc\",\n \"has_more\": false\n}\n" } } }, @@ -6734,7 +9909,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.", + "summary": "Create invite", + "description": "Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.", "operationId": "inviteUser", "tags": [ "Invites" @@ -6760,10 +9936,49 @@ } } } + }, + "201": { + "description": "User invited successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Invite" + } + } + } + }, + "400": { + "description": "The invite request is invalid or the user has already joined or been invited.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create invite", "group": "administration", "examples": { "request": { @@ -6781,7 +9996,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves an invite.", + "summary": "Retrieve invite", + "description": "Retrieves an invite.", "operationId": "retrieve-invite", "tags": [ "Invites" @@ -6807,16 +10023,65 @@ } } } + }, + "400": { + "description": "The invite request is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The invite was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The invite could not be retrieved because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve invite", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/invites/invite-abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"created_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533\n}\n" + "response": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"created_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533,\n \"projects\": []\n}\n" } } }, @@ -6826,7 +10091,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Delete an invite. If the invite has already been accepted, it cannot be deleted.", + "summary": "Delete invite", + "description": "Delete an invite. If the invite has already been accepted, it cannot be deleted.", "operationId": "delete-invite", "tags": [ "Invites" @@ -6852,10 +10118,49 @@ } } } + }, + "400": { + "description": "The request is invalid or the invite cannot be deleted in its current state.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller is not permitted to delete the invite.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The invite was not found in the organization.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit was exceeded.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete invite", "group": "administration", "examples": { "request": { @@ -6868,7 +10173,8 @@ }, "/organization/projects": { "get": { - "summary": "Returns a list of projects.", + "summary": "List projects", + "description": "Returns a list of projects.", "operationId": "list-projects", "security": [ { @@ -6918,10 +10224,49 @@ } } } + }, + "400": { + "description": "The project listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project specified by the after cursor was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List projects", "group": "administration", "examples": { "request": { @@ -6932,7 +10277,8 @@ } }, "post": { - "summary": "Create a new project in the organization. Projects can be created and archived, but cannot be deleted.", + "summary": "Create project", + "description": "Create a new project in the organization. Projects can be created and archived, but cannot be deleted.", "operationId": "create-project", "security": [ { @@ -6963,10 +10309,49 @@ } } } + }, + "201": { + "description": "Project created successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Project" + } + } + } + }, + "400": { + "description": "The project creation request is invalid or contains incompatible settings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create project", "group": "administration", "examples": { "request": { @@ -6979,7 +10364,8 @@ }, "/organization/projects/{project_id}": { "get": { - "summary": "Retrieves a project.", + "summary": "Retrieve project", + "description": "Retrieves a project.", "operationId": "retrieve-project", "security": [ { @@ -7010,12 +10396,40 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve project", "group": "administration", - "description": "Retrieve a project.", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" @@ -7025,7 +10439,8 @@ } }, "post": { - "summary": "Modifies a project in the organization.", + "summary": "Modify project", + "description": "Modifies a project in the organization.", "operationId": "modify-project", "security": [ { @@ -7077,10 +10492,39 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A requested project, user, service account, or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Modify project", "group": "administration", "examples": { "request": { @@ -7097,7 +10541,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Returns a list of API keys in the project.", + "summary": "List project API keys", + "description": "Returns a list of API keys in the project.", "operationId": "list-project-api-keys", "tags": [ "Projects" @@ -7156,10 +10601,49 @@ } } } + }, + "400": { + "description": "The listing parameters are invalid or the project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List project API keys", "group": "administration", "examples": { "request": { @@ -7177,7 +10661,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves an API key in the project.", + "summary": "Retrieve project API key", + "description": "Retrieves an API key in the project.", "operationId": "retrieve-project-api-key", "tags": [ "Projects" @@ -7212,10 +10697,49 @@ } } } + }, + "400": { + "description": "The project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve project API key", "group": "administration", "examples": { "request": { @@ -7231,7 +10755,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes an API key from the project.\n\nReturns confirmation of the key deletion, or an error if the key belonged to\na service account.\n", + "summary": "Delete project API key", + "description": "Deletes an API key from the project, including keys owned by service accounts.\n\nRequires permission to write project API keys. Deleting a service-account key\ndoes not delete the service account or its other keys.\n\nReturns confirmation of the key deletion.\n", "operationId": "delete-project-api-key", "tags": [ "Projects" @@ -7276,10 +10801,39 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A requested project, user, service account, or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete project API key", "group": "administration", "examples": { "request": { @@ -7288,11 +10842,121 @@ "response": "{\n \"object\": \"organization.project.api_key.deleted\",\n \"id\": \"key_abc\",\n \"deleted\": true\n}\n" } } + }, + "post": { + "security": [ + { + "AdminApiKeyAuth": [] + } + ], + "summary": "Update project API key", + "description": "Updates the scopes and/or expiration of an existing API key in the project, including a\nservice-account-owned key. Requires permission to write project API keys.\n\nProvide at least one of `scopes` or `expires_in_seconds`. Omitted fields stay\nunchanged; neither field accepts `null`. Both changes are saved together.\n\n`scopes` replaces the key's scope restrictions using the same scope identifiers\nas the dashboard. An empty array means All permissions, subject to the owner's\neffective access; it does not mean no access. Use `[\"api.all.read\"]` for read-only\naccess or specific scopes such as `[\"api.files.read\"]` for restricted access.\nThis does not change user or service-account roles or grant admin permissions.\nScope changes follow the same authentication-cache propagation as dashboard edits.\n\nProvide `expires_in_seconds` to set the expiration relative to this request.\nThe value must satisfy the organization's and project's expiry policies.\nExpired keys cannot be updated. Retrying resets the expiration relative to\nthe new request. The response contains only the redacted key, not its secret.\n", + "operationId": "update-project-api-key", + "tags": [ + "Projects" + ], + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "api_key_id", + "in": "path", + "description": "The ID of the API key.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateProjectApiKeyBody" + }, + "example": { + "scopes": [ + "api.all.read" + ] + } + } + } + }, + "responses": { + "200": { + "description": "Project API key updated successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectApiKey" + } + } + } + }, + "400": { + "description": "The project is archived, the key is expired, or the requested scopes or expiration are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to update this API key.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"scopes\": [\"api.all.read\"], \"expires_in_seconds\": 86400}'\n" + }, + "response": "{\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"expires_at\": 1711557933,\n \"last_used_at\": null,\n \"id\": \"key_abc\",\n \"owner_project_access\": \"active\",\n \"owner\": {\n \"type\": \"service_account\",\n \"service_account\": {\n \"id\": \"svc_acct_abc\",\n \"name\": \"My Service Account\",\n \"role\": \"member\",\n \"created_at\": 1711471533\n }\n }\n}\n" + } + } } }, "/organization/projects/{project_id}/archive": { "post": { - "summary": "Archives a project in the organization. Archived projects cannot be used or updated.", + "summary": "Archive project", + "description": "Archives a project in the organization. Archived projects cannot be used or updated.", "operationId": "archive-project", "security": [ { @@ -7323,10 +10987,49 @@ } } } + }, + "400": { + "description": "The project is already archived or is the default project and cannot be archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Archive project", "group": "administration", "examples": { "request": { @@ -7344,7 +11047,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "List certificates for this project.", + "summary": "List project certificates", + "description": "List certificates for this project.", "operationId": "listProjectCertificates", "tags": [ "Certificates" @@ -7403,22 +11107,41 @@ } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "List project certificates", - "group": "administration", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/certificates \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n ],\n \"first_id\": \"cert_abc\",\n \"last_id\": \"cert_abc\",\n \"has_more\": false\n}\n" - } - } - } - }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + } + }, + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/certificates \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n }\n ],\n \"first_id\": \"cert_abc\",\n \"last_id\": \"cert_abc\",\n \"has_more\": false\n}\n" + } + } + } + }, "/organization/projects/{project_id}/certificates/activate": { "post": { "security": [ @@ -7426,7 +11149,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Activate certificates at the project level.\n\nYou can atomically and idempotently activate up to 10 certificates at a time.\n", + "summary": "Activate certificates for project", + "description": "Activate certificates at the project level.\n\nYou can atomically and idempotently activate up to 10 certificates at a time.\n", "operationId": "activateProjectCertificates", "tags": [ "Certificates" @@ -7464,18 +11188,57 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A certificate was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The certificate update could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Activate certificates for project", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/certificates/activate \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n \"certificate_ids\": [\"cert_abc\", \"cert_def\"]\n}'\n" }, - "response": "{\n \"object\": \"organization.project.certificate.activation\",\n \"data\": [\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_def\",\n \"name\": \"My Example Certificate 2\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n ],\n}\n" + "response": "{\n \"object\": \"organization.project.certificate.activation\",\n \"data\": [\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_def\",\n \"name\": \"My Example Certificate 2\",\n \"active\": true,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n }\n ]\n}\n" } } } @@ -7487,7 +11250,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deactivate certificates at the project level. You can atomically and \nidempotently deactivate up to 10 certificates at a time.\n", + "summary": "Deactivate certificates for project", + "description": "Deactivate certificates at the project level. You can atomically and \nidempotently deactivate up to 10 certificates at a time.\n", "operationId": "deactivateProjectCertificates", "tags": [ "Certificates" @@ -7525,18 +11289,57 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A certificate was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The certificate update could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Deactivate certificates for project", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/certificates/deactivate \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n \"certificate_ids\": [\"cert_abc\", \"cert_def\"]\n}'\n" }, - "response": "{\n \"object\": \"organization.project.certificate.deactivation\",\n \"data\": [\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": false,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_def\",\n \"name\": \"My Example Certificate 2\",\n \"active\": false,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n ],\n}\n" + "response": "{\n \"object\": \"organization.project.certificate.deactivation\",\n \"data\": [\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Example Certificate\",\n \"active\": false,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n },\n {\n \"object\": \"organization.project.certificate\",\n \"id\": \"cert_def\",\n \"name\": \"My Example Certificate 2\",\n \"active\": false,\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 12345667,\n \"expires_at\": 12345678\n }\n }\n ]\n}\n" } } } @@ -7548,7 +11351,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves project data retention controls.", + "summary": "Retrieve project data retention", + "description": "Retrieves project data retention controls.", "operationId": "retrieve-project-data-retention", "tags": [ "Data retention" @@ -7574,10 +11378,39 @@ } } } + }, + "400": { + "description": "The project ID is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The organization or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve project data retention", "group": "administration", "examples": { "request": { @@ -7593,7 +11426,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates project data retention controls.", + "summary": "Update project data retention", + "description": "Updates project data retention controls.", "operationId": "update-project-data-retention", "tags": [ "Data retention" @@ -7630,10 +11464,39 @@ } } } + }, + "400": { + "description": "The requested data retention setting or transition is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The organization or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update project data retention", "group": "administration", "examples": { "request": { @@ -7651,7 +11514,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists the groups that have access to a project.", + "summary": "List project groups", + "description": "Lists the groups that have access to a project.", "operationId": "list-project-groups", "tags": [ "Project groups" @@ -7713,18 +11577,47 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List project groups", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc123/groups?limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"created_at\": 1711471533\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"group_type\": \"group\",\n \"created_at\": 1711471533\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" } } }, @@ -7734,7 +11627,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Grants a group access to a project.", + "summary": "Add project group", + "description": "Grants a group access to a project.", "operationId": "add-project-group", "tags": [ "Project groups" @@ -7772,18 +11666,57 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The group operation could not be completed because of a server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Add project group", "group": "administration", "examples": { "request": { "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc123/groups \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"role\": \"role_01J1F8PROJ\"\n }'\n" }, - "response": "{\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"created_at\": 1711471533\n}\n" + "response": "{\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"group_type\": \"group\",\n \"created_at\": 1711471533\n}\n" } } } @@ -7795,7 +11728,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a project's group.", + "summary": "Retrieve project group", + "description": "Retrieves a project's group.", "operationId": "retrieve-project-group", "tags": [ "Project groups" @@ -7845,12 +11779,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve project group", "group": "administration", "examples": { "request": { @@ -7866,7 +11829,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Revokes a group's access to a project.", + "summary": "Remove project group", + "description": "Revokes a group's access to a project.", "operationId": "remove-project-group", "tags": [ "Project groups" @@ -7902,12 +11866,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested group, user, or project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Remove project group", "group": "administration", "examples": { "request": { @@ -7925,7 +11918,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Returns hosted tool permissions for a project.", + "summary": "Retrieve project hosted tool permissions", + "description": "Returns hosted tool permissions for a project.", "operationId": "retrieve-project-hosted-tool-permissions", "tags": [ "Hosted tools" @@ -7951,10 +11945,49 @@ } } } + }, + "400": { + "description": "The project ID is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve project hosted tool permissions", "group": "administration", "examples": { "request": { @@ -7970,7 +12003,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates hosted tool permissions for a project.", + "summary": "Modify project hosted tool permissions", + "description": "Updates hosted tool permissions for a project.", "operationId": "update-project-hosted-tool-permissions", "tags": [ "Hosted tools" @@ -8007,10 +12041,59 @@ } } } + }, + "400": { + "description": "The hosted tool permission request is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The requested project setting conflicts with the organization policy.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Modify project hosted tool permissions", "group": "administration", "examples": { "request": { @@ -8028,7 +12111,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Returns model permissions for a project.", + "summary": "Retrieve project model permissions", + "description": "Returns model permissions for a project.", "operationId": "retrieve-project-model-permissions", "tags": [ "Projects" @@ -8054,10 +12138,49 @@ } } } + }, + "400": { + "description": "The project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or model permission settings were not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve project model permissions", "group": "administration", "examples": { "request": { @@ -8073,7 +12196,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates model permissions for a project.", + "summary": "Modify project model permissions", + "description": "Updates model permissions for a project.", "operationId": "update-project-model-permissions", "tags": [ "Projects" @@ -8110,10 +12234,49 @@ } } } + }, + "400": { + "description": "The model permission request is invalid or the project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Modify project model permissions", "group": "administration", "examples": { "request": { @@ -8129,7 +12292,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes model permissions for a project.", + "summary": "Delete project model permissions", + "description": "Deletes model permissions for a project.", "operationId": "delete-project-model-permissions", "tags": [ "Projects" @@ -8155,10 +12319,49 @@ } } } + }, + "400": { + "description": "The project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or model permission settings were not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete project model permissions", "group": "administration", "examples": { "request": { @@ -8176,7 +12379,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Returns the rate limits per model for a project.", + "summary": "List project rate limits", + "description": "Returns the rate limits per model for a project.", "operationId": "list-project-rate-limits", "tags": [ "Projects" @@ -8230,17 +12434,53 @@ } } } + }, + "400": { + "description": "The rate limit listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or pagination cursor was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + }, + "example": { + "error": { + "code": "project_not_found", + "message": "The project proj_abc was not found", + "type": "invalid_request_error", + "param": null + } + } + } + } } }, "x-oaiMeta": { - "name": "List project rate limits", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"project.rate_limit\",\n \"id\": \"rl-ada\",\n \"model\": \"ada\",\n \"max_requests_per_1_minute\": 600,\n \"max_tokens_per_1_minute\": 150000,\n \"max_images_per_1_minute\": 10\n }\n ],\n \"first_id\": \"rl-ada\",\n \"last_id\": \"rl-ada\",\n \"has_more\": false\n}\n", - "error_response": "{\n \"code\": 404,\n \"message\": \"The project {project_id} was not found\"\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"project.rate_limit\",\n \"id\": \"rl-ada\",\n \"model\": \"ada\",\n \"max_requests_per_1_minute\": 600,\n \"max_tokens_per_1_minute\": 150000,\n \"max_images_per_1_minute\": 10\n }\n ],\n \"first_id\": \"rl-ada\",\n \"last_id\": \"rl-ada\",\n \"has_more\": false\n}\n" } } } @@ -8252,7 +12492,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates a project rate limit.", + "summary": "Modify project rate limit", + "description": "Updates a project rate limit.", "operationId": "update-project-rate-limits", "tags": [ "Projects" @@ -8308,17 +12549,43 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + }, + "example": { + "error": { + "code": "project_not_found", + "message": "The project proj_abc was not found", + "type": "invalid_request_error", + "param": null + } + } + } + } } }, "x-oaiMeta": { - "name": "Modify project rate limit", "group": "administration", "examples": { "request": { "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"max_requests_per_1_minute\": 500\n }'\n" }, - "response": "{\n \"object\": \"project.rate_limit\",\n \"id\": \"rl-ada\",\n \"model\": \"ada\",\n \"max_requests_per_1_minute\": 600,\n \"max_tokens_per_1_minute\": 150000,\n \"max_images_per_1_minute\": 10\n }\n", - "error_response": "{\n \"code\": 404,\n \"message\": \"The project {project_id} was not found\"\n}\n" + "response": "{\n \"object\": \"project.rate_limit\",\n \"id\": \"rl-ada\",\n \"model\": \"ada\",\n \"max_requests_per_1_minute\": 600,\n \"max_tokens_per_1_minute\": 150000,\n \"max_images_per_1_minute\": 10\n }\n" } } } @@ -8330,7 +12597,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Returns a list of service accounts in the project.", + "summary": "List project service accounts", + "description": "Returns a list of service accounts in the project.", "operationId": "list-project-service-accounts", "tags": [ "Projects" @@ -8385,17 +12653,46 @@ } } } - } - }, - "x-oaiMeta": { - "name": "List project service accounts", - "group": "administration", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n }\n ],\n \"first_id\": \"svc_acct_abc\",\n \"last_id\": \"svc_acct_xyz\",\n \"has_more\": false\n}\n" - } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A requested project, user, service account, or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n }\n ],\n \"first_id\": \"svc_acct_abc\",\n \"last_id\": \"svc_acct_xyz\",\n \"has_more\": false\n}\n" + } } }, "post": { @@ -8404,7 +12701,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Creates a new service account in the project. By default, this also returns an unredacted API key for the service account.", + "summary": "Create project service account", + "description": "Creates a new service account in the project. By default, this also returns an unredacted API key for the service account.", "operationId": "create-project-service-account", "tags": [ "Projects" @@ -8442,6 +12740,16 @@ } } }, + "201": { + "description": "Project service account created successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectServiceAccountCreateResponse" + } + } + } + }, "400": { "description": "Error response when project is archived.", "content": { @@ -8451,10 +12759,39 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A requested project, user, service account, or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create project service account", "group": "administration", "examples": { "request": { @@ -8472,7 +12809,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a service account in the project.", + "summary": "Retrieve project service account", + "description": "Retrieves a service account in the project.", "operationId": "retrieve-project-service-account", "tags": [ "Projects" @@ -8507,10 +12845,49 @@ } } } + }, + "400": { + "description": "The project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or service account was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve project service account", "group": "administration", "examples": { "request": { @@ -8526,7 +12903,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates a service account in the project.", + "summary": "Update project service account", + "description": "Updates a service account in the project.", "operationId": "update-project-service-account", "tags": [ "Projects" @@ -8572,10 +12950,49 @@ } } } + }, + "400": { + "description": "The service account update is invalid or the project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or service account was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update project service account", "group": "administration", "examples": { "request": { @@ -8591,7 +13008,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes a service account from the project.\n\nReturns confirmation of service account deletion, or an error if the project\nis archived (archived projects have no service accounts).\n", + "summary": "Delete project service account", + "description": "Deletes a service account from the project.\n\nReturns confirmation of service account deletion, or an error if the project\nis archived (archived projects have no service accounts).\n", "operationId": "delete-project-service-account", "tags": [ "Projects" @@ -8626,10 +13044,49 @@ } } } + }, + "400": { + "description": "The request is invalid or the service account cannot be deleted in its current state.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller is not permitted to delete the service account.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or service account was not found in the organization.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit was exceeded.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete project service account", "group": "administration", "examples": { "request": { @@ -8647,7 +13104,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists project spend alerts.", + "summary": "List project spend alerts", + "description": "Lists project spend alerts.", "operationId": "list-project-spend-alerts", "tags": [ "Spend alerts" @@ -8716,10 +13174,39 @@ } } } + }, + "400": { + "description": "The spend alert listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or spend alert pagination cursor was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List project spend alerts", "group": "administration", "examples": { "request": { @@ -8735,7 +13222,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Creates a project spend alert.", + "summary": "Create project spend alert", + "description": "Creates a project spend alert.", "operationId": "create-project-spend-alert", "tags": [ "Spend alerts" @@ -8772,10 +13260,39 @@ } } } + }, + "400": { + "description": "The spend alert request is invalid or conflicts with the hard spend limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create project spend alert", "group": "administration", "examples": { "request": { @@ -8793,7 +13310,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a project spend alert.", + "summary": "Retrieve project spend alert", + "description": "Retrieves a project spend alert.", "operationId": "retrieve-project-spend-alert", "tags": [ "Spend alerts" @@ -8828,10 +13346,39 @@ } } } + }, + "400": { + "description": "The project ID is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or spend alert was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve project spend alert", "group": "administration", "examples": { "request": { @@ -8847,7 +13394,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates a project spend alert.", + "summary": "Update project spend alert", + "description": "Updates a project spend alert.", "operationId": "update-project-spend-alert", "tags": [ "Spend alerts" @@ -8893,10 +13441,39 @@ } } } + }, + "400": { + "description": "The spend alert update is invalid or conflicts with the hard spend limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or spend alert was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update project spend alert", "group": "administration", "examples": { "request": { @@ -8912,7 +13489,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes a project spend alert.", + "summary": "Delete project spend alert", + "description": "Deletes a project spend alert.", "operationId": "delete-project-spend-alert", "tags": [ "Spend alerts" @@ -8947,10 +13525,39 @@ } } } + }, + "400": { + "description": "The project ID is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or spend alert was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete project spend alert", "group": "administration", "examples": { "request": { @@ -8968,7 +13575,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Returns a list of users in the project.", + "summary": "List project users", + "description": "Returns a list of users in the project.", "operationId": "list-project-users", "tags": [ "Projects" @@ -9023,10 +13631,39 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A requested project, user, service account, or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List project users", "group": "administration", "examples": { "request": { @@ -9042,7 +13679,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Adds a user to the project. Users must already be members of the organization to be added to a project.", + "summary": "Create project user", + "description": "Adds a user to the project. Users must already be members of the organization to be added to a project.", "operationId": "create-project-user", "parameters": [ { @@ -9080,8 +13718,58 @@ } } }, + "201": { + "description": "User added to project successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectUser" + } + } + } + }, "400": { - "description": "Error response for various conditions.", + "description": "The request is invalid or the user cannot be added to the project in its current state.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller lacks the required permissions.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or user was not found in the organization.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The request conflicts with the current state of the resource.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request exceeded the rate limit.", "content": { "application/json": { "schema": { @@ -9092,7 +13780,6 @@ } }, "x-oaiMeta": { - "name": "Create project user", "group": "administration", "examples": { "request": { @@ -9110,7 +13797,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a user in the project.", + "summary": "Retrieve project user", + "description": "Retrieves a user in the project.", "operationId": "retrieve-project-user", "tags": [ "Projects" @@ -9145,10 +13833,49 @@ } } } + }, + "400": { + "description": "The project is archived.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The project or user was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve project user", "group": "administration", "examples": { "request": { @@ -9164,7 +13891,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Modifies a user's role in the project.", + "summary": "Modify project user", + "description": "Modifies a user's role in the project.", "operationId": "modify-project-user", "tags": [ "Projects" @@ -9220,10 +13948,39 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A requested project, user, service account, or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Modify project user", "group": "administration", "examples": { "request": { @@ -9239,7 +13996,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes a user from the project.\n\nReturns confirmation of project user deletion, or an error if the project is\narchived (archived projects have no users).\n", + "summary": "Delete project user", + "description": "Deletes a user from the project.\n\nReturns confirmation of project user deletion, or an error if the project is\narchived (archived projects have no users).\n", "operationId": "delete-project-user", "tags": [ "Projects" @@ -9284,10 +14042,39 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "A requested project, user, service account, or API key was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete project user", "group": "administration", "examples": { "request": { @@ -9305,7 +14092,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists the roles configured for the organization.", + "summary": "List organization roles", + "description": "Lists the roles configured for the organization.", "operationId": "list-roles", "tags": [ "Roles" @@ -9358,12 +14146,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List organization roles", "group": "administration", "examples": { "request": { @@ -9379,7 +14196,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Creates a custom role for the organization.", + "summary": "Create organization role", + "description": "Creates a custom role for the organization.", "operationId": "create-role", "tags": [ "Roles" @@ -9406,12 +14224,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Create organization role", "group": "administration", "examples": { "request": { @@ -9429,7 +14276,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves an organization role.", + "summary": "Retrieve organization role", + "description": "Retrieves an organization role.", "operationId": "retrieve-role", "tags": [ "Roles" @@ -9456,12 +14304,31 @@ } } }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve organization role", "group": "administration", "examples": { "request": { @@ -9477,7 +14344,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates an existing organization role.", + "summary": "Update organization role", + "description": "Updates an existing organization role.", "operationId": "update-role", "tags": [ "Roles" @@ -9515,12 +14383,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Update organization role", "group": "administration", "examples": { "request": { @@ -9536,7 +14433,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes a custom role from the organization.", + "summary": "Delete organization role", + "description": "Deletes a custom role from the organization.", "operationId": "delete-role", "tags": [ "Roles" @@ -9563,12 +14461,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Delete organization role", "group": "administration", "examples": { "request": { @@ -9586,7 +14513,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists organization spend alerts.", + "summary": "List organization spend alerts", + "description": "Lists organization spend alerts.", "operationId": "list-organization-spend-alerts", "tags": [ "Spend alerts" @@ -9646,10 +14574,39 @@ } } } + }, + "400": { + "description": "The spend alert listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The spend alert specified by the after cursor was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List organization spend alerts", "group": "administration", "examples": { "request": { @@ -9665,7 +14622,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Creates an organization spend alert.", + "summary": "Create organization spend alert", + "description": "Creates an organization spend alert.", "operationId": "create-organization-spend-alert", "tags": [ "Spend alerts" @@ -9691,10 +14649,29 @@ } } } + }, + "400": { + "description": "The spend alert request is invalid or conflicts with the hard spend limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create organization spend alert", "group": "administration", "examples": { "request": { @@ -9712,7 +14689,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves an organization spend alert.", + "summary": "Retrieve organization spend alert", + "description": "Retrieves an organization spend alert.", "operationId": "retrieve-organization-spend-alert", "tags": [ "Spend alerts" @@ -9738,10 +14716,29 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The spend alert was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve organization spend alert", "group": "administration", "examples": { "request": { @@ -9757,7 +14754,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates an organization spend alert.", + "summary": "Update organization spend alert", + "description": "Updates an organization spend alert.", "operationId": "update-organization-spend-alert", "tags": [ "Spend alerts" @@ -9794,10 +14792,39 @@ } } } + }, + "400": { + "description": "The spend alert update is invalid or conflicts with the hard spend limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The spend alert was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update organization spend alert", "group": "administration", "examples": { "request": { @@ -9813,7 +14840,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes an organization spend alert.", + "summary": "Delete organization spend alert", + "description": "Deletes an organization spend alert.", "operationId": "delete-organization-spend-alert", "tags": [ "Spend alerts" @@ -9839,10 +14867,29 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The spend alert was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete organization spend alert", "group": "administration", "examples": { "request": { @@ -9860,7 +14907,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get audio speeches usage details for the organization.", + "summary": "Audio speeches", + "description": "Get audio speeches usage details for the organization.", "operationId": "usage-audio-speeches", "tags": [ "Usage" @@ -9994,12 +15042,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Audio speeches", "group": "usage-audio-speeches", "examples": { "request": { @@ -10017,7 +15084,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get audio transcriptions usage details for the organization.", + "summary": "Audio transcriptions", + "description": "Get audio transcriptions usage details for the organization.", "operationId": "usage-audio-transcriptions", "tags": [ "Usage" @@ -10151,12 +15219,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Audio transcriptions", "group": "usage-audio-transcriptions", "examples": { "request": { @@ -10174,7 +15261,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get code interpreter sessions usage details for the organization.", + "summary": "Code interpreter sessions", + "description": "Get code interpreter sessions usage details for the organization.", "operationId": "usage-code-interpreter-sessions", "tags": [ "Usage" @@ -10269,12 +15357,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Code interpreter sessions", "group": "usage-code-interpreter-sessions", "examples": { "request": { @@ -10292,7 +15399,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get completions usage details for the organization.", + "summary": "Completions", + "description": "Get completions usage details for the organization.", "operationId": "usage-completions", "tags": [ "Usage" @@ -10391,7 +15499,7 @@ { "name": "group_by", "in": "query", - "description": "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier` or any combination of them.", + "description": "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`, `api_source` or any combination of them. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null.", "required": false, "schema": { "type": "array", @@ -10403,7 +15511,8 @@ "api_key_id", "model", "batch", - "service_tier" + "service_tier", + "api_source" ] } } @@ -10437,18 +15546,37 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Completions", "group": "usage-completions", "examples": { "request": { "curl": "curl \"https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1\" \\\n-H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n-H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.completions.result\",\n \"input_tokens\": 1000,\n \"input_cached_tokens\": 400,\n \"input_cache_write_tokens\": 100,\n \"input_uncached_tokens\": 500,\n \"output_tokens\": 500,\n \"input_text_tokens\": 400,\n \"output_text_tokens\": 400,\n \"input_cached_text_tokens\": 300,\n \"input_audio_tokens\": 50,\n \"input_cached_audio_tokens\": 50,\n \"output_audio_tokens\": 50,\n \"input_image_tokens\": 50,\n \"input_cached_image_tokens\": 50,\n \"output_image_tokens\": 50,\n \"num_model_requests\": 5,\n \"project_id\": null,\n \"user_id\": null,\n \"api_key_id\": null,\n \"model\": null,\n \"batch\": null,\n \"service_tier\": null\n }\n ]\n }\n ],\n \"has_more\": true,\n \"next_page\": \"page_AAAAAGdGxdEiJdKOAAAAAGcqsYA=\"\n}\n" + "response": "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.completions.result\",\n \"input_tokens\": 1000,\n \"input_cached_tokens\": 400,\n \"input_cache_write_tokens\": 100,\n \"input_cache_write_30m_tokens\": 75,\n \"input_cache_write_12h_tokens\": 25,\n \"input_uncached_tokens\": 500,\n \"output_tokens\": 500,\n \"input_text_tokens\": 400,\n \"output_text_tokens\": 400,\n \"input_cached_text_tokens\": 300,\n \"input_audio_tokens\": 50,\n \"input_cached_audio_tokens\": 50,\n \"output_audio_tokens\": 50,\n \"input_image_tokens\": 50,\n \"input_cached_image_tokens\": 50,\n \"output_image_tokens\": 50,\n \"num_model_requests\": 5,\n \"project_id\": null,\n \"user_id\": null,\n \"api_key_id\": null,\n \"model\": null,\n \"batch\": null,\n \"service_tier\": null\n }\n ]\n }\n ],\n \"has_more\": true,\n \"next_page\": \"page_AAAAAGdGxdEiJdKOAAAAAGcqsYA=\"\n}\n" } } } @@ -10460,7 +15588,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get embeddings usage details for the organization.", + "summary": "Embeddings", + "description": "Get embeddings usage details for the organization.", "operationId": "usage-embeddings", "tags": [ "Usage" @@ -10594,12 +15723,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Embeddings", "group": "usage-embeddings", "examples": { "request": { @@ -10617,7 +15765,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get file search calls usage details for the organization.", + "summary": "File search calls", + "description": "Get file search calls usage details for the organization.", "operationId": "usage-file-search-calls", "tags": [ "Usage" @@ -10751,12 +15900,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "File search calls", "group": "usage-file-search-calls", "examples": { "request": { @@ -10774,7 +15942,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get images usage details for the organization.", + "summary": "Images", + "description": "Get images usage details for the organization.", "operationId": "usage-images", "tags": [ "Usage" @@ -10946,12 +16115,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Images", "group": "usage-images", "examples": { "request": { @@ -10969,7 +16157,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get moderations usage details for the organization.", + "summary": "Moderations", + "description": "Get moderations usage details for the organization.", "operationId": "usage-moderations", "tags": [ "Usage" @@ -11103,12 +16292,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Moderations", "group": "usage-moderations", "examples": { "request": { @@ -11126,7 +16334,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get vector stores usage details for the organization.", + "summary": "Vector stores", + "description": "Get vector stores usage details for the organization.", "operationId": "usage-vector-stores", "tags": [ "Usage" @@ -11221,12 +16430,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Vector stores", "group": "usage-vector-stores", "examples": { "request": { @@ -11244,7 +16472,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Get web search calls usage details for the organization.", + "summary": "Web search calls", + "description": "Get web search calls usage details for the organization.", "operationId": "usage-web-search-calls", "tags": [ "Usage" @@ -11351,7 +16580,7 @@ { "name": "group_by", "in": "query", - "description": "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `context_level` or any combination of them.", + "description": "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `context_level`, `api_source` or any combination of them. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null.", "required": false, "schema": { "type": "array", @@ -11362,7 +16591,8 @@ "user_id", "api_key_id", "model", - "context_level" + "context_level", + "api_source" ] } } @@ -11396,12 +16626,31 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Web search calls", "group": "usage-web-search-calls", "examples": { "request": { @@ -11419,7 +16668,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists all of the users in the organization.", + "summary": "List users", + "description": "Lists all of the users in the organization.", "operationId": "list-users", "tags": [ "Users" @@ -11467,10 +16717,39 @@ } } } + }, + "400": { + "description": "The user listing parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List users", "group": "administration", "examples": { "request": { @@ -11488,7 +16767,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a user by their identifier.", + "summary": "Retrieve user", + "description": "Retrieves a user by their identifier.", "operationId": "retrieve-user", "tags": [ "Users" @@ -11514,10 +16794,39 @@ } } } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The user was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve user", "group": "administration", "examples": { "request": { @@ -11533,7 +16842,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Modifies a user's role in the organization.", + "summary": "Modify user", + "description": "Modifies a user's role in the organization.", "operationId": "modify-user", "tags": [ "Users" @@ -11570,10 +16880,49 @@ } } } + }, + "400": { + "description": "The requested user role is invalid or the update is not permitted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The user was not found in this organization.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Modify user", "group": "administration", "examples": { "request": { @@ -11589,7 +16938,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes a user from the organization.", + "summary": "Delete user", + "description": "Deletes a user from the organization.", "operationId": "delete-user", "tags": [ "Users" @@ -11615,10 +16965,49 @@ } } } + }, + "400": { + "description": "The request is invalid or the user cannot be removed in their current state.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller is not permitted to delete the user.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The user was not found in the organization.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit was exceeded.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete user", "group": "administration", "examples": { "request": { @@ -11636,7 +17025,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists the organization roles assigned to a user within the organization.", + "summary": "List user organization role assignments", + "description": "Lists the organization roles assigned to a user within the organization.", "operationId": "list-user-role-assignments", "tags": [ "User organization role assignments" @@ -11696,18 +17086,47 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List user organization role assignments", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/organization/users/user_abc123/roles \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false,\n \"description\": \"Allows managing organization groups\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {}\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false,\n \"description\": \"Allows managing organization groups\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {},\n \"assignment_sources\": [\n {\n \"principal_id\": \"user_abc123\",\n \"principal_type\": \"user\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" } } }, @@ -11717,7 +17136,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Assigns an organization role to a user within the organization.", + "summary": "Assign organization role to user", + "description": "Assigns an organization role to a user within the organization.", "operationId": "assign-user-role", "tags": [ "User organization role assignments" @@ -11755,12 +17175,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Assign organization role to user", "group": "administration", "examples": { "request": { @@ -11778,7 +17227,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves an organization role assigned to a user.", + "summary": "Retrieve user organization role", + "description": "Retrieves an organization role assigned to a user.", "operationId": "retrieve-user-role", "tags": [ "User organization role assignments" @@ -11814,12 +17264,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve user organization role", "group": "administration", "examples": { "request": { @@ -11835,7 +17314,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Unassigns an organization role from a user within the organization.", + "summary": "Unassign organization role from user", + "description": "Unassigns an organization role from a user within the organization.", "operationId": "unassign-user-role", "tags": [ "User organization role assignments" @@ -11871,12 +17351,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Unassign organization role from user", "group": "administration", "examples": { "request": { @@ -11894,7 +17403,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists the project roles assigned to a group within a project.", + "summary": "List project group role assignments", + "description": "Lists the project roles assigned to a group within a project.", "operationId": "list-project-group-role-assignments", "tags": [ "Project group role assignments" @@ -11963,18 +17473,47 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List project group role assignments", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/projects/proj_abc123/groups/group_01J1F8ABCDXYZ/roles \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8PROJ\",\n \"name\": \"API Project Key Manager\",\n \"permissions\": [\n \"api.organization.projects.api_keys.read\",\n \"api.organization.projects.api_keys.write\"\n ],\n \"resource_type\": \"api.project\",\n \"predefined_role\": false,\n \"description\": \"Allows managing API keys for the project\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {}\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8PROJ\",\n \"name\": \"API Project Key Manager\",\n \"permissions\": [\n \"api.organization.projects.api_keys.read\",\n \"api.organization.projects.api_keys.write\"\n ],\n \"resource_type\": \"api.project\",\n \"predefined_role\": false,\n \"description\": \"Allows managing API keys for the project\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {},\n \"assignment_sources\": [\n {\n \"principal_id\": \"group_01J1F8ABCDXYZ\",\n \"principal_type\": \"group\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" } } }, @@ -11984,7 +17523,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Assigns a project role to a group within a project.", + "summary": "Assign project role to group", + "description": "Assigns a project role to a group within a project.", "operationId": "assign-project-group-role", "tags": [ "Project group role assignments" @@ -12031,12 +17571,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Assign project role to group", "group": "administration", "examples": { "request": { @@ -12054,7 +17623,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a project role assigned to a group.", + "summary": "Retrieve project group role", + "description": "Retrieves a project role assigned to a group.", "operationId": "retrieve-project-group-role", "tags": [ "Project group role assignments" @@ -12099,12 +17669,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve project group role", "group": "administration", "examples": { "request": { @@ -12120,7 +17719,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Unassigns a project role from a group within a project.", + "summary": "Unassign project role from group", + "description": "Unassigns a project role from a group within a project.", "operationId": "unassign-project-group-role", "tags": [ "Project group role assignments" @@ -12165,12 +17765,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Unassign project role from group", "group": "administration", "examples": { "request": { @@ -12188,7 +17817,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists the roles configured for a project.", + "summary": "List project roles", + "description": "Lists the roles configured for a project.", "operationId": "list-project-roles", "tags": [ "Roles" @@ -12250,12 +17880,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List project roles", "group": "administration", "examples": { "request": { @@ -12271,7 +17930,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Creates a custom role for a project.", + "summary": "Create project role", + "description": "Creates a custom role for a project.", "operationId": "create-project-role", "tags": [ "Roles" @@ -12309,12 +17969,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Create project role", "group": "administration", "examples": { "request": { @@ -12332,7 +18021,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a project role.", + "summary": "Retrieve project role", + "description": "Retrieves a project role.", "operationId": "retrieve-project-role", "tags": [ "Roles" @@ -12368,12 +18058,31 @@ } } }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve project role", "group": "administration", "examples": { "request": { @@ -12389,7 +18098,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Updates an existing project role.", + "summary": "Update project role", + "description": "Updates an existing project role.", "operationId": "update-project-role", "tags": [ "Roles" @@ -12436,12 +18146,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Update project role", "group": "administration", "examples": { "request": { @@ -12457,7 +18196,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Deletes a custom role from a project.", + "summary": "Delete project role", + "description": "Deletes a custom role from a project.", "operationId": "delete-project-role", "tags": [ "Roles" @@ -12493,12 +18233,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Delete project role", "group": "administration", "examples": { "request": { @@ -12516,7 +18285,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Lists the project roles assigned to a user within a project.", + "summary": "List project user role assignments", + "description": "Lists the project roles assigned to a user within a project.", "operationId": "list-project-user-role-assignments", "tags": [ "Project user role assignments" @@ -12585,18 +18355,47 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List project user role assignments", "group": "administration", "examples": { "request": { "curl": "curl https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8PROJ\",\n \"name\": \"API Project Key Manager\",\n \"permissions\": [\n \"api.organization.projects.api_keys.read\",\n \"api.organization.projects.api_keys.write\"\n ],\n \"resource_type\": \"api.project\",\n \"predefined_role\": false,\n \"description\": \"Allows managing API keys for the project\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {}\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8PROJ\",\n \"name\": \"API Project Key Manager\",\n \"permissions\": [\n \"api.organization.projects.api_keys.read\",\n \"api.organization.projects.api_keys.write\"\n ],\n \"resource_type\": \"api.project\",\n \"predefined_role\": false,\n \"description\": \"Allows managing API keys for the project\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {},\n \"assignment_sources\": [\n {\n \"principal_id\": \"user_abc123\",\n \"principal_type\": \"user\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" } } }, @@ -12606,7 +18405,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Assigns a project role to a user within a project.", + "summary": "Assign project role to user", + "description": "Assigns a project role to a user within a project.", "operationId": "assign-project-user-role", "tags": [ "Project user role assignments" @@ -12653,12 +18453,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Assign project role to user", "group": "administration", "examples": { "request": { @@ -12676,7 +18505,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Retrieves a project role assigned to a user.", + "summary": "Retrieve project user role", + "description": "Retrieves a project role assigned to a user.", "operationId": "retrieve-project-user-role", "tags": [ "Project user role assignments" @@ -12721,12 +18551,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve project user role", "group": "administration", "examples": { "request": { @@ -12742,7 +18601,8 @@ "AdminApiKeyAuth": [] } ], - "summary": "Unassigns a project role from a user within a project.", + "summary": "Unassign project role from user", + "description": "Unassigns a project role from a user within a project.", "operationId": "unassign-project-user-role", "tags": [ "Project user role assignments" @@ -12787,12 +18647,41 @@ } } }, + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionErrorResponse" + } + } + } + }, + "404": { + "description": "The endpoint is unavailable or a requested resource was not found in this organization or project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Unassign project role from user", "group": "administration", "examples": { "request": { @@ -12805,7 +18694,8 @@ }, "/realtime/calls": { "post": { - "summary": "Create a new Realtime API call over WebRTC and receive the SDP answer needed\nto complete the peer connection.", + "summary": "Create call", + "description": "Create a new Realtime API call over WebRTC and receive the SDP answer needed\nto complete the peer connection.", "operationId": "create-realtime-call", "tags": [ "Realtime" @@ -12856,7 +18746,6 @@ } }, "x-oaiMeta": { - "name": "Create call", "group": "realtime", "returns": "Returns `201 Created` with the SDP answer in the response body. The\n`Location` response header includes the call ID for follow-up requests,\ne.g., establishing a monitoring WebSocket or hanging up the call.", "examples": { @@ -12870,7 +18759,8 @@ }, "/realtime/calls/{call_id}/accept": { "post": { - "summary": "Accept an incoming SIP call and configure the realtime session that will\nhandle it.", + "summary": "Accept call", + "description": "Accept an incoming SIP call and configure the realtime session that will\nhandle it.", "operationId": "accept-realtime-call", "tags": [ "Realtime" @@ -12900,10 +18790,39 @@ "responses": { "200": { "description": "Call accepted successfully." + }, + "404": { + "description": "The session or call was not found or is unavailable for this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The session or call can no longer accept this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error occurred. The response body is plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } } }, "x-oaiMeta": { - "name": "Accept call", "group": "realtime-calls", "returns": "Returns `200 OK` once OpenAI starts ringing the SIP leg with the supplied\nsession configuration.", "examples": { @@ -12916,7 +18835,8 @@ }, "/realtime/calls/{call_id}/hangup": { "post": { - "summary": "End an active Realtime API call, whether it was initiated over SIP or\nWebRTC.", + "summary": "Hang up call", + "description": "End an active Realtime API call, whether it was initiated over SIP or\nWebRTC.", "operationId": "hangup-realtime-call", "tags": [ "Realtime" @@ -12935,10 +18855,19 @@ "responses": { "200": { "description": "Call hangup initiated successfully." + }, + "404": { + "description": "The session or call was not found or is unavailable for this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Hang up call", "group": "realtime-calls", "returns": "Returns `200 OK` when OpenAI begins terminating the realtime call.", "examples": { @@ -12951,7 +18880,8 @@ }, "/realtime/calls/{call_id}/refer": { "post": { - "summary": "Transfer an active SIP call to a new destination using the SIP REFER verb.", + "summary": "Refer call", + "description": "Transfer an active SIP call to a new destination using the SIP REFER verb.", "operationId": "refer-realtime-call", "tags": [ "Realtime" @@ -12981,10 +18911,29 @@ "responses": { "200": { "description": "Call referred successfully." + }, + "404": { + "description": "The session or call was not found or is unavailable for this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error occurred. The response body is plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } } }, "x-oaiMeta": { - "name": "Refer call", "group": "realtime-calls", "returns": "Returns `200 OK` once the REFER is handed off to your SIP provider.", "examples": { @@ -12997,7 +18946,8 @@ }, "/realtime/calls/{call_id}/reject": { "post": { - "summary": "Decline an incoming SIP call by returning a SIP status code to the caller.", + "summary": "Reject call", + "description": "Decline an incoming SIP call by returning a SIP status code to the caller.", "operationId": "reject-realtime-call", "tags": [ "Realtime" @@ -13027,10 +18977,39 @@ "responses": { "200": { "description": "Call rejected successfully." + }, + "404": { + "description": "The session or call was not found or is unavailable for this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The session or call can no longer accept this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "An internal error occurred. The response body is plain text.", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } } }, "x-oaiMeta": { - "name": "Reject call", "group": "realtime-calls", "returns": "Returns `200 OK` after OpenAI sends the SIP status code to the caller.", "examples": { @@ -13043,7 +19022,8 @@ }, "/realtime/client_secrets": { "post": { - "summary": "Create a Realtime client secret with an associated session configuration.\n\nClient secrets are short-lived tokens that can be passed to a client app,\nsuch as a web frontend or mobile client, which grants access to the Realtime API without\nleaking your main API key. You can configure a custom TTL for each client secret.\n\nYou can also attach session configuration options to the client secret, which will be\napplied to any sessions created using that client secret, but these can also be overridden\nby the client connection.\n\n[Learn more about authentication with client secrets over WebRTC](https://developers.openai.com/api/docs/guides/realtime-webrtc).\n\nReturns the created client secret and the effective session object. The client secret is a string that looks like `ek_1234`.\n", + "summary": "Create client secret", + "description": "Create a Realtime client secret with an associated session configuration.\n\nClient secrets are short-lived tokens that can be passed to a client app,\nsuch as a web frontend or mobile client, which grants access to the Realtime API without\nleaking your main API key. You can configure a custom TTL for each client secret.\n\nYou can also attach session configuration options to the client secret, which will be\napplied to any sessions created using that client secret, but these can also be overridden\nby the client connection.\n\n[Learn more about authentication with client secrets over WebRTC](https://developers.openai.com/api/docs/guides/realtime-webrtc).\n\nReturns the created client secret and the effective session object. The client secret is a string that looks like `ek_1234`.\n", "operationId": "create-realtime-client-secret", "tags": [ "Realtime" @@ -13069,23 +19049,53 @@ } } } + }, + "400": { + "description": "Invalid session configuration or model.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The requested model was not found or is unavailable to this caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The requested model's availability could not be determined.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create client secret", "group": "realtime", "examples": { "request": { "curl": "curl -X POST https://api.openai.com/v1/realtime/client_secrets \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"expires_after\": {\n \"anchor\": \"created_at\",\n \"seconds\": 600\n },\n \"session\": {\n \"type\": \"realtime\",\n \"model\": \"gpt-realtime\",\n \"instructions\": \"You are a friendly assistant.\"\n }\n }'\n" }, - "response": "{\n \"value\": \"ek_68af296e8e408191a1120ab6383263c2\",\n \"expires_at\": 1756310470,\n \"session\": {\n \"type\": \"realtime\",\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9CiUVUzUzYIssh3ELY1d\",\n \"model\": \"gpt-realtime\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"instructions\": \"You are a friendly assistant.\",\n \"tools\": [],\n \"tool_choice\": \"auto\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": null,\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"expires_at\": 0,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": null,\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"alloy\",\n \"speed\": 1.0\n }\n },\n \"include\": null\n }\n}\n" + "response": "{\n \"value\": \"ek_68af296e8e408191a1120ab6383263c2\",\n \"expires_at\": 1756310470,\n \"session\": {\n \"type\": \"realtime\",\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9CiUVUzUzYIssh3ELY1d\",\n \"model\": \"gpt-realtime\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"instructions\": \"You are a friendly assistant.\",\n \"tools\": [],\n \"tool_choice\": \"auto\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": null,\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"expires_at\": 0,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": null,\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\"\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"alloy\",\n \"speed\": 1.0\n }\n },\n \"include\": null\n }\n}\n" } } } }, "/realtime/sessions": { "post": { - "summary": "Create an ephemeral API token for use in client-side applications with the\nRealtime API. Can be configured with the same session parameters as the\n`session.update` client event.\n\nIt responds with a session object, plus a `client_secret` key which contains\na usable ephemeral API token that can be used to authenticate browser clients\nfor the Realtime API.\n\nReturns the created Realtime session object, plus an ephemeral key.\n", + "summary": "Create session", + "description": "Create an ephemeral API token for use in client-side applications with the\nRealtime API. Can be configured with the same session parameters as the\n`session.update` client event.\n\nIt responds with a session object, plus a `client_secret` key which contains\na usable ephemeral API token that can be used to authenticate browser clients\nfor the Realtime API.\n\nReturns the created Realtime session object, plus an ephemeral key.\n", "operationId": "create-realtime-session", "tags": [ "Realtime" @@ -13114,7 +19124,6 @@ } }, "x-oaiMeta": { - "name": "Create session", "group": "realtime", "examples": { "request": { @@ -13127,7 +19136,8 @@ }, "/realtime/transcription_sessions": { "post": { - "summary": "Create an ephemeral API token for use in client-side applications with the\nRealtime API specifically for realtime transcriptions. \nCan be configured with the same session parameters as the `transcription_session.update` client event.\n\nIt responds with a session object, plus a `client_secret` key which contains\na usable ephemeral API token that can be used to authenticate browser clients\nfor the Realtime API.\n\nReturns the created Realtime transcription session object, plus an ephemeral key.\n", + "summary": "Create transcription session", + "description": "Create an ephemeral API token for use in client-side applications with the\nRealtime API specifically for realtime transcriptions. \nCan be configured with the same session parameters as the `transcription_session.update` client event.\n\nIt responds with a session object, plus a `client_secret` key which contains\na usable ephemeral API token that can be used to authenticate browser clients\nfor the Realtime API.\n\nReturns the created Realtime transcription session object, plus an ephemeral key.\n", "operationId": "create-realtime-transcription-session", "tags": [ "Realtime" @@ -13156,20 +19166,20 @@ } }, "x-oaiMeta": { - "name": "Create transcription session", "group": "realtime", "examples": { "request": { "curl": "curl -X POST https://api.openai.com/v1/realtime/transcription_sessions \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{}'\n" }, - "response": "{\n \"id\": \"sess_BBwZc7cFV3XizEyKGDCGL\",\n \"object\": \"realtime.transcription_session\",\n \"modalities\": [\"audio\", \"text\"],\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200\n },\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"language\": null,\n \"prompt\": \"\"\n },\n \"client_secret\": null\n}\n" + "response": "{\n \"id\": \"sess_BBwZc7cFV3XizEyKGDCGL\",\n \"object\": \"realtime.transcription_session\",\n \"modalities\": [\"audio\", \"text\"],\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200\n },\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"language\": null,\n \"prompt\": \"\"\n },\n \"client_secret\": {\n \"value\": \"ek_abc123\",\n \"expires_at\": 1742188264\n }\n}\n" } } } }, "/realtime/translations/client_secrets": { "post": { - "summary": "Create a Realtime translation client secret with an associated translation session configuration.\n\nClient secrets are short-lived tokens that can be passed to a client app,\nsuch as a web frontend or mobile client, which grants access to the Realtime\nTranslation API without leaking your main API key. You can configure a custom\nTTL for each client secret.\n\nReturns the created client secret and the effective translation session object.\nThe client secret is a string that looks like `ek_1234`.\n", + "summary": "Create translation client secret", + "description": "Create a Realtime translation client secret with an associated translation session configuration.\n\nClient secrets are short-lived tokens that can be passed to a client app,\nsuch as a web frontend or mobile client, which grants access to the Realtime\nTranslation API without leaking your main API key. You can configure a custom\nTTL for each client secret.\n\nReturns the created client secret and the effective translation session object.\nThe client secret is a string that looks like `ek_1234`.\n", "operationId": "create-realtime-translation-client-secret", "tags": [ "Realtime" @@ -13195,10 +19205,39 @@ } } } + }, + "400": { + "description": "Invalid session configuration or model.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The requested model was not found or is unavailable to this caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The requested model's availability could not be determined.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create translation client secret", "group": "realtime", "examples": { "request": { @@ -13215,7 +19254,8 @@ "tags": [ "Responses" ], - "summary": "Creates a model response. Provide [text](https://developers.openai.com/api/docs/guides/text) or\n[image](https://developers.openai.com/api/docs/guides/images-vision) inputs to generate [text](https://developers.openai.com/api/docs/guides/text)\nor [JSON](https://developers.openai.com/api/docs/guides/structured-outputs) outputs. Have the model call\nyour own [custom code](https://developers.openai.com/api/docs/guides/function-calling) or use built-in\n[tools](https://developers.openai.com/api/docs/guides/tools) like [web search](https://developers.openai.com/api/docs/guides/tools-web-search)\nor [file search](https://developers.openai.com/api/docs/guides/tools-file-search) to use your own data\nas input for the model's response.\n", + "summary": "Create a model response", + "description": "Creates a model response. Provide [text](https://developers.openai.com/api/docs/guides/text) or\n[image](https://developers.openai.com/api/docs/guides/images-vision) inputs to generate [text](https://developers.openai.com/api/docs/guides/text)\nor [JSON](https://developers.openai.com/api/docs/guides/structured-outputs) outputs. Have the model call\nyour own [custom code](https://developers.openai.com/api/docs/guides/function-calling) or use built-in\n[tools](https://developers.openai.com/api/docs/guides/tools) like [web search](https://developers.openai.com/api/docs/guides/tools-web-search)\nor [file search](https://developers.openai.com/api/docs/guides/tools-file-search) to use your own data\nas input for the model's response.\n", "requestBody": { "required": true, "content": { @@ -13242,6 +19282,26 @@ } } }, + "400": { + "description": "Invalid response request or incompatible request parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The requested model or a referenced resource was not found or is unavailable to this caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/InferenceRateLimited" }, @@ -13250,7 +19310,6 @@ } }, "x-oaiMeta": { - "name": "Create a model response", "group": "responses", "path": "create", "examples": [ @@ -13262,7 +19321,7 @@ "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=\"Tell me a three sentence bedtime story about a unicorn.\"\n)\n\nprint(response)\n", "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nOpenAIResponse response = client.CreateResponse(\"Tell me a three sentence bedtime story about a unicorn.\");\n\nConsole.WriteLine(response.GetOutputText());\n" }, - "response": "{\n \"id\": \"resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b\",\n \"object\": \"response\",\n \"created_at\": 1741476542,\n \"status\": \"completed\",\n \"completed_at\": 1741476543,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 36,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 87,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 123\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741476542,\n \"status\": \"completed\",\n \"completed_at\": 1741476543,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 36,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 87,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 123\n },\n \"user\": null,\n \"metadata\": {}\n}\n" }, { "title": "Image input", @@ -13272,7 +19331,7 @@ "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": [\n { \"type\": \"input_text\", \"text\": \"what is in this image?\" },\n {\n \"type\": \"input_image\",\n \"image_url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"\n }\n ]\n }\n ]\n)\n\nprint(response)\n", "csharp": "using System;\nusing System.Collections.Generic;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nList inputItems =\n[\n ResponseItem.CreateUserMessageItem(\n [\n ResponseContentPart.CreateInputTextPart(\"What is in this image?\"),\n ResponseContentPart.CreateInputImagePart(new Uri(\"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"))\n ]\n )\n];\n\nOpenAIResponse response = client.CreateResponse(inputItems);\n\nConsole.WriteLine(response.GetOutputText());\n" }, - "response": "{\n \"id\": \"resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41\",\n \"object\": \"response\",\n \"created_at\": 1741476777,\n \"status\": \"completed\",\n \"completed_at\": 1741476778,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 328,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 52,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 380\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741476777,\n \"status\": \"completed\",\n \"completed_at\": 1741476778,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 328,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 52,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 380\n },\n \"user\": null,\n \"metadata\": {}\n}\n" }, { "title": "File input", @@ -13281,7 +19340,7 @@ "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: [\n { type: \"input_text\", text: \"what is in this file?\" },\n {\n type: \"input_file\",\n file_url: \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n detail: \"auto\",\n },\n ],\n },\n ],\n});\n\nconsole.log(response);\n", "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": [\n { \"type\": \"input_text\", \"text\": \"what is in this file?\" },\n {\n \"type\": \"input_file\",\n \"file_url\": \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n \"detail\": \"auto\"\n }\n ]\n }\n ]\n)\n\nprint(response)\n" }, - "response": "{\n \"id\": \"resp_686eef60237881a2bd1180bb8b13de430e34c516d176ff86\",\n \"object\": \"response\",\n \"created_at\": 1752100704,\n \"status\": \"completed\",\n \"completed_at\": 1752100705,\n \"background\": false,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"max_tool_calls\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"id\": \"msg_686eef60d3e081a29283bdcbc4322fd90e34c516d176ff86\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"The file seems to contain excerpts from a letter to the shareholders of Berkshire Hathaway Inc., likely written by Warren Buffett. It covers several topics:\\n\\n1. **Communication Philosophy**: Buffett emphasizes the importance of transparency and candidness in reporting mistakes and successes to shareholders.\\n\\n2. **Mistakes and Learnings**: The letter acknowledges past mistakes in business assessments and management hires, highlighting the importance of correcting errors promptly.\\n\\n3. **CEO Succession**: Mention of Greg Abel stepping in as the new CEO and continuing the tradition of honest communication.\\n\\n4. **Pete Liegl Story**: A detailed account of acquiring Forest River and the relationship with its founder, highlighting trust and effective business decisions.\\n\\n5. **2024 Performance**: Overview of business performance, particularly in insurance and investment activities, with a focus on GEICO's improvement.\\n\\n6. **Tax Contributions**: Discussion of significant tax payments to the U.S. Treasury, credited to shareholders' reinvestments.\\n\\n7. **Investment Strategy**: A breakdown of Berkshire\\u2019s investments in both controlled subsidiaries and marketable equities, along with a focus on long-term holding strategies.\\n\\n8. **American Capitalism**: Reflections on America\\u2019s economic development and Berkshire\\u2019s role within it.\\n\\n9. **Property-Casualty Insurance**: Insights into the P/C insurance business model and its challenges and benefits.\\n\\n10. **Japanese Investments**: Information about Berkshire\\u2019s investments in Japanese companies and future plans.\\n\\n11. **Annual Meeting**: Details about the upcoming annual gathering in Omaha, including schedule changes and new book releases.\\n\\n12. **Personal Anecdotes**: Light-hearted stories about family and interactions, conveying Buffett's personable approach.\\n\\n13. **Financial Performance Data**: Tables comparing Berkshire\\u2019s annual performance to the S&P 500, showing impressive long-term gains.\\n\\nOverall, the letter reinforces Berkshire Hathaway's commitment to transparency, investment in both its businesses and the wider economy, and emphasizes strong leadership and prudent financial management.\"\n }\n ],\n \"role\": \"assistant\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"service_tier\": \"default\",\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_logprobs\": 0,\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 8438,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 398,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 8836\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_686eef60237881a2bd1180bb8b13de430e34c516d176ff86\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1752100704,\n \"status\": \"completed\",\n \"completed_at\": 1752100705,\n \"background\": false,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"max_tool_calls\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"id\": \"msg_686eef60d3e081a29283bdcbc4322fd90e34c516d176ff86\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"The file seems to contain excerpts from a letter to the shareholders of Berkshire Hathaway Inc., likely written by Warren Buffett. It covers several topics:\\n\\n1. **Communication Philosophy**: Buffett emphasizes the importance of transparency and candidness in reporting mistakes and successes to shareholders.\\n\\n2. **Mistakes and Learnings**: The letter acknowledges past mistakes in business assessments and management hires, highlighting the importance of correcting errors promptly.\\n\\n3. **CEO Succession**: Mention of Greg Abel stepping in as the new CEO and continuing the tradition of honest communication.\\n\\n4. **Pete Liegl Story**: A detailed account of acquiring Forest River and the relationship with its founder, highlighting trust and effective business decisions.\\n\\n5. **2024 Performance**: Overview of business performance, particularly in insurance and investment activities, with a focus on GEICO's improvement.\\n\\n6. **Tax Contributions**: Discussion of significant tax payments to the U.S. Treasury, credited to shareholders' reinvestments.\\n\\n7. **Investment Strategy**: A breakdown of Berkshire\\u2019s investments in both controlled subsidiaries and marketable equities, along with a focus on long-term holding strategies.\\n\\n8. **American Capitalism**: Reflections on America\\u2019s economic development and Berkshire\\u2019s role within it.\\n\\n9. **Property-Casualty Insurance**: Insights into the P/C insurance business model and its challenges and benefits.\\n\\n10. **Japanese Investments**: Information about Berkshire\\u2019s investments in Japanese companies and future plans.\\n\\n11. **Annual Meeting**: Details about the upcoming annual gathering in Omaha, including schedule changes and new book releases.\\n\\n12. **Personal Anecdotes**: Light-hearted stories about family and interactions, conveying Buffett's personable approach.\\n\\n13. **Financial Performance Data**: Tables comparing Berkshire\\u2019s annual performance to the S&P 500, showing impressive long-term gains.\\n\\nOverall, the letter reinforces Berkshire Hathaway's commitment to transparency, investment in both its businesses and the wider economy, and emphasizes strong leadership and prudent financial management.\"\n }\n ],\n \"role\": \"assistant\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"service_tier\": \"default\",\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_logprobs\": 0,\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 8438,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 398,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 8836\n },\n \"user\": null,\n \"metadata\": {}\n}\n" }, { "title": "Web search", @@ -13291,7 +19350,7 @@ "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n tools=[{ \"type\": \"web_search_preview\" }],\n input=\"What was a positive news story from today?\",\n)\n\nprint(response)\n", "csharp": "using System;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"What was a positive news story from today?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n ResponseTool.CreateWebSearchTool()\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" }, - "response": "{\n \"id\": \"resp_67ccf18ef5fc8190b16dbee19bc54e5f087bb177ab789d5c\",\n \"object\": \"response\",\n \"created_at\": 1741484430,\n \"status\": \"completed\",\n \"completed_at\": 1741484431,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"web_search_call\",\n \"id\": \"ws_67ccf18f64008190a39b619f4c8455ef087bb177ab789d5c\",\n \"status\": \"completed\"\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccf190ca3881909d433c50b1f6357e087bb177ab789d5c\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"As of today, March 9, 2025, one notable positive news story...\",\n \"annotations\": [\n {\n \"type\": \"url_citation\",\n \"start_index\": 442,\n \"end_index\": 557,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n },\n {\n \"type\": \"url_citation\",\n \"start_index\": 962,\n \"end_index\": 1077,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n },\n {\n \"type\": \"url_citation\",\n \"start_index\": 1336,\n \"end_index\": 1451,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n }\n ]\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"web_search_preview\",\n \"domains\": [],\n \"search_context_size\": \"medium\",\n \"user_location\": {\n \"type\": \"approximate\",\n \"city\": null,\n \"country\": \"US\",\n \"region\": null,\n \"timezone\": null\n }\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 328,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 356,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 684\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_67ccf18ef5fc8190b16dbee19bc54e5f087bb177ab789d5c\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741484430,\n \"status\": \"completed\",\n \"completed_at\": 1741484431,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"web_search_call\",\n \"id\": \"ws_67ccf18f64008190a39b619f4c8455ef087bb177ab789d5c\",\n \"status\": \"completed\"\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccf190ca3881909d433c50b1f6357e087bb177ab789d5c\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"As of today, March 9, 2025, one notable positive news story...\",\n \"annotations\": [\n {\n \"type\": \"url_citation\",\n \"start_index\": 442,\n \"end_index\": 557,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n },\n {\n \"type\": \"url_citation\",\n \"start_index\": 962,\n \"end_index\": 1077,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n },\n {\n \"type\": \"url_citation\",\n \"start_index\": 1336,\n \"end_index\": 1451,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n }\n ],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"web_search_preview\",\n \"domains\": [],\n \"search_context_size\": \"medium\",\n \"user_location\": {\n \"type\": \"approximate\",\n \"city\": null,\n \"country\": \"US\",\n \"region\": null,\n \"timezone\": null\n }\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 328,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 356,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 684\n },\n \"user\": null,\n \"metadata\": {}\n}\n" }, { "title": "File search", @@ -13301,7 +19360,7 @@ "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n tools=[{\n \"type\": \"file_search\",\n \"vector_store_ids\": [\"vs_1234567890\"],\n \"max_num_results\": 20\n }],\n input=\"What are the attributes of an ancient brown dragon?\",\n)\n\nprint(response)\n", "csharp": "using System;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"What are the attributes of an ancient brown dragon?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n ResponseTool.CreateFileSearchTool(\n vectorStoreIds: [\"vs_1234567890\"],\n maxResultCount: 20\n )\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" }, - "response": "{\n \"id\": \"resp_67ccf4c55fc48190b71bd0463ad3306d09504fb6872380d7\",\n \"object\": \"response\",\n \"created_at\": 1741485253,\n \"status\": \"completed\",\n \"completed_at\": 1741485254,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"file_search_call\",\n \"id\": \"fs_67ccf4c63cd08190887ef6464ba5681609504fb6872380d7\",\n \"status\": \"completed\",\n \"queries\": [\n \"attributes of an ancient brown dragon\"\n ],\n \"results\": null\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccf4c93e5c81909d595b369351a9d309504fb6872380d7\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The attributes of an ancient brown dragon include...\",\n \"annotations\": [\n {\n \"type\": \"file_citation\",\n \"index\": 320,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 576,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 815,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 815,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1030,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1030,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1156,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1225,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n }\n ]\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"filters\": null,\n \"max_num_results\": 20,\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0.0\n },\n \"vector_store_ids\": [\n \"vs_1234567890\"\n ]\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 18307,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 348,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 18655\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_67ccf4c55fc48190b71bd0463ad3306d09504fb6872380d7\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741485253,\n \"status\": \"completed\",\n \"completed_at\": 1741485254,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"file_search_call\",\n \"id\": \"fs_67ccf4c63cd08190887ef6464ba5681609504fb6872380d7\",\n \"status\": \"completed\",\n \"queries\": [\n \"attributes of an ancient brown dragon\"\n ],\n \"results\": null\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccf4c93e5c81909d595b369351a9d309504fb6872380d7\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The attributes of an ancient brown dragon include...\",\n \"annotations\": [\n {\n \"type\": \"file_citation\",\n \"index\": 320,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 576,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 815,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 815,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1030,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1030,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1156,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1225,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n }\n ],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"filters\": null,\n \"max_num_results\": 20,\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0.0\n },\n \"vector_store_ids\": [\n \"vs_1234567890\"\n ]\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 18307,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 348,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 18655\n },\n \"user\": null,\n \"metadata\": {}\n}\n" }, { "title": "Streaming", @@ -13311,7 +19370,7 @@ "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n instructions: \"You are a helpful assistant.\",\n input: \"Hello!\",\n stream: true,\n});\n\nfor await (const event of response) {\n console.log(event);\n}\n", "csharp": "using System;\nusing System.ClientModel;\nusing System.Threading.Tasks;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"Hello!\";\n\nResponseCreationOptions options = new()\n{\n Instructions = \"You are a helpful assistant.\",\n};\n\nAsyncCollectionResult responseUpdates = client.CreateResponseStreamingAsync(userInputText, options);\n\nawait foreach (StreamingResponseUpdate responseUpdate in responseUpdates)\n{\n if (responseUpdate is StreamingResponseOutputTextDeltaUpdate outputTextDeltaUpdate)\n {\n Console.Write(outputTextDeltaUpdate.Delta);\n }\n}\n" }, - "response": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"created_at\":1741290958,\"status\":\"in_progress\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}}}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"created_at\":1741290958,\"status\":\"in_progress\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}}}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"output_index\":0,\"item\":{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"in_progress\",\"role\":\"assistant\",\"content\":[]}}\n\nevent: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"\",\"annotations\":[]}}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"delta\":\"Hi\"}\n\n...\n\nevent: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"text\":\"Hi there! How can I assist you today?\"}\n\nevent: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[]}}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"output_index\":0,\"item\":{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"completed\",\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[]}]}}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"created_at\":1741290958,\"status\":\"completed\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"completed\",\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[]}]}],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":37,\"output_tokens\":11,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":48},\"user\":null,\"metadata\":{}}}\n" + "response": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"access_programs\":null,\"created_at\":1741290958,\"status\":\"in_progress\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"access_programs\":null,\"created_at\":1741290958,\"status\":\"in_progress\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"output_index\":0,\"item\":{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"in_progress\",\"role\":\"assistant\",\"content\":[]},\"sequence_number\":2}\n\nevent: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"\",\"annotations\":[],\"logprobs\":[]},\"sequence_number\":3}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"delta\":\"Hi\",\"sequence_number\":4,\"logprobs\":[]}\n\n: Intermediate response events omitted.\n\nevent: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"text\":\"Hi there! How can I assist you today?\",\"sequence_number\":10,\"logprobs\":[]}\n\nevent: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[],\"logprobs\":[]},\"sequence_number\":11}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"output_index\":0,\"item\":{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"completed\",\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[],\"logprobs\":[]}]},\"sequence_number\":12}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"access_programs\":null,\"created_at\":1741290958,\"status\":\"completed\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"completed\",\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[],\"logprobs\":[]}]}],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":37,\"output_tokens\":11,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":48,\"input_tokens_details\":{\"cached_tokens\":0,\"cache_write_tokens\":0}},\"user\":null,\"metadata\":{}},\"sequence_number\":13}\n\n" }, { "title": "Functions", @@ -13321,7 +19380,7 @@ "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n type: \"function\",\n name: \"get_current_weather\",\n description: \"Get the current weather in a given location\",\n parameters: {\n type: \"object\",\n properties: {\n location: {\n type: \"string\",\n description: \"The city and state, e.g. San Francisco, CA\",\n },\n unit: { type: \"string\", enum: [\"celsius\", \"fahrenheit\"] },\n },\n required: [\"location\", \"unit\"],\n },\n },\n];\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n tools: tools,\n input: \"What is the weather like in Boston today?\",\n tool_choice: \"auto\",\n});\n\nconsole.log(response);\n", "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nResponseTool getCurrentWeatherFunctionTool = ResponseTool.CreateFunctionTool(\n functionName: \"get_current_weather\",\n functionDescription: \"Get the current weather in a given location\",\n functionParameters: BinaryData.FromString(\"\"\"\n {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}\n },\n \"required\": [\"location\", \"unit\"]\n }\n \"\"\"\n )\n);\n\nstring userInputText = \"What is the weather like in Boston today?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n getCurrentWeatherFunctionTool\n },\n ToolChoice = ResponseToolChoice.CreateAutoChoice(),\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n" }, - "response": "{\n \"id\": \"resp_67ca09c5efe0819096d0511c92b8c890096610f474011cc0\",\n \"object\": \"response\",\n \"created_at\": 1741294021,\n \"status\": \"completed\",\n \"completed_at\": 1741294022,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"function_call\",\n \"id\": \"fc_67ca09c6bedc8190a7abfec07b1a1332096610f474011cc0\",\n \"call_id\": \"call_unLAR8MvFNptuiZK6K6HCy5k\",\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\",\\\"unit\\\":\\\"celsius\\\"}\",\n \"status\": \"completed\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"description\": \"Get the current weather in a given location\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\",\n \"unit\"\n ]\n },\n \"strict\": true\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 291,\n \"output_tokens\": 23,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 314\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_67ca09c5efe0819096d0511c92b8c890096610f474011cc0\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741294021,\n \"status\": \"completed\",\n \"completed_at\": 1741294022,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"function_call\",\n \"id\": \"fc_67ca09c6bedc8190a7abfec07b1a1332096610f474011cc0\",\n \"call_id\": \"call_unLAR8MvFNptuiZK6K6HCy5k\",\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\",\\\"unit\\\":\\\"celsius\\\"}\",\n \"status\": \"completed\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"description\": \"Get the current weather in a given location\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\",\n \"unit\"\n ]\n },\n \"strict\": true\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 291,\n \"output_tokens\": 23,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 314,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n }\n },\n \"user\": null,\n \"metadata\": {}\n}\n" }, { "title": "Reasoning", @@ -13331,7 +19390,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=\"How much wood would a woodchuck chuck?\",\n reasoning={\n \"effort\": \"high\"\n }\n)\n\nprint(response)\n", "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"How much wood would a woodchuck chuck?\";\n\nResponseCreationOptions options = new()\n{\n ReasoningOptions = new()\n {\n ReasoningEffortLevel = ResponseReasoningEffortLevel.High,\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" }, - "response": "{\n \"id\": \"resp_67ccd7eca01881908ff0b5146584e408072912b2993db808\",\n \"object\": \"response\",\n \"created_at\": 1741477868,\n \"status\": \"completed\",\n \"completed_at\": 1741477869,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd7f7b5848190a6f3e95d809f6b44072912b2993db808\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The classic tongue twister...\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": \"high\",\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 81,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 1035,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 832\n },\n \"total_tokens\": 1116\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_67ccd7eca01881908ff0b5146584e408072912b2993db808\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741477868,\n \"status\": \"completed\",\n \"completed_at\": 1741477869,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd7f7b5848190a6f3e95d809f6b44072912b2993db808\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The classic tongue twister...\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": \"high\",\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 81,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 1035,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 832\n },\n \"total_tokens\": 1116\n },\n \"user\": null,\n \"metadata\": {}\n}\n" } ] } @@ -13343,7 +19402,8 @@ "tags": [ "Responses" ], - "summary": "Retrieves a model response with the given ID.\n", + "summary": "Get a model response", + "description": "Retrieves a model response with the given ID.\n", "parameters": [ { "in": "path", @@ -13399,6 +19459,21 @@ "schema": { "$ref": "#/components/schemas/Response" } + }, + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/ResponseStreamEvent" + } + } + } + }, + "404": { + "description": "The response was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, @@ -13407,7 +19482,6 @@ } }, "x-oaiMeta": { - "name": "Get a model response", "group": "responses", "examples": { "request": { @@ -13415,7 +19489,7 @@ "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.retrieve(\"resp_123\");\nconsole.log(response);\n", "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.retrieve(\"resp_123\")\nprint(response)\n" }, - "response": "{\n \"id\": \"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44\",\n \"object\": \"response\",\n \"created_at\": 1741386163,\n \"status\": \"completed\",\n \"completed_at\": 1741386164,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Silent circuits hum, \\nThoughts emerge in data streams— \\nDigital dawn breaks.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 32,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 18,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 50\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741386163,\n \"status\": \"completed\",\n \"completed_at\": 1741386164,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Silent circuits hum, \\nThoughts emerge in data streams— \\nDigital dawn breaks.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 32,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 18,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 50\n },\n \"user\": null,\n \"metadata\": {}\n}\n" } } }, @@ -13424,7 +19498,8 @@ "tags": [ "Responses" ], - "summary": "Deletes a model response with the given ID.\n", + "summary": "Delete a model response", + "description": "Deletes a model response with the given ID.\n", "parameters": [ { "in": "path", @@ -13439,14 +19514,42 @@ ], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "response.deleted" + ], + "default": "response.deleted", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + } + }, + "required": [ + "object", + "deleted", + "id" + ] + } + } + } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/ErrorResponse" } } } @@ -13456,7 +19559,6 @@ } }, "x-oaiMeta": { - "name": "Delete a model response", "group": "responses", "examples": { "request": { @@ -13464,7 +19566,7 @@ "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.delete(\"resp_123\");\nconsole.log(response);\n", "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.delete(\"resp_123\")\nprint(response)\n" }, - "response": "{\n \"id\": \"resp_6786a1bec27481909a17d673315b29f6\",\n \"object\": \"response\",\n \"deleted\": true\n}\n" + "response": "{\n \"id\": \"resp_123\",\n \"object\": \"response.deleted\",\n \"deleted\": true\n}\n" } } } @@ -13475,7 +19577,8 @@ "tags": [ "Responses" ], - "summary": "Cancels a model response with the given ID. Only responses created with\nthe `background` parameter set to `true` can be cancelled.\n[Learn more](https://developers.openai.com/api/docs/guides/background).\n", + "summary": "Cancel a response", + "description": "Cancels a model response with the given ID. Only responses created with\nthe `background` parameter set to `true` can be cancelled.\n[Learn more](https://developers.openai.com/api/docs/guides/background).\n", "parameters": [ { "in": "path", @@ -13504,7 +19607,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/ErrorResponse" } } } @@ -13514,7 +19617,6 @@ } }, "x-oaiMeta": { - "name": "Cancel a response", "group": "responses", "examples": { "request": { @@ -13522,7 +19624,7 @@ "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.cancel(\"resp_123\");\nconsole.log(response);\n", "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.cancel(\"resp_123\")\nprint(response)\n" }, - "response": "{\n \"id\": \"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44\",\n \"object\": \"response\",\n \"created_at\": 1741386163,\n \"status\": \"cancelled\",\n \"background\": true,\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44\",\n \"status\": \"in_progress\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Silent circuits hum, \\nThoughts emerge in data streams— \\nDigital dawn breaks.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741386163,\n \"status\": \"cancelled\",\n \"background\": true,\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44\",\n \"status\": \"in_progress\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Silent circuits hum, \\nThoughts emerge in data streams— \\nDigital dawn breaks.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n}\n" } } } @@ -13533,7 +19635,8 @@ "tags": [ "Responses" ], - "summary": "Returns a list of input items for a given response.", + "summary": "List input items", + "description": "Returns a list of input items for a given response.", "parameters": [ { "in": "path", @@ -13597,12 +19700,21 @@ } } }, + "404": { + "description": "The response or the item specified by `after` was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List input items", "group": "responses", "examples": { "request": { @@ -13621,7 +19733,8 @@ "tags": [ "Assistants" ], - "summary": "Create a thread.", + "summary": "Create thread", + "description": "Create a thread.", "requestBody": { "content": { "application/json": { @@ -13647,7 +19760,6 @@ } }, "x-oaiMeta": { - "name": "Create thread", "group": "threads", "beta": true, "examples": [ @@ -13679,7 +19791,8 @@ "tags": [ "Assistants" ], - "summary": "Create a thread and run it in one request.", + "summary": "Create thread and run", + "description": "Create a thread and run it in one request.", "requestBody": { "required": true, "content": { @@ -13698,6 +19811,11 @@ "schema": { "$ref": "#/components/schemas/RunObject" } + }, + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/AssistantStreamEvent" + } } } }, @@ -13706,7 +19824,6 @@ } }, "x-oaiMeta": { - "name": "Create thread and run", "group": "threads", "beta": true, "examples": [ @@ -13717,7 +19834,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.create_and_run(\n assistant_id=\"asst_abc123\",\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Explain deep learning to a 5 year old.\"}\n ]\n }\n)\n\nprint(run)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_abc123\",\n thread: {\n messages: [\n { role: \"user\", content: \"Explain deep learning to a 5 year old.\" },\n ],\n },\n });\n\n console.log(run);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699076792,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"queued\",\n \"started_at\": null,\n \"expires_at\": 1699077392,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"required_action\": null,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are a helpful assistant.\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_completion_tokens\": null,\n \"max_prompt_tokens\": null,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"incomplete_details\": null,\n \"usage\": null,\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699076792,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"queued\",\n \"started_at\": null,\n \"expires_at\": 1699077392,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"required_action\": null,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant.\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_completion_tokens\": null,\n \"max_prompt_tokens\": null,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"incomplete_details\": null,\n \"usage\": null,\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" }, { "title": "Streaming", @@ -13726,7 +19843,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.create_and_run(\n assistant_id=\"asst_123\",\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Hello\"}\n ]\n },\n stream=True\n)\n\nfor event in stream:\n print(event)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_123\",\n thread: {\n messages: [\n { role: \"user\", content: \"Hello\" },\n ],\n },\n stream: true\n });\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" }, - "response": "event: thread.created\ndata: {\"id\":\"thread_123\",\"object\":\"thread\",\"created_at\":1710348075,\"metadata\":{}}\n\nevent: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[], \"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[], \"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710348077,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}], \"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710348077,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\n{\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1713226836,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1713226837,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":345,\"completion_tokens\":11,\"total_tokens\":356},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: done\ndata: [DONE]\n" + "response": "event: thread.created\ndata: {\"id\":\"thread_123\",\"object\":\"thread\",\"created_at\":1710348075,\"metadata\":{},\"tool_resources\":{}}\n\nevent: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"tool_resources\":{},\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[], \"metadata\":{},\"attachments\":[]}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[], \"metadata\":{},\"attachments\":[]}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n: Intermediate Assistant events omitted.\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710348077,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}], \"metadata\":{},\"attachments\":[]}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710348077,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1713226836,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1713226837,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":345,\"completion_tokens\":11,\"total_tokens\":356},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: done\ndata: [DONE]\n\n" }, { "title": "Streaming with Functions", @@ -13735,7 +19852,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n]\n\nstream = client.beta.threads.create_and_run(\n thread={\n \"messages\": [\n {\"role\": \"user\", \"content\": \"What is the weather like in San Francisco?\"}\n ]\n },\n assistant_id=\"asst_abc123\",\n tools=tools,\n stream=True\n)\n\nfor event in stream:\n print(event)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n];\n\nasync function main() {\n const stream = await openai.beta.threads.createAndRun({\n assistant_id: \"asst_123\",\n thread: {\n messages: [\n { role: \"user\", content: \"What is the weather like in San Francisco?\" },\n ],\n },\n tools: tools,\n stream: true\n });\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" }, - "response": "event: thread.created\ndata: {\"id\":\"thread_123\",\"object\":\"thread\",\"created_at\":1710351818,\"metadata\":{}}\n\nevent: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710351818,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710351819,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710352418,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[]},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710351819,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710352418,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[]},\"usage\":null}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"id\":\"call_XXNp8YGaFrjrSjgqxtC8JJ1B\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"\",\"output\":null}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"{\\\"\"}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"location\"}}]}}}\n\n...\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"ahrenheit\"}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"\\\"}\"}}]}}}\n\nevent: thread.run.requires_action\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"requires_action\",\"started_at\":1710351818,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":{\"type\":\"submit_tool_outputs\",\"submit_tool_outputs\":{\"tool_calls\":[{\"id\":\"call_XXNp8YGaFrjrSjgqxtC8JJ1B\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"San Francisco, CA\\\",\\\"unit\\\":\\\"fahrenheit\\\"}\"}}]}},\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":345,\"completion_tokens\":11,\"total_tokens\":356},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" + "response": "event: thread.created\ndata: {\"id\":\"thread_123\",\"object\":\"thread\",\"created_at\":1710351818,\"metadata\":{},\"tool_resources\":{}}\n\nevent: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710351818,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710351819,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710352418,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[]},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710351819,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710352418,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[]},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"id\":\"call_XXNp8YGaFrjrSjgqxtC8JJ1B\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"\",\"output\":null}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"{\\\"\"}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"location\"}}]}}}\n\n: Intermediate Assistant events omitted.\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"ahrenheit\"}}]}}}\n\nevent: thread.run.step.delta\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step.delta\",\"delta\":{\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"index\":0,\"type\":\"function\",\"function\":{\"arguments\":\"\\\"}\"}}]}}}\n\nevent: thread.run.requires_action\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710351818,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"requires_action\",\"started_at\":1710351818,\"expires_at\":1710352418,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":{\"type\":\"submit_tool_outputs\",\"submit_tool_outputs\":{\"tool_calls\":[{\"id\":\"call_XXNp8YGaFrjrSjgqxtC8JJ1B\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"San Francisco, CA\\\",\\\"unit\\\":\\\"fahrenheit\\\"}\"}}]}},\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":345,\"completion_tokens\":11,\"total_tokens\":356},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: done\ndata: [DONE]\n\n" } ] } @@ -13747,7 +19864,8 @@ "tags": [ "Assistants" ], - "summary": "Retrieves a thread.", + "summary": "Retrieve thread", + "description": "Retrieves a thread.", "parameters": [ { "in": "path", @@ -13775,7 +19893,6 @@ } }, "x-oaiMeta": { - "name": "Retrieve thread", "group": "threads", "beta": true, "examples": { @@ -13793,7 +19910,8 @@ "tags": [ "Assistants" ], - "summary": "Modifies a thread.", + "summary": "Modify thread", + "description": "Modifies a thread.", "parameters": [ { "in": "path", @@ -13831,7 +19949,6 @@ } }, "x-oaiMeta": { - "name": "Modify thread", "group": "threads", "beta": true, "examples": { @@ -13849,7 +19966,8 @@ "tags": [ "Assistants" ], - "summary": "Delete a thread.", + "summary": "Delete thread", + "description": "Delete a thread.", "parameters": [ { "in": "path", @@ -13877,7 +19995,6 @@ } }, "x-oaiMeta": { - "name": "Delete thread", "group": "threads", "beta": true, "examples": { @@ -13897,7 +20014,8 @@ "tags": [ "Assistants" ], - "summary": "Returns a list of messages for a given thread.", + "summary": "List messages", + "description": "Returns a list of messages for a given thread.", "parameters": [ { "in": "path", @@ -13972,7 +20090,6 @@ } }, "x-oaiMeta": { - "name": "List messages", "group": "threads", "beta": true, "examples": { @@ -13981,7 +20098,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nthread_messages = client.beta.threads.messages.list(\"thread_abc123\")\nprint(thread_messages.data)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const threadMessages = await openai.beta.threads.messages.list(\n \"thread_abc123\"\n );\n\n console.log(threadMessages.data);\n}\n\nmain();" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699016383,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n },\n {\n \"id\": \"msg_abc456\",\n \"object\": \"thread.message\",\n \"created_at\": 1699016383,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"Hello, what is AI?\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n }\n ],\n \"first_id\": \"msg_abc123\",\n \"last_id\": \"msg_abc456\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699016383,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {},\n \"status\": \"completed\",\n \"completed_at\": 1699016383,\n \"incomplete_at\": null,\n \"incomplete_details\": null\n },\n {\n \"id\": \"msg_abc456\",\n \"object\": \"thread.message\",\n \"created_at\": 1699016383,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"Hello, what is AI?\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {},\n \"status\": \"completed\",\n \"completed_at\": 1699016383,\n \"incomplete_at\": null,\n \"incomplete_details\": null\n }\n ],\n \"first_id\": \"msg_abc123\",\n \"last_id\": \"msg_abc456\",\n \"has_more\": false\n}\n" } } }, @@ -13990,7 +20107,8 @@ "tags": [ "Assistants" ], - "summary": "Create a message.", + "summary": "Create message", + "description": "Create a message.", "parameters": [ { "in": "path", @@ -14028,7 +20146,6 @@ } }, "x-oaiMeta": { - "name": "Create message", "group": "threads", "beta": true, "examples": { @@ -14037,7 +20154,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nthread_message = client.beta.threads.messages.create(\n \"thread_abc123\",\n role=\"user\",\n content=\"How does AI work? Explain it in simple terms.\",\n)\nprint(thread_message)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const threadMessages = await openai.beta.threads.messages.create(\n \"thread_abc123\",\n { role: \"user\", content: \"How does AI work? Explain it in simple terms.\" }\n );\n\n console.log(threadMessages);\n}\n\nmain();" }, - "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1713226573,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1713226573,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {},\n \"status\": \"completed\",\n \"completed_at\": 1713226573,\n \"incomplete_at\": null,\n \"incomplete_details\": null\n}\n" } } } @@ -14048,7 +20165,8 @@ "tags": [ "Assistants" ], - "summary": "Retrieve a message.", + "summary": "Retrieve message", + "description": "Retrieve a message.", "parameters": [ { "in": "path", @@ -14085,7 +20203,6 @@ } }, "x-oaiMeta": { - "name": "Retrieve message", "group": "threads", "beta": true, "examples": { @@ -14094,7 +20211,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nmessage = client.beta.threads.messages.retrieve(\n message_id=\"msg_abc123\",\n thread_id=\"thread_abc123\",\n)\nprint(message)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const message = await openai.beta.threads.messages.retrieve(\n \"msg_abc123\",\n { thread_id: \"thread_abc123\" }\n );\n\n console.log(message);\n}\n\nmain();" }, - "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699017614,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {}\n}\n" + "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699017614,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"attachments\": [],\n \"metadata\": {},\n \"status\": \"completed\",\n \"completed_at\": 1699017614,\n \"incomplete_at\": null,\n \"incomplete_details\": null\n}\n" } } }, @@ -14103,7 +20220,8 @@ "tags": [ "Assistants" ], - "summary": "Modifies a message.", + "summary": "Modify message", + "description": "Modifies a message.", "parameters": [ { "in": "path", @@ -14150,7 +20268,6 @@ } }, "x-oaiMeta": { - "name": "Modify message", "group": "threads", "beta": true, "examples": { @@ -14159,7 +20276,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nmessage = client.beta.threads.messages.update(\n message_id=\"msg_abc12\",\n thread_id=\"thread_abc123\",\n metadata={\n \"modified\": \"true\",\n \"user\": \"abc123\",\n },\n)\nprint(message)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const message = await openai.beta.threads.messages.update(\n \"thread_abc123\",\n \"msg_abc123\",\n {\n metadata: {\n modified: \"true\",\n user: \"abc123\",\n },\n }\n }'" }, - "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699017614,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"file_ids\": [],\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n }\n}\n" + "response": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1699017614,\n \"assistant_id\": null,\n \"thread_id\": \"thread_abc123\",\n \"run_id\": null,\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"How does AI work? Explain it in simple terms.\",\n \"annotations\": []\n }\n }\n ],\n \"metadata\": {\n \"modified\": \"true\",\n \"user\": \"abc123\"\n },\n \"status\": \"completed\",\n \"completed_at\": 1699017614,\n \"incomplete_at\": null,\n \"incomplete_details\": null,\n \"attachments\": []\n}\n" } } }, @@ -14168,7 +20285,8 @@ "tags": [ "Assistants" ], - "summary": "Deletes a message.", + "summary": "Delete message", + "description": "Deletes a message.", "parameters": [ { "in": "path", @@ -14205,7 +20323,6 @@ } }, "x-oaiMeta": { - "name": "Delete message", "group": "threads", "beta": true, "examples": { @@ -14225,7 +20342,8 @@ "tags": [ "Assistants" ], - "summary": "Returns a list of runs belonging to a thread.", + "summary": "List runs", + "description": "Returns a list of runs belonging to a thread.", "parameters": [ { "name": "thread_id", @@ -14292,7 +20410,6 @@ } }, "x-oaiMeta": { - "name": "List runs", "group": "threads", "beta": true, "examples": { @@ -14301,7 +20418,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nruns = client.beta.threads.runs.list(\n \"thread_abc123\"\n)\n\nprint(runs)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const runs = await openai.beta.threads.runs.list(\n \"thread_abc123\"\n );\n\n console.log(runs);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n },\n {\n \"id\": \"run_abc456\",\n \"object\": \"thread.run\",\n \"created_at\": 1699063290,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699063290,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699063291,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n }\n ],\n \"first_id\": \"run_abc123\",\n \"last_id\": \"run_abc456\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant.\",\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\"\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true,\n \"required_action\": null\n },\n {\n \"id\": \"run_abc456\",\n \"object\": \"thread.run\",\n \"created_at\": 1699063290,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699063290,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699063291,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant.\",\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\"\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true,\n \"required_action\": null\n }\n ],\n \"first_id\": \"run_abc123\",\n \"last_id\": \"run_abc456\",\n \"has_more\": false\n}\n" } } }, @@ -14310,7 +20427,8 @@ "tags": [ "Assistants" ], - "summary": "Create a run.", + "summary": "Create run", + "description": "Create a run.", "parameters": [ { "in": "path", @@ -14354,6 +20472,11 @@ "schema": { "$ref": "#/components/schemas/RunObject" } + }, + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/AssistantStreamEvent" + } } } }, @@ -14362,18 +20485,17 @@ } }, "x-oaiMeta": { - "name": "Create run", "group": "threads", "beta": true, "examples": [ { "title": "Default", "request": { - "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\"\n }'\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.create(\n thread_id=\"thread_abc123\",\n assistant_id=\"asst_abc123\"\n)\n\nprint(run)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.create(\n \"thread_abc123\",\n { assistant_id: \"asst_abc123\" }\n );\n\n console.log(run);\n}\n\nmain();\n" + "curl": "curl https://api.openai.com/v1/threads/thread_abc123/runs \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"assistant_id\": \"asst_abc123\",\n \"instructions\": \"You are a helpful assistant.\"\n }'\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.create(\n thread_id=\"thread_abc123\",\n assistant_id=\"asst_abc123\",\n instructions=\"You are a helpful assistant.\"\n)\n\nprint(run)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.create(\n \"thread_abc123\",\n { assistant_id: \"asst_abc123\", instructions: \"You are a helpful assistant.\" }\n );\n\n console.log(run);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699063290,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"queued\",\n \"started_at\": 1699063290,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699063291,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699063290,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"queued\",\n \"started_at\": null,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant.\",\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\"\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true,\n \"required_action\": null\n}\n" }, { "title": "Streaming", @@ -14382,7 +20504,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.runs.create(\n thread_id=\"thread_123\",\n assistant_id=\"asst_123\",\n stream=True\n)\n\nfor event in stream:\n print(event)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.runs.create(\n \"thread_123\",\n { assistant_id: \"asst_123\", stream: true }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" }, - "response": "event: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710330641,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710330642,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710330642,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710330641,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710330642,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" + "response": "event: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710330641,\"expires_at\":1710331240,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n: Intermediate Assistant events omitted.\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710330641,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710330642,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710330641,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710330642,\"expires_at\":1710331240,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710330640,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710330641,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710330642,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: done\ndata: [DONE]\n\n" }, { "title": "Streaming with Functions", @@ -14391,7 +20513,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n]\n\nstream = client.beta.threads.runs.create(\n thread_id=\"thread_abc123\",\n assistant_id=\"asst_abc123\",\n tools=tools,\n stream=True\n)\n\nfor event in stream:\n print(event)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\"],\n },\n }\n }\n];\n\nasync function main() {\n const stream = await openai.beta.threads.runs.create(\n \"thread_abc123\",\n {\n assistant_id: \"asst_abc123\",\n tools: tools,\n stream: true\n }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" }, - "response": "event: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710348075,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710348077,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710348077,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710348075,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710348077,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" + "response": "event: thread.run.created\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":null,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710348075,\"expires_at\":1710348675,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"Hello\",\"annotations\":[]}}]}}\n\n: Intermediate Assistant events omitted.\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" today\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"?\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_001\",\"object\":\"thread.message\",\"created_at\":1710348076,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710348077,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"Hello! How can I assist you today?\",\"annotations\":[]}}],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710348076,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710348077,\"expires_at\":1710348675,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_001\"}},\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710348075,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710348075,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710348077,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: done\ndata: [DONE]\n\n" } ] } @@ -14403,7 +20525,8 @@ "tags": [ "Assistants" ], - "summary": "Retrieves a run.", + "summary": "Retrieve run", + "description": "Retrieves a run.", "parameters": [ { "in": "path", @@ -14440,7 +20563,6 @@ } }, "x-oaiMeta": { - "name": "Retrieve run", "group": "threads", "beta": true, "examples": { @@ -14449,7 +20571,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.retrieve(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.retrieve(\n \"run_abc123\",\n { thread_id: \"thread_abc123\" }\n );\n\n console.log(run);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant.\",\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\"\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true,\n \"required_action\": null\n}\n" } } }, @@ -14458,7 +20580,8 @@ "tags": [ "Assistants" ], - "summary": "Modifies a run.", + "summary": "Modify run", + "description": "Modifies a run.", "parameters": [ { "in": "path", @@ -14505,7 +20628,6 @@ } }, "x-oaiMeta": { - "name": "Modify run", "group": "threads", "beta": true, "examples": { @@ -14514,7 +20636,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.update(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\",\n metadata={\"user_id\": \"user_abc123\"},\n)\n\nprint(run)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.update(\n \"run_abc123\",\n {\n thread_id: \"thread_abc123\",\n metadata: {\n user_id: \"user_abc123\",\n },\n }\n );\n\n console.log(run);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {\n \"user_id\": \"user_abc123\"\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075072,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699075072,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699075073,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant.\",\n \"incomplete_details\": null,\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"tool_resources\": {\n \"code_interpreter\": {\n \"file_ids\": [\n \"file-abc123\",\n \"file-abc456\"\n ]\n }\n },\n \"metadata\": {\n \"user_id\": \"user_abc123\"\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\"\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true,\n \"required_action\": null\n}\n" } } } @@ -14525,7 +20647,8 @@ "tags": [ "Assistants" ], - "summary": "Cancels a run that is `in_progress`.", + "summary": "Cancel a run", + "description": "Cancels a run that is `in_progress`.", "parameters": [ { "in": "path", @@ -14562,7 +20685,6 @@ } }, "x-oaiMeta": { - "name": "Cancel a run", "group": "threads", "beta": true, "examples": { @@ -14571,7 +20693,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.cancel(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.cancel(\n \"run_abc123\",\n { thread_id: \"thread_abc123\" }\n );\n\n console.log(run);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699076126,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"cancelling\",\n \"started_at\": 1699076126,\n \"expires_at\": 1699076726,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You summarize books.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": [\"vs_123\"]\n }\n },\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + "response": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699076126,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"cancelling\",\n \"started_at\": 1699076126,\n \"expires_at\": 1699076726,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You summarize books.\",\n \"tools\": [\n {\n \"type\": \"file_search\"\n }\n ],\n \"tool_resources\": {\n \"file_search\": {\n \"vector_store_ids\": [\"vs_123\"]\n }\n },\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true,\n \"required_action\": null,\n \"incomplete_details\": null,\n \"max_prompt_tokens\": null,\n \"max_completion_tokens\": null,\n \"truncation_strategy\": {\n \"type\": \"auto\"\n }\n}\n" } } } @@ -14582,7 +20704,8 @@ "tags": [ "Assistants" ], - "summary": "Returns a list of run steps belonging to a run.", + "summary": "List run steps", + "description": "Returns a list of run steps belonging to a run.", "parameters": [ { "name": "thread_id", @@ -14672,7 +20795,6 @@ } }, "x-oaiMeta": { - "name": "List run steps", "group": "threads", "beta": true, "examples": { @@ -14681,7 +20803,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun_steps = client.beta.threads.runs.steps.list(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\"\n)\n\nprint(run_steps)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const runStep = await openai.beta.threads.runs.steps.list(\n \"run_abc123\",\n { thread_id: \"thread_abc123\" }\n );\n console.log(runStep);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n }\n ],\n \"first_id\": \"step_abc123\",\n \"last_id\": \"step_abc456\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"metadata\": {}\n }\n ],\n \"first_id\": \"step_abc123\",\n \"last_id\": \"step_abc123\",\n \"has_more\": false\n}\n" } } } @@ -14692,7 +20814,8 @@ "tags": [ "Assistants" ], - "summary": "Retrieves a run step.", + "summary": "Retrieve run step", + "description": "Retrieves a run step.", "parameters": [ { "in": "path", @@ -14752,7 +20875,6 @@ } }, "x-oaiMeta": { - "name": "Retrieve run step", "group": "threads", "beta": true, "examples": { @@ -14761,7 +20883,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun_step = client.beta.threads.runs.steps.retrieve(\n thread_id=\"thread_abc123\",\n run_id=\"run_abc123\",\n step_id=\"step_abc123\"\n)\n\nprint(run_step)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const runStep = await openai.beta.threads.runs.steps.retrieve(\n \"step_abc123\",\n { thread_id: \"thread_abc123\", run_id: \"run_abc123\" }\n );\n console.log(runStep);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n}\n" + "response": "{\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"metadata\": {}\n}\n" } } } @@ -14772,7 +20894,8 @@ "tags": [ "Assistants" ], - "summary": "When a run has the `status: \"requires_action\"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.\n", + "summary": "Submit tool outputs to run", + "description": "When a run has the `status: \"requires_action\"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.\n", "parameters": [ { "in": "path", @@ -14811,6 +20934,11 @@ "schema": { "$ref": "#/components/schemas/RunObject" } + }, + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/AssistantStreamEvent" + } } } }, @@ -14819,7 +20947,6 @@ } }, "x-oaiMeta": { - "name": "Submit tool outputs to run", "group": "threads", "beta": true, "examples": [ @@ -14830,7 +20957,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nrun = client.beta.threads.runs.submit_tool_outputs(\n thread_id=\"thread_123\",\n run_id=\"run_123\",\n tool_outputs=[\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ]\n)\n\nprint(run)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const run = await openai.beta.threads.runs.submitToolOutputs(\n \"run_123\",\n {\n thread_id: \"thread_123\",\n tool_outputs: [\n {\n tool_call_id: \"call_001\",\n output: \"70 degrees and sunny.\",\n },\n ],\n }\n );\n\n console.log(run);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"run_123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075592,\n \"assistant_id\": \"asst_123\",\n \"thread_id\": \"thread_123\",\n \"status\": \"queued\",\n \"started_at\": 1699075592,\n \"expires_at\": 1699076192,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" + "response": "{\n \"id\": \"run_123\",\n \"object\": \"thread.run\",\n \"created_at\": 1699075592,\n \"assistant_id\": \"asst_123\",\n \"thread_id\": \"thread_123\",\n \"status\": \"queued\",\n \"started_at\": 1699075592,\n \"expires_at\": 1699076192,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": null,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant.\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"metadata\": {},\n \"usage\": null,\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\"\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true,\n \"required_action\": null,\n \"incomplete_details\": null\n}\n" }, { "title": "Streaming", @@ -14839,7 +20966,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nstream = client.beta.threads.runs.submit_tool_outputs(\n thread_id=\"thread_123\",\n run_id=\"run_123\",\n tool_outputs=[\n {\n \"tool_call_id\": \"call_001\",\n \"output\": \"70 degrees and sunny.\"\n }\n ],\n stream=True\n)\n\nfor event in stream:\n print(event)\n", "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nasync function main() {\n const stream = await openai.beta.threads.runs.submitToolOutputs(\n \"run_123\",\n {\n thread_id: \"thread_123\",\n tool_outputs: [\n {\n tool_call_id: \"call_001\",\n output: \"70 degrees and sunny.\",\n },\n ],\n }\n );\n\n for await (const event of stream) {\n console.log(event);\n }\n}\n\nmain();\n" }, - "response": "event: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710352449,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710352475,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"id\":\"call_iWr0kQ2EaYMaxNdl0v3KYkx7\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"San Francisco, CA\\\",\\\"unit\\\":\\\"fahrenheit\\\"}\",\"output\":\"70 degrees and sunny.\"}}]},\"usage\":{\"prompt_tokens\":291,\"completion_tokens\":24,\"total_tokens\":315}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":1710352448,\"expires_at\":1710353047,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710352475,\"expires_at\":1710353047,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":null}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":null}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"The\",\"annotations\":[]}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" current\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" weather\"}}]}}\n\n...\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" sunny\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\".\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710352477,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"The current weather in San Francisco, CA is 70 degrees Fahrenheit and sunny.\",\"annotations\":[]}}],\"metadata\":{}}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710352477,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":{\"prompt_tokens\":329,\"completion_tokens\":18,\"total_tokens\":347}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710352475,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710352477,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-5\",\"instructions\":null,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\",\"last_messages\":null},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}}\n\nevent: done\ndata: [DONE]\n" + "response": "event: thread.run.step.completed\ndata: {\"id\":\"step_001\",\"object\":\"thread.run.step\",\"created_at\":1710352449,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"tool_calls\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710352475,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"tool_calls\",\"tool_calls\":[{\"id\":\"call_iWr0kQ2EaYMaxNdl0v3KYkx7\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"San Francisco, CA\\\",\\\"unit\\\":\\\"fahrenheit\\\"}\",\"output\":\"70 degrees and sunny.\"}}]},\"usage\":{\"prompt_tokens\":291,\"completion_tokens\":24,\"total_tokens\":315},\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.queued\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"queued\",\"started_at\":1710352448,\"expires_at\":1710353047,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.in_progress\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"in_progress\",\"started_at\":1710352475,\"expires_at\":1710353047,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":null,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":null,\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: thread.run.step.created\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.step.in_progress\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"in_progress\",\"cancelled_at\":null,\"completed_at\":null,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":null,\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.message.created\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.message.in_progress\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"in_progress\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":null,\"role\":\"assistant\",\"content\":[],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\"The\",\"annotations\":[]}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" current\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" weather\"}}]}}\n\n: Intermediate Assistant events omitted.\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\" sunny\"}}]}}\n\nevent: thread.message.delta\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message.delta\",\"delta\":{\"content\":[{\"index\":0,\"type\":\"text\",\"text\":{\"value\":\".\"}}]}}\n\nevent: thread.message.completed\ndata: {\"id\":\"msg_002\",\"object\":\"thread.message\",\"created_at\":1710352476,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"run_id\":\"run_123\",\"status\":\"completed\",\"incomplete_details\":null,\"incomplete_at\":null,\"completed_at\":1710352477,\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":{\"value\":\"The current weather in San Francisco, CA is 70 degrees Fahrenheit and sunny.\",\"annotations\":[]}}],\"metadata\":{},\"attachments\":[]}\n\nevent: thread.run.step.completed\ndata: {\"id\":\"step_002\",\"object\":\"thread.run.step\",\"created_at\":1710352476,\"run_id\":\"run_123\",\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"type\":\"message_creation\",\"status\":\"completed\",\"cancelled_at\":null,\"completed_at\":1710352477,\"expires_at\":1710353047,\"failed_at\":null,\"last_error\":null,\"step_details\":{\"type\":\"message_creation\",\"message_creation\":{\"message_id\":\"msg_002\"}},\"usage\":{\"prompt_tokens\":329,\"completion_tokens\":18,\"total_tokens\":347},\"expired_at\":null,\"metadata\":{}}\n\nevent: thread.run.completed\ndata: {\"id\":\"run_123\",\"object\":\"thread.run\",\"created_at\":1710352447,\"assistant_id\":\"asst_123\",\"thread_id\":\"thread_123\",\"status\":\"completed\",\"started_at\":1710352475,\"expires_at\":null,\"cancelled_at\":null,\"failed_at\":null,\"completed_at\":1710352477,\"required_action\":null,\"last_error\":null,\"model\":\"gpt-4.1\",\"instructions\":\"You are a helpful assistant.\",\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"description\":\"Get the current weather in a given location\",\"parameters\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"]}},\"required\":[\"location\"]}}}],\"metadata\":{},\"temperature\":1.0,\"top_p\":1.0,\"max_completion_tokens\":null,\"max_prompt_tokens\":null,\"truncation_strategy\":{\"type\":\"auto\"},\"incomplete_details\":null,\"usage\":{\"prompt_tokens\":20,\"completion_tokens\":11,\"total_tokens\":31},\"response_format\":\"auto\",\"tool_choice\":\"auto\",\"parallel_tool_calls\":true}\n\nevent: done\ndata: [DONE]\n\n" } ] } @@ -14851,7 +20978,8 @@ "tags": [ "Uploads" ], - "summary": "Creates an intermediate [Upload](https://developers.openai.com/api/reference/resources/uploads) object\nthat you can add [Parts](https://developers.openai.com/api/reference/resources/uploads/subresources/parts) to.\nCurrently, an Upload can accept at most 8 GB in total and expires after an\nhour after you create it.\n\nOnce you complete the Upload, we will create a\n[File](https://developers.openai.com/api/reference/resources/files) object that contains all the parts\nyou uploaded. This File is usable in the rest of our platform as a regular\nFile object.\n\nFor certain `purpose` values, the correct `mime_type` must be specified.\nPlease refer to documentation for the\n[supported MIME types for your use case](https://developers.openai.com/api/docs/guides/tools-file-search#supported-files).\n\nFor guidance on the proper filename extensions for each purpose, please\nfollow the documentation on [creating a\nFile](https://developers.openai.com/api/reference/resources/files/methods/create).\n\nReturns the Upload object with status `pending`.\n", + "summary": "Create upload", + "description": "Creates an intermediate [Upload](https://developers.openai.com/api/reference/resources/uploads) object\nthat you can add [Parts](https://developers.openai.com/api/reference/resources/uploads/subresources/parts) to.\nCurrently, an Upload can accept at most 8 GB in total and expires after an\nhour after you create it.\n\nOnce you complete the Upload, we will create a\n[File](https://developers.openai.com/api/reference/resources/files) object that contains all the parts\nyou uploaded. This File is usable in the rest of our platform as a regular\nFile object.\n\nFor certain `purpose` values, the correct `mime_type` must be specified.\nPlease refer to documentation for the\n[supported MIME types for your use case](https://developers.openai.com/api/docs/guides/tools-file-search#supported-files).\n\nFor guidance on the proper filename extensions for each purpose, please\nfollow the documentation on [creating a\nFile](https://developers.openai.com/api/reference/resources/files/methods/create).\n\nReturns the Upload object with status `pending`.\n", "requestBody": { "required": true, "content": { @@ -14872,10 +21000,29 @@ } } } + }, + "400": { + "description": "The upload request is invalid or exceeds a file size or storage quota limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many upload requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create upload", "group": "uploads", "examples": { "request": { @@ -14892,7 +21039,8 @@ "tags": [ "Uploads" ], - "summary": "Cancels the Upload. No Parts may be added after an Upload is cancelled.\n\nReturns the Upload object with status `cancelled`.\n", + "summary": "Cancel upload", + "description": "Cancels the Upload. No Parts may be added after an Upload is cancelled.\n\nReturns the Upload object with status `cancelled`.\n", "parameters": [ { "in": "path", @@ -14915,10 +21063,49 @@ } } } + }, + "400": { + "description": "The upload is no longer pending or is already being completed and cannot be cancelled.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The upload was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "410": { + "description": "The upload has expired. Create a new upload before adding parts or completing it.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many upload requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Cancel upload", "group": "uploads", "examples": { "request": { @@ -14935,7 +21122,8 @@ "tags": [ "Uploads" ], - "summary": "Completes the [Upload](https://developers.openai.com/api/reference/resources/uploads).\n\nWithin the returned Upload object, there is a nested [File](https://developers.openai.com/api/reference/resources/files) object that is ready to use in the rest of the platform.\n\nYou can specify the order of the Parts by passing in an ordered list of the Part IDs.\n\nThe number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.\nReturns the Upload object with status `completed`, including an additional `file` property containing the created usable File object.\n", + "summary": "Complete upload", + "description": "Completes the [Upload](https://developers.openai.com/api/reference/resources/uploads).\n\nWithin the returned Upload object, there is a nested [File](https://developers.openai.com/api/reference/resources/files) object that is ready to use in the rest of the platform.\n\nYou can specify the order of the Parts by passing in an ordered list of the Part IDs.\n\nThe number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.\nReturns the Upload object with status `completed`, including an additional `file` property containing the created usable File object.\n", "parameters": [ { "in": "path", @@ -14968,16 +21156,65 @@ } } } + }, + "400": { + "description": "The upload cannot be completed in its current state, the parts are invalid, or the uploaded size does not match the specified size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The upload was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "410": { + "description": "The upload has expired. Create a new upload before adding parts or completing it.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many upload requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The upload could not be completed. Retry the same request, preserving the part order and MD5 value.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Complete upload", "group": "uploads", "examples": { "request": { "curl": "curl https://api.openai.com/v1/uploads/upload_abc123/complete\n -d '{\n \"part_ids\": [\"part_def456\", \"part_ghi789\"]\n }'\n" }, - "response": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"completed\",\n \"expires_at\": 1719127296,\n \"file\": {\n \"id\": \"file-xyz321\",\n \"object\": \"file\",\n \"bytes\": 2147483648,\n \"created_at\": 1719186911,\n \"expires_at\": 1719127296,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n}\n" + "response": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"completed\",\n \"expires_at\": 1719127296,\n \"file\": {\n \"id\": \"file-xyz321\",\n \"object\": \"file\",\n \"bytes\": 2147483648,\n \"created_at\": 1719186911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"processed\"\n }\n}\n" } } } @@ -14988,7 +21225,8 @@ "tags": [ "Uploads" ], - "summary": "Adds a [Part](https://developers.openai.com/api/reference/resources/uploads/subresources/parts) to an [Upload](https://developers.openai.com/api/reference/resources/uploads) object. A Part represents a chunk of bytes from the file you are trying to upload.\n\nEach Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.\n\nIt is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](https://developers.openai.com/api/reference/resources/uploads/methods/complete).\n", + "summary": "Add upload part", + "description": "Adds a [Part](https://developers.openai.com/api/reference/resources/uploads/subresources/parts) to an [Upload](https://developers.openai.com/api/reference/resources/uploads) object. A Part represents a chunk of bytes from the file you are trying to upload.\n\nEach Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.\n\nIt is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](https://developers.openai.com/api/reference/resources/uploads/methods/complete).\n", "parameters": [ { "in": "path", @@ -15021,10 +21259,59 @@ } } } + }, + "400": { + "description": "The upload cannot accept more parts, or the part exceeds an upload size limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The upload was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "410": { + "description": "The upload has expired. Create a new upload before adding parts or completing it.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many upload requests. Reduce the request rate and try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "The part could not be uploaded. Try the request again.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Add upload part", "group": "uploads", "examples": { "request": { @@ -15041,7 +21328,8 @@ "tags": [ "Vector stores" ], - "summary": "Returns a list of vector stores.", + "summary": "List vector stores", + "description": "Returns a list of vector stores.", "parameters": [ { "name": "limit", @@ -15096,10 +21384,19 @@ }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "503": { + "description": "The vector store list is temporarily unavailable. Retry the request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "List vector stores", "group": "vector_stores", "examples": { "request": { @@ -15107,7 +21404,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_stores = client.vector_stores.list()\nprint(vector_stores)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStores = await openai.vectorStores.list();\n console.log(vectorStores);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n },\n {\n \"id\": \"vs_abc456\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ v2\",\n \"description\": null,\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n }\n ],\n \"first_id\": \"vs_abc123\",\n \"last_id\": \"vs_abc456\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n },\n \"usage_bytes\": 139920,\n \"status\": \"completed\",\n \"last_active_at\": null,\n \"metadata\": {}\n },\n {\n \"id\": \"vs_abc456\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ v2\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n },\n \"usage_bytes\": 139920,\n \"status\": \"completed\",\n \"last_active_at\": null,\n \"metadata\": {}\n }\n ],\n \"first_id\": \"vs_abc123\",\n \"last_id\": \"vs_abc456\",\n \"has_more\": false\n}\n" } } }, @@ -15116,7 +21413,8 @@ "tags": [ "Vector stores" ], - "summary": "Create a vector store.", + "summary": "Create vector store", + "description": "Create a vector store.", "requestBody": { "required": true, "content": { @@ -15138,12 +21436,31 @@ } } }, + "400": { + "description": "The vector store input, files or chunking configuration are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "A referenced input file was not found or is not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Create vector store", "group": "vector_stores", "examples": { "request": { @@ -15151,7 +21468,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.vector_stores.create(\n name=\"Support FAQ\"\n)\nprint(vector_store)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.create({\n name: \"Support FAQ\"\n });\n console.log(vectorStore);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n" + "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 0,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0\n },\n \"usage_bytes\": 0,\n \"status\": \"completed\",\n \"last_active_at\": null,\n \"metadata\": {}\n}\n" } } } @@ -15162,7 +21479,8 @@ "tags": [ "Vector stores" ], - "summary": "Retrieves a vector store.", + "summary": "Retrieve vector store", + "description": "Retrieves a vector store.", "parameters": [ { "in": "path", @@ -15185,12 +21503,21 @@ } } }, + "404": { + "description": "The vector store was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve vector store", "group": "vector_stores", "examples": { "request": { @@ -15198,7 +21525,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.vector_stores.retrieve(\n vector_store_id=\"vs_abc123\"\n)\nprint(vector_store)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.retrieve(\n \"vs_abc123\"\n );\n console.log(vectorStore);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776\n}\n" + "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n },\n \"usage_bytes\": 139920,\n \"status\": \"completed\",\n \"last_active_at\": null,\n \"metadata\": {}\n}\n" } } }, @@ -15207,7 +21534,8 @@ "tags": [ "Vector stores" ], - "summary": "Modifies a vector store.", + "summary": "Modify vector store", + "description": "Modifies a vector store.", "parameters": [ { "in": "path", @@ -15240,12 +21568,41 @@ } } }, + "400": { + "description": "The vector store input is invalid, the store has expired, or the store cannot be modified.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller is not authorized to update the vector store.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Modify vector store", "group": "vector_stores", "examples": { "request": { @@ -15253,7 +21610,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store = client.vector_stores.update(\n vector_store_id=\"vs_abc123\",\n name=\"Support FAQ\"\n)\nprint(vector_store)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.update(\n \"vs_abc123\",\n {\n name: \"Support FAQ\"\n }\n );\n console.log(vectorStore);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n" + "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n },\n \"usage_bytes\": 139920,\n \"status\": \"completed\",\n \"last_active_at\": null,\n \"metadata\": {}\n}\n" } } }, @@ -15262,7 +21619,8 @@ "tags": [ "Vector stores" ], - "summary": "Delete a vector store.", + "summary": "Delete vector store", + "description": "Delete a vector store.", "parameters": [ { "in": "path", @@ -15285,12 +21643,40 @@ } } }, + "404": { + "description": "The vector store was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The vector store is temporarily unavailable for this change or was modified concurrently.", + "headers": { + "Retry-After": { + "description": "When this change is blocked by a vector store migration, the number of seconds to wait before retrying. Other conflicts may omit this header.", + "schema": { + "type": "integer", + "minimum": 1 + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Delete vector store", "group": "vector_stores", "examples": { "request": { @@ -15298,7 +21684,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store = client.vector_stores.delete(\n vector_store_id=\"vs_abc123\"\n)\nprint(deleted_vector_store)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStore = await openai.vectorStores.delete(\n \"vs_abc123\"\n );\n console.log(deletedVectorStore);\n}\n\nmain();\n" }, - "response": "{\n id: \"vs_abc123\",\n object: \"vector_store.deleted\",\n deleted: true\n}\n" + "response": "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store.deleted\",\n \"deleted\": true\n}\n" } } } @@ -15309,8 +21695,8 @@ "tags": [ "Vector stores" ], - "summary": "Create a vector store file batch.", - "description": "The maximum number of files in a single batch request is 2000.\nVector store file attach requests are rate limited per vector store (300 requests per minute across both this endpoint and `/vector_stores/{vector_store_id}/files`).\nFor ingesting multiple files into the same vector store, this batch endpoint is recommended.\n", + "summary": "Create vector store file batch", + "description": "Create a vector store file batch.", "parameters": [ { "in": "path", @@ -15344,21 +21730,68 @@ } } }, + "400": { + "description": "The file batch input is invalid, the store has expired, or a file limit would be exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The vector store is temporarily unavailable for this change or was modified concurrently.", + "headers": { + "Retry-After": { + "description": "When this change is blocked by a vector store migration, the number of seconds to wait before retrying. Other conflicts may omit this header.", + "schema": { + "type": "integer", + "minimum": 1 + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The files could not be attached to the vector store.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create vector store file batch", "group": "vector_stores", - "description": "Attaches multiple files to a vector store in one request. This is the recommended approach for multi-file ingestion, especially because per-vector-store file attach writes are rate-limited (300 requests/minute shared with `/vector_stores/{vector_store_id}/files`).\n", "examples": { "request": { "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"files\": [\n {\n \"file_id\": \"file-abc123\",\n \"attributes\": {\"category\": \"finance\"}\n },\n {\n \"file_id\": \"file-abc456\",\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"max_chunk_size_tokens\": 1200,\n \"chunk_overlap_tokens\": 200\n }\n }\n ]\n }'\n", "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file_batch = client.vector_stores.file_batches.create(\n vector_store_id=\"vs_abc123\",\n files=[\n {\n \"file_id\": \"file-abc123\",\n \"attributes\": {\"category\": \"finance\"},\n },\n {\n \"file_id\": \"file-abc456\",\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"max_chunk_size_tokens\": 1200,\n \"chunk_overlap_tokens\": 200,\n },\n },\n ],\n)\nprint(vector_store_file_batch)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const myVectorStoreFileBatch = await openai.vectorStores.fileBatches.create(\n \"vs_abc123\",\n {\n files: [\n {\n file_id: \"file-abc123\",\n attributes: { category: \"finance\" },\n },\n {\n file_id: \"file-abc456\",\n chunking_strategy: {\n type: \"static\",\n max_chunk_size_tokens: 1200,\n chunk_overlap_tokens: 200,\n },\n },\n ]\n }\n );\n console.log(myVectorStoreFileBatch);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n" + "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0\n }\n}\n" } } } @@ -15369,7 +21802,8 @@ "tags": [ "Vector stores" ], - "summary": "Retrieves a vector store file batch.", + "summary": "Retrieve vector store file batch", + "description": "Retrieves a vector store file batch.", "parameters": [ { "in": "path", @@ -15403,12 +21837,31 @@ } } }, + "400": { + "description": "The file batch identifier is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store or file batch was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve vector store file batch", "group": "vector_stores", "examples": { "request": { @@ -15416,7 +21869,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file_batch = client.vector_stores.file_batches.retrieve(\n vector_store_id=\"vs_abc123\",\n batch_id=\"vsfb_abc123\"\n)\nprint(vector_store_file_batch)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFileBatch = await openai.vectorStores.fileBatches.retrieve(\n \"vsfb_abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(vectorStoreFileBatch);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n" + "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0\n }\n}\n" } } } @@ -15427,7 +21880,8 @@ "tags": [ "Vector stores" ], - "summary": "Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.", + "summary": "Cancel vector store file batch", + "description": "Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.", "parameters": [ { "in": "path", @@ -15459,12 +21913,50 @@ } } }, + "400": { + "description": "The file batch identifier is invalid or the vector store has expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store or file batch was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The vector store is temporarily unavailable for this change or was modified concurrently.", + "headers": { + "Retry-After": { + "description": "When this change is blocked by a vector store migration, the number of seconds to wait before retrying. Other conflicts may omit this header.", + "schema": { + "type": "integer", + "minimum": 1 + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Cancel vector store file batch", "group": "vector_stores", "examples": { "request": { @@ -15472,7 +21964,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store_file_batch = client.vector_stores.file_batches.cancel(\n vector_store_id=\"vs_abc123\",\n file_batch_id=\"vsfb_abc123\"\n)\nprint(deleted_vector_store_file_batch)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFileBatch = await openai.vectorStores.fileBatches.cancel(\n \"vsfb_abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(deletedVectorStoreFileBatch);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 12,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 15,\n }\n}\n" + "response": "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 12,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 15\n }\n}\n" } } } @@ -15483,7 +21975,8 @@ "tags": [ "Vector stores" ], - "summary": "Returns a list of vector store files in a batch.", + "summary": "List vector store files in a batch", + "description": "Returns a list of vector store files in a batch.", "parameters": [ { "name": "vector_store_id", @@ -15568,12 +22061,31 @@ } } }, + "400": { + "description": "The file batch identifier or file filter is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store or file batch was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List vector store files in a batch", "group": "vector_stores", "examples": { "request": { @@ -15581,7 +22093,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_files = client.vector_stores.file_batches.list_files(\n vector_store_id=\"vs_abc123\",\n batch_id=\"vsfb_abc123\"\n)\nprint(vector_store_files)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFiles = await openai.vectorStores.fileBatches.listFiles(\n \"vsfb_abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(vectorStoreFiles);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"usage_bytes\": 1234,\n \"status\": \"completed\",\n \"last_error\": null\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"usage_bytes\": 1234,\n \"status\": \"completed\",\n \"last_error\": null\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" } } } @@ -15592,7 +22104,8 @@ "tags": [ "Vector stores" ], - "summary": "Returns a list of vector store files.", + "summary": "List vector store files", + "description": "Returns a list of vector store files.", "parameters": [ { "name": "vector_store_id", @@ -15668,12 +22181,31 @@ } } }, + "400": { + "description": "The requested file filter is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "List vector store files", "group": "vector_stores", "examples": { "request": { @@ -15681,7 +22213,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_files = client.vector_stores.files.list(\n vector_store_id=\"vs_abc123\"\n)\nprint(vector_store_files)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFiles = await openai.vectorStores.files.list(\n \"vs_abc123\"\n );\n console.log(vectorStoreFiles);\n}\n\nmain();\n" }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"usage_bytes\": 1234,\n \"status\": \"completed\",\n \"last_error\": null\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"usage_bytes\": 1234,\n \"status\": \"completed\",\n \"last_error\": null\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" } } }, @@ -15690,8 +22222,8 @@ "tags": [ "Vector stores" ], - "summary": "Create a vector store file by attaching a [File](https://developers.openai.com/api/reference/resources/files) to a [vector store](https://developers.openai.com/api/reference/resources/vector_stores).", - "description": "This endpoint is subject to a per-vector-store write rate limit of 300 requests per minute, shared with `/vector_stores/{vector_store_id}/file_batches`.\nFor uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume.", + "summary": "Create vector store file", + "description": "Create a vector store file by attaching a [File](https://developers.openai.com/api/reference/resources/files) to a [vector store](https://developers.openai.com/api/reference/resources/vector_stores).", "parameters": [ { "in": "path", @@ -15725,14 +22257,61 @@ } } }, + "400": { + "description": "The file input is invalid, the store has expired, or a file limit would be exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The vector store is temporarily unavailable for this change or was modified concurrently.", + "headers": { + "Retry-After": { + "description": "When this change is blocked by a vector store migration, the number of seconds to wait before retrying. Other conflicts may omit this header.", + "schema": { + "type": "integer", + "minimum": 1 + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The file could not be attached to the vector store.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create vector store file", "group": "vector_stores", - "description": "Attaches one file to a vector store. File attach writes are rate-limited per vector store (300 requests/minute shared with `/vector_stores/{vector_store_id}/file_batches`), so use file batches when uploading multiple files.\n", "examples": { "request": { "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"file_id\": \"file-abc123\"\n }'\n", @@ -15750,7 +22329,8 @@ "tags": [ "Vector stores" ], - "summary": "Retrieves a vector store file.", + "summary": "Retrieve vector store file", + "description": "Retrieves a vector store file.", "parameters": [ { "in": "path", @@ -15784,12 +22364,31 @@ } } }, + "404": { + "description": "The vector store or file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The vector store file could not be retrieved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve vector store file", "group": "vector_stores", "examples": { "request": { @@ -15797,7 +22396,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\nvector_store_file = client.vector_stores.files.retrieve(\n vector_store_id=\"vs_abc123\",\n file_id=\"file-abc123\"\n)\nprint(vector_store_file)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFile = await openai.vectorStores.files.retrieve(\n \"file-abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(vectorStoreFile);\n}\n\nmain();\n" }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null\n}\n" + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"usage_bytes\": 1234\n}\n" } } }, @@ -15806,7 +22405,8 @@ "tags": [ "Vector stores" ], - "summary": "Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](https://developers.openai.com/api/reference/resources/files/methods/delete) endpoint.", + "summary": "Delete vector store file", + "description": "Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](https://developers.openai.com/api/reference/resources/files/methods/delete) endpoint.", "parameters": [ { "in": "path", @@ -15838,12 +22438,60 @@ } } }, + "400": { + "description": "The vector store has expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store or file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The vector store is temporarily unavailable for this change or was modified concurrently.", + "headers": { + "Retry-After": { + "description": "When this change is blocked by a vector store migration, the number of seconds to wait before retrying. Other conflicts may omit this header.", + "schema": { + "type": "integer", + "minimum": 1 + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The vector store file could not be deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Delete vector store file", "group": "vector_stores", "examples": { "request": { @@ -15851,7 +22499,7 @@ "python": "from openai import OpenAI\nclient = OpenAI()\n\ndeleted_vector_store_file = client.vector_stores.files.delete(\n vector_store_id=\"vs_abc123\",\n file_id=\"file-abc123\"\n)\nprint(deleted_vector_store_file)\n", "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFile = await openai.vectorStores.files.delete(\n \"file-abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(deletedVectorStoreFile);\n}\n\nmain();\n" }, - "response": "{\n id: \"file-abc123\",\n object: \"vector_store.file.deleted\",\n deleted: true\n}\n" + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file.deleted\",\n \"deleted\": true\n}\n" } } }, @@ -15860,7 +22508,8 @@ "tags": [ "Vector stores" ], - "summary": "Update attributes on a vector store file.", + "summary": "Update vector store file attributes", + "description": "Update attributes on a vector store file.", "parameters": [ { "in": "path", @@ -15904,18 +22553,66 @@ } } }, + "400": { + "description": "The file attributes are invalid or the vector store has expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store or file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "409": { + "description": "The vector store is temporarily unavailable for this change or was modified concurrently.", + "headers": { + "Retry-After": { + "description": "When this change is blocked by a vector store migration, the number of seconds to wait before retrying. Other conflicts may omit this header.", + "schema": { + "type": "integer", + "minimum": 1 + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The vector store file attributes could not be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update vector store file attributes", "group": "vector_stores", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/vector_stores/{vector_store_id}/files/{file_id} \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"attributes\": {\"key1\": \"value1\", \"key2\": 2}}'\n" + "curl": "curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"attributes\": {\"key1\": \"value1\", \"key2\": 2}}'\n" }, - "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"usage_bytes\": 1234,\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"chunking_strategy\": {...},\n \"attributes\": {\"key1\": \"value1\", \"key2\": 2}\n}\n" + "response": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"usage_bytes\": 1234,\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"static\": {\n \"max_chunk_size_tokens\": 800,\n \"chunk_overlap_tokens\": 400\n }\n },\n \"attributes\": {\"key1\": \"value1\", \"key2\": 2}\n}\n" } } } @@ -15926,7 +22623,8 @@ "tags": [ "Vector stores" ], - "summary": "Retrieve the parsed contents of a vector store file.", + "summary": "Retrieve vector store file content", + "description": "Retrieve the parsed contents of a vector store file.", "parameters": [ { "in": "path", @@ -15960,18 +22658,47 @@ } } }, + "400": { + "description": "The vector store has expired or the file content is not ready.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store or file was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The vector store file content could not be retrieved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Retrieve vector store file content", "group": "vector_stores", "examples": { "request": { "curl": "curl \\\nhttps://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123/content \\\n-H \"Authorization: Bearer $OPENAI_API_KEY\"\n" }, - "response": "{\n \"file_id\": \"file-abc123\",\n \"filename\": \"example.txt\",\n \"attributes\": {\"key\": \"value\"},\n \"content\": [\n {\"type\": \"text\", \"text\": \"...\"},\n ...\n ]\n}\n" + "response": "{\n \"object\": \"vector_store.file_content.page\",\n \"data\": [\n {\"type\": \"text\", \"text\": \"file content\"}\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" } } } @@ -15982,7 +22709,8 @@ "tags": [ "Vector stores" ], - "summary": "Search a vector store for relevant chunks based on a query and file attributes filter.", + "summary": "Search vector store", + "description": "Search a vector store for relevant chunks based on a query and file attributes filter.", "parameters": [ { "in": "path", @@ -16016,18 +22744,37 @@ } } }, + "400": { + "description": "The search input or filters are invalid, or the vector store has expired.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The vector store was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Search vector store", "group": "vector_stores", "examples": { "request": { "curl": "curl -X POST \\\nhttps://api.openai.com/v1/vector_stores/vs_abc123/search \\\n-H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\"query\": \"What is the return policy?\", \"filters\": {...}}'\n" }, - "response": "{\n \"object\": \"vector_store.search_results.page\",\n \"search_query\": \"What is the return policy?\",\n \"data\": [\n {\n \"file_id\": \"file_123\",\n \"filename\": \"document.pdf\",\n \"score\": 0.95,\n \"attributes\": {\n \"author\": \"John Doe\",\n \"date\": \"2023-01-01\"\n },\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Relevant chunk\"\n }\n ]\n },\n {\n \"file_id\": \"file_456\",\n \"filename\": \"notes.txt\",\n \"score\": 0.89,\n \"attributes\": {\n \"author\": \"Jane Smith\",\n \"date\": \"2023-01-02\"\n },\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Sample text content from the vector store.\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" + "response": "{\n \"object\": \"vector_store.search_results.page\",\n \"search_query\": [\"What is the return policy?\"],\n \"data\": [\n {\n \"file_id\": \"file_123\",\n \"filename\": \"document.pdf\",\n \"score\": 0.95,\n \"attributes\": {\n \"author\": \"John Doe\",\n \"date\": \"2023-01-01\"\n },\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Relevant chunk\"\n }\n ]\n },\n {\n \"file_id\": \"file_456\",\n \"filename\": \"notes.txt\",\n \"score\": 0.89,\n \"attributes\": {\n \"author\": \"Jane Smith\",\n \"date\": \"2023-01-02\"\n },\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Sample text content from the vector store.\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" } } } @@ -16037,7 +22784,8 @@ "tags": [ "Conversations" ], - "summary": "Create a conversation.", + "summary": "Create a conversation", + "description": "Create a conversation.", "operationId": "createConversation", "parameters": [], "requestBody": { @@ -16060,12 +22808,31 @@ } } }, + "400": { + "description": "The conversation input is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The conversation update could not be finalized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Create a conversation", "group": "conversations", "path": "create", "examples": { @@ -16085,7 +22852,8 @@ "tags": [ "Conversations" ], - "summary": "Get a conversation", + "summary": "Retrieve a conversation", + "description": "Get a conversation", "operationId": "getConversation", "parameters": [ { @@ -16110,12 +22878,21 @@ } } }, + "404": { + "description": "The conversation was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Retrieve a conversation", "group": "conversations", "path": "retrieve", "examples": { @@ -16133,7 +22910,8 @@ "tags": [ "Conversations" ], - "summary": "Delete a conversation. Items in the conversation will not be deleted.", + "summary": "Delete a conversation", + "description": "Delete a conversation. Items in the conversation will not be deleted.", "operationId": "deleteConversation", "parameters": [ { @@ -16158,12 +22936,21 @@ } } }, + "404": { + "description": "The conversation was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" } }, "x-oaiMeta": { - "name": "Delete a conversation", "group": "conversations", "path": "delete", "examples": { @@ -16182,6 +22969,7 @@ "Conversations" ], "summary": "Update a conversation", + "description": "Update a conversation", "operationId": "updateConversation", "parameters": [ { @@ -16215,12 +23003,41 @@ } } }, + "400": { + "description": "The conversation metadata is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The conversation was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The conversation update could not be finalized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "x-oaiMeta": { - "name": "Update a conversation", "group": "conversations", "path": "update", "examples": { @@ -16235,20 +23052,21 @@ } } }, - "/safety/alerts/{id}": { + "/safety/cases/{id}": { "get": { - "summary": "Get a safety alert belonging to the authenticated API project.", - "operationId": "Getprojectsafetyalert", + "summary": "Get safety case", + "description": "Get a safety case by ID.", + "operationId": "Getsafetycase", "parameters": [ { "name": "id", "in": "path", - "description": "Project safety alert ID", + "description": "Safety case ID", "required": true, "schema": { - "description": "Project safety alert ID", + "description": "Safety case ID", "type": "string", - "maxLength": 38 + "maxLength": 128 } } ], @@ -16258,110 +23076,153 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SafetyAlertResource" + "$ref": "#/components/schemas/SafetyCaseResource" + } + } + } + }, + "400": { + "description": "The safety case ID is too long.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The safety case was not found or is not accessible to the caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The safety case lookup failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "503": { + "description": "The safety case lookup is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Retrieve a safety alert", - "group": "safety-alerts", + "group": "safety-cases", "path": "retrieve", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/safety/alerts/alert_0123456789abcdef0123456789abcdef \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" + "curl": "curl https://api.openai.com/v1/safety/cases/C-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" }, - "response": "{\n \"id\": \"alert_0123456789abcdef0123456789abcdef\",\n \"object\": \"safety.alert\",\n \"created_at\": 1787659200,\n \"request_id\": \"req_123\",\n \"response_id\": \"resp_123\",\n \"model\": \"gpt-6-astra\",\n \"request_paused\": true,\n \"error_type\": \"potentially_unintended_data_access\",\n \"reason\": \"Potentially unintended data access.\"\n}\n" + "response": "{\n \"id\": \"C-abc123\",\n \"object\": \"safety.case\",\n \"created_at\": 1787659200,\n \"entity_identifier\": \"safety-id-123\",\n \"reason\": \"cyber_abuse\",\n \"notice\": {\"type\": \"warning\"}\n}\n" } } } }, - "/live/sessions/{session_id}/content": { + "/safety/alerts/{id}": { "get": { - "tags": [ - "Live" - ], - "summary": "Get Live session content", - "description": "Download stored session audio as stereo WAV: input left, output right.", - "operationId": "download-live-recording", + "summary": "Get project safety alert", + "description": "Get a safety alert belonging to the authenticated API project.", + "operationId": "Getprojectsafetyalert", "parameters": [ { - "name": "session_id", + "name": "id", "in": "path", - "description": "The ID of the stored Live session to download. Use the session ID returned when the session started with storage enabled.", + "description": "Project safety alert ID", "required": true, "schema": { - "description": "The ID of the stored Live session to download. Use the session ID returned when the session started with storage enabled.", + "description": "Project safety alert ID", "type": "string", - "pattern": "^live_[A-Za-z0-9_-]{1,128}$" + "maxLength": 38 } } ], "responses": { "200": { - "description": "Stored session recording. Input audio is in the left channel and output audio is in the right channel.", + "description": "Success", "content": { - "audio/wav": { + "application/json": { "schema": { - "description": "The Live session recording as a stereo WAV file, with input audio in the left channel and output audio in the right channel.", - "type": "string", - "format": "binary" + "$ref": "#/components/schemas/SafetyAlertResource" } } } - } - }, - "x-oaiMeta": { - "name": "Download recording", - "group": "live", - "returns": "The stored session recording as binary stereo WAV audio." - } - } - }, - "/organization/spend_limit": { - "get": { - "summary": "Get the organization's hard spend limit.", - "operationId": "Getorganizationspendlimit", - "parameters": [], - "responses": { - "200": { - "description": "Hard spend limit retrieved successfully.", + }, + "400": { + "description": "The safety alert ID is too long.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganizationSpendLimitResource" + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The safety alert was not found or is not accessible to the caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "503": { + "description": "The safety alert lookup is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Retrieve organization spend limit", - "group": "administration", + "group": "safety-alerts", + "path": "retrieve", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/organization/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + "curl": "curl https://api.openai.com/v1/safety/alerts/alert_0123456789abcdef0123456789abcdef \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n" }, - "response": "{\n \"object\": \"organization.spend_limit\",\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"enforcement\": {\n \"status\": \"enforcing\"\n }\n}\n" - } - }, - "security": [ - { - "AdminApiKeyAuth": [] + "response": "{\n \"id\": \"alert_0123456789abcdef0123456789abcdef\",\n \"object\": \"safety.alert\",\n \"created_at\": 1787659200,\n \"request_id\": \"req_123\",\n \"response_id\": \"resp_123\",\n \"model\": \"gpt-6-astra\",\n \"request_paused\": true,\n \"error_type\": \"potentially_unintended_data_access\",\n \"reason\": \"Potentially unintended data access.\"\n}\n" } - ] - }, + } + } + }, + "/organization/external_keys": { "post": { - "summary": "Create or replace the organization's hard spend limit.", - "operationId": "Updateorganizationspendlimit", + "summary": "Add an external key config for an organization", + "description": "Add an external key config for an organization", + "operationId": "Addanexternalkeyconfigforanorganization", "parameters": [], "requestBody": { - "description": "Parameters for the hard spend limit you want to create or replace.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateOrganizationSpendLimitBody" + "$ref": "#/components/schemas/V1OrganizationExternalKeysPostRequest" } } }, @@ -16369,58 +23230,82 @@ }, "responses": { "200": { - "description": "Hard spend limit created or replaced successfully.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganizationSpendLimitResource" + "$ref": "#/components/schemas/ExternalKeyResource" } } } } }, - "x-oaiMeta": { - "name": "Update organization spend limit", - "group": "administration", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\"\n }'\n" - }, - "response": "{\n \"object\": \"organization.spend_limit\",\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"enforcement\": {\n \"status\": \"enforcing\"\n }\n}\n" - } - }, "security": [ { "AdminApiKeyAuth": [] } ] }, - "delete": { - "summary": "Delete the organization's hard spend limit.", - "operationId": "Deleteorganizationspendlimit", - "parameters": [], + "get": { + "summary": "List the external key configs registered on the user's organization", + "description": "List the external key configs registered on the user's organization", + "operationId": "Listtheexternalkeyconfigsregisteredontheuser'sorganization", + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "maximum": 100 + } + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/OrderEnum" + } + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + { + "name": "purpose", + "in": "query", + "description": "Filter by key purpose. When omitted, returns keys of all purposes.", + "required": false, + "schema": { + "$ref": "#/components/schemas/ExternalKeyPurpose" + } + } + ], "responses": { "200": { - "description": "Hard spend limit deleted successfully.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganizationSpendLimitDeletedResource" + "$ref": "#/components/schemas/ListExternalKeysResource" } } } } }, - "x-oaiMeta": { - "name": "Delete organization spend limit", - "group": "administration", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/organization/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": "{\n \"object\": \"organization.spend_limit.deleted\",\n \"deleted\": true\n}\n" - } - }, "security": [ { "AdminApiKeyAuth": [] @@ -16428,44 +23313,33 @@ ] } }, - "/organization/projects/{project_id}/spend_limit": { + "/organization/external_keys/{external_key_id}": { "get": { - "summary": "Get a project's hard spend limit.", - "operationId": "Getprojectspendlimit", + "summary": "Retrieve an external key registration", + "description": "Retrieve a stored external key registration for the user's organization.", + "operationId": "Retrieveanexternalkeyregistration", "parameters": [ { - "name": "project_id", + "name": "external_key_id", "in": "path", - "description": "The ID of the project whose hard spend limit is being managed.", "required": true, "schema": { - "example": "proj_123", "type": "string" } } ], "responses": { "200": { - "description": "Hard spend limit retrieved successfully.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProjectSpendLimitResource" + "$ref": "#/components/schemas/ExternalKeyResource" } } } } }, - "x-oaiMeta": { - "name": "Retrieve project spend limit", - "group": "administration", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": "{\n \"object\": \"project.spend_limit\",\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"enforcement\": {\n \"status\": \"enforcing\"\n }\n}\n" - } - }, "security": [ { "AdminApiKeyAuth": [] @@ -16473,96 +23347,65 @@ ] }, "delete": { - "summary": "Delete a project's hard spend limit.", - "operationId": "Deleteprojectspendlimit", + "summary": "Delete an external key config for the user's organization", + "description": "Delete an external key config for the user's organization", + "operationId": "Deleteanexternalkeyconfigfortheuser'sorganization", "parameters": [ { - "name": "project_id", + "name": "external_key_id", "in": "path", - "description": "The ID of the project whose hard spend limit is being managed.", "required": true, "schema": { - "example": "proj_123", "type": "string" } } ], "responses": { "200": { - "description": "Hard spend limit deleted successfully.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProjectSpendLimitDeletedResource" + "$ref": "#/components/schemas/ExternalKeyResource" } } } } }, - "x-oaiMeta": { - "name": "Delete project spend limit", - "group": "administration", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" - }, - "response": "{\n \"object\": \"project.spend_limit.deleted\",\n \"deleted\": true\n}\n" - } - }, "security": [ { "AdminApiKeyAuth": [] } ] - }, + } + }, + "/organization/external_keys/{external_key_id}/validate": { "post": { - "summary": "Create or replace a project's hard spend limit.", - "operationId": "Updateprojectspendlimit", + "summary": "Validate an external key config for the user's organization", + "description": "Validate an external key config for the user's organization", + "operationId": "Validateanexternalkeyconfigfortheuser'sorganization", "parameters": [ { - "name": "project_id", + "name": "external_key_id", "in": "path", - "description": "The ID of the project whose hard spend limit is being managed.", "required": true, "schema": { - "example": "proj_123", "type": "string" } } ], - "requestBody": { - "description": "Parameters for the hard spend limit you want to create or replace.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateProjectSpendLimitBody" - } - } - }, - "required": true - }, "responses": { "200": { - "description": "Hard spend limit created or replaced successfully.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProjectSpendLimitResource" + "$ref": "#/components/schemas/ValidateExternalKeyResource" } } } } }, - "x-oaiMeta": { - "name": "Update project spend limit", - "group": "administration", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\"\n }'\n" - }, - "response": "{\n \"object\": \"project.spend_limit\",\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"enforcement\": {\n \"status\": \"enforcing\"\n }\n}\n" - } - }, "security": [ { "AdminApiKeyAuth": [] @@ -16570,200 +23413,147 @@ ] } }, - "/organization/projects/{project_id}/service_accounts/{service_account_id}/api_keys": { - "post": { - "summary": "Creates an API key for a service account in the project.", - "operationId": "CreateanAPIkeyforaserviceaccount", + "/live/sessions/{session_id}/content": { + "get": { + "tags": [ + "Live" + ], + "summary": "Download recording", + "description": "Get Live session content", + "operationId": "download-live-recording", "parameters": [ { - "name": "project_id", - "in": "path", - "description": "The ID of the project.", - "required": true, - "schema": { - "description": "The ID of the project.", - "type": "string" - } - }, - { - "name": "service_account_id", + "name": "session_id", "in": "path", - "description": "The ID of the service account.", + "description": "The ID of the stored Live session to download. Use the session ID returned when the session started with storage enabled.", "required": true, "schema": { - "description": "The ID of the service account.", - "type": "string" + "description": "The ID of the stored Live session to download. Use the session ID returned when the session started with storage enabled.", + "type": "string", + "pattern": "^live_[A-Za-z0-9_-]{1,128}$" } } ], - "requestBody": { - "description": "The service account API key create request payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateProjectServiceAccountApiKeyBody" - } - } - } - }, "responses": { "200": { - "description": "Service account API key created successfully.", + "description": "Stored session recording. Input audio is in the left channel and output audio is in the right channel.", + "content": { + "audio/wav": { + "schema": { + "description": "The Live session recording as a stereo WAV file, with input audio in the left channel and output audio in the right channel.", + "type": "string", + "format": "binary" + } + } + } + }, + "400": { + "description": "Invalid Live session ID.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ServiceAccountApiKeyBody" + "$ref": "#/components/schemas/ErrorResponse" } } } - } - }, - "x-oaiMeta": { - "name": "Create project service account API key", - "group": "administration", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc/api_keys \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Production App\",\n \"scopes\": [\"api.responses.write\"]\n }'\n" - }, - "response": "{\n \"object\": \"organization.project.service_account.api_key\",\n \"value\": \"sk-abcdefghijklmnop123\",\n \"name\": \"Production App\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\"\n}\n" - } - }, - "security": [ - { - "AdminApiKeyAuth": [] - } - ] - } - }, - "/content_provenance_checks": { - "post": { - "summary": "Check whether an image or audio file contains known OpenAI provenance signals. [Learn more about content provenance](https://developers.openai.com/api/docs/guides/content-provenance).\n\nIf `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect.", - "operationId": "Createcontentprovenancecheck", - "parameters": [], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateContentProvenanceBody" - } - } - } - }, - "responses": { - "200": { - "description": "Success", + }, + "404": { + "description": "The endpoint is unavailable or the stored session recording was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProvenanceResource" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "Create content provenance check", - "group": "content_provenance_checks", - "examples": [] - } - } - }, - "/videos": { - "post": { - "tags": [ - "Videos" - ], - "summary": "Create a new video generation job from a prompt and optional reference assets.", - "operationId": "createVideo", - "parameters": [], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateVideoMultipartBody" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVideoJsonBody" - } - } - } - }, - "responses": { - "200": { - "description": "Success", + }, + "500": { + "description": "The stored session audio could not be exported.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VideoResource" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "429": { - "$ref": "#/components/responses/InferenceRateLimited" - }, "503": { - "$ref": "#/components/responses/InferenceServiceUnavailable" + "description": "The audio export is temporarily unavailable.", + "headers": { + "Retry-After": { + "description": "The minimum number of seconds to wait before retrying.", + "schema": { + "type": "integer", + "minimum": 1 + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, - "deprecated": true, "x-oaiMeta": { - "name": "Create video", - "group": "videos", - "path": "create", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/videos \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F \"model=sora-2\" \\\n -F \"prompt=A calico cat playing a piano on stage\"\n", - "javascript": "import OpenAI from 'openai';\n\nconst openai = new OpenAI();\n\nconst video = await openai.videos.create({ prompt: 'A calico cat playing a piano on stage' });\n\nconsole.log(video.id);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nvideo = client.videos.create(\n prompt=\"A calico cat playing a piano on stage\",\n)\nprint(video.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n video, err := client.Videos.New(context.TODO(), openai.VideoNewParams{\n Prompt: \"A calico cat playing a piano on stage\",\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", video.ID)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nvideo = openai.videos.create(prompt: \"A calico cat playing a piano on stage\")\n\nputs(video)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoCreateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoCreateParams params = VideoCreateParams.builder()\n .prompt(\"A calico cat playing a piano on stage\")\n .build();\n Video video = client.videos().create(params);\n }\n}\n" - }, - "response": "{\n \"id\": \"video_123\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"queued\",\n \"progress\": 0,\n \"created_at\": 1712697600,\n \"size\": \"1024x1792\",\n \"seconds\": \"8\",\n \"quality\": \"standard\"\n}\n" - } + "group": "live", + "returns": "The stored session recording as binary stereo WAV audio." } - }, + } + }, + "/organization/workload_identity_providers": { "get": { - "tags": [ - "Videos" - ], - "summary": "List recently generated videos for the current project.", - "operationId": "ListVideos", + "summary": "List Platform workload identity providers", + "description": "List OIDC providers in the authenticated Admin API key's organization.", + "operationId": "ListPlatformworkloadidentityproviders", "parameters": [ { "name": "limit", "in": "query", - "description": "Number of items to retrieve", "required": false, "schema": { "type": "integer", - "minimum": 0, + "minimum": 1, "maximum": 100 } }, { "name": "order", "in": "query", - "description": "Sort order of results by timestamp. Use `asc` for ascending order or `desc` for descending order.", "required": false, "schema": { - "$ref": "#/components/schemas/OrderEnum" + "oneOf": [ + { + "default": "asc", + "x-stainless-const": true, + "type": "string", + "enum": [ + "asc" + ] + }, + { + "default": "desc", + "x-stainless-const": true, + "type": "string", + "enum": [ + "desc" + ] + } + ] } }, { "name": "after", "in": "query", - "description": "Identifier for the last item from the previous pagination request", "required": false, "schema": { - "description": "Identifier for the last item from the previous pagination request", - "type": "string" + "type": "string", + "minLength": 1 } } ], @@ -16773,44 +23563,37 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VideoListResource" + "$ref": "#/components/schemas/PlatformProviderListResource" } } } } }, - "deprecated": true, "x-oaiMeta": { - "name": "List videos", - "group": "videos", - "path": "list for the organization.", + "group": "administration", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/videos \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from 'openai';\n\nconst openai = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const video of openai.videos.list()) {\n console.log(video.id);\n}\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\npage = client.videos.list()\npage = page.data[0]\nprint(page.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n page, err := client.Videos.List(context.TODO(), openai.VideoListParams{\n\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", page)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\npage = openai.videos.list\n\nputs(page)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.VideoListPage;\nimport com.openai.models.videos.VideoListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoListPage page = client.videos().list();\n }\n}\n" + "curl": "curl -X GET \"https://api.openai.com/v1/organization/workload_identity_providers?limit=20&order=asc\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" }, - "response": "{\n \"data\": [\n {\n \"id\": \"video_123\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"completed\"\n }\n ],\n \"object\": \"list\"\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.workload_identity_provider\",\n \"id\": \"wip_example\",\n \"type\": \"oidc\",\n \"name\": \"CI provider\",\n \"issuer\": \"https://issuer.example.com\",\n \"audience\": \"openai\",\n \"verification\": {\n \"type\": \"discovery\",\n \"discovery_url\": null\n },\n \"description\": null,\n \"attribute_transformations\": [],\n \"enabled\": true,\n \"created_at\": 1793664000,\n \"updated_at\": 1793664000\n }\n ],\n \"first_id\": \"wip_example\",\n \"last_id\": \"wip_example\",\n \"has_more\": false\n}\n" } - } - } - }, - "/videos/characters": { + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, "post": { - "tags": [ - "Videos" - ], - "summary": "Create a character from an uploaded video.", - "operationId": "CreateVideoCharacter", + "summary": "Create Platform workload identity provider", + "description": "Register an OIDC provider for keyless project service-account authentication.", + "operationId": "CreatePlatformworkloadidentityprovider", "parameters": [], "requestBody": { "content": { - "multipart/form-data": { + "application/json": { "schema": { - "$ref": "#/components/schemas/CreateVideoCharacterBody" + "$ref": "#/components/schemas/CreatePlatformWorkloadIdentityProviderBody" } } } @@ -16821,31 +23604,41 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VideoCharacterResource" + "$ref": "#/components/schemas/PlatformProvider" } } } } }, - "deprecated": true + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl -X POST \"https://api.openai.com/v1/organization/workload_identity_providers\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"CI provider\",\n \"type\": \"oidc\",\n \"issuer\": \"https://issuer.example.com\",\n \"audience\": \"openai\"\n}'\n" + }, + "response": "{\n \"object\": \"organization.workload_identity_provider\",\n \"id\": \"wip_example\",\n \"type\": \"oidc\",\n \"name\": \"CI provider\",\n \"issuer\": \"https://issuer.example.com\",\n \"audience\": \"openai\",\n \"verification\": {\n \"type\": \"discovery\",\n \"discovery_url\": null\n },\n \"description\": null,\n \"attribute_transformations\": [],\n \"enabled\": true,\n \"created_at\": 1793664000,\n \"updated_at\": 1793664000\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] } }, - "/videos/characters/{character_id}": { + "/organization/workload_identity_providers/{workload_identity_provider_id}": { "get": { - "tags": [ - "Videos" - ], - "summary": "Fetch a character.", - "operationId": "GetVideoCharacter", + "summary": "Retrieve Platform workload identity provider", + "description": "Retrieve an OIDC provider in the authenticated organization.", + "operationId": "RetrievePlatformworkloadidentityprovider", "parameters": [ { - "name": "character_id", + "name": "workload_identity_provider_id", "in": "path", - "description": "The identifier of the character to retrieve.", "required": true, "schema": { - "example": "char_123", - "type": "string" + "type": "string", + "minLength": 1 } } ], @@ -16855,33 +23648,47 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VideoCharacterResource" + "$ref": "#/components/schemas/PlatformProvider" } } } } }, - "deprecated": true - } - }, - "/videos/edits": { + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl -X GET \"https://api.openai.com/v1/organization/workload_identity_providers/wip_example\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" + }, + "response": "{\n \"object\": \"organization.workload_identity_provider\",\n \"id\": \"wip_example\",\n \"type\": \"oidc\",\n \"name\": \"CI provider\",\n \"issuer\": \"https://issuer.example.com\",\n \"audience\": \"openai\",\n \"verification\": {\n \"type\": \"discovery\",\n \"discovery_url\": null\n },\n \"description\": null,\n \"attribute_transformations\": [],\n \"enabled\": true,\n \"created_at\": 1793664000,\n \"updated_at\": 1793664000\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, "post": { - "tags": [ - "Videos" + "summary": "Update Platform workload identity provider", + "description": "Update supplied provider fields, preserving omitted fields.", + "operationId": "UpdatePlatformworkloadidentityprovider", + "parameters": [ + { + "name": "workload_identity_provider_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 1 + } + } ], - "summary": "Create a new video generation job by editing a source video or existing generated video.", - "operationId": "CreateVideoEdit", - "parameters": [], "requestBody": { "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateVideoEditMultipartBody" - } - }, "application/json": { "schema": { - "$ref": "#/components/schemas/CreateVideoEditJsonBody" + "$ref": "#/components/schemas/UpdatePlatformWorkloadIdentityProviderBody" } } } @@ -16892,80 +23699,136 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VideoResource" + "$ref": "#/components/schemas/PlatformProvider" } } } - }, - "429": { - "$ref": "#/components/responses/InferenceRateLimited" - }, - "503": { - "$ref": "#/components/responses/InferenceServiceUnavailable" } }, - "deprecated": true - } - }, - "/videos/extensions": { - "post": { - "tags": [ - "Videos" - ], - "summary": "Create an extension of a completed video.", - "operationId": "CreateVideoExtend", - "parameters": [], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateVideoExtendMultipartBody" - } + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl -X POST \"https://api.openai.com/v1/organization/workload_identity_providers/wip_example\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"enabled\": false\n}'\n" }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVideoExtendJsonBody" - } - } + "response": "{\n \"object\": \"organization.workload_identity_provider\",\n \"id\": \"wip_example\",\n \"type\": \"oidc\",\n \"name\": \"CI provider\",\n \"issuer\": \"https://issuer.example.com\",\n \"audience\": \"openai\",\n \"verification\": {\n \"type\": \"discovery\",\n \"discovery_url\": null\n },\n \"description\": null,\n \"attribute_transformations\": [],\n \"enabled\": false,\n \"created_at\": 1793664000,\n \"updated_at\": 1793664000\n}\n" } }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, + "delete": { + "summary": "Delete Platform workload identity provider", + "description": "Delete a provider after deleting all its federation rules.", + "operationId": "DeletePlatformworkloadidentityprovider", + "parameters": [ + { + "name": "workload_identity_provider_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 1 + } + } + ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VideoResource" + "$ref": "#/components/schemas/PlatformProviderDeletedResource" } } } - }, - "429": { - "$ref": "#/components/responses/InferenceRateLimited" - }, - "503": { - "$ref": "#/components/responses/InferenceServiceUnavailable" } }, - "deprecated": true + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl -X DELETE \"https://api.openai.com/v1/organization/workload_identity_providers/wip_example\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" + }, + "response": "{\n \"object\": \"organization.workload_identity_provider.deleted\",\n \"id\": \"wip_example\",\n \"deleted\": true\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] } }, - "/videos/{video_id}": { + "/organization/workload_identity_providers/{workload_identity_provider_id}/federation_rules": { "get": { - "tags": [ - "Videos" - ], - "summary": "Fetch the latest metadata for a generated video.", - "operationId": "GetVideo", + "summary": "List Platform workload identity federation rules", + "description": "List the provider's federation rules to project service accounts.", + "operationId": "ListPlatformworkloadidentityfederationrules", "parameters": [ { - "name": "video_id", + "name": "workload_identity_provider_id", "in": "path", - "description": "The identifier of the video to retrieve.", "required": true, "schema": { - "example": "video_123", - "type": "string" + "type": "string", + "minLength": 1 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "oneOf": [ + { + "default": "asc", + "x-stainless-const": true, + "type": "string", + "enum": [ + "asc" + ] + }, + { + "default": "desc", + "x-stainless-const": true, + "type": "string", + "enum": [ + "desc" + ] + } + ] + } + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 + } + }, + { + "name": "service_account_id", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 } } ], @@ -16975,176 +23838,160 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VideoResource" + "$ref": "#/components/schemas/PlatformFederationRuleListResource" } } } } }, - "deprecated": true, "x-oaiMeta": { - "name": "Retrieve video", - "group": "videos", - "path": "retrieve matching the provided identifier.", + "group": "administration", "examples": { - "response": "", "request": { - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst video = await client.videos.retrieve('video_123');\n\nconsole.log(video.id);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nvideo = client.videos.retrieve(\n \"video_123\",\n)\nprint(video.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n video, err := client.Videos.Get(context.TODO(), \"video_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", video.ID)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nvideo = openai.videos.retrieve(\"video_123\")\n\nputs(video)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n Video video = client.videos().retrieve(\"video_123\");\n }\n}\n" - } + "curl": "curl -X GET \"https://api.openai.com/v1/organization/workload_identity_providers/wip_example/federation_rules?limit=20&order=asc\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.workload_identity_federation_rule\",\n \"id\": \"wifr_example\",\n \"workload_identity_provider_id\": \"wip_example\",\n \"project_id\": \"proj_example\",\n \"service_account_id\": \"svc_acct_example\",\n \"name\": null,\n \"description\": null,\n \"attribute_matchers\": {\n \"sub\": \"ci:release\"\n },\n \"permissions\": {\n \"type\": \"service_account_default\"\n },\n \"enabled\": true,\n \"created_at\": 1793664000,\n \"updated_at\": 1793664000\n }\n ],\n \"first_id\": \"wifr_example\",\n \"last_id\": \"wifr_example\",\n \"has_more\": false\n}\n" } - } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] }, - "delete": { - "tags": [ - "Videos" - ], - "summary": "Permanently delete a completed or failed video and its stored assets.", - "operationId": "DeleteVideo", + "post": { + "summary": "Create Platform workload identity federation rule", + "description": "Bind verified token attributes to an existing project service account.", + "operationId": "CreatePlatformworkloadidentityfederationrule", "parameters": [ { - "name": "video_id", + "name": "workload_identity_provider_id", "in": "path", - "description": "The identifier of the video to delete.", "required": true, "schema": { - "example": "video_123", - "type": "string" + "type": "string", + "minLength": 1 } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreatePlatformWorkloadIdentityFederationRuleBody" + } + } + } + }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedVideoResource" + "$ref": "#/components/schemas/PlatformFederationRule" } } } } }, - "deprecated": true, "x-oaiMeta": { - "name": "Delete video", - "group": "videos", - "path": "delete", + "group": "administration", "examples": { - "response": "", "request": { - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst video = await client.videos.delete('video_123');\n\nconsole.log(video.id);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nvideo = client.videos.delete(\n \"video_123\",\n)\nprint(video.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n video, err := client.Videos.Delete(context.TODO(), \"video_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", video.ID)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nvideo = openai.videos.delete(\"video_123\")\n\nputs(video)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.VideoDeleteParams;\nimport com.openai.models.videos.VideoDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoDeleteResponse video = client.videos().delete(\"video_123\");\n }\n}\n" - } + "curl": "curl -X POST \"https://api.openai.com/v1/organization/workload_identity_providers/wip_example/federation_rules\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"project_id\": \"proj_example\",\n \"service_account_id\": \"svc_acct_example\",\n \"attribute_matchers\": {\n \"sub\": \"ci:release\"\n }\n}'\n" + }, + "response": "{\n \"object\": \"organization.workload_identity_federation_rule\",\n \"id\": \"wifr_example\",\n \"workload_identity_provider_id\": \"wip_example\",\n \"project_id\": \"proj_example\",\n \"service_account_id\": \"svc_acct_example\",\n \"name\": null,\n \"description\": null,\n \"attribute_matchers\": {\n \"sub\": \"ci:release\"\n },\n \"permissions\": {\n \"type\": \"service_account_default\"\n },\n \"enabled\": true,\n \"created_at\": 1793664000,\n \"updated_at\": 1793664000\n}\n" } - } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] } }, - "/videos/{video_id}/content": { + "/organization/workload_identity_providers/{workload_identity_provider_id}/federation_rules/{workload_identity_federation_rule_id}": { "get": { - "tags": [ - "Videos" - ], - "summary": "Download the generated video bytes or a derived preview asset.\n\nStreams the rendered video content for the specified video job.", - "operationId": "RetrieveVideoContent", + "summary": "Retrieve Platform workload identity federation rule", + "description": "Retrieve a federation rule owned by the authenticated organization and provider.", + "operationId": "RetrievePlatformworkloadidentityfederationrule", "parameters": [ { - "name": "video_id", + "name": "workload_identity_provider_id", "in": "path", - "description": "The identifier of the video whose media to download.", "required": true, "schema": { - "example": "video_123", - "type": "string" + "type": "string", + "minLength": 1 } }, { - "name": "variant", - "in": "query", - "description": "Which downloadable asset to return. Defaults to the MP4 video.", - "required": false, + "name": "workload_identity_federation_rule_id", + "in": "path", + "required": true, "schema": { - "$ref": "#/components/schemas/VideoContentVariant" + "type": "string", + "minLength": 1 } } ], "responses": { "200": { - "description": "The video bytes or preview asset that matches the requested variant.", + "description": "Success", "content": { - "video/mp4": { - "schema": { - "type": "string", - "format": "binary" - } - }, - "image/webp": { - "schema": { - "type": "string", - "format": "binary" - } - }, "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/PlatformFederationRule" } } } } }, - "deprecated": true, "x-oaiMeta": { - "name": "Retrieve video content", - "group": "videos", - "path": "content", + "group": "administration", "examples": { - "response": "", "request": { - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst response = await client.videos.downloadContent('video_123');\n\nconsole.log(response);\n\nconst content = await response.blob();\nconsole.log(content);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nresponse = client.videos.download_content(\n video_id=\"video_123\",\n)\nprint(response)\ncontent = response.read()\nprint(content)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n response, err := client.Videos.DownloadContent(\n context.TODO(),\n \"video_123\",\n openai.VideoDownloadContentParams{\n\n },\n )\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", response)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nresponse = openai.videos.download_content(\"video_123\")\n\nputs(response)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.core.http.HttpResponse;\nimport com.openai.models.videos.VideoDownloadContentParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n HttpResponse response = client.videos().downloadContent(\"video_123\");\n }\n}\n" - } + "curl": "curl -X GET \"https://api.openai.com/v1/organization/workload_identity_providers/wip_example/federation_rules/wifr_example\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" + }, + "response": "{\n \"object\": \"organization.workload_identity_federation_rule\",\n \"id\": \"wifr_example\",\n \"workload_identity_provider_id\": \"wip_example\",\n \"project_id\": \"proj_example\",\n \"service_account_id\": \"svc_acct_example\",\n \"name\": null,\n \"description\": null,\n \"attribute_matchers\": {\n \"sub\": \"ci:release\"\n },\n \"permissions\": {\n \"type\": \"service_account_default\"\n },\n \"enabled\": true,\n \"created_at\": 1793664000,\n \"updated_at\": 1793664000\n}\n" } - } - } - }, - "/videos/{video_id}/remix": { + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, "post": { - "tags": [ - "Videos" - ], - "summary": "Create a remix of a completed video using a refreshed prompt.", - "operationId": "CreateVideoRemix", + "summary": "Update Platform workload identity federation rule", + "description": "Update supplied matcher, permission, metadata, or enabled fields.", + "operationId": "UpdatePlatformworkloadidentityfederationrule", "parameters": [ { - "name": "video_id", + "name": "workload_identity_provider_id", "in": "path", - "description": "The identifier of the completed video to remix.", "required": true, "schema": { - "example": "video_123", - "type": "string" + "type": "string", + "minLength": 1 + } + }, + { + "name": "workload_identity_federation_rule_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 1 } } ], "requestBody": { "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateVideoRemixBody" - } - }, "application/json": { "schema": { - "$ref": "#/components/schemas/CreateVideoRemixBody" + "$ref": "#/components/schemas/UpdatePlatformWorkloadIdentityFederationRuleBody" } } } @@ -17155,417 +24002,328 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VideoResource" + "$ref": "#/components/schemas/PlatformFederationRule" } } } - }, - "429": { - "$ref": "#/components/responses/InferenceRateLimited" - }, - "503": { - "$ref": "#/components/responses/InferenceServiceUnavailable" } }, - "deprecated": true, "x-oaiMeta": { - "name": "Remix video", - "group": "videos", - "path": "remix using the provided prompt.", + "group": "administration", "examples": { "request": { - "curl": "curl -X POST https://api.openai.com/v1/videos/video_123/remix \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"prompt\": \"Extend the scene with the cat taking a bow to the cheering audience\"\n }'\n", - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst video = await client.videos.remix('video_123', { prompt: 'Extend the scene with the cat taking a bow to the cheering audience' });\n\nconsole.log(video.id);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nvideo = client.videos.remix(\n video_id=\"video_123\",\n prompt=\"Extend the scene with the cat taking a bow to the cheering audience\",\n)\nprint(video.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n video, err := client.Videos.Remix(\n context.TODO(),\n \"video_123\",\n openai.VideoRemixParams{\n Prompt: \"Extend the scene with the cat taking a bow to the cheering audience\",\n },\n )\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", video.ID)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nvideo = openai.videos.remix(\"video_123\", prompt: \"Extend the scene with the cat taking a bow to the cheering audience\")\n\nputs(video)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoRemixParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoRemixParams params = VideoRemixParams.builder()\n .videoId(\"video_123\")\n .prompt(\"Extend the scene with the cat taking a bow to the cheering audience\")\n .build();\n Video video = client.videos().remix(params);\n }\n}\n" + "curl": "curl -X POST \"https://api.openai.com/v1/organization/workload_identity_providers/wip_example/federation_rules/wifr_example\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"enabled\": false\n}'\n" }, - "response": "{\n \"id\": \"video_456\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"queued\",\n \"progress\": 0,\n \"created_at\": 1712698600,\n \"size\": \"720x1280\",\n \"seconds\": \"8\",\n \"remixed_from_video_id\": \"video_123\"\n}\n" - } - } - } - }, - "/responses/input_tokens": { - "post": { - "summary": "Returns input token counts of the request.\n\nReturns an object with `object` set to `response.input_tokens` and an `input_tokens` count.", - "operationId": "Getinputtokencounts", - "parameters": [], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TokenCountsBody" - } - } + "response": "{\n \"object\": \"organization.workload_identity_federation_rule\",\n \"id\": \"wifr_example\",\n \"workload_identity_provider_id\": \"wip_example\",\n \"project_id\": \"proj_example\",\n \"service_account_id\": \"svc_acct_example\",\n \"name\": null,\n \"description\": null,\n \"attribute_matchers\": {\n \"sub\": \"ci:release\"\n },\n \"permissions\": {\n \"type\": \"service_account_default\"\n },\n \"enabled\": false,\n \"created_at\": 1793664000,\n \"updated_at\": 1793664000\n}\n" } }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TokenCountsResource" - } - } + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, + "delete": { + "summary": "Delete Platform workload identity federation rule", + "description": "Delete a federation rule to a project service account.", + "operationId": "DeletePlatformworkloadidentityfederationrule", + "parameters": [ + { + "name": "workload_identity_provider_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 1 } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "Get input token counts", - "group": "responses", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/responses/input_tokens \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"Tell me a joke.\"\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst client = new OpenAI();\n\nconst response = await client.responses.inputTokens.count({\n model: \"gpt-6-astra\",\n input: \"Tell me a joke.\",\n});\n\nconsole.log(response.input_tokens);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.input_tokens.count(\n model=\"gpt-6-astra\",\n input=\"Tell me a joke.\"\n)\nprint(response.input_tokens)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n client := openai.NewClient()\n response, err := client.Responses.InputTokens.Count(context.TODO(), responses.InputTokenCountParams{\n Model: \"gpt-6-astra\",\n Input: \"Tell me a joke.\",\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", response.InputTokens)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.input_tokens.count(model: \"gpt-6-astra\", input: \"Tell me a joke.\")\n\nputs(response)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.responses.inputtokens.InputTokenCountParams;\nimport com.openai.models.responses.inputtokens.InputTokenCountResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n InputTokenCountParams params = InputTokenCountParams.builder()\n .model(\"gpt-6-astra\")\n .input(\"Tell me a joke.\")\n .build();\n\n InputTokenCountResponse response = client.responses().inputTokens().count(params);\n }\n}\n" - }, - "response": "{\n \"object\": \"response.input_tokens\",\n \"input_tokens\": 11\n}\n" - } - } - } - }, - "/responses/compact": { - "post": { - "summary": "Compact a conversation. Returns a compacted response object.\n\nLearn when and how to compact long-running conversations in the [conversation state guide](https://developers.openai.com/api/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](https://developers.openai.com/api/docs/guides/conversation-state#compaction-advanced).", - "operationId": "Compactconversation", - "parameters": [], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CompactResponseMethodPublicBody" - } + { + "name": "workload_identity_federation_rule_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 1 } } - }, + ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CompactResource" + "$ref": "#/components/schemas/PlatformFederationRuleDeletedResource" } } } - }, - "429": { - "$ref": "#/components/responses/InferenceRateLimited" - }, - "503": { - "$ref": "#/components/responses/InferenceServiceUnavailable" } }, "x-oaiMeta": { - "name": "Compact a response", - "group": "responses", + "group": "administration", "examples": { "request": { - "curl": "curl -X POST https://api.openai.com/v1/responses/compact \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Create a simple landing page for a dog petting café.\"\n },\n {\n \"id\": \"msg_001\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Below is a single file, ready-to-use landing page for a dog petting café:...\"\n }\n ],\n \"role\": \"assistant\"\n }\n ]\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\n// Compact the previous response if you are running out of tokens\nconst compactedResponse = await openai.responses.compact({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: \"Create a simple landing page for a dog petting café.\",\n },\n // All items returned from previous requests are included here, like reasoning, message, function call, etc.\n {\n id: \"msg_030d085c0b53e67e0069332e3a72d4819c96c6f2c4adc15d33\",\n type: \"message\",\n status: \"completed\",\n content: [\n {\n type: \"output_text\",\n annotations: [],\n logprobs: [],\n text: \"Below is a single file, ready-to-use landing page for a dog petting café:...\",\n },\n ],\n role: \"assistant\",\n },\n ],\n});\n\n// Pass the compactedResponse.output as input to the next request\nconsole.log(compactedResponse);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\ncompacted_response = client.responses.compact(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": \"Create a simple landing page for a dog petting cafe.\",\n },\n # All items returned from previous requests are included here, like reasoning, message, function call, etc.\n {\n \"id\": \"msg_001\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Below is a single file, ready-to-use landing page for a dog petting café:...\",\n },\n ],\n \"role\": \"assistant\",\n },\n ]\n)\n# Pass the compacted_response.output as input to the next request\nprint(compacted_response)\n" + "curl": "curl -X DELETE \"https://api.openai.com/v1/organization/workload_identity_providers/wip_example/federation_rules/wifr_example\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" }, - "response": "{\n \"id\": \"resp_001\",\n \"object\": \"response.compaction\",\n \"created_at\": 1764967971,\n \"output\": [\n {\n \"id\": \"msg_000\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Create a simple landing page for a dog petting cafe.\"\n }\n ],\n \"role\": \"user\"\n },\n {\n \"id\": \"cmp_001\",\n \"type\": \"compaction\",\n \"encrypted_content\": \"gAAAAABpM0Yj-...=\"\n }\n ],\n \"usage\": {\n \"input_tokens\": 139,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 438,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 64\n },\n \"total_tokens\": 577\n }\n}\n" + "response": "{\n \"object\": \"organization.workload_identity_federation_rule.deleted\",\n \"id\": \"wifr_example\",\n \"deleted\": true\n}\n" } - } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] } }, - "/skills": { - "post": { - "tags": [ - "Skills" - ], - "summary": "Create a new skill.", - "operationId": "CreateSkill", - "parameters": [], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateSkillBody" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateSkillBody" - } + "/organization/usage/decisions": { + "get": { + "summary": "Decisions", + "description": "Get Decisions API usage details for the organization.", + "operationId": "OrganizationDecisionsusage", + "parameters": [ + { + "name": "start_time", + "in": "query", + "description": "Start time (Unix seconds) of the query time range, inclusive.", + "required": true, + "schema": { + "type": "integer" } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SkillResource" + }, + { + "name": "end_time", + "in": "query", + "description": "End time (Unix seconds) of the query time range, exclusive.", + "required": false, + "schema": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" } - } + ] } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - }, - "get": { - "tags": [ - "Skills" - ], - "summary": "List all skills for the current project.", - "operationId": "ListSkills", - "parameters": [ { - "name": "limit", + "name": "bucket_width", "in": "query", - "description": "Number of items to retrieve", + "description": "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.", "required": false, "schema": { - "type": "integer", - "minimum": 0, - "maximum": 100 + "anyOf": [ + { + "description": "Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.", + "oneOf": [ + { + "$ref": "#/components/schemas/DecisionsUsageBucketWidth" + } + ] + }, + { + "type": "null" + } + ] } }, { - "name": "order", + "name": "limit", "in": "query", - "description": "Sort order of results by timestamp. Use `asc` for ascending order or `desc` for descending order.", + "description": "Specifies the number of buckets to return.\n- `bucket_width=1d`: default: 7, max: 31\n- `bucket_width=1h`: default: 24, max: 168\n- `bucket_width=1m`: default: 60, max: 1440", "required": false, "schema": { - "$ref": "#/components/schemas/OrderEnum" + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] } }, { - "name": "after", + "name": "page", "in": "query", - "description": "Identifier for the last item from the previous pagination request", + "description": "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.", "required": false, "schema": { - "description": "Identifier for the last item from the previous pagination request", - "type": "string" + "anyOf": [ + { + "description": "A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.", + "type": "string" + }, + { + "type": "null" + } + ] } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SkillListResource" + }, + { + "name": "project_ids", + "in": "query", + "description": "Return only usage for these projects.", + "required": false, + "schema": { + "anyOf": [ + { + "description": "Return only usage for these projects.", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "type": "null" } - } + ] } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - } - }, - "/skills/{skill_id}": { - "delete": { - "tags": [ - "Skills" - ], - "summary": "Delete a skill by its ID.", - "operationId": "DeleteSkill", - "parameters": [ { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill to delete.", - "required": true, + "name": "group_by", + "in": "query", + "description": "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`, `api_source` or any combination of them. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null.", + "required": false, "schema": { - "example": "skill_123", - "type": "string" + "anyOf": [ + { + "description": "Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`, `api_source` or any combination of them. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null.", + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/DecisionsUsageGroupBy" + } + } + ] + }, + { + "type": "null" + } + ] } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeletedSkillResource" + }, + { + "name": "user_ids", + "in": "query", + "description": "Return only usage for these users.", + "required": false, + "schema": { + "anyOf": [ + { + "description": "Return only usage for these users.", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "type": "null" } - } + ] } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - }, - "get": { - "tags": [ - "Skills" - ], - "summary": "Get a skill by its ID.", - "operationId": "GetSkill", - "parameters": [ { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill to retrieve.", - "required": true, + "name": "api_key_ids", + "in": "query", + "description": "Return only usage for these API keys.", + "required": false, "schema": { - "example": "skill_123", - "type": "string" + "anyOf": [ + { + "description": "Return only usage for these API keys.", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "type": "null" + } + ] } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SkillResource" + }, + { + "name": "models", + "in": "query", + "description": "Return only usage for these models.", + "required": false, + "schema": { + "anyOf": [ + { + "description": "Return only usage for these models.", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "type": "null" } - } + ] } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - }, - "post": { - "tags": [ - "Skills" - ], - "summary": "Update the default version pointer for a skill.", - "operationId": "UpdateSkillDefaultVersion", - "parameters": [ { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill.", - "required": true, + "name": "batch", + "in": "query", + "description": "If `true`, return batch jobs only. If `false`, return non-batch jobs only. By default, return both.", + "required": false, "schema": { - "example": "skill_123", - "type": "string" + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetDefaultSkillVersionBody" - } - } - } - }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SkillResource" + "$ref": "#/components/schemas/PublicDecisionsUsageResponseResource" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - } - }, - "/skills/{skill_id}/content": { - "get": { - "tags": [ - "Skills" - ], - "summary": "Download a skill zip bundle by its ID.", - "operationId": "GetSkillContent", - "parameters": [ - { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill to download.", - "required": true, - "schema": { - "example": "skill_123", - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "The skill zip bundle.", + "400": { + "description": "The request parameters are invalid or the requested operation cannot be performed.", "content": { - "application/zip": { - "schema": { - "type": "string", - "format": "binary" - } - }, "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/DecisionsUsageErrorResponse" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - } - }, - "/skills/{skill_id}/versions": { - "post": { - "tags": [ - "Skills" - ], - "summary": "Create a new immutable skill version.", - "operationId": "CreateSkillVersion", - "parameters": [ - { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill to version.", - "required": true, - "schema": { - "example": "skill_123", - "type": "string" - } - } - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateSkillVersionBody" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateSkillVersionBody" - } - } - } - }, - "responses": { - "200": { - "description": "Success", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SkillVersionResource" + "$ref": "#/components/schemas/DecisionsUsagePermissionErrorResponse" } } } @@ -17573,53 +24331,78 @@ "429": { "$ref": "#/components/responses/TooManyRequests" } - } - }, + }, + "x-oaiMeta": { + "group": "usage-decisions", + "examples": { + "request": { + "curl": "curl --get \"https://api.openai.com/v1/organization/usage/decisions\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n --data-urlencode \"start_time=1790812800\" \\\n --data-urlencode \"end_time=1790899200\" \\\n --data-urlencode \"bucket_width=1d\" \\\n --data-urlencode \"group_by=project_id\" \\\n --data-urlencode \"group_by=model\"\n" + }, + "response": "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1790812800,\n \"end_time\": 1790899200,\n \"results\": [\n {\n \"object\": \"organization.usage.decisions.result\",\n \"input_tokens\": 1000,\n \"input_cached_tokens\": 400,\n \"output_tokens\": 0,\n \"num_model_requests\": 5,\n \"project_id\": \"proj_example\",\n \"model\": \"gpt-6-luna\",\n \"user_id\": null,\n \"api_key_id\": null,\n \"batch\": null,\n \"service_tier\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + } + }, + "/organization/external_storage": { "get": { - "tags": [ - "Skills" - ], - "summary": "List skill versions for a skill.", - "operationId": "ListSkillVersions", + "summary": "List external storage configurations", + "description": "List the organization's customer-managed external storage configurations.", + "operationId": "Listexternalstorageconfigurations", "parameters": [ { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill.", - "required": true, + "name": "project_id", + "in": "query", + "required": false, "schema": { - "example": "skill_123", - "type": "string" + "anyOf": [ + { + "example": "proj_123", + "type": "string" + }, + { + "type": "null" + } + ] } }, { - "name": "limit", + "name": "after", "in": "query", - "description": "Number of versions to retrieve.", + "description": "Return external storage configurations after this ID.", "required": false, "schema": { - "type": "integer", - "minimum": 0, - "maximum": 100 + "anyOf": [ + { + "description": "Return external storage configurations after this ID.", + "type": "string" + }, + { + "type": "null" + } + ] } }, { "name": "order", "in": "query", - "description": "Sort order of results by version number.", "required": false, "schema": { - "$ref": "#/components/schemas/OrderEnum" + "$ref": "#/components/schemas/ExternalStorageOrder" } }, { - "name": "after", + "name": "limit", "in": "query", - "description": "The skill version ID to start after.", "required": false, "schema": { - "example": "skillver_123", - "type": "string" + "type": "integer", + "minimum": 1, + "maximum": 100 } } ], @@ -17629,219 +24412,71 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SkillVersionListResource" + "$ref": "#/components/schemas/ExternalStorageListResource" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - } - }, - "/skills/{skill_id}/versions/{version}": { - "get": { - "tags": [ - "Skills" - ], - "summary": "Get a specific skill version.", - "operationId": "GetSkillVersion", - "parameters": [ - { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill.", - "required": true, - "schema": { - "example": "skill_123", - "type": "string" - } - }, - { - "name": "version", - "in": "path", - "description": "The version number to retrieve.", - "required": true, - "schema": { - "description": "The version number to retrieve.", - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SkillVersionResource" - } - } - } - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - }, - "delete": { - "tags": [ - "Skills" - ], - "summary": "Delete a skill version.", - "operationId": "DeleteSkillVersion", - "parameters": [ - { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill.", - "required": true, - "schema": { - "example": "skill_123", - "type": "string" - } - }, - { - "name": "version", - "in": "path", - "description": "The skill version number.", - "required": true, - "schema": { - "description": "The skill version number.", - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", + "400": { + "description": "The organization is not enabled for external storage or the listing parameters are invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedSkillVersionResource" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - } - }, - "/skills/{skill_id}/versions/{version}/content": { - "get": { - "tags": [ - "Skills" - ], - "summary": "Download a skill version zip bundle.", - "operationId": "GetSkillVersionContent", - "parameters": [ - { - "name": "skill_id", - "in": "path", - "description": "The identifier of the skill.", - "required": true, - "schema": { - "example": "skill_123", - "type": "string" - } - }, - { - "name": "version", - "in": "path", - "description": "The skill version number.", - "required": true, - "schema": { - "description": "The skill version number.", - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "The skill zip bundle.", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { - "application/zip": { - "schema": { - "type": "string", - "format": "binary" - } - }, "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - } - } - }, - "/chatkit/sessions/{session_id}/cancel": { - "post": { - "summary": "Cancel an active ChatKit session and return its most recent metadata.\n\nCancelling prevents new requests from using the issued client secret.", - "operationId": "CancelChatSessionMethod", - "parameters": [ - { - "name": "session_id", - "in": "path", - "description": "Unique identifier for the ChatKit session to cancel.", - "required": true, - "schema": { - "example": "cksess_123", - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", + "404": { + "description": "The organization or project was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChatSessionResource" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Cancel chat session", - "group": "chatkit", - "beta": true, - "path": "cancel-session new requests from using the issued client secret.", + "group": "administration", "examples": { "request": { - "curl": "curl -X POST \\\n https://api.openai.com/v1/chatkit/sessions/cksess_123/cancel \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst chatSession = await client.beta.chatkit.sessions.cancel('cksess_123');\n\nconsole.log(chatSession.id);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nchat_session = client.beta.chatkit.sessions.cancel(\n \"cksess_123\",\n)\nprint(chat_session.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n client := openai.NewClient()\n chatSession, err := client.Beta.ChatKit.Sessions.Cancel(context.TODO(), \"cksess_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nchat_session = openai.beta.chatkit.sessions.cancel(\"cksess_123\")\n\nputs(chat_session)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.sessions.SessionCancelParams;\nimport com.openai.models.beta.chatkit.threads.ChatSession;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ChatSession chatSession = client.beta().chatkit().sessions().cancel(\"cksess_123\");\n }\n}\n" + "curl": "curl \"https://api.openai.com/v1/organization/external_storage?limit=20&order=desc\" \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"id\": \"cksess_123\",\n \"object\": \"chatkit.session\",\n \"workflow\": {\n \"id\": \"workflow_alpha\",\n \"version\": \"1\"\n },\n \"scope\": {\n \"customer_id\": \"cust_456\"\n },\n \"max_requests_per_1_minute\": 30,\n \"ttl_seconds\": 900,\n \"status\": \"cancelled\",\n \"cancelled_at\": 1712345678\n}\n" + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_abc123\",\n \"project_id\": \"proj_abc123\",\n \"provider\": {\n \"type\": \"aws\",\n \"account_id\": \"123456789012\",\n \"region\": \"us-east-1\",\n \"bucket\": \"customer-logs\",\n \"role_arn\": \"arn:aws:iam::123456789012:role/OpenAIExternalStorageRole\",\n \"external_id\": \"proj_abc123\"\n },\n \"geography\": \"US\",\n \"status\": \"validated\",\n \"created_at\": 1711471533\n },\n {\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_azure123\",\n \"project_id\": \"proj_azure123\",\n \"provider\": {\n \"type\": \"azure\",\n \"tenant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"subscription_id\": \"22222222-2222-2222-2222-222222222222\",\n \"resource_group\": \"customer-rg\",\n \"account_name\": \"customerstorage\",\n \"container\": \"openai-data\",\n \"region\": \"eastus\"\n },\n \"geography\": \"US\",\n \"status\": \"validated\",\n \"created_at\": 1711471500\n },\n {\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_gcp123\",\n \"project_id\": \"proj_gcp123\",\n \"provider\": {\n \"type\": \"gcp\",\n \"bucket\": \"customer-gcp-retention\",\n \"workload_identity_project_number\": \"123456789012\",\n \"workload_identity_pool_id\": \"customer-pool\",\n \"workload_identity_provider_id\": \"customer-provider\",\n \"region\": \"us-central1\",\n \"audience\": \"proj_gcp123\"\n },\n \"geography\": \"US\",\n \"status\": \"validated\",\n \"created_at\": 1711471400\n },\n {\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_oci123\",\n \"project_id\": \"proj_oci123\",\n \"provider\": {\n \"type\": \"oci\",\n \"tenancy_ocid\": \"ocid1.tenancy.oc1..example\",\n \"region\": \"us-ashburn-1\",\n \"bucket\": \"customer-oci-retention\"\n },\n \"geography\": \"US\",\n \"status\": \"validated\",\n \"created_at\": 1711471300\n }\n ],\n \"first_id\": \"extstorage_abc123\",\n \"last_id\": \"extstorage_oci123\",\n \"has_more\": false\n}\n" } - } - } - }, - "/chatkit/sessions": { + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, "post": { - "summary": "Create a ChatKit session.", - "operationId": "CreateChatSessionMethod", + "summary": "Create an external storage configuration", + "description": "Register one customer-managed external storage configuration.", + "operationId": "Createanexternalstorageconfiguration", "parameters": [], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateChatSessionBody" + "$ref": "#/components/schemas/CreateExternalStorageBody" } } - } + }, + "required": true }, "responses": { "200": { @@ -17849,130 +24484,104 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChatSessionResource" + "$ref": "#/components/schemas/ExternalStorageResponse" } } } - } - }, - "x-oaiMeta": { - "name": "Create ChatKit session", - "group": "chatkit", - "beta": true, - "path": "sessions/create object.", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/chatkit/sessions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -d '{\n \"workflow\": {\n \"id\": \"workflow_alpha\",\n \"version\": \"2024-10-01\"\n },\n \"scope\": {\n \"project\": \"alpha\",\n \"environment\": \"staging\"\n },\n \"expires_after\": 1800,\n \"max_requests_per_1_minute\": 60,\n \"max_requests_per_session\": 500\n }'\n", - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst chatSession = await client.beta.chatkit.sessions.create({ user: 'user', workflow: { id: 'id' } });\n\nconsole.log(chatSession.id);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nchat_session = client.beta.chatkit.sessions.create(\n user=\"user\",\n workflow={\n \"id\": \"id\"\n },\n)\nprint(chat_session.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n client := openai.NewClient()\n chatSession, err := client.Beta.ChatKit.Sessions.New(context.TODO(), openai.BetaChatKitSessionNewParams{\n User: \"user\",\n Workflow: openai.ChatSessionWorkflowParam{\n ID: \"id\",\n },\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nchat_session = openai.beta.chatkit.sessions.create(user: \"user\", workflow: {id: \"id\"})\n\nputs(chat_session)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.sessions.SessionCreateParams;\nimport com.openai.models.beta.chatkit.threads.ChatSession;\nimport com.openai.models.beta.chatkit.threads.ChatSessionWorkflowParam;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n SessionCreateParams params = SessionCreateParams.builder()\n .user(\"user\")\n .workflow(ChatSessionWorkflowParam.builder()\n .id(\"id\")\n .build())\n .build();\n ChatSession chatSession = client.beta().chatkit().sessions().create(params);\n }\n}\n" - }, - "response": "{\n \"client_secret\": \"chatkit_token_123\",\n \"expires_at\": 1735689600,\n \"workflow\": {\n \"id\": \"workflow_alpha\",\n \"version\": \"2024-10-01\"\n },\n \"scope\": {\n \"project\": \"alpha\",\n \"environment\": \"staging\"\n },\n \"max_requests_per_1_minute\": 60,\n \"max_requests_per_session\": 500,\n \"status\": \"active\"\n}\n" - } - } - } - }, - "/chatkit/threads/{thread_id}/items": { - "get": { - "summary": "List items that belong to a ChatKit thread.", - "operationId": "ListThreadItemsMethod", - "parameters": [ - { - "name": "thread_id", - "in": "path", - "description": "Identifier of the ChatKit thread whose items are requested.", - "required": true, - "schema": { - "example": "cthr_123", - "type": "string" - } }, - { - "name": "limit", - "in": "query", - "description": "Maximum number of thread items to return. Defaults to 20.", - "required": false, - "schema": { - "type": "integer", - "minimum": 0, - "maximum": 100 + "400": { + "description": "The external storage request is invalid or the organization or project does not support it.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, - { - "name": "order", - "in": "query", - "description": "Sort order for results by creation time. Defaults to `desc`.", - "required": false, - "schema": { - "$ref": "#/components/schemas/OrderEnum" + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, - { - "name": "after", - "in": "query", - "description": "List items created after this thread item ID. Defaults to null for the first page.", - "required": false, - "schema": { - "description": "List items created after this thread item ID. Defaults to null for the first page.", - "type": "string" + "404": { + "description": "The organization, project, or external storage was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, - { - "name": "before", - "in": "query", - "description": "List items created before this thread item ID. Defaults to null for the newest results.", - "required": false, - "schema": { - "description": "List items created before this thread item ID. Defaults to null for the newest results.", - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", + "503": { + "description": "External storage registration is temporarily unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ThreadItemListResource" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "List ChatKit thread items", - "group": "chatkit", - "beta": true, - "path": "threads/list-items for the specified thread.", - "examples": { - "request": { - "curl": "curl \"https://api.openai.com/v1/chatkit/threads/cthr_abc123/items?limit=3\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const thread of client.beta.chatkit.threads.listItems('cthr_123')) {\n console.log(thread);\n}\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\npage = client.beta.chatkit.threads.list_items(\n thread_id=\"cthr_123\",\n)\npage = page.data[0]\nprint(page)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n client := openai.NewClient()\n page, err := client.Beta.ChatKit.Threads.ListItems(\n context.TODO(),\n \"cthr_123\",\n openai.BetaChatKitThreadListItemsParams{\n\n },\n )\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", page)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\npage = openai.beta.chatkit.threads.list_items(\"cthr_123\")\n\nputs(page)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadListItemsPage;\nimport com.openai.models.beta.chatkit.threads.ThreadListItemsParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadListItemsPage page = client.beta().chatkit().threads().listItems(\"cthr_123\");\n }\n}\n" + "group": "administration", + "examples": [ + { + "title": "AWS S3", + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/external_storage \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"project_id\": \"proj_abc123\",\n \"provider\": {\n \"type\": \"aws\",\n \"bucket\": \"customer-logs\",\n \"role_arn\": \"arn:aws:iam::123456789012:role/OpenAIExternalStorageRole\"\n }\n }'\n" + }, + "response": "{\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_abc123\",\n \"project_id\": \"proj_abc123\",\n \"provider\": {\n \"type\": \"aws\",\n \"account_id\": \"123456789012\",\n \"region\": \"us-east-1\",\n \"bucket\": \"customer-logs\",\n \"role_arn\": \"arn:aws:iam::123456789012:role/OpenAIExternalStorageRole\",\n \"external_id\": \"proj_abc123\"\n },\n \"geography\": \"US\",\n \"status\": \"pending\",\n \"created_at\": 1711471533\n}\n" + }, + { + "title": "Azure Blob Storage", + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/external_storage \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"project_id\": \"proj_azure123\",\n \"provider\": {\n \"type\": \"azure\",\n \"tenant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"subscription_id\": \"22222222-2222-2222-2222-222222222222\",\n \"resource_group\": \"customer-rg\",\n \"account_name\": \"customerstorage\",\n \"container\": \"openai-data\"\n }\n }'\n" + }, + "response": "{\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_azure123\",\n \"project_id\": \"proj_azure123\",\n \"provider\": {\n \"type\": \"azure\",\n \"tenant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"subscription_id\": \"22222222-2222-2222-2222-222222222222\",\n \"resource_group\": \"customer-rg\",\n \"account_name\": \"customerstorage\",\n \"container\": \"openai-data\",\n \"region\": \"eastus\"\n },\n \"geography\": \"US\",\n \"status\": \"pending\",\n \"created_at\": 1711471533\n}\n" + }, + { + "title": "Google Cloud Storage", + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/external_storage \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"project_id\": \"proj_gcp123\",\n \"provider\": {\n \"type\": \"gcp\",\n \"bucket\": \"customer-gcp-retention\",\n \"workload_identity_project_number\": \"123456789012\",\n \"workload_identity_pool_id\": \"customer-pool\",\n \"workload_identity_provider_id\": \"customer-provider\"\n }\n }'\n" + }, + "response": "{\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_gcp123\",\n \"project_id\": \"proj_gcp123\",\n \"provider\": {\n \"type\": \"gcp\",\n \"bucket\": \"customer-gcp-retention\",\n \"workload_identity_project_number\": \"123456789012\",\n \"workload_identity_pool_id\": \"customer-pool\",\n \"workload_identity_provider_id\": \"customer-provider\",\n \"region\": \"us-central1\",\n \"audience\": \"proj_gcp123\"\n },\n \"geography\": \"US\",\n \"status\": \"pending\",\n \"created_at\": 1711471400\n}\n" }, - "response": "{\n \"data\": [\n {\n \"id\": \"cthi_user_001\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"user_message\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"I need help debugging an onboarding issue.\"\n }\n ],\n \"attachments\": []\n },\n {\n \"id\": \"cthi_assistant_002\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"assistant_message\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Let's start by confirming the workflow version you deployed.\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"object\": \"list\"\n}\n" + { + "title": "OCI Object Storage", + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/external_storage \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"project_id\": \"proj_oci123\",\n \"provider\": {\n \"type\": \"oci\",\n \"tenancy_ocid\": \"ocid1.tenancy.oc1..example\",\n \"region\": \"us-ashburn-1\",\n \"bucket\": \"customer-oci-retention\"\n }\n }'\n" + }, + "response": "{\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_oci123\",\n \"project_id\": \"proj_oci123\",\n \"provider\": {\n \"type\": \"oci\",\n \"tenancy_ocid\": \"ocid1.tenancy.oc1..example\",\n \"region\": \"us-ashburn-1\",\n \"bucket\": \"customer-oci-retention\"\n },\n \"geography\": \"US\",\n \"status\": \"pending\",\n \"created_at\": 1711471300\n}\n" + } + ] + }, + "security": [ + { + "AdminApiKeyAuth": [] } - } + ] } }, - "/chatkit/threads/{thread_id}": { + "/organization/external_storage/{external_storage_id}": { "get": { - "summary": "Retrieve a ChatKit thread by its identifier.", - "operationId": "GetThreadMethod", + "summary": "Get an external storage configuration", + "description": "Get one customer-managed external storage configuration.", + "operationId": "Getanexternalstorageconfiguration", "parameters": [ { - "name": "thread_id", + "name": "external_storage_id", "in": "path", - "description": "Identifier of the ChatKit thread to retrieve.", "required": true, "schema": { - "example": "cthr_123", + "example": "extstorage_123", "type": "string" } } @@ -17983,41 +24592,68 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ThreadResource" + "$ref": "#/components/schemas/ExternalStorageResponse" + } + } + } + }, + "400": { + "description": "The organization is not enabled for external storage.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The organization or external storage was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Retrieve ChatKit thread", - "group": "chatkit", - "beta": true, - "path": "threads/retrieve", + "group": "administration", "examples": { "request": { - "curl": "curl https://api.openai.com/v1/chatkit/threads/cthr_abc123 \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst chatkitThread = await client.beta.chatkit.threads.retrieve('cthr_123');\n\nconsole.log(chatkitThread.id);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nchatkit_thread = client.beta.chatkit.threads.retrieve(\n \"cthr_123\",\n)\nprint(chatkit_thread.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n chatkitThread, err := client.Beta.ChatKit.Threads.Get(context.TODO(), \"cthr_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", chatkitThread.ID)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nchatkit_thread = openai.beta.chatkit.threads.retrieve(\"cthr_123\")\n\nputs(chatkit_thread)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ChatKitThread;\nimport com.openai.models.beta.chatkit.threads.ThreadRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ChatKitThread chatkitThread = client.beta().chatkit().threads().retrieve(\"cthr_123\");\n }\n}\n" + "curl": "curl https://api.openai.com/v1/organization/external_storage/extstorage_azure123 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"id\": \"cthr_abc123\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Customer escalation\",\n \"items\": {\n \"data\": [\n {\n \"id\": \"cthi_user_001\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"user_message\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"I need help debugging an onboarding issue.\"\n }\n ],\n \"attachments\": []\n },\n {\n \"id\": \"cthi_assistant_002\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"assistant_message\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Let's start by confirming the workflow version you deployed.\"\n }\n ]\n }\n ],\n \"has_more\": false\n }\n}\n" + "response": "{\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_azure123\",\n \"project_id\": \"proj_azure123\",\n \"provider\": {\n \"type\": \"azure\",\n \"tenant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"subscription_id\": \"22222222-2222-2222-2222-222222222222\",\n \"resource_group\": \"customer-rg\",\n \"account_name\": \"customerstorage\",\n \"container\": \"openai-data\",\n \"region\": \"eastus\"\n },\n \"geography\": \"US\",\n \"status\": \"validated\",\n \"created_at\": 1711471533\n}\n" } - } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] }, "delete": { - "summary": "Delete a ChatKit thread along with its items and stored attachments.", - "operationId": "DeleteThreadMethod", + "summary": "Delete an external storage configuration", + "description": "Disconnect a customer-managed external storage configuration. Removing the project's last configuration restores organization-default retention if customer-managed retention was active. Repeating a deletion also completes any interrupted retention update. Cloud storage is unchanged.", + "operationId": "Deleteanexternalstorageconfiguration", "parameters": [ { - "name": "thread_id", + "name": "external_storage_id", "in": "path", - "description": "Identifier of the ChatKit thread to delete.", "required": true, "schema": { - "example": "cthr_123", + "example": "extstorage_123", "type": "string" } } @@ -18028,2825 +24664,3089 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedThreadResource" + "$ref": "#/components/schemas/ExternalStorageDeletedResource" } } } - } - }, - "x-oaiMeta": { - "beta": true, - "examples": { - "response": "", - "request": { - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst thread = await client.beta.chat_kit.threads.delete('cthr_123');\n\nconsole.log(thread.id);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\nthread = client.beta.chat_kit.threads.delete(\n \"cthr_123\",\n)\nprint(thread.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n thread, err := client.Beta.ChatKit.Threads.Delete(context.TODO(), \"cthr_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", thread.ID)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nthread = openai.beta.chat_kit.threads.delete(\"cthr_123\")\n\nputs(thread)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chat_kit.threads.ThreadDeleteParams;\nimport com.openai.models.beta.chat_kit.threads.ThreadDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadDeleteResponse thread = client.beta().chat_kit().threads().delete(\"cthr_123\");\n }\n}\n" - } - }, - "name": "Delete ChatKit thread", - "group": "chatkit", - "path": "threads/delete" - } - } - }, - "/chatkit/threads": { - "get": { - "summary": "List ChatKit threads with optional pagination and user filters.", - "operationId": "ListThreadsMethod", - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "Maximum number of thread items to return. Defaults to 20.", - "required": false, - "schema": { - "type": "integer", - "minimum": 0, - "maximum": 100 - } - }, - { - "name": "order", - "in": "query", - "description": "Sort order for results by creation time. Defaults to `desc`.", - "required": false, - "schema": { - "$ref": "#/components/schemas/OrderEnum" - } }, - { - "name": "after", - "in": "query", - "description": "List items created after this thread item ID. Defaults to null for the first page.", - "required": false, - "schema": { - "description": "List items created after this thread item ID. Defaults to null for the first page.", - "type": "string" + "400": { + "description": "The organization is not enabled for external storage.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, - { - "name": "before", - "in": "query", - "description": "List items created before this thread item ID. Defaults to null for the newest results.", - "required": false, - "schema": { - "description": "List items created before this thread item ID. Defaults to null for the newest results.", - "type": "string" + "403": { + "description": "The caller does not have permission to perform this operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } } }, - { - "name": "user", - "in": "query", - "description": "Filter threads that belong to this user identifier. Defaults to null to return all users.", - "required": false, - "schema": { - "description": "Filter threads that belong to this user identifier. Defaults to null to return all users.", - "type": "string", - "minLength": 1, - "maxLength": 512 - } - } - ], - "responses": { - "200": { - "description": "Success", + "404": { + "description": "The organization or external storage was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ThreadListResource" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "List ChatKit threads", - "group": "chatkit", - "beta": true, - "path": "list-threads scope.", + "group": "administration", "examples": { "request": { - "curl": "curl \"https://api.openai.com/v1/chatkit/threads?limit=2&order=desc\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const chatkitThread of client.beta.chatkit.threads.list()) {\n console.log(chatkitThread.id);\n}\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\npage = client.beta.chatkit.threads.list()\npage = page.data[0]\nprint(page.id)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n page, err := client.Beta.ChatKit.Threads.List(context.TODO(), openai.BetaChatKitThreadListParams{\n\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", page)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\npage = openai.beta.chatkit.threads.list\n\nputs(page)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadListPage;\nimport com.openai.models.beta.chatkit.threads.ThreadListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadListPage page = client.beta().chatkit().threads().list();\n }\n}\n" + "curl": "curl -X DELETE https://api.openai.com/v1/organization/external_storage/extstorage_abc123 \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "response": "{\n \"data\": [\n {\n \"id\": \"cthr_abc123\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Customer escalation\"\n },\n {\n \"id\": \"cthr_def456\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Demo feedback\"\n }\n ],\n \"has_more\": false,\n \"object\": \"list\"\n}\n" + "response": "{\n \"object\": \"organization.external_storage.deleted\",\n \"id\": \"extstorage_abc123\",\n \"deleted\": true\n}\n" } - } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] } }, - "/agents/environments/{environment_id}": { - "get": { - "operationId": "retrieveAgentEnvironment", - "summary": "Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle).", - "description": "Retrieves an execution environment's connection status and safe installed metadata.", - "tags": [ - "Agents" - ], + "/organization/external_storage/{external_storage_id}/validate": { + "post": { + "summary": "Validate an external storage configuration", + "description": "Validate one customer-managed external storage configuration.", + "operationId": "Validateanexternalstorageconfiguration", "parameters": [ { - "name": "environment_id", + "name": "external_storage_id", "in": "path", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the environment." + "example": "extstorage_123", + "type": "string" + } } ], "responses": { "200": { - "description": "The requested environment.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PublicEnvironmentResource" + "$ref": "#/components/schemas/ExternalStorageResponse" } } } }, "400": { - "description": "The request was invalid.", + "description": "The external storage configuration is invalid or the organization or project does not support it.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { - "description": "The requested session or event was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "409": { - "description": "The request conflicted with the current session state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "500": { - "description": "An internal error occurred.", + "description": "The organization, project, or external storage was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { - "description": "The service is temporarily unavailable.", + "description": "External storage validation is temporarily unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Retrieve an agent environment" - } - } - }, - "/agents/environments/{environment_id}/files": { - "get": { - "operationId": "listAgentEnvironmentFiles", - "summary": "Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).", - "description": "Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination.", - "tags": [ - "Agents" - ], - "parameters": [ - { - "name": "environment_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the environment." - }, - { - "name": "path", - "in": "query", - "required": false, - "schema": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Restrict the listing to this absolute workspace directory." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 1, - "maximum": 100 - }, - "description": "The maximum number of files to return, between 1 and 100." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam" + "group": "administration", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/external_storage/extstorage_azure123/validate \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "description": "Sort by case-sensitive path components. Defaults to descending." - }, + "response": "{\n \"object\": \"organization.external_storage\",\n \"id\": \"extstorage_azure123\",\n \"project_id\": \"proj_azure123\",\n \"provider\": {\n \"type\": \"azure\",\n \"tenant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"subscription_id\": \"22222222-2222-2222-2222-222222222222\",\n \"resource_group\": \"customer-rg\",\n \"account_name\": \"customerstorage\",\n \"container\": \"openai-data\",\n \"region\": \"eastus\"\n },\n \"geography\": \"US\",\n \"status\": \"validated\",\n \"created_at\": 1711471533\n}\n" + } + }, + "security": [ { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The opaque token from the previous page. Keep the same path, order, and limit." + "AdminApiKeyAuth": [] } - ], + ] + } + }, + "/organization/spend_limit": { + "get": { + "summary": "Get organization spend limit", + "description": "Get the organization's hard spend limit.", + "operationId": "Getorganizationspendlimit", + "parameters": [], "responses": { "200": { - "description": "A page of live environment files.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EnvironmentFileListResource" - } - } - } - }, - "400": { - "description": "The request was invalid.", + "description": "Hard spend limit retrieved successfully.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/OrganizationSpendLimitResource" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/PermissionErrorResponse" } } } }, "404": { - "description": "The requested session or event was not found.", + "description": "The organization does not have a hard spend limit.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "409": { - "description": "The request conflicted with the current session state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "500": { - "description": "An internal error occurred.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "503": { - "description": "The service is temporarily unavailable.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "List agent environment files" - } - }, - "post": { - "operationId": "createAgentEnvironmentFile", - "summary": "Copies inline bytes or a Files API file into a connected execution environment. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).", - "description": "Copies inline bytes or a Files API file into a connected execution environment.", - "tags": [ - "Agents" - ], - "parameters": [ - { - "name": "environment_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "group": "administration", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "description": "The ID of the environment." + "response": "{\n \"object\": \"organization.spend_limit\",\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"enforcement\": {\n \"status\": \"enforcing\"\n }\n}\n" } - ], + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, + "post": { + "summary": "Update organization spend limit", + "description": "Create or replace the organization's hard spend limit.", + "operationId": "Updateorganizationspendlimit", + "parameters": [], "requestBody": { + "description": "Parameters for the hard spend limit you want to create or replace.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HostedEnvironmentFileParam" + "$ref": "#/components/schemas/UpdateOrganizationSpendLimitBody" } } - } + }, + "required": true }, "responses": { - "201": { - "description": "The created live environment file.", + "200": { + "description": "Hard spend limit created or replaced successfully.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentFileResource" + "$ref": "#/components/schemas/OrganizationSpendLimitResource" } } } }, "400": { - "description": "The request was invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", + "description": "The requested spend limit is invalid or cannot be applied.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "404": { - "description": "The requested session or event was not found.", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/PermissionErrorResponse" } } } - }, - "409": { - "description": "The request conflicted with the current session state.", + } + }, + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\"\n }'\n" + }, + "response": "{\n \"object\": \"organization.spend_limit\",\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"enforcement\": {\n \"status\": \"enforcing\"\n }\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, + "delete": { + "summary": "Delete organization spend limit", + "description": "Delete the organization's hard spend limit.", + "operationId": "Deleteorganizationspendlimit", + "parameters": [], + "responses": { + "200": { + "description": "Hard spend limit deleted successfully.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/OrganizationSpendLimitDeletedResource" } } } }, - "500": { - "description": "An internal error occurred.", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/PermissionErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "404": { + "description": "The organization does not have a hard spend limit.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Create an agent environment file" - } + "group": "administration", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/organization/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": "{\n \"object\": \"organization.spend_limit.deleted\",\n \"deleted\": true\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] } }, - "/agents/sessions/{session_id}/subagents": { + "/organization/projects/{project_id}/spend_limit": { "get": { - "operationId": "listAgentSessionSubagents", - "summary": "Lists subagents in a session, including nested and closed subagents. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Lists subagents in a session, including nested and closed subagents.", - "tags": [ - "Agents" - ], + "summary": "Get project spend limit", + "description": "Get a project's hard spend limit.", + "operationId": "Getprojectspendlimit", "parameters": [ { - "name": "session_id", + "name": "project_id", "in": "path", + "description": "The ID of the project whose hard spend limit is being managed.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + "example": "proj_123", + "type": "string" + } } ], "responses": { "200": { - "description": "The requested subagents.", + "description": "Hard spend limit retrieved successfully.", "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "default": "list", - "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SubagentResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." - }, - "first_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." - }, - "last_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." - }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "$ref": "#/components/schemas/ProjectSpendLimitResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The project ID is invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/PermissionErrorResponse" } } } }, - "403": { - "description": "The API key lacks the required Responses permission.", + "404": { + "description": "The project was not found or does not have a hard spend limit.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } - }, - "404": { - "description": "The requested session or event was not found.", + } + }, + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" + }, + "response": "{\n \"object\": \"project.spend_limit\",\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"enforcement\": {\n \"status\": \"enforcing\"\n }\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + }, + "delete": { + "summary": "Delete project spend limit", + "description": "Delete a project's hard spend limit.", + "operationId": "Deleteprojectspendlimit", + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project whose hard spend limit is being managed.", + "required": true, + "schema": { + "example": "proj_123", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Hard spend limit deleted successfully.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ProjectSpendLimitDeletedResource" } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "400": { + "description": "The project ID is invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "500": { - "description": "An internal error occurred.", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/PermissionErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "404": { + "description": "The project was not found or does not have a hard spend limit.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "List session subagents" - } - } - }, - "/agents/sessions/{session_id}/subagents/{subagent_id}": { - "get": { - "operationId": "retrieveAgentSessionSubagent", - "summary": "Retrieves a subagent belonging to this session. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Retrieves a subagent belonging to this session.", - "tags": [ - "Agents" - ], - "parameters": [ - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "group": "administration", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\"\n" }, - "description": "The ID of the session." - }, + "response": "{\n \"object\": \"project.spend_limit.deleted\",\n \"deleted\": true\n}\n" + } + }, + "security": [ { - "name": "subagent_id", + "AdminApiKeyAuth": [] + } + ] + }, + "post": { + "summary": "Update project spend limit", + "description": "Create or replace a project's hard spend limit.", + "operationId": "Updateprojectspendlimit", + "parameters": [ + { + "name": "project_id", "in": "path", + "description": "The ID of the project whose hard spend limit is being managed.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." + "example": "proj_123", + "type": "string" + } } ], - "responses": { - "200": { - "description": "The requested subagent.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubagentResource" - } + "requestBody": { + "description": "Parameters for the hard spend limit you want to create or replace.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateProjectSpendLimitBody" } } }, - "400": { - "description": "The request was invalid.", + "required": true + }, + "responses": { + "200": { + "description": "Hard spend limit created or replaced successfully.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ProjectSpendLimitResource" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "400": { + "description": "The requested spend limit is invalid or cannot be applied.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/PermissionErrorResponse" } } } }, "404": { - "description": "The requested session or event was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "409": { - "description": "The request conflicted with the current session state.", + "description": "The project was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "500": { - "description": "An internal error occurred.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "503": { - "description": "The service is temporarily unavailable.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Retrieve a session subagent" - } + "group": "administration", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/spend_limit \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\"\n }'\n" + }, + "response": "{\n \"object\": \"project.spend_limit\",\n \"threshold_amount\": 10000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"enforcement\": {\n \"status\": \"enforcing\"\n }\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] } }, - "/agents/sessions/{session_id}/subagents/{subagent_id}/items": { + "/organization/projects/{project_id}/service_tier_settings": { "get": { - "operationId": "listAgentSessionSubagentItems", - "summary": "Lists this subagent's own items across all of its turns. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Lists this subagent's own items across all of its turns.", - "tags": [ - "Agents" - ], + "summary": "Retrieve project service tier settings", + "description": "Retrieve the configured default and enabled service tiers for a project.", + "operationId": "Retrieveprojectservicetiersettings", "parameters": [ { - "name": "session_id", + "name": "project_id", "in": "path", + "description": "The ID of the project", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "description": "The ID of the project", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectServiceTierSettingsResource" + } + } + } + } + }, + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/service_tier_settings \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\"\n" }, - "description": "The ID of the session." - }, + "response": "{\n \"object\": \"project.service_tier_settings\",\n \"default\": \"standard\",\n \"enabled_tiers\": \"all\"\n}\n" + } + }, + "security": [ { - "name": "subagent_id", + "AdminApiKeyAuth": [] + } + ] + }, + "post": { + "summary": "Update project service tier settings", + "description": "Update the default or enabled service tiers atomically. Supply at least one field. Omitted fields keep their current values.", + "operationId": "Updateprojectservicetiersettings", + "parameters": [ + { + "name": "project_id", "in": "path", + "description": "The ID of the project", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." + "description": "The ID of the project", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateProjectServiceTierSettingsBody" + } + } }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 + "required": true + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProjectServiceTierSettingsResource" + } + } + } + } + }, + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/organization/projects/proj_abc/service_tier_settings \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"default\":\"standard\",\"enabled_tiers\":[]}'\n" }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, + "response": "{\n \"object\": \"project.service_tier_settings\",\n \"default\": \"standard\",\n \"enabled_tiers\": []\n}\n" + } + }, + "security": [ { - "name": "order", - "in": "query", - "required": false, + "AdminApiKeyAuth": [] + } + ] + } + }, + "/organization/projects/{project_id}/service_accounts/{service_account_id}/api_keys": { + "post": { + "summary": "Create an API key for a service account", + "description": "Creates an API key for a service account in the project.", + "operationId": "CreateanAPIkeyforaserviceaccount", + "parameters": [ + { + "name": "project_id", + "in": "path", + "description": "The ID of the project.", + "required": true, "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." + "description": "The ID of the project.", + "type": "string" + } }, { - "name": "after", - "in": "query", - "required": false, + "name": "service_account_id", + "in": "path", + "description": "The ID of the service account.", + "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + "description": "The ID of the service account.", + "type": "string" + } } ], + "requestBody": { + "description": "The service account API key create request payload.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateProjectServiceAccountApiKeyBody" + } + } + } + }, "responses": { "200": { - "description": "The requested subagent history.", + "description": "Service account API key created successfully.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionItemListResource" + "$ref": "#/components/schemas/ServiceAccountApiKeyBody" } } } }, "400": { - "description": "The request was invalid.", + "description": "The API key request is invalid or the project is archived.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "403": { + "description": "The caller does not have permission to perform this operation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/PermissionErrorResponse" } } } }, - "403": { - "description": "The API key lacks the required Responses permission.", + "404": { + "description": "The project or service account was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "404": { - "description": "The requested session or event was not found.", + "429": { + "description": "Too many management requests. Reduce the request rate and try again later.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "group": "administration", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc/api_keys \\\n -H \"Authorization: Bearer $OPENAI_ADMIN_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"Production App\",\n \"scopes\": [\"api.responses.write\"]\n }'\n" + }, + "response": "{\n \"object\": \"organization.project.service_account.api_key\",\n \"value\": \"sk-abcdefghijklmnop123\",\n \"name\": \"Production App\",\n \"created_at\": 1711471533,\n \"id\": \"key_abc\"\n}\n" + } + }, + "security": [ + { + "AdminApiKeyAuth": [] + } + ] + } + }, + "/content_provenance_checks": { + "post": { + "summary": "Create content provenance check", + "description": "Check whether an image or audio file contains known OpenAI provenance signals. [Learn more about content provenance](https://developers.openai.com/api/docs/guides/content-provenance).\n\nIf `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect.", + "operationId": "Createcontentprovenancecheck", + "parameters": [], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateContentProvenanceBody" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProvenanceResource" } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "400": { + "description": "The file is missing, invalid, unsupported, too large, or rejected by safety checks.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Content provenance checks are unavailable to this caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, "500": { - "description": "An internal error occurred.", + "description": "The content provenance check could not be completed.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { - "description": "The service is temporarily unavailable.", + "description": "Content provenance inspection is temporarily unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "List subagent items" + "group": "content_provenance_checks", + "examples": [] } } }, - "/agents/sessions/{session_id}/subagents/{subagent_id}/turns": { - "get": { - "operationId": "listAgentSessionSubagentTurns", - "summary": "Lists all turns of this subagent, including turns after a resume. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Lists all turns of this subagent, including turns after a resume.", + "/videos": { + "post": { "tags": [ - "Agents" + "Videos" ], - "parameters": [ - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "summary": "Create a video", + "description": "Create a new video generation job from a prompt and optional reference assets.", + "operationId": "createVideo", + "parameters": [], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateVideoMultipartBody" + } }, - "description": "The ID of the session." + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVideoJsonBody" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VideoResource" + } + } + } }, - { - "name": "subagent_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." + "400": { + "description": "The video request is invalid, or the organization does not support video generation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "A referenced character was not found or is not accessible, or the Videos API is unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "$ref": "#/components/responses/InferenceRateLimited" + }, + "500": { + "description": "The video generation task could not be created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } }, + "503": { + "$ref": "#/components/responses/InferenceServiceUnavailable" + } + }, + "deprecated": true, + "x-oaiMeta": { + "group": "videos", + "path": "create", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/videos \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F \"model=sora-2\" \\\n -F \"prompt=A calico cat playing a piano on stage\"\n", + "javascript": "import OpenAI from 'openai';\n\nconst openai = new OpenAI();\n\nconst video = await openai.videos.create({ prompt: 'A calico cat playing a piano on stage' });\n\nconsole.log(video.id);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nvideo = client.videos.create(\n prompt=\"A calico cat playing a piano on stage\",\n)\nprint(video.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n video, err := client.Videos.New(context.TODO(), openai.VideoNewParams{\n Prompt: \"A calico cat playing a piano on stage\",\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", video.ID)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nvideo = openai.videos.create(prompt: \"A calico cat playing a piano on stage\")\n\nputs(video)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoCreateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoCreateParams params = VideoCreateParams.builder()\n .prompt(\"A calico cat playing a piano on stage\")\n .build();\n Video video = client.videos().create(params);\n }\n}\n" + }, + "response": "{\n \"id\": \"video_123\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"queued\",\n \"progress\": 0,\n \"created_at\": 1712697600,\n \"size\": \"1024x1792\",\n \"seconds\": \"8\",\n \"prompt\": \"A calico cat playing a piano on stage\",\n \"completed_at\": null,\n \"expires_at\": null,\n \"error\": null,\n \"remixed_from_video_id\": null\n}\n" + } + } + }, + "get": { + "tags": [ + "Videos" + ], + "summary": "List videos", + "description": "List recently generated videos for the current project.", + "operationId": "ListVideos", + "parameters": [ { "name": "limit", "in": "query", + "description": "Number of items to retrieve", "required": false, "schema": { "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + "minimum": 0, + "maximum": 100 + } }, { "name": "order", "in": "query", + "description": "Sort order of results by timestamp. Use `asc` for ascending order or `desc` for descending order.", "required": false, "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." + "$ref": "#/components/schemas/OrderEnum" + } }, { "name": "after", "in": "query", + "description": "Identifier for the last item from the previous pagination request", "required": false, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + "description": "Identifier for the last item from the previous pagination request", + "type": "string" + } } ], "responses": { "200": { - "description": "The requested subagent history.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionTurnListResource", - "description": "A page of turns from an agent session or subagent." + "$ref": "#/components/schemas/VideoListResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The query parameters are invalid, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "404": { + "description": "The video specified by after was not found or is not accessible, or the Videos API is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } - }, - "403": { - "description": "The API key lacks the required Responses permission.", + } + }, + "deprecated": true, + "x-oaiMeta": { + "group": "videos", + "path": "list for the organization.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/videos \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from 'openai';\n\nconst openai = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const video of openai.videos.list()) {\n console.log(video.id);\n}\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\npage = client.videos.list()\npage = page.data[0]\nprint(page.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n page, err := client.Videos.List(context.TODO(), openai.VideoListParams{\n\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", page)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\npage = openai.videos.list\n\nputs(page)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.VideoListPage;\nimport com.openai.models.videos.VideoListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoListPage page = client.videos().list();\n }\n}\n" + }, + "response": "{\n \"data\": [\n {\n \"id\": \"video_123\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"completed\",\n \"created_at\": 1712697600,\n \"completed_at\": 1712697840,\n \"progress\": 100,\n \"expires_at\": null,\n \"error\": null,\n \"prompt\": \"A calico cat playing a piano on stage\",\n \"size\": \"1024x1792\",\n \"seconds\": \"8\",\n \"remixed_from_video_id\": null\n }\n ],\n \"object\": \"list\",\n \"first_id\": \"video_123\",\n \"last_id\": \"video_123\",\n \"has_more\": false\n}\n" + } + } + } + }, + "/videos/characters": { + "post": { + "tags": [ + "Videos" + ], + "summary": "Create a character", + "description": "Create a character from an uploaded video.", + "operationId": "CreateVideoCharacter", + "parameters": [], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateVideoCharacterBody" + } + } + } + }, + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/VideoCharacterResource" } } } }, - "404": { - "description": "The requested session or event was not found.", + "400": { + "description": "The character request or video upload is invalid, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "404": { + "description": "The video character endpoint is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { - "description": "An internal error occurred.", + "description": "The character could not be created.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "504": { + "description": "The character creation request timed out.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, - "x-oaiMeta": { - "name": "List subagent turns" - } + "deprecated": true } }, - "/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}": { + "/videos/characters/{character_id}": { "get": { - "operationId": "retrieveAgentSessionSubagentTurn", - "summary": "Retrieves a turn belonging to this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Retrieves a turn belonging to this subagent.", "tags": [ - "Agents" + "Videos" ], + "summary": "Retrieve a character", + "description": "Fetch a character.", + "operationId": "GetVideoCharacter", "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "subagent_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." - }, - { - "name": "turn_id", + "name": "character_id", "in": "path", + "description": "The identifier of the character to retrieve.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of a turn belonging to this subagent." + "example": "char_123", + "type": "string" + } } ], "responses": { "200": { - "description": "The requested subagent history.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TurnResource" + "$ref": "#/components/schemas/VideoCharacterResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The character ID is invalid, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "404": { + "description": "The character was not found or is not accessible, or the video character endpoint is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } - }, - "403": { - "description": "The API key lacks the required Responses permission.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } + } + }, + "deprecated": true + } + }, + "/videos/edits": { + "post": { + "tags": [ + "Videos" + ], + "summary": "Create a video edit", + "description": "Create a new video generation job by editing a source video or existing generated video.", + "operationId": "CreateVideoEdit", + "parameters": [], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateVideoEditMultipartBody" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVideoEditJsonBody" + } } - }, - "404": { - "description": "The requested session or event was not found.", + } + }, + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/VideoResource" } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "400": { + "description": "The edit request or source video is invalid, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "500": { - "description": "An internal error occurred.", + "404": { + "description": "The source video or a referenced character was not found or is not accessible, the source video is not ready, or the Videos API is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "429": { + "$ref": "#/components/responses/InferenceRateLimited" + }, + "500": { + "description": "The source video media is unavailable or the edit task could not be created.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } + }, + "503": { + "$ref": "#/components/responses/InferenceServiceUnavailable" } }, - "x-oaiMeta": { - "name": "Retrieve a subagent turn" - } + "deprecated": true } }, - "/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items": { - "get": { - "operationId": "listAgentSessionSubagentTurnItems", - "summary": "Lists items belonging to one turn of this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", - "description": "Lists items belonging to one turn of this subagent.", + "/videos/extensions": { + "post": { "tags": [ - "Agents" + "Videos" ], - "parameters": [ - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "subagent_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the subagent in this session." - }, - { - "name": "turn_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of a turn belonging to this subagent." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "summary": "Create a video extension", + "description": "Create an extension of a completed video.", + "operationId": "CreateVideoExtend", + "parameters": [], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateVideoExtendMultipartBody" + } }, - "description": "Return resources after this resource ID in the selected order." + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVideoExtendJsonBody" + } + } } - ], + }, "responses": { "200": { - "description": "The requested subagent history.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionItemListResource" + "$ref": "#/components/schemas/VideoResource" } } } }, "400": { - "description": "The request was invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", + "description": "The extension request or source video is invalid, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "403": { - "description": "The API key lacks the required Responses permission.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { - "description": "The requested session or event was not found.", + "description": "The source video was not found or is not accessible, the source video is not ready, or the Videos API is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "409": { - "description": "The request conflicted with the current session state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } + "429": { + "$ref": "#/components/responses/InferenceRateLimited" }, "500": { - "description": "An internal error occurred.", + "description": "The source video media is unavailable or the extension task could not be created.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { - "description": "The service is temporarily unavailable.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } + "$ref": "#/components/responses/InferenceServiceUnavailable" } }, - "x-oaiMeta": { - "name": "List subagent turn items" - } + "deprecated": true } }, - "/agents": { + "/videos/{video_id}": { "get": { - "operationId": "listAgents", - "summary": "Lists reusable agents in the current project. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Lists reusable agents in the current project.", "tags": [ - "Agents" + "Videos" ], + "summary": "Retrieve a video", + "description": "Fetch the latest metadata for a generated video.", + "operationId": "GetVideo", "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 1 - }, - "description": "The maximum number of resources to return." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." - }, - { - "name": "after", - "in": "query", - "required": false, + "name": "video_id", + "in": "path", + "description": "The identifier of the video to retrieve.", + "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + "example": "video_123", + "type": "string" + } } ], "responses": { "200": { - "description": "A page of agents.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AgentListResource", - "description": "A page of reusable agents." + "$ref": "#/components/schemas/VideoResource" } } } }, "400": { - "description": "The request was invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", + "description": "The request is invalid, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { - "description": "The requested session or event was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "409": { - "description": "The request conflicted with the current session state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "500": { - "description": "An internal error occurred.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "503": { - "description": "The service is temporarily unavailable.", + "description": "The video was not found or is not accessible, or the Videos API is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, + "deprecated": true, "x-oaiMeta": { - "name": "List agents" + "group": "videos", + "path": "retrieve matching the provided identifier.", + "examples": { + "response": "{\n \"id\": \"video_123\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"queued\",\n \"progress\": 0,\n \"created_at\": 1712697600,\n \"completed_at\": null,\n \"error\": null,\n \"expires_at\": null,\n \"prompt\": \"A calico cat playing a piano on stage\",\n \"remixed_from_video_id\": null,\n \"size\": \"720x1280\",\n \"seconds\": \"4\"\n}\n", + "request": { + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst video = await client.videos.retrieve('video_123');\n\nconsole.log(video.id);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nvideo = client.videos.retrieve(\n \"video_123\",\n)\nprint(video.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n video, err := client.Videos.Get(context.TODO(), \"video_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", video.ID)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nvideo = openai.videos.retrieve(\"video_123\")\n\nputs(video)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n Video video = client.videos().retrieve(\"video_123\");\n }\n}\n" + } + } } }, - "post": { - "operationId": "createAgent", - "summary": "Creates a reusable agent without storing credentials. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Creates a reusable agent without storing credentials.", + "delete": { "tags": [ - "Agents" + "Videos" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAgentParams" - } + "summary": "Delete a video", + "description": "Permanently delete a completed or failed video and its stored assets.", + "operationId": "DeleteVideo", + "parameters": [ + { + "name": "video_id", + "in": "path", + "description": "The identifier of the video to delete.", + "required": true, + "schema": { + "example": "video_123", + "type": "string" } } - }, + ], "responses": { - "201": { - "description": "The created agent.", + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AgentResource" + "$ref": "#/components/schemas/DeletedVideoResource" } } } }, "400": { - "description": "The request was invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", + "description": "The video is still being processed, the request is invalid, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { - "description": "The requested session or event was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "409": { - "description": "The request conflicted with the current session state.", + "description": "The video was not found or is not accessible, or the Videos API is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { - "description": "An internal error occurred.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "503": { - "description": "The service is temporarily unavailable.", + "description": "The video or its stored media could not be deleted.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, + "deprecated": true, "x-oaiMeta": { - "name": "Create an agent" + "group": "videos", + "path": "delete", + "examples": { + "response": "{\n \"id\": \"video_123\",\n \"object\": \"video.deleted\",\n \"deleted\": true\n}\n", + "request": { + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst video = await client.videos.delete('video_123');\n\nconsole.log(video.id);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nvideo = client.videos.delete(\n \"video_123\",\n)\nprint(video.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n video, err := client.Videos.Delete(context.TODO(), \"video_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", video.ID)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nvideo = openai.videos.delete(\"video_123\")\n\nputs(video)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.VideoDeleteParams;\nimport com.openai.models.videos.VideoDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoDeleteResponse video = client.videos().delete(\"video_123\");\n }\n}\n" + } + } } } }, - "/agents/{agent_id}": { + "/videos/{video_id}/content": { "get": { - "operationId": "retrieveAgent", - "summary": "Retrieves a reusable agent by ID. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Retrieves a reusable agent by ID.", "tags": [ - "Agents" + "Videos" ], + "summary": "Download video content", + "description": "Download the generated video bytes or a derived preview asset.\n\nStreams the rendered video content for the specified video job.", + "operationId": "RetrieveVideoContent", "parameters": [ { - "name": "agent_id", + "name": "video_id", "in": "path", + "description": "The identifier of the video whose media to download.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the reusable agent." + "example": "video_123", + "type": "string" + } + }, + { + "name": "variant", + "in": "query", + "description": "Which downloadable asset to return. Defaults to the MP4 video.", + "required": false, + "schema": { + "$ref": "#/components/schemas/VideoContentVariant" + } } ], "responses": { "200": { - "description": "The requested agent.", + "description": "The video bytes or preview asset that matches the requested variant.", "content": { - "application/json": { + "video/mp4": { "schema": { - "$ref": "#/components/schemas/AgentResource" - } - } - } - }, - "400": { - "description": "The request was invalid.", - "content": { - "application/json": { + "type": "string", + "format": "binary" + }, + "example": "" + }, + "image/webp": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "type": "string", + "format": "binary" } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", - "content": { + }, "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "type": "string" } } } }, - "404": { - "description": "The requested session or event was not found.", + "400": { + "description": "The request or content variant is invalid, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "404": { + "description": "The video was not found or is not ready, its download is unavailable or expired, or the Videos API is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { - "description": "An internal error occurred.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "503": { - "description": "The service is temporarily unavailable.", + "description": "The requested video media is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, + "deprecated": true, "x-oaiMeta": { - "name": "Retrieve an agent" + "group": "videos", + "path": "content", + "examples": { + "request": { + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst response = await client.videos.downloadContent('video_123');\n\nconsole.log(response);\n\nconst content = await response.blob();\nconsole.log(content);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nresponse = client.videos.download_content(\n video_id=\"video_123\",\n)\nprint(response)\ncontent = response.read()\nprint(content)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n response, err := client.Videos.DownloadContent(\n context.TODO(),\n \"video_123\",\n openai.VideoDownloadContentParams{\n\n },\n )\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", response)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nresponse = openai.videos.download_content(\"video_123\")\n\nputs(response)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.core.http.HttpResponse;\nimport com.openai.models.videos.VideoDownloadContentParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n HttpResponse response = client.videos().downloadContent(\"video_123\");\n }\n}\n" + } + } } - }, + } + }, + "/videos/{video_id}/remix": { "post": { - "operationId": "updateAgent", - "summary": "Updates a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Updates a reusable agent.", "tags": [ - "Agents" + "Videos" ], + "summary": "Create a video remix", + "description": "Create a remix of a completed video using a refreshed prompt.", + "operationId": "CreateVideoRemix", "parameters": [ { - "name": "agent_id", + "name": "video_id", "in": "path", + "description": "The identifier of the completed video to remix.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the reusable agent." + "example": "video_123", + "type": "string" + } } ], "requestBody": { "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateVideoRemixBody" + } + }, "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateAgentParams" + "$ref": "#/components/schemas/CreateVideoRemixBody" } } } }, "responses": { "200": { - "description": "The updated agent.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AgentResource" + "$ref": "#/components/schemas/VideoResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The request or source video is not supported for remixing, or the organization does not support video generation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { - "description": "The requested session or event was not found.", + "description": "The source video or a referenced character was not found or is not accessible, the source video is not ready, or the Videos API is unavailable.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "409": { - "description": "The request conflicted with the current session state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } + "429": { + "$ref": "#/components/responses/InferenceRateLimited" }, "500": { - "description": "An internal error occurred.", + "description": "The source generation is unavailable or the remix task could not be created.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { - "description": "The service is temporarily unavailable.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } + "$ref": "#/components/responses/InferenceServiceUnavailable" } }, + "deprecated": true, "x-oaiMeta": { - "name": "Update an agent" + "group": "videos", + "path": "remix using the provided prompt.", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/videos/video_123/remix \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"prompt\": \"Extend the scene with the cat taking a bow to the cheering audience\"\n }'\n", + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst video = await client.videos.remix('video_123', { prompt: 'Extend the scene with the cat taking a bow to the cheering audience' });\n\nconsole.log(video.id);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nvideo = client.videos.remix(\n video_id=\"video_123\",\n prompt=\"Extend the scene with the cat taking a bow to the cheering audience\",\n)\nprint(video.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n video, err := client.Videos.Remix(\n context.TODO(),\n \"video_123\",\n openai.VideoRemixParams{\n Prompt: \"Extend the scene with the cat taking a bow to the cheering audience\",\n },\n )\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", video.ID)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nvideo = openai.videos.remix(\"video_123\", prompt: \"Extend the scene with the cat taking a bow to the cheering audience\")\n\nputs(video)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoRemixParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoRemixParams params = VideoRemixParams.builder()\n .videoId(\"video_123\")\n .prompt(\"Extend the scene with the cat taking a bow to the cheering audience\")\n .build();\n Video video = client.videos().remix(params);\n }\n}\n" + }, + "response": "{\n \"id\": \"video_456\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"queued\",\n \"progress\": 0,\n \"created_at\": 1712698600,\n \"size\": \"720x1280\",\n \"seconds\": \"8\",\n \"remixed_from_video_id\": \"video_123\",\n \"prompt\": \"Extend the scene with the cat taking a bow to the cheering audience\",\n \"completed_at\": null,\n \"expires_at\": null,\n \"error\": null\n}\n" + } } - }, - "delete": { - "operationId": "deleteAgent", - "summary": "Deletes a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", - "description": "Deletes a reusable agent.", + } + }, + "/responses/input_tokens": { + "post": { "tags": [ - "Agents" + "Responses" ], - "parameters": [ - { - "name": "agent_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the reusable agent." + "summary": "Get input token counts", + "description": "Returns input token counts of the request.\n\nReturns an object with `object` set to `response.input_tokens` and an `input_tokens` count.", + "operationId": "Getinputtokencounts", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenCountsBody" + } + } } - ], + }, "responses": { "200": { - "description": "The deleted agent.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedAgentResource" + "$ref": "#/components/schemas/TokenCountsResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The request to count input tokens is invalid or contains incompatible parameters.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "429": { + "$ref": "#/components/responses/TooManyRequests" + } + }, + "x-oaiMeta": { + "group": "responses", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/responses/input_tokens \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"Tell me a joke.\"\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst client = new OpenAI();\n\nconst response = await client.responses.inputTokens.count({\n model: \"gpt-6-astra\",\n input: \"Tell me a joke.\",\n});\n\nconsole.log(response.input_tokens);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.input_tokens.count(\n model=\"gpt-6-astra\",\n input=\"Tell me a joke.\"\n)\nprint(response.input_tokens)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n client := openai.NewClient()\n response, err := client.Responses.InputTokens.Count(context.TODO(), responses.InputTokenCountParams{\n Model: \"gpt-6-astra\",\n Input: \"Tell me a joke.\",\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", response.InputTokens)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.input_tokens.count(model: \"gpt-6-astra\", input: \"Tell me a joke.\")\n\nputs(response)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.responses.inputtokens.InputTokenCountParams;\nimport com.openai.models.responses.inputtokens.InputTokenCountResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n InputTokenCountParams params = InputTokenCountParams.builder()\n .model(\"gpt-6-astra\")\n .input(\"Tell me a joke.\")\n .build();\n\n InputTokenCountResponse response = client.responses().inputTokens().count(params);\n }\n}\n" + }, + "response": "{\n \"object\": \"response.input_tokens\",\n \"input_tokens\": 11\n}\n" + } + } + } + }, + "/responses/compact": { + "post": { + "tags": [ + "Responses" + ], + "summary": "Compact conversation", + "description": "Compact a conversation. Returns a compacted response object.\n\nLearn when and how to compact long-running conversations in the [conversation state guide](https://developers.openai.com/api/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](https://developers.openai.com/api/docs/guides/conversation-state#compaction-advanced).", + "operationId": "Compactconversation", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CompactResponseMethodPublicBody" + } + } + } + }, + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/CompactResource" } } } }, - "404": { - "description": "The requested session or event was not found.", + "400": { + "description": "Invalid compaction request or incompatible input parameters.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "429": { + "$ref": "#/components/responses/InferenceRateLimited" + }, + "503": { + "$ref": "#/components/responses/InferenceServiceUnavailable" + } + }, + "x-oaiMeta": { + "group": "responses", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/responses/compact \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Create a simple landing page for a dog petting café.\"\n },\n {\n \"id\": \"msg_001\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Below is a single file, ready-to-use landing page for a dog petting café:...\"\n }\n ],\n \"role\": \"assistant\"\n }\n ]\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\n// Compact the previous response if you are running out of tokens\nconst compactedResponse = await openai.responses.compact({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: \"Create a simple landing page for a dog petting café.\",\n },\n // All items returned from previous requests are included here, like reasoning, message, function call, etc.\n {\n id: \"msg_030d085c0b53e67e0069332e3a72d4819c96c6f2c4adc15d33\",\n type: \"message\",\n status: \"completed\",\n content: [\n {\n type: \"output_text\",\n annotations: [],\n logprobs: [],\n text: \"Below is a single file, ready-to-use landing page for a dog petting café:...\",\n },\n ],\n role: \"assistant\",\n },\n ],\n});\n\n// Pass the compactedResponse.output as input to the next request\nconsole.log(compactedResponse);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\ncompacted_response = client.responses.compact(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": \"Create a simple landing page for a dog petting cafe.\",\n },\n # All items returned from previous requests are included here, like reasoning, message, function call, etc.\n {\n \"id\": \"msg_001\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Below is a single file, ready-to-use landing page for a dog petting café:...\",\n },\n ],\n \"role\": \"assistant\",\n },\n ]\n)\n# Pass the compacted_response.output as input to the next request\nprint(compacted_response)\n" + }, + "response": "{\n \"id\": \"resp_001\",\n \"object\": \"response.compaction\",\n \"created_at\": 1764967971,\n \"output\": [\n {\n \"id\": \"msg_000\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Create a simple landing page for a dog petting cafe.\"\n }\n ],\n \"role\": \"user\"\n },\n {\n \"id\": \"cmp_001\",\n \"type\": \"compaction\",\n \"encrypted_content\": \"gAAAAABpM0Yj-...=\"\n }\n ],\n \"usage\": {\n \"input_tokens\": 139,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 438,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 64\n },\n \"total_tokens\": 577\n }\n}\n" + } + } + } + }, + "/skills": { + "post": { + "tags": [ + "Skills" + ], + "summary": "Create Skill", + "description": "Create a new skill.", + "operationId": "CreateSkill", + "parameters": [], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateSkillBody" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateSkillBody" + } + } + } + }, + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/SkillResource" } } } }, - "500": { - "description": "An internal error occurred.", + "400": { + "description": "The uploaded skill files or archive are invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The skill could not be saved.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } - }, - "x-oaiMeta": { - "name": "Delete an agent" } - } - }, - "/agents/environments/templates": { + }, "get": { - "operationId": "listAgentEnvironmentTemplates", - "summary": "Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Lists reusable environment templates without returning confidential values.", "tags": [ - "Agents" + "Skills" ], + "summary": "List Skills", + "description": "List all skills for the current project.", + "operationId": "ListSkills", "parameters": [ { "name": "limit", "in": "query", + "description": "Number of items to retrieve", "required": false, "schema": { "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + "minimum": 0, + "maximum": 100 + } }, { "name": "order", "in": "query", + "description": "Sort order of results by timestamp. Use `asc` for ascending order or `desc` for descending order.", "required": false, "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." + "$ref": "#/components/schemas/OrderEnum" + } }, { "name": "after", "in": "query", + "description": "Identifier for the last item from the previous pagination request", "required": false, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + "description": "Identifier for the last item from the previous pagination request", + "type": "string" + } } ], "responses": { "200": { - "description": "A page of environment templates.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentTemplateListResource", - "description": "A page of reusable environment templates." + "$ref": "#/components/schemas/SkillListResource" } } } }, - "400": { - "description": "The request was invalid.", + "404": { + "description": "The skill specified by `after` was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } + "429": { + "$ref": "#/components/responses/TooManyRequests" + } + } + } + }, + "/skills/{skill_id}": { + "delete": { + "tags": [ + "Skills" + ], + "summary": "Delete Skill", + "description": "Delete a skill by its ID.", + "operationId": "DeleteSkill", + "parameters": [ + { + "name": "skill_id", + "in": "path", + "description": "The identifier of the skill to delete.", + "required": true, + "schema": { + "example": "skill_123", + "type": "string" } - }, - "403": { - "description": "The API key lacks the required management permission.", + } + ], + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/DeletedSkillResource" } } } }, "404": { - "description": "The requested environment definition was not found.", + "description": "The skill was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "500": { - "description": "An internal error occurred.", + "429": { + "$ref": "#/components/responses/TooManyRequests" + } + } + }, + "get": { + "tags": [ + "Skills" + ], + "summary": "Get Skill", + "description": "Get a skill by its ID.", + "operationId": "GetSkill", + "parameters": [ + { + "name": "skill_id", + "in": "path", + "description": "The identifier of the skill to retrieve.", + "required": true, + "schema": { + "example": "skill_123", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/SkillResource" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "404": { + "description": "The skill was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" } - }, - "x-oaiMeta": { - "name": "List agent environment templates" } }, "post": { - "operationId": "createAgentEnvironmentTemplate", - "summary": "Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Creates reusable environment configuration without returning confidential setup commands or environment values.", "tags": [ - "Agents" + "Skills" + ], + "summary": "Update Skill Default Version", + "description": "Update the default version pointer for a skill.", + "operationId": "UpdateSkillDefaultVersion", + "parameters": [ + { + "name": "skill_id", + "in": "path", + "description": "The identifier of the skill.", + "required": true, + "schema": { + "example": "skill_123", + "type": "string" + } + } ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateEnvironmentTemplateParams" + "$ref": "#/components/schemas/SetDefaultSkillVersionBody" } } } }, "responses": { - "201": { - "description": "The created environment template.", + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentTemplateResource" + "$ref": "#/components/schemas/SkillResource" } } } }, "400": { - "description": "The request was invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "403": { - "description": "The API key lacks the required management permission.", + "description": "The requested version is invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { - "description": "The requested environment definition was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "500": { - "description": "An internal error occurred.", + "description": "The skill or requested skill version was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } + "429": { + "$ref": "#/components/responses/TooManyRequests" } - }, - "x-oaiMeta": { - "name": "Create an agent environment template" } } }, - "/agents/environments/templates/{environment_template_id}": { + "/skills/{skill_id}/content": { "get": { - "operationId": "retrieveAgentEnvironmentTemplate", - "summary": "Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Retrieves reusable environment configuration without returning confidential values.", "tags": [ - "Agents" + "Skills" ], + "summary": "Get Skill Content", + "description": "Download a skill zip bundle by its ID.", + "operationId": "GetSkillContent", "parameters": [ { - "name": "environment_template_id", + "name": "skill_id", "in": "path", + "description": "The identifier of the skill to download.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the reusable environment template." + "example": "skill_123", + "type": "string" + } } ], "responses": { "200": { - "description": "The requested environment template.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EnvironmentTemplateResource" - } - } - } - }, - "400": { - "description": "The request was invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "401": { - "description": "Authentication or project context was missing.", + "description": "The skill zip bundle.", "content": { - "application/json": { + "application/zip": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "type": "string", + "format": "binary" } - } - } - }, - "403": { - "description": "The API key lacks the required management permission.", - "content": { + }, "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "type": "string" } } } }, "404": { - "description": "The requested environment definition was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } - }, - "500": { - "description": "An internal error occurred.", + "description": "The skill was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } - } + "429": { + "$ref": "#/components/responses/TooManyRequests" } - }, - "x-oaiMeta": { - "name": "Retrieve an agent environment template" } - }, + } + }, + "/skills/{skill_id}/versions": { "post": { - "operationId": "updateAgentEnvironmentTemplate", - "summary": "Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Updates reusable environment configuration without returning confidential values.", "tags": [ - "Agents" + "Skills" ], + "summary": "Create Skill Version", + "description": "Create a new immutable skill version.", + "operationId": "CreateSkillVersion", "parameters": [ { - "name": "environment_template_id", + "name": "skill_id", "in": "path", + "description": "The identifier of the skill to version.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the reusable environment template." + "example": "skill_123", + "type": "string" + } } ], "requestBody": { "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateSkillVersionBody" + } + }, "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateEnvironmentTemplateParams" + "$ref": "#/components/schemas/CreateSkillVersionBody" } } } }, "responses": { "200": { - "description": "The updated environment template.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EnvironmentTemplateResource" + "$ref": "#/components/schemas/SkillVersionResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The uploaded skill files or archive are invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "404": { + "description": "The skill was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "403": { - "description": "The API key lacks the required management permission.", + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "description": "The skill version could not be saved.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } + } + } + }, + "get": { + "tags": [ + "Skills" + ], + "summary": "List Skill Versions", + "description": "List skill versions for a skill.", + "operationId": "ListSkillVersions", + "parameters": [ + { + "name": "skill_id", + "in": "path", + "description": "The identifier of the skill.", + "required": true, + "schema": { + "example": "skill_123", + "type": "string" + } }, - "404": { - "description": "The requested environment definition was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } + { + "name": "limit", + "in": "query", + "description": "Number of versions to retrieve.", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "maximum": 100 } }, - "409": { - "description": "The request conflicted with the current environment state.", + { + "name": "order", + "in": "query", + "description": "Sort order of results by version number.", + "required": false, + "schema": { + "$ref": "#/components/schemas/OrderEnum" + } + }, + { + "name": "after", + "in": "query", + "description": "The skill version ID to start after.", + "required": false, + "schema": { + "example": "skillver_123", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/SkillVersionListResource" } } } }, - "500": { - "description": "An internal error occurred.", + "400": { + "description": "The version specified by `after` does not belong to this skill.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "404": { + "description": "The skill or the version specified by `after` was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" } - }, - "x-oaiMeta": { - "name": "Update an agent environment template" } - }, - "delete": { - "operationId": "deleteAgentEnvironmentTemplate", - "summary": "Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", - "description": "Deletes reusable environment configuration and all confidential template inputs.", + } + }, + "/skills/{skill_id}/versions/{version}": { + "get": { "tags": [ - "Agents" + "Skills" ], + "summary": "Get Skill Version", + "description": "Get a specific skill version.", + "operationId": "GetSkillVersion", "parameters": [ { - "name": "environment_template_id", + "name": "skill_id", "in": "path", + "description": "The identifier of the skill.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the reusable environment template." + "example": "skill_123", + "type": "string" + } + }, + { + "name": "version", + "in": "path", + "description": "The version number to retrieve.", + "required": true, + "schema": { + "description": "The version number to retrieve.", + "type": "string" + } } ], "responses": { "200": { - "description": "The deleted environment template.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedEnvironmentTemplateResource" + "$ref": "#/components/schemas/SkillVersionResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The requested version is invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "404": { + "description": "The skill or requested skill version was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "403": { - "description": "The API key lacks the required management permission.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } + "429": { + "$ref": "#/components/responses/TooManyRequests" + } + } + }, + "delete": { + "tags": [ + "Skills" + ], + "summary": "Delete Skill Version", + "description": "Delete a skill version.", + "operationId": "DeleteSkillVersion", + "parameters": [ + { + "name": "skill_id", + "in": "path", + "description": "The identifier of the skill.", + "required": true, + "schema": { + "example": "skill_123", + "type": "string" } }, - "404": { - "description": "The requested environment definition was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" - } - } + { + "name": "version", + "in": "path", + "description": "The skill version number.", + "required": true, + "schema": { + "description": "The skill version number.", + "type": "string" } - }, - "409": { - "description": "The request conflicted with the current environment state.", + } + ], + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/DeletedSkillVersionResource" } } } }, - "500": { - "description": "An internal error occurred.", + "400": { + "description": "The requested version is invalid, or it is the default version and other versions remain.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "404": { + "description": "The skill or requested skill version was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" } - }, - "x-oaiMeta": { - "name": "Delete an agent environment template" } } }, - "/agents/sessions": { + "/skills/{skill_id}/versions/{version}/content": { "get": { - "operationId": "listAgentSessions", - "summary": "Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", - "description": "Lists managed agent sessions using ID-based pagination and the requested sort order.", "tags": [ - "Agents" + "Skills" ], + "summary": "Get Skill Version Content", + "description": "Download a skill version zip bundle.", + "operationId": "GetSkillVersionContent", "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 1 - }, - "description": "The maximum number of resources to return." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`." - }, - { - "name": "agent_id", - "in": "query", - "required": false, + "name": "skill_id", + "in": "path", + "description": "The identifier of the skill.", + "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Only return sessions whose root agent has this ID. Omit to return sessions for all agents." + "example": "skill_123", + "type": "string" + } }, { - "name": "after", - "in": "query", - "required": false, + "name": "version", + "in": "path", + "description": "The skill version number.", + "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + "description": "The skill version number.", + "type": "string" + } } ], "responses": { "200": { - "description": "A page of sessions.", + "description": "The skill zip bundle.", "content": { - "application/json": { + "application/zip": { "schema": { - "$ref": "#/components/schemas/SessionListResource", - "description": "A paginated list of sessions." + "type": "string", + "format": "binary" } - } - } - }, - "400": { - "description": "The request was invalid.", - "content": { + }, "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "type": "string" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "400": { + "description": "The requested version is invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "403": { - "description": "The API key lacks the required Responses permission.", + "404": { + "description": "The skill or requested skill version was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "404": { - "description": "The requested session or event was not found.", + "429": { + "$ref": "#/components/responses/TooManyRequests" + } + } + } + }, + "/chatkit/sessions/{session_id}/cancel": { + "post": { + "summary": "Cancel a ChatKit session", + "description": "Cancel an active ChatKit session and return its most recent metadata.\n\nCancelling prevents new requests from using the issued client secret.", + "operationId": "CancelChatSessionMethod", + "parameters": [ + { + "name": "session_id", + "in": "path", + "description": "Unique identifier for the ChatKit session to cancel.", + "required": true, + "schema": { + "example": "cksess_123", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ChatSessionResource" + }, + "examples": { + "Example": { + "value": { + "id": "cksess_123", + "object": "chatkit.session", + "client_secret": "", + "expires_at": 1712349876, + "workflow": { + "id": "workflow_alpha", + "version": "2024-10-01", + "state_variables": { + "message": "hello" + }, + "tracing": { + "enabled": true + } + }, + "user": "user_789", + "rate_limits": { + "max_requests_per_1_minute": 60 + }, + "max_requests_per_1_minute": 60, + "status": "cancelled", + "chatkit_configuration": { + "automatic_thread_titling": { + "enabled": true + }, + "file_upload": { + "enabled": true, + "max_file_size": 16, + "max_files": 20 + }, + "history": { + "enabled": true, + "recent_threads": 10 + } + } + } + } } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "400": { + "description": "The request is invalid or the required ChatKit beta header is missing or invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "500": { - "description": "An internal error occurred.", + "404": { + "description": "The session was not found or is not accessible.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "429": { + "description": "The request rate limit has been exceeded.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "List agent sessions" + "group": "chatkit", + "beta": true, + "path": "cancel-session new requests from using the issued client secret.", + "examples": { + "request": { + "curl": "curl -X POST \\\n https://api.openai.com/v1/chatkit/sessions/cksess_123/cancel \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst chatSession = await client.beta.chatkit.sessions.cancel('cksess_123');\n\nconsole.log(chatSession.id);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nchat_session = client.beta.chatkit.sessions.cancel(\n \"cksess_123\",\n)\nprint(chat_session.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n client := openai.NewClient()\n chatSession, err := client.Beta.ChatKit.Sessions.Cancel(context.TODO(), \"cksess_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nchat_session = openai.beta.chatkit.sessions.cancel(\"cksess_123\")\n\nputs(chat_session)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.sessions.SessionCancelParams;\nimport com.openai.models.beta.chatkit.threads.ChatSession;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ChatSession chatSession = client.beta().chatkit().sessions().cancel(\"cksess_123\");\n }\n}\n" + }, + "response": "{\n \"id\": \"cksess_123\",\n \"object\": \"chatkit.session\",\n \"client_secret\": \"\",\n \"expires_at\": 1735689600,\n \"workflow\": {\n \"id\": \"workflow_alpha\",\n \"version\": null,\n \"state_variables\": null,\n \"tracing\": {\n \"enabled\": true\n }\n },\n \"user\": \"user_123\",\n \"rate_limits\": {\n \"max_requests_per_1_minute\": 10\n },\n \"max_requests_per_1_minute\": 10,\n \"status\": \"cancelled\",\n \"chatkit_configuration\": {\n \"automatic_thread_titling\": {\n \"enabled\": true\n },\n \"file_upload\": {\n \"enabled\": false,\n \"max_file_size\": 512,\n \"max_files\": 10\n },\n \"history\": {\n \"enabled\": true,\n \"recent_threads\": null\n }\n }\n}\n" + } } - }, + } + }, + "/chatkit/sessions": { "post": { - "operationId": "createAgentSession", - "summary": "Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions).", - "description": "Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true.", - "tags": [ - "Agents" - ], + "summary": "Create a ChatKit session", + "description": "Create a ChatKit session.", + "operationId": "CreateChatSessionMethod", + "parameters": [], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateAgentSessionParams" + "$ref": "#/components/schemas/CreateChatSessionBody" } } } }, "responses": { - "201": { - "description": "The created session or its event stream.", + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionResource" - } - }, - "text/event-stream": { - "schema": { - "$ref": "#/components/schemas/SessionEvent" + "$ref": "#/components/schemas/ChatSessionResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The request is invalid or the required ChatKit beta header is missing or invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "404": { + "description": "The requested workflow or workflow version was not found or is not accessible.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "403": { - "description": "The API key lacks the required Responses permission.", + "429": { + "description": "The request rate limit has been exceeded.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } + } + }, + "x-oaiMeta": { + "group": "chatkit", + "beta": true, + "path": "sessions/create object.", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/chatkit/sessions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -d '{\n \"user\": \"user_123\",\n \"workflow\": {\"id\": \"workflow_alpha\"}\n }'\n", + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst chatSession = await client.beta.chatkit.sessions.create({ user: 'user_123', workflow: { id: 'workflow_alpha' } });\n\nconsole.log(chatSession.id);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nchat_session = client.beta.chatkit.sessions.create(\n user=\"user_123\",\n workflow={\n \"id\": \"workflow_alpha\"\n },\n)\nprint(chat_session.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n client := openai.NewClient()\n chatSession, err := client.Beta.ChatKit.Sessions.New(context.TODO(), openai.BetaChatKitSessionNewParams{\n User: \"user_123\",\n Workflow: openai.ChatSessionWorkflowParam{\n ID: \"workflow_alpha\",\n },\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", chatSession.ID)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nchat_session = openai.beta.chatkit.sessions.create(user: \"user_123\", workflow: {id: \"workflow_alpha\"})\n\nputs(chat_session)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.sessions.SessionCreateParams;\nimport com.openai.models.beta.chatkit.threads.ChatSession;\nimport com.openai.models.beta.chatkit.threads.ChatSessionWorkflowParam;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n SessionCreateParams params = SessionCreateParams.builder()\n .user(\"user_123\")\n .workflow(ChatSessionWorkflowParam.builder()\n .id(\"workflow_alpha\")\n .build())\n .build();\n ChatSession chatSession = client.beta().chatkit().sessions().create(params);\n }\n}\n" + }, + "response": "{\n \"id\": \"cksess_123\",\n \"object\": \"chatkit.session\",\n \"client_secret\": \"ek_example_00eyJleHBpcmVzX2F0IjogMTczNTY4OTYwMH0=\",\n \"expires_at\": 1735689600,\n \"workflow\": {\n \"id\": \"workflow_alpha\",\n \"version\": null,\n \"state_variables\": null,\n \"tracing\": {\n \"enabled\": true\n }\n },\n \"user\": \"user_123\",\n \"rate_limits\": {\n \"max_requests_per_1_minute\": 10\n },\n \"max_requests_per_1_minute\": 10,\n \"status\": \"active\",\n \"chatkit_configuration\": {\n \"automatic_thread_titling\": {\n \"enabled\": true\n },\n \"file_upload\": {\n \"enabled\": false,\n \"max_file_size\": 512,\n \"max_files\": 10\n },\n \"history\": {\n \"enabled\": true,\n \"recent_threads\": null\n }\n }\n}\n" + } + } + } + }, + "/chatkit/threads/{thread_id}/items": { + "get": { + "summary": "List ChatKit thread items", + "description": "List items that belong to a ChatKit thread.", + "operationId": "ListThreadItemsMethod", + "parameters": [ + { + "name": "thread_id", + "in": "path", + "description": "Identifier of the ChatKit thread whose items are requested.", + "required": true, + "schema": { + "example": "cthr_123", + "type": "string" + } }, - "404": { - "description": "The requested session or event was not found.", + { + "name": "limit", + "in": "query", + "description": "Maximum number of thread items to return. Defaults to 20.", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "maximum": 100 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order for results by creation time. Defaults to `desc`.", + "required": false, + "schema": { + "$ref": "#/components/schemas/OrderEnum" + } + }, + { + "name": "after", + "in": "query", + "description": "List items created after this thread item ID. Defaults to null for the first page.", + "required": false, + "schema": { + "description": "List items created after this thread item ID. Defaults to null for the first page.", + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "List items created before this thread item ID. Defaults to null for the newest results.", + "required": false, + "schema": { + "description": "List items created before this thread item ID. Defaults to null for the newest results.", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ThreadItemListResource" } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "400": { + "description": "The request is invalid or the required ChatKit beta header is missing or invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "500": { - "description": "An internal error occurred.", + "404": { + "description": "The thread was not found or is not accessible.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "429": { + "description": "The request rate limit has been exceeded.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, - "x-oai-streaming": { - "request_field": "stream", - "response_status_code": 201 - }, "x-oaiMeta": { - "name": "Create an agent session" + "group": "chatkit", + "beta": true, + "path": "threads/list-items for the specified thread.", + "examples": { + "request": { + "curl": "curl \"https://api.openai.com/v1/chatkit/threads/cthr_abc123/items?limit=3\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const thread of client.beta.chatkit.threads.listItems('cthr_123')) {\n console.log(thread);\n}\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\npage = client.beta.chatkit.threads.list_items(\n thread_id=\"cthr_123\",\n)\npage = page.data[0]\nprint(page)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n client := openai.NewClient()\n page, err := client.Beta.ChatKit.Threads.ListItems(\n context.TODO(),\n \"cthr_123\",\n openai.BetaChatKitThreadListItemsParams{\n\n },\n )\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", page)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\npage = openai.beta.chatkit.threads.list_items(\"cthr_123\")\n\nputs(page)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadListItemsPage;\nimport com.openai.models.beta.chatkit.threads.ThreadListItemsParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadListItemsPage page = client.beta().chatkit().threads().listItems(\"cthr_123\");\n }\n}\n" + }, + "response": "{\n \"data\": [\n {\n \"id\": \"cthi_user_001\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"chatkit.user_message\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"I need help debugging an onboarding issue.\"\n }\n ],\n \"attachments\": [],\n \"created_at\": 1712345600,\n \"thread_id\": \"cthr_abc123\",\n \"inference_options\": null\n },\n {\n \"id\": \"cthi_assistant_002\",\n \"object\": \"chatkit.thread_item\",\n \"type\": \"chatkit.assistant_message\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Let's start by confirming the workflow version you deployed.\",\n \"annotations\": []\n }\n ],\n \"created_at\": 1712345601,\n \"thread_id\": \"cthr_abc123\"\n }\n ],\n \"has_more\": false,\n \"object\": \"list\",\n \"first_id\": \"cthi_user_001\",\n \"last_id\": \"cthi_assistant_002\"\n}\n" + } } } }, - "/agents/sessions/{session_id}": { + "/chatkit/threads/{thread_id}": { "get": { - "operationId": "retrieveAgentSession", - "summary": "Retrieves the current state of a managed agent session. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", - "description": "Retrieves the current state of a managed agent session.", - "tags": [ - "Agents" - ], + "summary": "Retrieve a ChatKit thread", + "description": "Retrieve a ChatKit thread by its identifier.", + "operationId": "GetThreadMethod", "parameters": [ { - "name": "session_id", + "name": "thread_id", "in": "path", + "description": "Identifier of the ChatKit thread to retrieve.", "required": true, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session." + "example": "cthr_123", + "type": "string" + } } ], "responses": { "200": { - "description": "The requested session.", + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionResource" + "$ref": "#/components/schemas/ThreadResource" } } } }, "400": { - "description": "The request was invalid.", + "description": "The request is invalid or the required ChatKit beta header is missing or invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authentication or project context was missing.", + "404": { + "description": "The thread was not found or is not accessible.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "403": { - "description": "The API key lacks the required Responses permission.", + "429": { + "description": "The request rate limit has been exceeded.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } - }, - "404": { - "description": "The requested session or event was not found.", + } + }, + "x-oaiMeta": { + "group": "chatkit", + "beta": true, + "path": "threads/retrieve", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/chatkit/threads/cthr_abc123 \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst chatkitThread = await client.beta.chatkit.threads.retrieve('cthr_123');\n\nconsole.log(chatkitThread.id);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nchatkit_thread = client.beta.chatkit.threads.retrieve(\n \"cthr_123\",\n)\nprint(chatkit_thread.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n chatkitThread, err := client.Beta.ChatKit.Threads.Get(context.TODO(), \"cthr_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", chatkitThread.ID)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nchatkit_thread = openai.beta.chatkit.threads.retrieve(\"cthr_123\")\n\nputs(chatkit_thread)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ChatKitThread;\nimport com.openai.models.beta.chatkit.threads.ThreadRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ChatKitThread chatkitThread = client.beta().chatkit().threads().retrieve(\"cthr_123\");\n }\n}\n" + }, + "response": "{\n \"id\": \"cthr_abc123\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Customer escalation\",\n \"created_at\": 1712345600,\n \"status\": {\n \"type\": \"active\"\n },\n \"user\": \"user_123\"\n}\n" + } + } + }, + "delete": { + "summary": "Delete a ChatKit thread", + "description": "Delete a ChatKit thread along with its items and stored attachments.", + "operationId": "DeleteThreadMethod", + "parameters": [ + { + "name": "thread_id", + "in": "path", + "description": "Identifier of the ChatKit thread to delete.", + "required": true, + "schema": { + "example": "cthr_123", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/DeletedThreadResource" } } } }, - "409": { - "description": "The request conflicted with the current session state.", + "400": { + "description": "The request is invalid or the required ChatKit beta header is missing or invalid.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "500": { - "description": "An internal error occurred.", + "404": { + "description": "The thread was not found or is not accessible.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "503": { - "description": "The service is temporarily unavailable.", + "429": { + "description": "The request rate limit has been exceeded.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse-2" + "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-oaiMeta": { - "name": "Retrieve an agent session" + "beta": true, + "examples": { + "response": "{\n \"id\": \"cthr_123\",\n \"object\": \"chatkit.thread.deleted\",\n \"deleted\": true\n}\n", + "request": { + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\nconst thread = await client.beta.chat_kit.threads.delete('cthr_123');\n\nconsole.log(thread.id);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nthread = client.beta.chat_kit.threads.delete(\n \"cthr_123\",\n)\nprint(thread.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n thread, err := client.Beta.ChatKit.Threads.Delete(context.TODO(), \"cthr_123\")\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", thread.ID)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nthread = openai.beta.chat_kit.threads.delete(\"cthr_123\")\n\nputs(thread)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chat_kit.threads.ThreadDeleteParams;\nimport com.openai.models.beta.chat_kit.threads.ThreadDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadDeleteResponse thread = client.beta().chat_kit().threads().delete(\"cthr_123\");\n }\n}\n" + } + }, + "group": "chatkit", + "path": "threads/delete" } - }, - "post": { - "operationId": "updateAgentSession", - "summary": "Updates session metadata. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", - "description": "Updates session metadata. Omitted fields are unchanged.", - "tags": [ - "Agents" - ], + } + }, + "/chatkit/threads": { + "get": { + "summary": "List ChatKit threads", + "description": "List ChatKit threads with optional pagination and user filters.", + "operationId": "ListThreadsMethod", "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "description": "Maximum number of thread items to return. Defaults to 20.", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "maximum": 100 + } + }, + { + "name": "order", + "in": "query", + "description": "Sort order for results by creation time. Defaults to `desc`.", + "required": false, + "schema": { + "$ref": "#/components/schemas/OrderEnum" + } + }, + { + "name": "after", + "in": "query", + "description": "List items created after this thread item ID. Defaults to null for the first page.", + "required": false, + "schema": { + "description": "List items created after this thread item ID. Defaults to null for the first page.", + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "description": "List items created before this thread item ID. Defaults to null for the newest results.", + "required": false, + "schema": { + "description": "List items created before this thread item ID. Defaults to null for the newest results.", + "type": "string" + } + }, + { + "name": "user", + "in": "query", + "description": "Filter threads that belong to this user identifier. Defaults to null to return all users.", + "required": false, "schema": { + "description": "Filter threads that belong to this user identifier. Defaults to null to return all users.", "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 1, + "maxLength": 512 + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ThreadListResource" + } + } + } + }, + "400": { + "description": "The request is invalid or the required ChatKit beta header is missing or invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "The thread specified by after was not found or is not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "The request rate limit has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "x-oaiMeta": { + "group": "chatkit", + "beta": true, + "path": "list-threads scope.", + "examples": { + "request": { + "curl": "curl \"https://api.openai.com/v1/chatkit/threads?limit=2&order=desc\" \\\n -H \"OpenAI-Beta: chatkit_beta=v1\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from 'openai';\n\nconst client = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const chatkitThread of client.beta.chatkit.threads.list()) {\n console.log(chatkitThread.id);\n}\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\npage = client.beta.chatkit.threads.list()\npage = page.data[0]\nprint(page.id)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n)\n\nfunc main() {\n client := openai.NewClient()\n page, err := client.Beta.ChatKit.Threads.List(context.TODO(), openai.BetaChatKitThreadListParams{\n\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", page)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\npage = openai.beta.chatkit.threads.list\n\nputs(page)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.beta.chatkit.threads.ThreadListPage;\nimport com.openai.models.beta.chatkit.threads.ThreadListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n ThreadListPage page = client.beta().chatkit().threads().list();\n }\n}\n" }, - "description": "The ID of the session." + "response": "{\n \"data\": [\n {\n \"id\": \"cthr_abc123\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Customer escalation\",\n \"created_at\": 1712345600,\n \"status\": {\n \"type\": \"active\"\n },\n \"user\": \"user_123\"\n },\n {\n \"id\": \"cthr_def456\",\n \"object\": \"chatkit.thread\",\n \"title\": \"Demo feedback\",\n \"created_at\": 1712345600,\n \"status\": {\n \"type\": \"active\"\n },\n \"user\": \"user_456\"\n }\n ],\n \"has_more\": false,\n \"object\": \"list\",\n \"first_id\": \"cthr_abc123\",\n \"last_id\": \"cthr_def456\"\n}\n" } + } + } + }, + "/decisions": { + "post": { + "operationId": "createDecision", + "summary": "Create a decision", + "description": "Use this endpoint to quickly answer classification or scoring questions about some input. You can ask multiple questions in one request.", + "tags": [ + "Decisions" ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateAgentSessionParams" + "$ref": "#/components/schemas/DecisionRequest" } } - } + }, + "required": true }, "responses": { "200": { - "description": "The updated session.", + "description": "The answers and token usage.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionResource" + "$ref": "#/components/schemas/DecisionResponse" + } + } + } + } + }, + "x-oaiMeta": { + "group": "decisions", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/decisions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-luna\",\n \"input\": \"The package arrived with a broken screen.\",\n \"questions\": [\n {\n \"type\": \"predicate\",\n \"name\": \"damaged\",\n \"instructions\": \"Does the customer report a damaged item?\"\n }\n ]\n }'\n" + }, + "response": "{\n \"model\": \"gpt-6-luna\",\n \"answers\": [\n {\"type\": \"predicate\", \"name\": \"damaged\", \"probability\": 0.95}\n ],\n \"usage\": {\n \"input_tokens\": 42,\n \"input_tokens_details\": {\"cached_tokens\": 0, \"cache_write_tokens\": 0},\n \"output_tokens\": 0,\n \"output_tokens_details\": {\"reasoning_tokens\": 0},\n \"total_tokens\": 42\n }\n}\n" + } + } + } + }, + "/agents/automations": { + "post": { + "operationId": "createAgentAutomation", + "summary": "Create an automation", + "description": "Saves an active automation without invoking it immediately.", + "tags": [ + "Agents" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAutomationParams" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The created automation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AutomationResource" } } } @@ -20872,7 +27772,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -20921,38 +27821,118 @@ } } } - }, - "x-oaiMeta": { - "name": "Update an agent session" } }, - "delete": { - "operationId": "deleteAgentSession", - "summary": "Removes a managed agent session from the public API and returns a deletion confirmation. Physical cleanup may continue asynchronously. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", - "description": "Removes a managed agent session from the public API and returns a deletion confirmation. Physical cleanup may continue asynchronously.", + "get": { + "operationId": "listAgentAutomations", + "summary": "List automations", + "description": "Lists project-owned automations, optionally filtered by target session.", "tags": [ "Agents" ], "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, { "name": "session_id", - "in": "path", - "required": true, + "in": "query", + "required": false, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the session." + "description": "Matches existing-session targets, including agent-created automations." } ], "responses": { "200": { - "description": "The deleted session.", + "description": "The automations.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedSessionResource" + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AutomationResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." } } } @@ -20978,7 +27958,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -21017,6 +27997,16 @@ } } }, + "501": { + "description": "Automation listing is not implemented.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "503": { "description": "The service is temporarily unavailable.", "content": { @@ -21027,93 +28017,36 @@ } } } - }, - "x-oaiMeta": { - "name": "Delete an agent session" } } }, - "/agents/sessions/{session_id}/artifacts": { + "/agents/automations/{automation_id}": { "get": { - "operationId": "listAgentSessionArtifacts", - "summary": "Lists immutable artifacts published by completed hosted session turns. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", - "description": "Lists immutable artifacts published by completed hosted session turns.", + "operationId": "getAgentAutomation", + "summary": "Get an automation", + "description": "Retrieves a project-owned automation.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam" - }, - "description": "Sort by creation time and ID. Defaults to descending." - }, - { - "name": "environment_id", - "in": "query", - "required": false, - "schema": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Restrict the listing to artifacts produced by this environment." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 1, - "maximum": 100 - }, - "description": "The maximum number of artifacts to return, between 1 and 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576 - }, - "description": "Return artifacts after this immutable artifact ID." + } } ], "responses": { "200": { - "description": "A page of durable session artifacts.", + "description": "Successful response.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionArtifactListResource", - "description": "A page of durable artifacts published by a session." + "$ref": "#/components/schemas/AutomationResource" } } } @@ -21139,7 +28072,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -21188,51 +28121,44 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent session artifacts" } - } - }, - "/agents/sessions/{session_id}/artifacts/{artifact_id}": { - "get": { - "operationId": "retrieveAgentSessionArtifact", - "summary": "Retrieves immutable metadata for one durable session artifact. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", - "description": "Retrieves immutable metadata for one durable session artifact.", + }, + "post": { + "operationId": "updateAgentAutomation", + "summary": "Update an automation", + "description": "Updates supplied fields; target and metadata replace the whole field.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session that owns the artifact." - }, - { - "name": "artifact_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The immutable session artifact ID." + } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateAutomationParams" + } + } + }, + "required": true + }, "responses": { "200": { - "description": "The requested session artifact.", + "description": "Successful response.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionArtifactResource" + "$ref": "#/components/schemas/AutomationResource" } } } @@ -21258,7 +28184,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -21307,49 +28233,34 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve an agent session artifact" } }, "delete": { - "operationId": "deleteAgentSessionArtifact", - "summary": "Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", - "description": "Deletes an immutable session artifact without deleting its live environment file or original Files API object.", + "operationId": "deleteAgentAutomation", + "summary": "Delete an automation", + "description": "Deletes the automation and prevents future invocations without deleting its target session.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session that owns the artifact." - }, - { - "name": "artifact_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The immutable session artifact ID." + } } ], "responses": { "200": { - "description": "The deleted session artifact.", + "description": "Successful response.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedSessionArtifactResource" + "$ref": "#/components/schemas/DeletedAutomationResource" } } } @@ -21375,7 +28286,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -21424,52 +28335,36 @@ } } } - }, - "x-oaiMeta": { - "name": "Delete an agent session artifact" } } }, - "/agents/sessions/{session_id}/artifacts/{artifact_id}/content": { - "get": { - "operationId": "retrieveAgentSessionArtifactContent", - "summary": "Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", - "description": "Downloads immutable session artifact bytes after the execution environment expires.", + "/agents/automations/{automation_id}/pause": { + "post": { + "operationId": "pauseAgentAutomation", + "summary": "Pause an automation", + "description": "Pauses future scheduled delivery without stopping an active session.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "description": "The ID of the session that owns the artifact." - }, - { - "name": "artifact_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The immutable session artifact ID." + } } ], "responses": { "200": { - "description": "The immutable artifact contents.", + "description": "Successful response.", "content": { - "application/octet-stream": { + "application/json": { "schema": { - "type": "string", - "format": "binary" + "$ref": "#/components/schemas/AutomationResource" } } } @@ -21495,7 +28390,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -21544,40 +28439,36 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve agent session artifact content" } } }, - "/agents/sessions/{session_id}/events": { - "get": { - "operationId": "listAgentSessionEvents", - "summary": "Streams live events for an agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).", - "description": "Streams live events for an agent session.", + "/agents/automations/{automation_id}/resume": { + "post": { + "operationId": "resumeAgentAutomation", + "summary": "Resume an automation", + "description": "Resumes scheduled delivery; one-time automations without a pending invocation require a future run_at.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the session." + } } ], "responses": { "200": { - "description": "A live stream of session events.", + "description": "Successful response.", "content": { - "text/event-stream": { + "application/json": { "schema": { - "$ref": "#/components/schemas/SessionEvent" + "$ref": "#/components/schemas/AutomationResource" } } } @@ -21603,7 +28494,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -21652,58 +28543,39 @@ } } } - }, - "x-oai-streaming": { - "request_field": null, - "response_status_code": 200 - }, - "x-oaiMeta": { - "name": "Stream agent session events" } - }, + } + }, + "/agents/automations/{automation_id}/invocations": { "post": { - "operationId": "createAgentSessionEvents", - "summary": "Submits message, cancellation, or tool-result events to a managed agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).", - "description": "Submits message, cancellation, or tool-result events to a managed agent session.", + "operationId": "createAgentAutomationInvocation", + "summary": "Invoke an automation", + "description": "Queues a manual delivery without changing the saved schedule.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "Idempotency-Key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "description": "An optional client-generated key that makes retries of submitted messages idempotent." + } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateSessionEventsParams" + "responses": { + "200": { + "description": "The queued invocation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AutomationInvocationResource" + } } } - } - }, - "responses": { - "202": { - "description": "The events were accepted." }, "400": { "description": "The request was invalid.", @@ -21726,7 +28598,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -21775,31 +28647,25 @@ } } } - }, - "x-oaiMeta": { - "name": "Create agent session input events" } - } - }, - "/agents/sessions/{session_id}/items": { + }, "get": { - "operationId": "listAgentSessionItems", - "summary": "Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).", - "description": "Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history.", + "operationId": "listAgentAutomationInvocations", + "summary": "List automation invocations", + "description": "Lists delivery records for a project-owned automation.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the session." + } }, { "name": "limit", @@ -21838,11 +28704,60 @@ ], "responses": { "200": { - "description": "A page of session items.", + "description": "The invocation history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionItemListResource" + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AutomationInvocationResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." } } } @@ -21868,7 +28783,7 @@ } }, "403": { - "description": "The API key lacks the required Responses permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -21907,6 +28822,16 @@ } } }, + "501": { + "description": "This operation is not implemented.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "503": { "description": "The service is temporarily unavailable.", "content": { @@ -21917,75 +28842,46 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent session items" } } }, - "/agents/sessions/{session_id}/turns": { + "/agents/automations/{automation_id}/invocations/{invocation_id}": { "get": { - "operationId": "listAgentSessionTurns", - "summary": "Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).", - "description": "Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order.", + "operationId": "getAgentAutomationInvocation", + "summary": "Get an automation invocation", + "description": "Retrieves a delivery record for a project-owned automation.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", + "name": "automation_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "The ID of the session." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100, - "default": 20 - }, - "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "The order in which resources are returned. Defaults to `desc`." + } }, { - "name": "after", - "in": "query", - "required": false, + "name": "invocation_id", + "in": "path", + "required": true, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 - }, - "description": "Return resources after this resource ID in the selected order." + } } ], "responses": { "200": { - "description": "A page of session turns.", + "description": "The invocation.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SessionTurnListResource", - "description": "A page of turns from an agent session or subagent." + "$ref": "#/components/schemas/AutomationInvocationResource" } } } @@ -22010,6 +28906,16 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { "description": "The requested session or event was not found.", "content": { @@ -22050,51 +28956,70 @@ } } } - }, - "x-oaiMeta": { - "name": "List agent session turns" } } }, - "/agents/sessions/{session_id}/turns/{turn_id}": { + "/agents/environments": { "get": { - "operationId": "retrieveAgentSessionTurn", - "summary": "Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).", - "description": "Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session.", + "operationId": "listAgentEnvironments", + "summary": "List agent environments", + "description": "Lists OpenAI-hosted environments owned by the authenticated principal. Requires access to the prewarming beta.", "tags": [ "Agents" ], "parameters": [ { - "name": "session_id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, "schema": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 }, - "description": "The ID of the session that owns the turn." + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { - "name": "turn_id", - "in": "path", - "required": true, + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, "schema": { "type": "string", "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the turn." + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "type", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/EnvironmentTypeParam" + }, + "description": "The hosting type to list. Defaults to `openai_hosted`." } ], "responses": { "200": { - "description": "The requested turn.", + "description": "A page of owned environments.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TurnResource" + "$ref": "#/components/schemas/AgentEnvironmentListResource", + "description": "An ID-paginated list of owned environments." } } } @@ -22119,8 +29044,18 @@ } } }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, "404": { - "description": "The requested session or event was not found.", + "description": "The requested environment or referenced resource was not found.", "content": { "application/json": { "schema": { @@ -22130,7 +29065,7 @@ } }, "409": { - "description": "The request conflicted with the current session state.", + "description": "The request conflicted with the current environment state.", "content": { "application/json": { "schema": { @@ -22159,74 +29094,45 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve an agent session turn" } - } - }, - "/vaults": { - "get": { - "operationId": "listVaults", - "summary": "Lists vaults using ID-based pagination. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Lists vaults using ID-based pagination.", + }, + "post": { + "operationId": "createAgentEnvironment", + "summary": "Create an agent environment", + "description": "Creates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta.", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 0 - }, - "description": "The maximum number of resources to return. Defaults to 20. Values are clamped between 1 and 100." - }, - { - "name": "status", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/VaultStatusFilterParam" - }, - "description": "Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default." - }, - { - "name": "after", - "in": "query", + "name": "Idempotency-Key", + "in": "header", "required": false, "schema": { "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 1, + "maxLength": 256 }, - "description": "Return resources after this resource ID in the selected order." + "description": "Deduplicates creation for 24 hours within the authenticated organization, project, and creator. Retry the same JSON parameters with the same key to retrieve the original environment in its current state. Different parameters or an incomplete hosted creation return 409. Deleted environments are not recreated. After retention expires, the key may create a new environment. Without this header, each request creates a new environment." } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAgentEnvironmentParams" + } + } + }, + "required": true + }, "responses": { - "200": { - "description": "A page of vaults.", + "201": { + "description": "The created OpenAI-hosted environment.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultListResource", - "description": "A page of vaults." + "$ref": "#/components/schemas/PublicEnvironmentResource" } } } @@ -22252,7 +29158,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -22262,7 +29168,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested environment or referenced resource was not found.", "content": { "application/json": { "schema": { @@ -22272,7 +29178,17 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current environment state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "429": { + "description": "The request exceeded a rate or capacity limit.", "content": { "application/json": { "schema": { @@ -22301,34 +29217,37 @@ } } } - }, - "x-oaiMeta": { - "name": "List vaults" } - }, - "post": { - "operationId": "createVault", - "summary": "Creates a vault for the current project. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Creates a vault for the current project.", + } + }, + "/agents/environments/{environment_id}": { + "get": { + "operationId": "retrieveAgentEnvironment", + "summary": "Retrieve an agent environment", + "description": "Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle).", "tags": [ - "Vaults" + "Agents" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVaultParams" - } - } + "parameters": [ + { + "name": "environment_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the environment." } - }, + ], "responses": { - "201": { - "description": "The created vault.", + "200": { + "description": "The requested environment.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultResource" + "$ref": "#/components/schemas/PublicEnvironmentResource" } } } @@ -22354,7 +29273,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -22364,7 +29283,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -22374,7 +29293,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -22403,23 +29322,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Create a vault" } } }, - "/vaults/{vault_id}": { + "/agents/environments/{environment_id}/files": { "get": { - "operationId": "retrieveVault", - "summary": "Retrieves a vault by its ID. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Retrieves a vault by its ID.", + "operationId": "listAgentEnvironmentFiles", + "summary": "List agent environment files", + "description": "Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "environment_id", "in": "path", "required": true, "schema": { @@ -22427,16 +29343,65 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the environment." + }, + { + "name": "path", + "in": "query", + "required": false, + "schema": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Restrict the listing to this absolute workspace directory." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "minimum": 1, + "maximum": 100 + }, + "description": "The maximum number of files to return, between 1 and 100." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam" + }, + "description": "Sort by case-sensitive path components. Defaults to descending." + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The opaque token from the previous page. Keep the same path, order, and limit." } ], "responses": { "200": { - "description": "The requested vault.", + "description": "A page of live environment files.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultResource" + "$ref": "#/components/schemas/EnvironmentFileListResource" } } } @@ -22462,7 +29427,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -22472,7 +29437,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -22482,7 +29447,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -22511,21 +29476,18 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve a vault" } }, - "delete": { - "operationId": "deleteVault", - "summary": "Deletes a vault and all its credentials. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Deletes a vault and all its credentials.", + "post": { + "operationId": "createAgentEnvironmentFile", + "summary": "Write an agent environment file", + "description": "Copies inline bytes or a Files API file into a connected execution environment, replacing an existing regular file at the same path. Upload between turns and wait for success before starting the next turn. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "environment_id", "in": "path", "required": true, "schema": { @@ -22533,16 +29495,25 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the environment." } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HostedEnvironmentFileParam" + } + } + } + }, "responses": { - "200": { - "description": "The deleted vault.", + "201": { + "description": "The written live environment file.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedVaultResource" + "$ref": "#/components/schemas/EnvironmentFileResource" } } } @@ -22568,7 +29539,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -22578,7 +29549,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -22588,7 +29559,17 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "429": { + "description": "The Files API rate limit for your user has been exceeded.", "content": { "application/json": { "schema": { @@ -22617,23 +29598,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Delete a vault" } } }, - "/vaults/{vault_id}/credentials": { + "/agents/sessions/{session_id}/subagents": { "get": { - "operationId": "listVaultCredentials", - "summary": "Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Lists a vault's credentials using ID-based pagination without returning secret values.", + "operationId": "listAgentSessionSubagents", + "summary": "List session subagents", + "description": "Lists subagents in a session, including nested and closed subagents. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -22641,40 +29619,30 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "$ref": "#/components/schemas/ListOrderParam", - "default": "desc" - }, - "description": "Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`." + "description": "The ID of the session." }, { "name": "limit", "in": "query", "required": false, "schema": { - "type": [ - "integer", - "null" - ], + "type": "integer", "format": "int64", - "minimum": 0 + "minimum": 1, + "maximum": 100, + "default": 20 }, - "description": "The maximum number of resources to return. Defaults to 20. Values are clamped between 1 and 100." + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { - "name": "status", + "name": "order", "in": "query", "required": false, "schema": { - "$ref": "#/components/schemas/VaultStatusFilterParam" + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" }, - "description": "Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default." + "description": "The order in which resources are returned. Defaults to `desc`." }, { "name": "after", @@ -22690,12 +29658,60 @@ ], "responses": { "200": { - "description": "A page of vault credentials.", + "description": "The requested subagents.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultCredentialListResource", - "description": "A page of credentials in a vault." + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SubagentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." } } } @@ -22721,7 +29737,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -22731,7 +29747,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -22741,7 +29757,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -22770,21 +29786,20 @@ } } } - }, - "x-oaiMeta": { - "name": "List vault credentials" } - }, - "post": { - "operationId": "createVaultCredential", - "summary": "Creates a vault credential. Secret values are write-only and are never returned. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Creates a vault credential. Secret values are write-only and are never returned.", + } + }, + "/agents/sessions/{session_id}/subagents/{subagent_id}": { + "get": { + "operationId": "retrieveAgentSessionSubagent", + "summary": "Retrieve a session subagent", + "description": "Retrieves a subagent belonging to this session. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -22792,25 +29807,27 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session." + }, + { + "name": "subagent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the subagent in this session." } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVaultCredentialParams" - } - } - } - }, "responses": { - "201": { - "description": "The created vault credential without secret values.", + "200": { + "description": "The requested subagent.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultCredentialResource" + "$ref": "#/components/schemas/SubagentResource" } } } @@ -22836,7 +29853,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -22846,7 +29863,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -22856,7 +29873,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -22885,23 +29902,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Create a vault credential" } } }, - "/vaults/{vault_id}/credentials/{credential_id}": { + "/agents/sessions/{session_id}/subagents/{subagent_id}/items": { "get": { - "operationId": "retrieveVaultCredential", - "summary": "Retrieves vault credential metadata without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Retrieves vault credential metadata without returning secret values.", + "operationId": "listAgentSessionSubagentItems", + "summary": "List subagent items", + "description": "Lists this subagent's own items across all of its turns. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -22909,10 +29923,10 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session." }, { - "name": "credential_id", + "name": "subagent_id", "in": "path", "required": true, "schema": { @@ -22920,16 +29934,50 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault credential." + "description": "The ID of the subagent in this session." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." } ], "responses": { "200": { - "description": "The requested vault credential without secret values.", + "description": "The requested subagent history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultCredentialResource" + "$ref": "#/components/schemas/SessionItemListResource" } } } @@ -22955,7 +30003,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -22965,7 +30013,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -22975,7 +30023,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -23004,21 +30052,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Retrieve a vault credential" } - }, - "post": { - "operationId": "rotateVaultCredential", - "summary": "Rotates a vault credential's write-only secret and returns only credential metadata. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Rotates a vault credential's write-only secret and returns only credential metadata.", + } + }, + "/agents/sessions/{session_id}/subagents/{subagent_id}/turns": { + "get": { + "operationId": "listAgentSessionSubagentTurns", + "summary": "List subagent turns", + "description": "Lists all turns of this subagent, including turns after a resume. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -23026,10 +30073,10 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session." }, { - "name": "credential_id", + "name": "subagent_id", "in": "path", "required": true, "schema": { @@ -23037,25 +30084,51 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault credential." + "description": "The ID of the subagent in this session." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RotateVaultCredentialParams" - } - } - } - }, "responses": { "200": { - "description": "The rotated vault credential without secret values.", + "description": "The requested subagent history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VaultCredentialResource" + "$ref": "#/components/schemas/SessionTurnListResource", + "description": "A page of turns from an agent session or subagent." } } } @@ -23081,7 +30154,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -23091,7 +30164,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -23101,7 +30174,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -23130,21 +30203,20 @@ } } } - }, - "x-oaiMeta": { - "name": "Rotate a vault credential" } - }, - "delete": { - "operationId": "deleteVaultCredential", - "summary": "Deletes a vault credential. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", - "description": "Deletes a vault credential.", + } + }, + "/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}": { + "get": { + "operationId": "retrieveAgentSessionSubagentTurn", + "summary": "Retrieve a subagent turn", + "description": "Retrieves a turn belonging to this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ - "Vaults" + "Agents" ], "parameters": [ { - "name": "vault_id", + "name": "session_id", "in": "path", "required": true, "schema": { @@ -23152,10 +30224,10 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault." + "description": "The ID of the session." }, { - "name": "credential_id", + "name": "subagent_id", "in": "path", "required": true, "schema": { @@ -23163,16 +30235,27 @@ "minLength": 0, "maxLength": 1048576 }, - "description": "The ID of the vault credential." + "description": "The ID of the subagent in this session." + }, + { + "name": "turn_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of a turn belonging to this subagent." } ], "responses": { "200": { - "description": "The deleted vault credential.", + "description": "The requested subagent history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DeletedVaultCredentialResource" + "$ref": "#/components/schemas/TurnResource" } } } @@ -23198,7 +30281,7 @@ } }, "403": { - "description": "The API key lacks the required management permission.", + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { @@ -23208,7 +30291,7 @@ } }, "404": { - "description": "The requested vault or credential was not found.", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { @@ -23218,7 +30301,7 @@ } }, "409": { - "description": "The request conflicted with the current vault state.", + "description": "The request conflicted with the current session state.", "content": { "application/json": { "schema": { @@ -23247,9852 +30330,7071 @@ } } } - }, - "x-oaiMeta": { - "name": "Delete a vault credential" } } }, - "/responses?beta=true": { - "post": { - "operationId": "beta_createResponse", - "tags": [ - "Responses" - ], - "summary": "Creates a model response. Provide [text](https://developers.openai.com/api/docs/guides/text) or\n[image](https://developers.openai.com/api/docs/guides/images-vision) inputs to generate [text](https://developers.openai.com/api/docs/guides/text)\nor [JSON](https://developers.openai.com/api/docs/guides/structured-outputs) outputs. Have the model call\nyour own [custom code](https://developers.openai.com/api/docs/guides/function-calling) or use built-in\n[tools](https://developers.openai.com/api/docs/guides/tools) like [web search](https://developers.openai.com/api/docs/guides/tools-web-search)\nor [file search](https://developers.openai.com/api/docs/guides/tools-file-search) to use your own data\nas input for the model's response.\n", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BetaCreateResponse" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BetaResponse" - } - }, - "text/event-stream": { - "schema": { - "$ref": "#/components/schemas/BetaResponseStreamEvent" - } - } - } - }, - "429": { - "$ref": "#/components/responses/InferenceRateLimited" - }, - "503": { - "$ref": "#/components/responses/InferenceServiceUnavailable" - } - }, - "x-oaiMeta": { - "name": "Create a model response", - "group": "responses", - "path": "create", - "examples": [ - { - "title": "Text input", - "request": { - "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"Tell me a three sentence bedtime story about a unicorn.\"\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: \"Tell me a three sentence bedtime story about a unicorn.\"\n});\n\nconsole.log(response);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=\"Tell me a three sentence bedtime story about a unicorn.\"\n)\n\nprint(response)\n", - "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nOpenAIResponse response = client.CreateResponse(\"Tell me a three sentence bedtime story about a unicorn.\");\n\nConsole.WriteLine(response.GetOutputText());\n" - }, - "response": "{\n \"id\": \"resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b\",\n \"object\": \"response\",\n \"created_at\": 1741476542,\n \"status\": \"completed\",\n \"completed_at\": 1741476543,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 36,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 87,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 123\n },\n \"user\": null,\n \"metadata\": {}\n}\n" - }, - { - "title": "Image input", - "request": { - "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\"type\": \"input_text\", \"text\": \"what is in this image?\"},\n {\n \"type\": \"input_image\",\n \"image_url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"\n }\n ]\n }\n ]\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: [\n { type: \"input_text\", text: \"what is in this image?\" },\n {\n type: \"input_image\",\n image_url:\n \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\",\n },\n ],\n },\n ],\n});\n\nconsole.log(response);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": [\n { \"type\": \"input_text\", \"text\": \"what is in this image?\" },\n {\n \"type\": \"input_image\",\n \"image_url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"\n }\n ]\n }\n ]\n)\n\nprint(response)\n", - "csharp": "using System;\nusing System.Collections.Generic;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nList inputItems =\n[\n ResponseItem.CreateUserMessageItem(\n [\n ResponseContentPart.CreateInputTextPart(\"What is in this image?\"),\n ResponseContentPart.CreateInputImagePart(new Uri(\"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"))\n ]\n )\n];\n\nOpenAIResponse response = client.CreateResponse(inputItems);\n\nConsole.WriteLine(response.GetOutputText());\n" - }, - "response": "{\n \"id\": \"resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41\",\n \"object\": \"response\",\n \"created_at\": 1741476777,\n \"status\": \"completed\",\n \"completed_at\": 1741476778,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 328,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 52,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 380\n },\n \"user\": null,\n \"metadata\": {}\n}\n" - }, - { - "title": "File input", - "request": { - "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\"type\": \"input_text\", \"text\": \"what is in this file?\"},\n {\n \"type\": \"input_file\",\n \"file_url\": \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n \"detail\": \"auto\"\n }\n ]\n }\n ]\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: [\n { type: \"input_text\", text: \"what is in this file?\" },\n {\n type: \"input_file\",\n file_url: \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n detail: \"auto\",\n },\n ],\n },\n ],\n});\n\nconsole.log(response);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": [\n { \"type\": \"input_text\", \"text\": \"what is in this file?\" },\n {\n \"type\": \"input_file\",\n \"file_url\": \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n \"detail\": \"auto\"\n }\n ]\n }\n ]\n)\n\nprint(response)\n" - }, - "response": "{\n \"id\": \"resp_686eef60237881a2bd1180bb8b13de430e34c516d176ff86\",\n \"object\": \"response\",\n \"created_at\": 1752100704,\n \"status\": \"completed\",\n \"completed_at\": 1752100705,\n \"background\": false,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"max_tool_calls\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"id\": \"msg_686eef60d3e081a29283bdcbc4322fd90e34c516d176ff86\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"The file seems to contain excerpts from a letter to the shareholders of Berkshire Hathaway Inc., likely written by Warren Buffett. It covers several topics:\\n\\n1. **Communication Philosophy**: Buffett emphasizes the importance of transparency and candidness in reporting mistakes and successes to shareholders.\\n\\n2. **Mistakes and Learnings**: The letter acknowledges past mistakes in business assessments and management hires, highlighting the importance of correcting errors promptly.\\n\\n3. **CEO Succession**: Mention of Greg Abel stepping in as the new CEO and continuing the tradition of honest communication.\\n\\n4. **Pete Liegl Story**: A detailed account of acquiring Forest River and the relationship with its founder, highlighting trust and effective business decisions.\\n\\n5. **2024 Performance**: Overview of business performance, particularly in insurance and investment activities, with a focus on GEICO's improvement.\\n\\n6. **Tax Contributions**: Discussion of significant tax payments to the U.S. Treasury, credited to shareholders' reinvestments.\\n\\n7. **Investment Strategy**: A breakdown of Berkshire\\u2019s investments in both controlled subsidiaries and marketable equities, along with a focus on long-term holding strategies.\\n\\n8. **American Capitalism**: Reflections on America\\u2019s economic development and Berkshire\\u2019s role within it.\\n\\n9. **Property-Casualty Insurance**: Insights into the P/C insurance business model and its challenges and benefits.\\n\\n10. **Japanese Investments**: Information about Berkshire\\u2019s investments in Japanese companies and future plans.\\n\\n11. **Annual Meeting**: Details about the upcoming annual gathering in Omaha, including schedule changes and new book releases.\\n\\n12. **Personal Anecdotes**: Light-hearted stories about family and interactions, conveying Buffett's personable approach.\\n\\n13. **Financial Performance Data**: Tables comparing Berkshire\\u2019s annual performance to the S&P 500, showing impressive long-term gains.\\n\\nOverall, the letter reinforces Berkshire Hathaway's commitment to transparency, investment in both its businesses and the wider economy, and emphasizes strong leadership and prudent financial management.\"\n }\n ],\n \"role\": \"assistant\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"service_tier\": \"default\",\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_logprobs\": 0,\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 8438,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 398,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 8836\n },\n \"user\": null,\n \"metadata\": {}\n}\n" - }, - { - "title": "Web search", - "request": { - "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"tools\": [{ \"type\": \"web_search_preview\" }],\n \"input\": \"What was a positive news story from today?\"\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n tools: [{ type: \"web_search_preview\" }],\n input: \"What was a positive news story from today?\",\n});\n\nconsole.log(response);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n tools=[{ \"type\": \"web_search_preview\" }],\n input=\"What was a positive news story from today?\",\n)\n\nprint(response)\n", - "csharp": "using System;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"What was a positive news story from today?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n ResponseTool.CreateWebSearchTool()\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" - }, - "response": "{\n \"id\": \"resp_67ccf18ef5fc8190b16dbee19bc54e5f087bb177ab789d5c\",\n \"object\": \"response\",\n \"created_at\": 1741484430,\n \"status\": \"completed\",\n \"completed_at\": 1741484431,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"web_search_call\",\n \"id\": \"ws_67ccf18f64008190a39b619f4c8455ef087bb177ab789d5c\",\n \"status\": \"completed\"\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccf190ca3881909d433c50b1f6357e087bb177ab789d5c\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"As of today, March 9, 2025, one notable positive news story...\",\n \"annotations\": [\n {\n \"type\": \"url_citation\",\n \"start_index\": 442,\n \"end_index\": 557,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n },\n {\n \"type\": \"url_citation\",\n \"start_index\": 962,\n \"end_index\": 1077,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n },\n {\n \"type\": \"url_citation\",\n \"start_index\": 1336,\n \"end_index\": 1451,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n }\n ]\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"web_search_preview\",\n \"domains\": [],\n \"search_context_size\": \"medium\",\n \"user_location\": {\n \"type\": \"approximate\",\n \"city\": null,\n \"country\": \"US\",\n \"region\": null,\n \"timezone\": null\n }\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 328,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 356,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 684\n },\n \"user\": null,\n \"metadata\": {}\n}\n" - }, - { - "title": "File search", - "request": { - "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"tools\": [{\n \"type\": \"file_search\",\n \"vector_store_ids\": [\"vs_1234567890\"],\n \"max_num_results\": 20\n }],\n \"input\": \"What are the attributes of an ancient brown dragon?\"\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n tools: [{\n type: \"file_search\",\n vector_store_ids: [\"vs_1234567890\"],\n max_num_results: 20\n }],\n input: \"What are the attributes of an ancient brown dragon?\",\n});\n\nconsole.log(response);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n tools=[{\n \"type\": \"file_search\",\n \"vector_store_ids\": [\"vs_1234567890\"],\n \"max_num_results\": 20\n }],\n input=\"What are the attributes of an ancient brown dragon?\",\n)\n\nprint(response)\n", - "csharp": "using System;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"What are the attributes of an ancient brown dragon?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n ResponseTool.CreateFileSearchTool(\n vectorStoreIds: [\"vs_1234567890\"],\n maxResultCount: 20\n )\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" - }, - "response": "{\n \"id\": \"resp_67ccf4c55fc48190b71bd0463ad3306d09504fb6872380d7\",\n \"object\": \"response\",\n \"created_at\": 1741485253,\n \"status\": \"completed\",\n \"completed_at\": 1741485254,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"file_search_call\",\n \"id\": \"fs_67ccf4c63cd08190887ef6464ba5681609504fb6872380d7\",\n \"status\": \"completed\",\n \"queries\": [\n \"attributes of an ancient brown dragon\"\n ],\n \"results\": null\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccf4c93e5c81909d595b369351a9d309504fb6872380d7\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The attributes of an ancient brown dragon include...\",\n \"annotations\": [\n {\n \"type\": \"file_citation\",\n \"index\": 320,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 576,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 815,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 815,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1030,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1030,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1156,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1225,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n }\n ]\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"filters\": null,\n \"max_num_results\": 20,\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0.0\n },\n \"vector_store_ids\": [\n \"vs_1234567890\"\n ]\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 18307,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 348,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 18655\n },\n \"user\": null,\n \"metadata\": {}\n}\n" - }, - { - "title": "Streaming", - "request": { - "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"instructions\": \"You are a helpful assistant.\",\n \"input\": \"Hello!\",\n \"stream\": true\n }'\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n instructions=\"You are a helpful assistant.\",\n input=\"Hello!\",\n stream=True\n)\n\nfor event in response:\n print(event)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n instructions: \"You are a helpful assistant.\",\n input: \"Hello!\",\n stream: true,\n});\n\nfor await (const event of response) {\n console.log(event);\n}\n", - "csharp": "using System;\nusing System.ClientModel;\nusing System.Threading.Tasks;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"Hello!\";\n\nResponseCreationOptions options = new()\n{\n Instructions = \"You are a helpful assistant.\",\n};\n\nAsyncCollectionResult responseUpdates = client.CreateResponseStreamingAsync(userInputText, options);\n\nawait foreach (StreamingResponseUpdate responseUpdate in responseUpdates)\n{\n if (responseUpdate is StreamingResponseOutputTextDeltaUpdate outputTextDeltaUpdate)\n {\n Console.Write(outputTextDeltaUpdate.Delta);\n }\n}\n" - }, - "response": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"created_at\":1741290958,\"status\":\"in_progress\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}}}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"created_at\":1741290958,\"status\":\"in_progress\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}}}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"output_index\":0,\"item\":{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"in_progress\",\"role\":\"assistant\",\"content\":[]}}\n\nevent: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"\",\"annotations\":[]}}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"delta\":\"Hi\"}\n\n...\n\nevent: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"text\":\"Hi there! How can I assist you today?\"}\n\nevent: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[]}}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"output_index\":0,\"item\":{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"completed\",\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[]}]}}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"created_at\":1741290958,\"status\":\"completed\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"completed\",\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[]}]}],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":37,\"output_tokens\":11,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":48},\"user\":null,\"metadata\":{}}}\n" - }, - { - "title": "Functions", - "request": { - "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"What is the weather like in Boston today?\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\", \"unit\"]\n }\n }\n ],\n \"tool_choice\": \"auto\"\n }'\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\", \"unit\"],\n }\n }\n]\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n tools=tools,\n input=\"What is the weather like in Boston today?\",\n tool_choice=\"auto\"\n)\n\nprint(response)\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n type: \"function\",\n name: \"get_current_weather\",\n description: \"Get the current weather in a given location\",\n parameters: {\n type: \"object\",\n properties: {\n location: {\n type: \"string\",\n description: \"The city and state, e.g. San Francisco, CA\",\n },\n unit: { type: \"string\", enum: [\"celsius\", \"fahrenheit\"] },\n },\n required: [\"location\", \"unit\"],\n },\n },\n];\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n tools: tools,\n input: \"What is the weather like in Boston today?\",\n tool_choice: \"auto\",\n});\n\nconsole.log(response);\n", - "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nResponseTool getCurrentWeatherFunctionTool = ResponseTool.CreateFunctionTool(\n functionName: \"get_current_weather\",\n functionDescription: \"Get the current weather in a given location\",\n functionParameters: BinaryData.FromString(\"\"\"\n {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}\n },\n \"required\": [\"location\", \"unit\"]\n }\n \"\"\"\n )\n);\n\nstring userInputText = \"What is the weather like in Boston today?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n getCurrentWeatherFunctionTool\n },\n ToolChoice = ResponseToolChoice.CreateAutoChoice(),\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n" - }, - "response": "{\n \"id\": \"resp_67ca09c5efe0819096d0511c92b8c890096610f474011cc0\",\n \"object\": \"response\",\n \"created_at\": 1741294021,\n \"status\": \"completed\",\n \"completed_at\": 1741294022,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"function_call\",\n \"id\": \"fc_67ca09c6bedc8190a7abfec07b1a1332096610f474011cc0\",\n \"call_id\": \"call_unLAR8MvFNptuiZK6K6HCy5k\",\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\",\\\"unit\\\":\\\"celsius\\\"}\",\n \"status\": \"completed\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"description\": \"Get the current weather in a given location\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\",\n \"unit\"\n ]\n },\n \"strict\": true\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 291,\n \"output_tokens\": 23,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 314\n },\n \"user\": null,\n \"metadata\": {}\n}\n" - }, - { - "title": "Reasoning", - "request": { - "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"How much wood would a woodchuck chuck?\",\n \"reasoning\": {\n \"effort\": \"high\"\n }\n }'\n", - "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: \"How much wood would a woodchuck chuck?\",\n reasoning: {\n effort: \"high\"\n }\n});\n\nconsole.log(response);\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=\"How much wood would a woodchuck chuck?\",\n reasoning={\n \"effort\": \"high\"\n }\n)\n\nprint(response)\n", - "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"How much wood would a woodchuck chuck?\";\n\nResponseCreationOptions options = new()\n{\n ReasoningOptions = new()\n {\n ReasoningEffortLevel = ResponseReasoningEffortLevel.High,\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" - }, - "response": "{\n \"id\": \"resp_67ccd7eca01881908ff0b5146584e408072912b2993db808\",\n \"object\": \"response\",\n \"created_at\": 1741477868,\n \"status\": \"completed\",\n \"completed_at\": 1741477869,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd7f7b5848190a6f3e95d809f6b44072912b2993db808\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The classic tongue twister...\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": \"high\",\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 81,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 1035,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 832\n },\n \"total_tokens\": 1116\n },\n \"user\": null,\n \"metadata\": {}\n}\n" - } - ] - }, - "parameters": [ - { - "name": "openai-beta", - "in": "header", - "required": false, - "description": "Optional beta features to enable for this request.", - "style": "simple", - "explode": false, - "schema": { - "type": "array", - "x-stainless-param": "betas", - "items": { - "type": "string", - "enum": [ - "responses_multi_agent=v1" - ] - } - } - } - ] - } - }, - "/responses/{response_id}?beta=true": { + "/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items": { "get": { - "operationId": "beta_getResponse", + "operationId": "listAgentSessionSubagentTurnItems", + "summary": "List subagent turn items", + "description": "Lists items belonging to one turn of this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent).", "tags": [ - "Responses" + "Agents" ], - "summary": "Retrieves a model response with the given ID.\n", "parameters": [ { + "name": "session_id", "in": "path", - "name": "response_id", "required": true, "schema": { "type": "string", - "example": "resp_677efb5139a88190b512bc3fef8e535d" + "minLength": 0, + "maxLength": 1048576 }, - "description": "The ID of the response to retrieve." + "description": "The ID of the session." }, { - "in": "query", - "name": "include", + "name": "subagent_id", + "in": "path", + "required": true, "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BetaIncludeEnum" - } + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "description": "Additional fields to include in the response. See the `include`\nparameter for Response creation above for more information.\n" + "description": "The ID of the subagent in this session." }, { - "in": "query", - "name": "stream", + "name": "turn_id", + "in": "path", + "required": true, "schema": { - "type": "boolean" + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "description": "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](https://developers.openai.com/api/reference/resources/responses/streaming-events)\nfor more information.\n" + "description": "The ID of a turn belonging to this subagent." }, { + "name": "limit", "in": "query", - "name": "starting_after", + "required": false, "schema": { - "type": "integer" + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 }, - "description": "The sequence number of the event after which to start streaming.\n" + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { + "name": "order", "in": "query", - "name": "include_obfuscation", + "required": false, "schema": { - "type": "boolean" + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" }, - "description": "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events\nto normalize payload sizes as a mitigation to certain side-channel\nattacks. These obfuscation fields are included by default, but add a\nsmall amount of overhead to the data stream. You can set\n`include_obfuscation` to false to optimize for bandwidth if you trust\nthe network links between your application and the OpenAI API.\n" + "description": "The order in which resources are returned. Defaults to `desc`." }, { - "name": "openai-beta", - "in": "header", + "name": "after", + "in": "query", "required": false, - "description": "Optional beta features to enable for this request.", - "style": "simple", - "explode": false, "schema": { - "type": "array", - "x-stainless-param": "betas", - "items": { - "type": "string", - "enum": [ - "responses_multi_agent=v1" - ] - } - } + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." } ], "responses": { "200": { - "description": "OK", + "description": "The requested subagent history.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BetaResponse" + "$ref": "#/components/schemas/SessionItemListResource" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "Get a model response", - "group": "responses", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/responses/resp_123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.retrieve(\"resp_123\");\nconsole.log(response);\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.retrieve(\"resp_123\")\nprint(response)\n" - }, - "response": "{\n \"id\": \"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44\",\n \"object\": \"response\",\n \"created_at\": 1741386163,\n \"status\": \"completed\",\n \"completed_at\": 1741386164,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Silent circuits hum, \\nThoughts emerge in data streams— \\nDigital dawn breaks.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 32,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 18,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 50\n },\n \"user\": null,\n \"metadata\": {}\n}\n" - } - } - }, - "delete": { - "operationId": "beta_deleteResponse", - "tags": [ - "Responses" - ], - "summary": "Deletes a model response with the given ID.\n", - "parameters": [ - { - "in": "path", - "name": "response_id", - "required": true, - "schema": { - "type": "string", - "example": "resp_677efb5139a88190b512bc3fef8e535d" - }, - "description": "The ID of the response to delete." - }, - { - "name": "openai-beta", - "in": "header", - "required": false, - "description": "Optional beta features to enable for this request.", - "style": "simple", - "explode": false, - "schema": { - "type": "array", - "x-stainless-param": "betas", - "items": { - "type": "string", - "enum": [ - "responses_multi_agent=v1" - ] + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - ], - "responses": { - "200": { - "description": "OK" }, - "404": { - "description": "Not Found", + "401": { + "description": "Authentication or project context was missing.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BetaError" + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "Delete a model response", - "group": "responses", - "examples": { - "request": { - "curl": "curl -X DELETE https://api.openai.com/v1/responses/resp_123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.delete(\"resp_123\");\nconsole.log(response);\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.delete(\"resp_123\")\nprint(response)\n" - }, - "response": "{\n \"id\": \"resp_6786a1bec27481909a17d673315b29f6\",\n \"object\": \"response\",\n \"deleted\": true\n}\n" - } - } - } - }, - "/responses/{response_id}/cancel?beta=true": { - "post": { - "operationId": "beta_cancelResponse", - "tags": [ - "Responses" - ], - "summary": "Cancels a model response with the given ID. Only responses created with\nthe `background` parameter set to `true` can be cancelled.\n[Learn more](https://developers.openai.com/api/docs/guides/background).\n", - "parameters": [ - { - "in": "path", - "name": "response_id", - "required": true, - "schema": { - "type": "string", - "example": "resp_677efb5139a88190b512bc3fef8e535d" - }, - "description": "The ID of the response to cancel." - }, - { - "name": "openai-beta", - "in": "header", - "required": false, - "description": "Optional beta features to enable for this request.", - "style": "simple", - "explode": false, - "schema": { - "type": "array", - "x-stainless-param": "betas", - "items": { - "type": "string", - "enum": [ - "responses_multi_agent=v1" - ] - } - } - } - ], - "responses": { - "200": { - "description": "OK", + "403": { + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BetaResponse" + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, "404": { - "description": "Not Found", + "description": "The requested session or event was not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BetaError" + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "Cancel a response", - "group": "responses", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/responses/resp_123/cancel \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.cancel(\"resp_123\");\nconsole.log(response);\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.cancel(\"resp_123\")\nprint(response)\n" - }, - "response": "{\n \"id\": \"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44\",\n \"object\": \"response\",\n \"created_at\": 1741386163,\n \"status\": \"cancelled\",\n \"background\": true,\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44\",\n \"status\": \"in_progress\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Silent circuits hum, \\nThoughts emerge in data streams— \\nDigital dawn breaks.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n}\n" - } - } - } - }, - "/responses/compact?beta=true": { - "post": { - "summary": "Compact a conversation. Returns a compacted response object.\n\nLearn when and how to compact long-running conversations in the [conversation state guide](https://developers.openai.com/api/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](https://developers.openai.com/api/docs/guides/conversation-state#compaction-advanced).", - "operationId": "beta_Compactconversation", - "parameters": [ - { - "name": "openai-beta", - "in": "header", - "required": false, - "description": "Optional beta features to enable for this request.", - "style": "simple", - "explode": false, - "schema": { - "type": "array", - "x-stainless-param": "betas", - "items": { - "type": "string", - "enum": [ - "responses_multi_agent=v1" - ] - } - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BetaCompactResponseMethodPublicBody" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Success", + }, + "500": { + "description": "An internal error occurred.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BetaCompactResource" + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "429": { - "$ref": "#/components/responses/InferenceRateLimited" - }, "503": { - "$ref": "#/components/responses/InferenceServiceUnavailable" - } - }, - "x-oaiMeta": { - "name": "Compact a response", - "group": "responses", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/responses/compact \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Create a simple landing page for a dog petting café.\"\n },\n {\n \"id\": \"msg_001\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Below is a single file, ready-to-use landing page for a dog petting café:...\"\n }\n ],\n \"role\": \"assistant\"\n }\n ]\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\n// Compact the previous response if you are running out of tokens\nconst compactedResponse = await openai.responses.compact({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: \"Create a simple landing page for a dog petting café.\",\n },\n // All items returned from previous requests are included here, like reasoning, message, function call, etc.\n {\n id: \"msg_030d085c0b53e67e0069332e3a72d4819c96c6f2c4adc15d33\",\n type: \"message\",\n status: \"completed\",\n content: [\n {\n type: \"output_text\",\n annotations: [],\n logprobs: [],\n text: \"Below is a single file, ready-to-use landing page for a dog petting café:...\",\n },\n ],\n role: \"assistant\",\n },\n ],\n});\n\n// Pass the compactedResponse.output as input to the next request\nconsole.log(compactedResponse);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\ncompacted_response = client.responses.compact(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": \"Create a simple landing page for a dog petting cafe.\",\n },\n # All items returned from previous requests are included here, like reasoning, message, function call, etc.\n {\n \"id\": \"msg_001\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Below is a single file, ready-to-use landing page for a dog petting café:...\",\n },\n ],\n \"role\": \"assistant\",\n },\n ]\n)\n# Pass the compacted_response.output as input to the next request\nprint(compacted_response)\n" - }, - "response": "{\n \"id\": \"resp_001\",\n \"object\": \"response.compaction\",\n \"created_at\": 1764967971,\n \"output\": [\n {\n \"id\": \"msg_000\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Create a simple landing page for a dog petting cafe.\"\n }\n ],\n \"role\": \"user\"\n },\n {\n \"id\": \"cmp_001\",\n \"type\": \"compaction\",\n \"encrypted_content\": \"gAAAAABpM0Yj-...=\"\n }\n ],\n \"usage\": {\n \"input_tokens\": 139,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 438,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 64\n },\n \"total_tokens\": 577\n }\n}\n" + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } } }, - "/responses/{response_id}/input_items?beta=true": { + "/agents": { "get": { - "operationId": "beta_listInputItems", + "operationId": "listAgents", + "summary": "List agents", + "description": "Lists reusable agents in the current project. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", "tags": [ - "Responses" + "Agents" ], - "summary": "Returns a list of input items for a given response.", "parameters": [ - { - "in": "path", - "name": "response_id", - "required": true, - "schema": { - "type": "string" - }, - "description": "The ID of the response to retrieve input items for." - }, { "name": "limit", "in": "query", - "description": "A limit on the number of objects to be returned. Limit can range between\n1 and 100, and the default is 20.\n", "required": false, "schema": { "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, "default": 20 - } - }, - { - "in": "query", - "name": "order", - "schema": { - "type": "string", - "enum": [ - "asc", - "desc" - ] }, - "description": "The order to return the input items in. Default is `desc`.\n- `asc`: Return the input items in ascending order.\n- `desc`: Return the input items in descending order.\n" + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { + "name": "order", "in": "query", - "name": "after", + "required": false, "schema": { - "type": "string" + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" }, - "description": "An item ID to list items after, used in pagination.\n" + "description": "The order in which resources are returned. Defaults to `desc`." }, { + "name": "after", "in": "query", - "name": "include", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BetaIncludeEnum" - } - }, - "description": "Additional fields to include in the response. See the `include`\nparameter for Response creation above for more information.\n" - }, - { - "name": "openai-beta", - "in": "header", "required": false, - "description": "Optional beta features to enable for this request.", - "style": "simple", - "explode": false, "schema": { - "type": "array", - "x-stainless-param": "betas", - "items": { - "type": "string", - "enum": [ - "responses_multi_agent=v1" - ] - } - } + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." } ], "responses": { "200": { - "description": "OK", + "description": "A page of agents.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BetaResponseItemList" + "$ref": "#/components/schemas/AgentListResource", + "description": "A page of reusable agents." } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "List input items", - "group": "responses", - "examples": { - "request": { - "curl": "curl https://api.openai.com/v1/responses/resp_abc123/input_items \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", - "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.inputItems.list(\"resp_123\");\nconsole.log(response.data);\n", - "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.input_items.list(\"resp_123\")\nprint(response.data)\n" - }, - "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"msg_abc123\",\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Tell me a three sentence bedtime story about a unicorn.\"\n }\n ]\n }\n ],\n \"first_id\": \"msg_abc123\",\n \"last_id\": \"msg_abc123\",\n \"has_more\": false\n}\n" - } - } - } - }, - "/responses/input_tokens?beta=true": { - "post": { - "summary": "Returns input token counts of the request.\n\nReturns an object with `object` set to `response.input_tokens` and an `input_tokens` count.", - "operationId": "beta_Getinputtokencounts", - "parameters": [ - { - "name": "openai-beta", - "in": "header", - "required": false, - "description": "Optional beta features to enable for this request.", - "style": "simple", - "explode": false, - "schema": { - "type": "array", - "x-stainless-param": "betas", - "items": { - "type": "string", - "enum": [ - "responses_multi_agent=v1" - ] + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BetaTokenCountsBody" + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Success", + }, + "403": { + "description": "The API key lacks the required permission.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BetaTokenCountsResource" + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - } - }, - "x-oaiMeta": { - "name": "Get input token counts", - "group": "responses", - "examples": { - "request": { - "curl": "curl -X POST https://api.openai.com/v1/responses/input_tokens \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"Tell me a joke.\"\n }'\n", - "javascript": "import OpenAI from \"openai\";\n\nconst client = new OpenAI();\n\nconst response = await client.responses.inputTokens.count({\n model: \"gpt-6-astra\",\n input: \"Tell me a joke.\",\n});\n\nconsole.log(response.input_tokens);\n", - "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.input_tokens.count(\n model=\"gpt-6-astra\",\n input=\"Tell me a joke.\"\n)\nprint(response.input_tokens)\n", - "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n client := openai.NewClient()\n response, err := client.Responses.InputTokens.Count(context.TODO(), responses.InputTokenCountParams{\n Model: \"gpt-6-astra\",\n Input: \"Tell me a joke.\",\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", response.InputTokens)\n}\n", - "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.input_tokens.count(model: \"gpt-6-astra\", input: \"Tell me a joke.\")\n\nputs(response)\n", - "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.responses.inputtokens.InputTokenCountParams;\nimport com.openai.models.responses.inputtokens.InputTokenCountResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n InputTokenCountParams params = InputTokenCountParams.builder()\n .model(\"gpt-6-astra\")\n .input(\"Tell me a joke.\")\n .build();\n\n InputTokenCountResponse response = client.responses().inputTokens().count(params);\n }\n}\n" - }, - "response": "{\n \"object\": \"response.input_tokens\",\n \"input_tokens\": 11\n}\n" - } - } - } - } - }, - "webhooks": { - "batch_cancelled": { - "post": { - "description": "Sent when a batch has been cancelled.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookBatchCancelled" + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" - } - } - } - }, - "batch_completed": { - "post": { - "description": "Sent when a batch has completed processing.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookBatchCompleted" + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" - } - } - } - }, - "batch_expired": { - "post": { - "description": "Sent when a batch has expired before completion.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookBatchExpired" + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" - } - } - } - }, - "batch_failed": { - "post": { - "description": "Sent when a batch has failed.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookBatchFailed" + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" - } } - } - }, - "eval_run_canceled": { + }, "post": { - "description": "Sent when an eval run has been canceled.\n", + "operationId": "createAgent", + "summary": "Create an agent", + "description": "Creates a reusable agent without storing credentials. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", + "tags": [ + "Agents" + ], "requestBody": { - "description": "The event payload sent by the API.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WebhookEvalRunCanceled" + "$ref": "#/components/schemas/CreateAgentParams" } } } }, "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "eval_run_failed": { - "post": { - "description": "Sent when an eval run has failed.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookEvalRunFailed" + "201": { + "description": "The created agent.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AgentResource" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "eval_run_succeeded": { - "post": { - "description": "Sent when an eval run has succeeded.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookEvalRunSucceeded" + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "fine_tuning_job_cancelled": { - "post": { - "description": "Sent when a fine-tuning job has been cancelled.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookFineTuningJobCancelled" + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "fine_tuning_job_failed": { - "post": { - "description": "Sent when a fine-tuning job has failed.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookFineTuningJobFailed" + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "fine_tuning_job_succeeded": { - "post": { - "description": "Sent when a fine-tuning job has succeeded.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookFineTuningJobSucceeded" + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" - } - } - } - }, - "live_call_incoming": { - "post": { - "deprecated": true, - "description": "Deprecated: use `live.transport.incoming`. Retained only for existing subscriptions.\nSent when an incoming API SIP session is available for Live acceptance.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookLiveCallIncoming" + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" } } } }, - "live_transport_incoming": { - "post": { - "description": "Sent when an incoming API SIP session is available for Live acceptance.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookLiveTransportIncoming" - } - } + "/agents/{agent_id}": { + "get": { + "operationId": "retrieveAgent", + "summary": "Retrieve an agent", + "description": "Retrieves a reusable agent by ID. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "agent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the reusable agent." } - }, + ], "responses": { "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + "description": "The requested agent.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AgentResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } - } - }, - "realtime_call_incoming": { + }, "post": { - "description": "Sent when an incoming API SIP session is available for Realtime acceptance.\n", + "operationId": "updateAgent", + "summary": "Update an agent", + "description": "Updates a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "agent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the reusable agent." + } + ], "requestBody": { - "description": "The event payload sent by the API.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WebhookRealtimeCallIncoming" + "$ref": "#/components/schemas/UpdateAgentParams" } } } }, "responses": { "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" - } - } - } - }, - "response_cancelled": { - "post": { - "description": "Sent when a background response has been cancelled.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookResponseCancelled" + "description": "The updated agent.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AgentResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } } }, + "x-oaiMeta": { + "examples": { + "request": { + "curl": "# 1. Omit reasoning: keep its current settings while renaming the agent.\ncurl \"https://api.openai.com/v1/agents/$AGENT_ID\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: agents=v1\" \\\n -d '{\"name\": \"Renamed\"}'\n\n# 2. Send null: reset reasoning to the model's defaults.\ncurl \"https://api.openai.com/v1/agents/$AGENT_ID\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: agents=v1\" \\\n -d '{\"reasoning\": null}'\n\n# 3. Send an object: replace the entire reasoning configuration, without merging.\n# The agent's model must support the \"low\" reasoning effort.\ncurl \"https://api.openai.com/v1/agents/$AGENT_ID\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: agents=v1\" \\\n -d '{\"reasoning\": {\"effort\": \"low\"}}'\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\nagent_id = \"your-agent-id\"\n\n# 1. Omit reasoning: keep its current settings while renaming the agent.\nclient.beta.agents.update(agent_id, name=\"Renamed\")\n\n# 2. Python's None sends JSON null: reset reasoning to the model's defaults.\nclient.beta.agents.update(agent_id, reasoning=None)\n\n# 3. Send an object: replace the entire reasoning configuration, without merging.\n# The agent's model must support the \"low\" reasoning effort.\nclient.beta.agents.update(agent_id, reasoning={\"effort\": \"low\"})\n", + "javascript": "import OpenAI from \"openai\";\n\nconst client = new OpenAI();\nconst agentId = \"your-agent-id\";\n\n// 1. Omit reasoning: keep its current settings while renaming the agent.\nawait client.beta.agents.update(agentId, { name: \"Renamed\" });\n\n// 2. Send null: reset reasoning to the model's defaults.\nawait client.beta.agents.update(agentId, { reasoning: null });\n\n// 3. Send an object: replace the entire reasoning configuration, without merging.\n// The agent's model must support the \"low\" reasoning effort.\nawait client.beta.agents.update(agentId, { reasoning: { effort: \"low\" } });\n", + "go": "package main\n\nimport (\n \"context\"\n \"log\"\n\n \"github.com/openai/openai-go/v3\"\n \"github.com/openai/openai-go/v3/packages/param\"\n)\n\nfunc main() {\n client := openai.NewClient()\n ctx := context.Background()\n agentID := \"your-agent-id\"\n\n // 1. Omit reasoning: keep its current settings while renaming the agent.\n _, err := client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{\n Name: openai.String(\"Renamed\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n\n // 2. Send null: reset reasoning to the model's defaults.\n _, err = client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{\n Reasoning: param.NullStruct[openai.AgentReasoningParam](),\n })\n if err != nil {\n log.Fatal(err)\n }\n\n // 3. Send an object: replace the entire reasoning configuration, without merging.\n // The agent's model must support the \"low\" reasoning effort.\n _, err = client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{\n Reasoning: openai.AgentReasoningParam{Effort: openai.AgentReasoningParamEffortLow},\n })\n if err != nil {\n log.Fatal(err)\n }\n}\n", + "java": "import com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.core.JsonValue;\nimport com.openai.models.beta.agents.AgentReasoningParam;\nimport com.openai.models.beta.agents.AgentUpdateParams;\n\npublic class AgentUpdateExample {\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n String agentId = \"your-agent-id\";\n\n // 1. Omit reasoning: keep its current settings while renaming the agent.\n client.beta().agents().update(AgentUpdateParams.builder()\n .agentId(agentId)\n .name(\"Renamed\")\n .build());\n\n // 2. Send null: reset reasoning to the model's defaults.\n client.beta().agents().update(AgentUpdateParams.builder()\n .agentId(agentId)\n .reasoning(JsonValue.from(null))\n .build());\n\n // 3. Send an object: replace the entire reasoning configuration, without merging.\n // The agent's model must support the \"low\" reasoning effort.\n client.beta().agents().update(AgentUpdateParams.builder()\n .agentId(agentId)\n .reasoning(AgentReasoningParam.builder()\n .effort(AgentReasoningParam.Effort.LOW)\n .build())\n .build());\n }\n}\n", + "ruby": "require \"openai\"\n\nclient = OpenAI::Client.new\nagent_id = \"your-agent-id\"\n\n# 1. Omit reasoning: keep its current settings while renaming the agent.\nclient.beta.agents.update(agent_id, name: \"Renamed\")\n\n# 2. Ruby's nil sends JSON null: reset reasoning to the model's defaults.\nclient.beta.agents.update(agent_id, reasoning: nil)\n\n# 3. Send an object: replace the entire reasoning configuration, without merging.\n# The agent's model must support the \"low\" reasoning effort.\nclient.beta.agents.update(agent_id, reasoning: {effort: :low})\n" + } + } + } + }, + "delete": { + "operationId": "deleteAgent", + "summary": "Delete an agent", + "description": "Deletes a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "agent_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the reusable agent." + } + ], "responses": { "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + "description": "The deleted agent.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedAgentResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } } }, - "response_completed": { - "post": { - "description": "Sent when a background response has completed successfully.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookResponseCompleted" - } - } + "/agents/environments/templates": { + "get": { + "operationId": "listAgentEnvironmentTemplates", + "summary": "List agent environment templates", + "description": "Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." } - }, + ], "responses": { "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + "description": "A page of environment templates.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnvironmentTemplateListResource", + "description": "A page of reusable environment templates." + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested environment definition was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } - } - }, - "response_failed": { + }, "post": { - "description": "Sent when a background response has failed.\n", + "operationId": "createAgentEnvironmentTemplate", + "summary": "Create an agent environment template", + "description": "Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", + "tags": [ + "Agents" + ], "requestBody": { - "description": "The event payload sent by the API.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WebhookResponseFailed" + "$ref": "#/components/schemas/CreateEnvironmentTemplateParams" } } } }, "responses": { - "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + "201": { + "description": "The created environment template.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnvironmentTemplateResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested environment definition was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } } }, - "response_incomplete": { - "post": { - "description": "Sent when a background response is incomplete.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookResponseIncomplete" - } - } + "/agents/environments/templates/{environment_template_id}": { + "get": { + "operationId": "retrieveAgentEnvironmentTemplate", + "summary": "Retrieve an agent environment template", + "description": "Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "environment_template_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the reusable environment template." } - }, + ], "responses": { "200": { - "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + "description": "The requested environment template.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnvironmentTemplateResource" + } + } + } + }, + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "404": { + "description": "The requested environment definition was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } - } - }, - "safety_alert_created": { + }, "post": { - "description": "Sent when an approved safety alert is available for an API project.\nRetrieve the alert with a project API key granted `api.safety.alerts.read`.\n", + "operationId": "updateAgentEnvironmentTemplate", + "summary": "Update an agent environment template", + "description": "Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "environment_template_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the reusable environment template." + } + ], "requestBody": { - "description": "The event payload sent by the API.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WebhookSafetyAlertCreated" + "$ref": "#/components/schemas/UpdateEnvironmentTemplateParams" } } } }, "responses": { "200": { - "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." - } - } - } - }, - "safety_org_alert_created": { - "post": { - "description": "Sent when an approved safety alert is available for an enterprise workspace.\nRetrieve the alert from `https://api.chatgpt.com/v1/safety/alerts/{id}` with\nan administrator API key for the workspace's backing organization granted\n`chatgpt.enterprise.safety_alerts.read`.\n", - "requestBody": { - "description": "The event payload sent by the API.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebhookSafetyOrgAlertCreated" + "description": "The updated environment template.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnvironmentTemplateResource" + } } } - } - }, - "responses": { - "200": { - "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." - } - } - } - } - }, - "components": { - "schemas": { - "AddUploadPartRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "data": { - "description": "The chunk of bytes for this Part.\n", - "type": "string", - "format": "binary" - } - }, - "required": [ - "data" - ] - }, - "AdminApiKey": { - "type": "object", - "description": "Represents an individual Admin API key in an org.", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.admin_api_key" - ], - "description": "The object type, which is always `organization.admin_api_key`", - "x-stainless-const": true }, - "id": { - "type": "string", - "example": "key_abc", - "description": "The identifier, which can be referenced in API endpoints" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ], - "example": "Administration Key", - "description": "The name of the API key" + } }, - "redacted_value": { - "type": "string", - "example": "sk-admin...def", - "description": "The redacted value of the API key" + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "created_at": { - "type": "integer", - "format": "unixtime", - "example": 1711471533, - "description": "The Unix timestamp (in seconds) of when the API key was created" + "404": { + "description": "The requested environment definition was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "expires_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime", - "example": 1714063533, - "description": "The Unix timestamp (in seconds) of when the API key expires" - }, - { - "type": "null" + "409": { + "description": "The request conflicted with the current environment state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "last_used_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime", - "example": 1711471534, - "description": "The Unix timestamp (in seconds) of when the API key was last used" - }, - { - "type": "null" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "owner": { - "type": "object", - "properties": { - "type": { - "type": "string", - "example": "user", - "description": "Always `user`" - }, - "object": { - "type": "string", - "example": "organization.user", - "description": "The object type, which is always organization.user" - }, - "id": { - "type": "string", - "example": "sa_456", - "description": "The identifier, which can be referenced in API endpoints" - }, - "name": { - "type": "string", - "example": "My Service Account", - "description": "The name of the user" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "example": 1711471533, - "description": "The Unix timestamp (in seconds) of when the user was created" - }, - "role": { - "type": "string", - "example": "owner", - "description": "Always `owner`" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } } - }, - "required": [ - "object", - "redacted_value", - "created_at", - "expires_at", - "id", - "owner" - ], - "x-oaiMeta": { - "name": "The admin API key object", - "example": "{\n \"object\": \"organization.admin_api_key\",\n \"id\": \"key_abc\",\n \"name\": \"Main Admin Key\",\n \"redacted_value\": \"sk-admin...xyz\",\n \"created_at\": 1711471533,\n \"last_used_at\": 1711471534,\n \"owner\": {\n \"type\": \"user\",\n \"object\": \"organization.user\",\n \"id\": \"user_123\",\n \"name\": \"John Doe\",\n \"created_at\": 1711471533,\n \"role\": \"owner\"\n }\n}\n" } }, - "AdminApiKeyCreateResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/AdminApiKey" - }, + "delete": { + "operationId": "deleteAgentEnvironmentTemplate", + "summary": "Delete an agent environment template", + "description": "Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup).", + "tags": [ + "Agents" + ], + "parameters": [ { - "type": "object", - "description": "The newly created admin API key. The `value` field is only returned once, when the key is created.", - "properties": { - "value": { - "type": "string", - "example": "sk-admin-1234abcd", - "description": "The value of the API key. Only shown on create." - } + "name": "environment_template_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "required": [ - "value" - ] + "description": "The ID of the reusable environment template." } - ] - }, - "ApiKeyList": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "example": "list", - "x-stainless-const": true + ], + "responses": { + "200": { + "description": "The deleted environment template.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedEnvironmentTemplateResource" + } + } + } }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AdminApiKey" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } }, - "has_more": { - "type": "boolean", - "example": false + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ], - "example": "key_abc" + } }, - "last_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" + "404": { + "description": "The requested environment definition was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ], - "example": "key_xyz" - } - }, - "required": [ - "object", - "data", - "has_more" - ] - }, - "AssignedRoleDetails": { - "type": "object", - "description": "Detailed information about a role assignment entry returned when listing assignments.", - "properties": { - "id": { - "type": "string", - "description": "Identifier for the role." + } }, - "name": { - "type": "string", - "description": "Name of the role." + "409": { + "description": "The request conflicted with the current environment state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "permissions": { - "type": "array", - "description": "Permissions associated with the role.", - "items": { - "type": "string" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } }, - "resource_type": { - "type": "string", - "description": "Resource type the role applies to." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/agents/sessions": { + "get": { + "operationId": "listAgentSessions", + "summary": "List agent sessions", + "description": "Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, - "predefined_role": { - "type": "boolean", - "description": "Whether the role is predefined by OpenAI." + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." }, - "description": { - "description": "Description of the role.", - "anyOf": [ - { - "type": "string" + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "agent_id", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Only return sessions whose root agent has this ID. Omit to return sessions for all agents." + }, + { + "name": "metadata", + "in": "query", + "required": false, + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 }, - { - "type": "null" + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 + }, + "description": "Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. New sessions and metadata updates may take time to appear in filtered results.", + "style": "deepObject", + "explode": true + } + ], + "responses": { + "200": { + "description": "A page of sessions.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionListResource", + "description": "A paginated list of sessions." + } } - ] + } }, - "created_at": { - "description": "When the role was created.", - "anyOf": [ - { - "type": "integer", - "format": "unixtime" - }, - { - "type": "null" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "updated_at": { - "description": "When the role was last updated.", - "anyOf": [ - { - "type": "integer", - "format": "unixtime" - }, - { - "type": "null" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "created_by": { - "description": "Identifier of the actor who created the role.", - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "created_by_user_obj": { - "description": "User details for the actor that created the role, when available.", - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "metadata": { - "description": "Arbitrary metadata stored on the role.", - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "assignment_sources": { - "description": "Principals from which the role assignment is inherited, when available.", - "anyOf": [ - { - "type": "array", - "items": { - "type": "object", - "properties": { - "principal_id": { - "type": "string" - }, - "principal_type": { - "type": "string" - } - }, - "required": [ - "principal_id", - "principal_type" - ] + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - }, - { - "type": "null" } - ] + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } - }, - "required": [ - "id", - "name", - "permissions", - "resource_type", - "predefined_role", - "description", - "created_at", - "updated_at", - "created_by", - "created_by_user_obj", - "metadata", - "assignment_sources" - ] + } }, - "AssistantObject": { - "type": "object", - "title": "Assistant", - "description": "Represents an `assistant` that can call the model and use tools.", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `assistant`.", - "type": "string", - "enum": [ - "assistant" - ], - "x-stainless-const": true - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the assistant was created.", - "type": "integer", - "format": "unixtime" - }, - "name": { - "anyOf": [ - { - "description": "The name of the assistant. The maximum length is 256 characters.\n", - "type": "string", - "maxLength": 256 - }, - { - "type": "null" + "post": { + "operationId": "createAgentSession", + "summary": "Create an agent session", + "description": "Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions).", + "tags": [ + "Agents" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAgentSessionParams" } - ] - }, - "description": { - "anyOf": [ - { - "description": "The description of the assistant. The maximum length is 512 characters.\n", - "type": "string", - "maxLength": 512 + } + } + }, + "responses": { + "201": { + "description": "The created session or its event stream.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionResource" + } }, - { - "type": "null" + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/SessionEvent" + } } - ] + } }, - "model": { - "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", - "type": "string" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "instructions": { - "anyOf": [ - { - "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", - "type": "string", - "maxLength": 256000 - }, - { - "type": "null" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "tools": { - "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", - "default": [], - "type": "array", - "maxItems": 128, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - ] + } } }, - "tool_resources": { - "anyOf": [ - { - "type": "object", - "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } - } + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - }, - { - "type": "null" } - ] + } }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "temperature": { - "anyOf": [ - { - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1 - }, - { - "type": "null" + "429": { + "description": "The Files API rate limit for your user has been exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "top_p": { - "anyOf": [ - { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" - }, - { - "type": "null" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "response_format": { - "anyOf": [ - { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption" - }, - { - "type": "null" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } } }, - "required": [ - "id", - "object", - "created_at", - "name", - "description", - "model", - "instructions", - "tools", - "metadata" + "x-oai-streaming": { + "request_field": "stream", + "response_status_code": 201 + } + } + }, + "/agents/sessions/{session_id}": { + "get": { + "operationId": "retrieveAgentSession", + "summary": "Retrieve an agent session", + "description": "Retrieves the current state of a managed agent session. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", + "tags": [ + "Agents" ], - "x-oaiMeta": { - "name": "The assistant object", - "example": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698984975,\n \"name\": \"Math Tutor\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" - }, - "deprecated": true - }, - "AssistantStreamEvent": { - "description": "Represents an event emitted when streaming a Run.\n\nEach event in a server-sent events stream has an `event` and `data` property:\n\n```\nevent: thread.created\ndata: {\"id\": \"thread_123\", \"object\": \"thread\", ...}\n```\n\nWe emit events whenever a new object is created, transitions to a new state, or is being\nstreamed in parts (deltas). For example, we emit `thread.run.created` when a new run\nis created, `thread.run.completed` when a run completes, and so on. When an Assistant chooses\nto create a message during a run, we emit a `thread.message.created event`, a\n`thread.message.in_progress` event, many `thread.message.delta` events, and finally a\n`thread.message.completed` event.\n\nWe may add additional events over time, so we recommend handling unknown events gracefully\nin your code. See the [Assistants API quickstart](https://developers.openai.com/api/docs/assistants/migration) to learn how to\nintegrate the Assistants API with streaming.\n", - "oneOf": [ + "parameters": [ { - "$ref": "#/components/schemas/ThreadStreamEvent" + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + } + ], + "responses": { + "200": { + "description": "The requested session.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionResource" + } + } + } }, - { - "$ref": "#/components/schemas/RunStreamEvent" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/RunStepStreamEvent" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/MessageStreamEvent" + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ErrorEvent" + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/DoneEvent" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } - ], - "x-oaiMeta": { - "name": "Assistant stream events", - "beta": true } }, - "AssistantSupportedModels": { - "type": "string", - "enum": [ - "gpt-5", - "gpt-5-mini", - "gpt-5-nano", - "gpt-5-2025-08-07", - "gpt-5-mini-2025-08-07", - "gpt-5-nano-2025-08-07", - "gpt-4.1", - "gpt-4.1-mini", - "gpt-4.1-nano", - "gpt-4.1-2025-04-14", - "gpt-4.1-mini-2025-04-14", - "gpt-4.1-nano-2025-04-14", - "o3-mini", - "o3-mini-2025-01-31", - "o1", - "o1-2024-12-17", - "gpt-4o", - "gpt-4o-2024-11-20", - "gpt-4o-2024-08-06", - "gpt-4o-2024-05-13", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4.5-preview", - "gpt-4.5-preview-2025-02-27", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-1106-preview", - "gpt-4-vision-preview", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-3.5-turbo", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k-0613" - ] - }, - "AssistantToolsCode": { - "type": "object", - "title": "Code interpreter tool", - "properties": { - "type": { - "type": "string", - "description": "The type of tool being defined: `code_interpreter`", - "enum": [ - "code_interpreter" - ], - "x-stainless-const": true - } - }, - "required": [ - "type" - ] - }, - "AssistantToolsFileSearch": { - "type": "object", - "title": "FileSearch tool", - "properties": { - "type": { - "type": "string", - "description": "The type of tool being defined: `file_search`", - "enum": [ - "file_search" - ], - "x-stainless-const": true - }, - "file_search": { - "type": "object", - "description": "Overrides for the file search tool.", - "properties": { - "max_num_results": { - "type": "integer", - "minimum": 1, - "maximum": 50, - "description": "The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.\n\nNote that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://developers.openai.com/api/docs/guides/tools-file-search#retrieval-customization) for more information.\n" - }, - "ranking_options": { - "$ref": "#/components/schemas/FileSearchRankingOptions" - } - } - } - }, - "required": [ - "type" - ] - }, - "AssistantToolsFileSearchTypeOnly": { - "type": "object", - "title": "FileSearch tool", - "properties": { - "type": { - "type": "string", - "description": "The type of tool being defined: `file_search`", - "enum": [ - "file_search" - ], - "x-stainless-const": true - } - }, - "required": [ - "type" - ] - }, - "AssistantToolsFunction": { - "type": "object", - "title": "Function tool", - "properties": { - "type": { - "type": "string", - "description": "The type of tool being defined: `function`", - "enum": [ - "function" - ], - "x-stainless-const": true - }, - "function": { - "$ref": "#/components/schemas/FunctionObject" - } - }, - "required": [ - "type", - "function" - ] - }, - "AssistantsApiResponseFormatOption": { - "description": "Specifies the format that the model must output. Compatible with [GPT-4o](https://developers.openai.com/api/docs/models/gpt-4o), [GPT-4 Turbo](https://developers.openai.com/api/docs/models/gpt-4-turbo), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](https://developers.openai.com/api/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.\n\n**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.\n", - "oneOf": [ - { - "type": "string", - "description": "`auto` is the default value\n", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "$ref": "#/components/schemas/ResponseFormatText" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonObject" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonSchema" - } - ] - }, - "AssistantsApiToolChoiceOption": { - "description": "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tools and instead generates a message.\n`auto` is the default value and means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools before responding to the user.\nSpecifying a particular tool like `{\"type\": \"file_search\"}` or `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n", - "oneOf": [ - { - "type": "string", - "description": "`none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.\n", - "enum": [ - "none", - "auto", - "required" - ] - }, + "post": { + "operationId": "updateAgentSession", + "summary": "Update an agent session", + "description": "Updates session tools, metadata, model, reasoning effort, or service tier. Model settings apply to subsequent turns. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", + "tags": [ + "Agents" + ], + "parameters": [ { - "$ref": "#/components/schemas/AssistantsNamedToolChoice" + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." } - ] - }, - "AssistantsNamedToolChoice": { - "type": "object", - "description": "Specifies a tool the model should use. Use to force the model to call a specific tool.", - "properties": { - "type": { - "type": "string", - "enum": [ - "function", - "code_interpreter", - "file_search" - ], - "description": "The type of the tool. If type is `function`, the function name must be set" - }, - "function": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateAgentSessionParams" } - }, - "required": [ - "name" - ] + } } }, - "required": [ - "type" - ] - }, - "AudioResponseFormat": { - "description": "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and `diarized_json`, with `diarized_json` required to receive speaker annotations.\n", - "type": "string", - "enum": [ - "json", - "text", - "srt", - "verbose_json", - "vtt", - "diarized_json" - ], - "default": "json" - }, - "AudioTranscription": { - "type": "object", - "properties": { - "model": { - "description": "The model to use for transcription. Current options are `whisper-1`, `gpt-transcribe`, `gpt-live-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.\n", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "whisper-1", - "gpt-transcribe", - "gpt-live-transcribe", - "gpt-4o-mini-transcribe", - "gpt-4o-mini-transcribe-2025-12-15", - "gpt-4o-transcribe", - "gpt-4o-transcribe-diarize", - "gpt-realtime-whisper" - ] + "responses": { + "200": { + "description": "The updated session.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionResource" + } } - ] - }, - "language": { - "type": "string", - "description": "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n" + } }, - "languages": { - "type": "array", - "description": "Possible languages of the input audio, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. Supported by `gpt-transcribe` and `gpt-live-transcribe`.\n", - "minItems": 1, - "items": { - "type": "string" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } }, - "keywords": { - "type": "array", - "description": "Words or phrases to guide transcription of the input audio. Supported by `gpt-transcribe` and `gpt-live-transcribe`.\n", - "items": { - "type": "string" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } }, - "prompt": { - "type": "string", - "description": "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](https://developers.openai.com/api/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example \"expect words related to technology\".\nPrompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.\n" + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "delay": { - "type": "string", - "description": "Controls how long the model waits before emitting transcription text.\nHigher values can improve transcription accuracy at the cost of latency.\nOnly supported with `gpt-realtime-whisper` in GA Realtime sessions.\n", - "enum": [ - "minimal", - "low", - "medium", - "high", - "xhigh" - ] - } - } - }, - "AudioTranscriptionResponse": { - "type": "object", - "properties": { - "model": { - "description": "The model used for transcription. Current options are `whisper-1`, `gpt-transcribe`, `gpt-live-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.\n", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "whisper-1", - "gpt-transcribe", - "gpt-live-transcribe", - "gpt-4o-mini-transcribe", - "gpt-4o-mini-transcribe-2025-12-15", - "gpt-4o-transcribe", - "gpt-4o-transcribe-diarize", - "gpt-realtime-whisper" - ] + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "language": { - "type": "string", - "description": "The language of the input audio.\n" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "languages": { - "type": "array", - "description": "The possible input audio languages configured for transcription, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n", - "minItems": 1, - "items": { - "type": "string" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } }, - "prompt": { - "type": "string", - "description": "The prompt configured for input audio transcription, when present.\n" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } }, - "AuditLog": { - "type": "object", - "description": "A log of a user action or configuration change within this organization.", - "properties": { - "id": { - "type": "string", - "description": "The ID of this log." - }, - "type": { - "$ref": "#/components/schemas/AuditLogEventType" - }, - "effective_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of the event." - }, - "project": { - "type": "object", - "description": "The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - }, - "name": { - "type": "string", - "description": "The project title." + "delete": { + "operationId": "deleteAgentSession", + "summary": "Delete an agent session", + "description": "Removes a managed agent session from the public API and returns a deletion confirmation. If backend execution has ended, deletion can cancel a still-open public turn and abandon unpublished outputs. Running execution must be cancelled first. Physical cleanup may continue asynchronously. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + } + ], + "responses": { + "200": { + "description": "The deleted session.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedSessionResource" + } } } }, - "actor": { - "anyOf": [ - { - "$ref": "#/components/schemas/AuditLogActor" - }, - { - "type": "null" - } - ] - }, - "api_key.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The tracking ID of the API key." - }, - "data": { - "type": "object", - "description": "The payload used to create the API key.", - "properties": { - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`" - } + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "api_key.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The tracking ID of the API key." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the API key.", - "properties": { - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`" - } + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "api_key.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The tracking ID of the API key." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "checkpoint.permission.created": { - "type": "object", - "description": "The project and fine-tuned model checkpoint that the checkpoint permission was created for.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the checkpoint permission." - }, - "data": { - "type": "object", - "description": "The payload used to create the checkpoint permission.", - "properties": { - "project_id": { - "type": "string", - "description": "The ID of the project that the checkpoint permission was created for." - }, - "fine_tuned_model_checkpoint": { - "type": "string", - "description": "The ID of the fine-tuned model checkpoint." - } + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "checkpoint.permission.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the checkpoint permission." + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "external_key.registered": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the external key configuration." - }, - "data": { - "type": "object", - "description": "The configuration for the external key." + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "external_key.removed": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the external key configuration." - } - } - }, - "group.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the group." - }, - "data": { - "type": "object", - "description": "Information about the created group.", - "properties": { - "group_name": { - "type": "string", - "description": "The group name." - } + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } + } + } + } + }, + "/agents/sessions/{session_id}/artifacts": { + "get": { + "operationId": "listAgentSessionArtifacts", + "summary": "List agent session artifacts", + "description": "Lists immutable artifacts published by completed hosted session turns. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." }, - "group.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the group." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the group.", - "properties": { - "group_name": { - "type": "string", - "description": "The updated group name." - } - } - } - } + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, - "group.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the group." - } - } + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." }, - "scim.enabled": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the SCIM was enabled for." + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "environment_id", + "in": "query", + "required": false, + "schema": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Restrict the listing to artifacts produced by this environment." + } + ], + "responses": { + "200": { + "description": "A page of durable session artifacts.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionArtifactListResource", + "description": "A page of durable artifacts published by a session." + } } } }, - "scim.disabled": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the SCIM was disabled for." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "invite.sent": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the invite." - }, - "data": { - "type": "object", - "description": "The payload used to create the invite.", - "properties": { - "email": { - "type": "string", - "description": "The email invited to the organization." - }, - "role": { - "type": "string", - "description": "The role the email was invited to be. Is either `owner` or `member`." - } + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "invite.accepted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the invite." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "invite.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the invite." + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "ip_allowlist.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the IP allowlist configuration." - }, - "name": { - "type": "string", - "description": "The name of the IP allowlist configuration." - }, - "allowed_ips": { - "type": "array", - "description": "The IP addresses or CIDR ranges included in the configuration.", - "items": { - "type": "string" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "ip_allowlist.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the IP allowlist configuration." - }, - "allowed_ips": { - "type": "array", - "description": "The updated set of IP addresses or CIDR ranges in the configuration.", - "items": { - "type": "string" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "ip_allowlist.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the IP allowlist configuration." - }, - "name": { - "type": "string", - "description": "The name of the IP allowlist configuration." - }, - "allowed_ips": { - "type": "array", - "description": "The IP addresses or CIDR ranges that were in the configuration.", - "items": { - "type": "string" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } + } + } + } + }, + "/agents/sessions/{session_id}/artifacts/{artifact_id}": { + "get": { + "operationId": "retrieveAgentSessionArtifact", + "summary": "Retrieve an agent session artifact", + "description": "Retrieves immutable metadata for one durable session artifact. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session that owns the artifact." }, - "ip_allowlist.config.activated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "configs": { - "type": "array", - "description": "The configurations that were activated.", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the IP allowlist configuration." - }, - "name": { - "type": "string", - "description": "The name of the IP allowlist configuration." - } - } + { + "name": "artifact_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The immutable session artifact ID." + } + ], + "responses": { + "200": { + "description": "The requested session artifact.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionArtifactResource" } } } }, - "ip_allowlist.config.deactivated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "configs": { - "type": "array", - "description": "The configurations that were deactivated.", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the IP allowlist configuration." - }, - "name": { - "type": "string", - "description": "The name of the IP allowlist configuration." - } - } + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "login.succeeded": { - "type": "object", - "description": "This event has no additional fields beyond the standard audit log attributes." - }, - "login.failed": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "error_code": { - "type": "string", - "description": "The error code of the failure." - }, - "error_message": { - "type": "string", - "description": "The error message of the failure." + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "logout.succeeded": { - "type": "object", - "description": "This event has no additional fields beyond the standard audit log attributes." - }, - "logout.failed": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "error_code": { - "type": "string", - "description": "The error code of the failure." - }, - "error_message": { - "type": "string", - "description": "The error message of the failure." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "organization.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The organization ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the organization settings.", - "properties": { - "title": { - "type": "string", - "description": "The organization title." - }, - "description": { - "type": "string", - "description": "The organization description." - }, - "name": { - "type": "string", - "description": "The organization name." - }, - "threads_ui_visibility": { - "type": "string", - "description": "Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`." - }, - "usage_dashboard_visibility": { - "type": "string", - "description": "Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`." - }, - "api_call_logging": { - "type": "string", - "description": "How your organization logs data from supported API calls. One of `disabled`, `enabled_per_call`, `enabled_for_all_projects`, or `enabled_for_selected_projects`" - }, - "api_call_logging_project_ids": { - "type": "string", - "description": "The list of project ids if api_call_logging is set to `enabled_for_selected_projects`" - } + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "project.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - }, - "data": { - "type": "object", - "description": "The payload used to create the project.", - "properties": { - "name": { - "type": "string", - "description": "The project name." - }, - "title": { - "type": "string", - "description": "The title of the project as seen on the dashboard." - } + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "project.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the project.", - "properties": { - "title": { - "type": "string", - "description": "The title of the project as seen on the dashboard." - } + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "project.archived": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - }, - "project.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." + } + } + }, + "delete": { + "operationId": "deleteAgentSessionArtifact", + "summary": "Delete an agent session artifact", + "description": "Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session that owns the artifact." + }, + { + "name": "artifact_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The immutable session artifact ID." + } + ], + "responses": { + "200": { + "description": "The deleted session artifact.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedSessionArtifactResource" + } } } }, - "rate_limit.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The rate limit ID" - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the rate limits.", - "properties": { - "max_requests_per_1_minute": { - "type": "integer", - "description": "The maximum requests per minute." - }, - "max_tokens_per_1_minute": { - "type": "integer", - "description": "The maximum tokens per minute." - }, - "max_images_per_1_minute": { - "type": "integer", - "description": "The maximum images per minute. Only relevant for certain models." - }, - "max_audio_megabytes_per_1_minute": { - "type": "integer", - "description": "The maximum audio megabytes per minute. Only relevant for certain models." - }, - "max_requests_per_1_day": { - "type": "integer", - "description": "The maximum requests per day. Only relevant for certain models." - }, - "batch_1_day_max_input_tokens": { - "type": "integer", - "description": "The maximum batch input tokens per day. Only relevant for certain models." - } + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "rate_limit.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The rate limit ID" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "role.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The role ID." - }, - "role_name": { - "type": "string", - "description": "The name of the role." - }, - "permissions": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The permissions granted by the role." - }, - "resource_type": { - "type": "string", - "description": "The type of resource the role belongs to." - }, - "resource_id": { - "type": "string", - "description": "The resource the role is scoped to." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "role.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The role ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the role.", - "properties": { - "role_name": { - "type": "string", - "description": "The updated role name, when provided." - }, - "resource_id": { - "type": "string", - "description": "The resource the role is scoped to." - }, - "resource_type": { - "type": "string", - "description": "The type of resource the role belongs to." - }, - "permissions_added": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The permissions added to the role." - }, - "permissions_removed": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The permissions removed from the role." - }, - "description": { - "type": "string", - "description": "The updated role description, when provided." - }, - "metadata": { - "type": "object", - "description": "Additional metadata stored on the role." - } + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "role.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The role ID." + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "role.assignment.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The identifier of the role assignment." - }, - "principal_id": { - "type": "string", - "description": "The principal (user or group) that received the role." - }, - "principal_type": { - "type": "string", - "description": "The type of principal (user or group) that received the role." - }, - "resource_id": { - "type": "string", - "description": "The resource the role assignment is scoped to." - }, - "resource_type": { - "type": "string", - "description": "The type of resource the role assignment is scoped to." + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "role.assignment.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The identifier of the role assignment." - }, - "principal_id": { - "type": "string", - "description": "The principal (user or group) that had the role removed." - }, - "principal_type": { - "type": "string", - "description": "The type of principal (user or group) that had the role removed." - }, - "resource_id": { - "type": "string", - "description": "The resource the role assignment was scoped to." - }, - "resource_type": { - "type": "string", - "description": "The type of resource the role assignment was scoped to." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } + } + } + } + }, + "/agents/sessions/{session_id}/artifacts/{artifact_id}/content": { + "get": { + "operationId": "retrieveAgentSessionArtifactContent", + "summary": "Retrieve agent session artifact content", + "description": "Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session that owns the artifact." }, - "role.bound_to_resource": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource the role was bound to. ChatGPT workspace connector resources use `__`." - }, - "role_id": { - "type": "string", - "description": "The ID of the role that was bound to the resource." - }, - "resource_id": { - "type": "string", - "description": "The ID of the resource the role was bound to." - }, - "resource_type": { - "type": "string", - "description": "The type of resource the role was bound to." - }, - "permissions": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The permissions granted to the role for the resource." - }, - "workspace_id": { - "type": "string", - "description": "The workspace ID for a ChatGPT workspace connector resource." - }, - "connector_id": { - "type": "string", - "description": "The connector ID for a ChatGPT workspace connector resource." - }, - "connector_name": { - "type": "string", - "description": "The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved." - }, - "enabled": { - "type": "boolean", - "description": "Whether the connector is enabled for the role." - }, - "source": { - "type": "string", - "description": "The connector role mutation path that produced the event.", - "enum": [ - "role_toggle", - "role_connector_update", - "role_delete", - "workspace_permissions", - "connector_publish" - ] + { + "name": "artifact_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The immutable session artifact ID." + } + ], + "responses": { + "200": { + "description": "The immutable artifact contents.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } } } }, - "role.unbound_from_resource": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource the role was unbound from. ChatGPT workspace connector resources use `__`." - }, - "role_id": { - "type": "string", - "description": "The ID of the role that was unbound from the resource." - }, - "resource_id": { - "type": "string", - "description": "The ID of the resource the role was unbound from." - }, - "resource_type": { - "type": "string", - "description": "The type of resource the role was unbound from." - }, - "permissions": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The permissions remaining for the role after the change." - }, - "workspace_id": { - "type": "string", - "description": "The workspace ID for a ChatGPT workspace connector resource." - }, - "connector_id": { - "type": "string", - "description": "The connector ID for a ChatGPT workspace connector resource." - }, - "connector_name": { - "type": "string", - "description": "The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved." - }, - "enabled": { - "type": "boolean", - "description": "Whether the connector is enabled for the role." - }, - "source": { - "type": "string", - "description": "The connector role mutation path that produced the event.", - "enum": [ - "role_toggle", - "role_connector_update", - "role_delete", - "workspace_permissions", - "connector_publish" - ] + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "service_account.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The service account ID." - }, - "data": { - "type": "object", - "description": "The payload used to create the service account.", - "properties": { - "role": { - "type": "string", - "description": "The role of the service account. Is either `owner` or `member`." - } + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "service_account.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The service account ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to updated the service account.", - "properties": { - "role": { - "type": "string", - "description": "The role of the service account. Is either `owner` or `member`." - } + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "service_account.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The service account ID." + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "workload_identity_provider.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The workload identity provider ID." - }, - "data": { - "type": "object", - "description": "The payload used to create the workload identity provider." + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "workload_identity_provider.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The workload identity provider ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the workload identity provider." + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "workload_identity_provider.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The workload identity provider ID." - }, - "name": { - "type": "string", - "description": "The workload identity provider name." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/agents/sessions/{session_id}/events": { + "get": { + "operationId": "listAgentSessionEvents", + "summary": "Stream agent session events", + "description": "Streams live events for an agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." + } + ], + "responses": { + "200": { + "description": "A live stream of session events.", + "content": { + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/SessionEvent" + } } } }, - "workload_identity_provider_mapping.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The workload identity provider mapping ID." - }, - "identity_provider_id": { - "type": "string", - "description": "The workload identity provider ID." - }, - "data": { - "type": "object", - "description": "The payload used to create the workload identity provider mapping." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "workload_identity_provider_mapping.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The workload identity provider mapping ID." - }, - "identity_provider_id": { - "type": "string", - "description": "The workload identity provider ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the workload identity provider mapping." + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "workload_identity_provider_mapping.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The workload identity provider mapping ID." - }, - "identity_provider_id": { - "type": "string", - "description": "The workload identity provider ID." - }, - "project_id": { - "type": "string", - "description": "The project ID." - }, - "service_account_id": { - "type": "string", - "description": "The mapped service account ID." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "user.added": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The user ID." - }, - "data": { - "type": "object", - "description": "The payload used to add the user to the project.", - "properties": { - "role": { - "type": "string", - "description": "The role of the user. Is either `owner` or `member`." - } + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "user.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The project ID." - }, - "changes_requested": { - "type": "object", - "description": "The payload used to update the user.", - "properties": { - "role": { - "type": "string", - "description": "The role of the user. Is either `owner` or `member`." - } + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "user.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The user ID." + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "certificate.created": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The certificate ID." - }, - "name": { - "type": "string", - "description": "The name of the certificate." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } + } + }, + "x-oai-streaming": { + "request_field": null, + "response_status_code": 200 + } + }, + "post": { + "operationId": "createAgentSessionEvents", + "summary": "Create agent session input events", + "description": "Submits message, cancellation, tool-result, or computer-use approval-response events to a managed agent session. Cancellation can recover a still-open turn whose backend execution has ended by marking it cancelled and abandoning unpublished outputs. Saved results, published files, and existing terminal outcomes are preserved. HTTP 202 confirms acceptance, not durable completion. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." }, - "certificate.updated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The certificate ID." - }, - "name": { - "type": "string", - "description": "The name of the certificate." + { + "name": "Idempotency-Key", + "in": "header", + "required": false, + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "description": "An optional client-generated key that makes retries of submitted messages idempotent." + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateSessionEventsParams" } } + } + }, + "responses": { + "202": { + "description": "The events were accepted." }, - "certificate.deleted": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "id": { - "type": "string", - "description": "The certificate ID." - }, - "name": { - "type": "string", - "description": "The name of the certificate." - }, - "certificate": { - "type": "string", - "description": "The certificate content in PEM format." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "certificates.activated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "certificates": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The certificate ID." - }, - "name": { - "type": "string", - "description": "The name of the certificate." - } - } + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "certificates.deactivated": { - "type": "object", - "description": "The details for events with this `type`.", - "properties": { - "certificates": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The certificate ID." - }, - "name": { - "type": "string", - "description": "The name of the certificate." - } - } + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } - } - }, - "required": [ - "id", - "type", - "effective_at" - ], - "x-oaiMeta": { - "name": "The audit log object", - "example": "{\n \"id\": \"req_xxx_20240101\",\n \"type\": \"api_key.created\",\n \"effective_at\": 1720804090,\n \"actor\": {\n \"type\": \"session\",\n \"session\": {\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n },\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\"\n }\n },\n \"api_key.created\": {\n \"id\": \"key_xxxx\",\n \"data\": {\n \"scopes\": [\"resource.operation\"]\n }\n }\n}\n" - } - }, - "AuditLogActor": { - "type": "object", - "description": "The actor who performed the audit logged action.", - "properties": { - "type": { - "type": "string", - "description": "The type of actor. Is either `session` or `api_key`.", - "enum": [ - "session", - "api_key" - ] }, - "session": { - "$ref": "#/components/schemas/AuditLogActorSession" + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "api_key": { - "$ref": "#/components/schemas/AuditLogActorApiKey" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } } - }, - "AuditLogActorApiKey": { - "type": "object", - "description": "The API Key used to perform the audit logged action.", - "properties": { - "id": { - "type": "string", - "description": "The tracking id of the API key." + } + }, + "/agents/sessions/{session_id}/items": { + "get": { + "operationId": "listAgentSessionItems", + "summary": "List agent session items", + "description": "Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." }, - "type": { - "type": "string", - "description": "The type of API key. Can be either `user` or `service_account`.", - "enum": [ - "user", - "service_account" - ] + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, - "user": { - "$ref": "#/components/schemas/AuditLogActorUser" + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." }, - "service_account": { - "$ref": "#/components/schemas/AuditLogActorServiceAccount" - } - } - }, - "AuditLogActorServiceAccount": { - "type": "object", - "description": "The service account that performed the audit logged action.", - "properties": { - "id": { - "type": "string", - "description": "The service account id." + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." } - } - }, - "AuditLogActorSession": { - "type": "object", - "description": "The session in which the audit logged action was performed.", - "properties": { - "user": { - "$ref": "#/components/schemas/AuditLogActorUser" + ], + "responses": { + "200": { + "description": "A page of session items.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionItemListResource" + } + } + } }, - "ip_address": { - "type": "string", - "description": "The IP address from which the action was performed." - } - } - }, - "AuditLogActorUser": { - "type": "object", - "description": "The user who performed the audit logged action.", - "properties": { - "id": { - "type": "string", - "description": "The user id." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "email": { - "type": "string", - "description": "The user email." - } - } - }, - "AuditLogEventType": { - "type": "string", - "description": "The event type.", - "enum": [ - "api_key.created", - "api_key.updated", - "api_key.deleted", - "certificate.created", - "certificate.updated", - "certificate.deleted", - "certificates.activated", - "certificates.deactivated", - "checkpoint.permission.created", - "checkpoint.permission.deleted", - "external_key.registered", - "external_key.removed", - "group.created", - "group.updated", - "group.deleted", - "invite.sent", - "invite.accepted", - "invite.deleted", - "ip_allowlist.created", - "ip_allowlist.updated", - "ip_allowlist.deleted", - "ip_allowlist.config.activated", - "ip_allowlist.config.deactivated", - "login.succeeded", - "login.failed", - "logout.succeeded", - "logout.failed", - "organization.updated", - "project.created", - "project.updated", - "project.archived", - "project.deleted", - "rate_limit.updated", - "rate_limit.deleted", - "resource.deleted", - "tunnel.created", - "tunnel.updated", - "tunnel.deleted", - "workload_identity_provider.created", - "workload_identity_provider.updated", - "workload_identity_provider.deleted", - "workload_identity_provider_mapping.created", - "workload_identity_provider_mapping.updated", - "workload_identity_provider_mapping.deleted", - "role.created", - "role.updated", - "role.deleted", - "role.assignment.created", - "role.assignment.deleted", - "role.bound_to_resource", - "role.unbound_from_resource", - "scim.enabled", - "scim.disabled", - "service_account.created", - "service_account.updated", - "service_account.deleted", - "user.added", - "user.updated", - "user.deleted", - "tenant.metadata.updated", - "tenant.microsoft_entra_mapping.upserted", - "tenant.microsoft_entra_mapping.deleted", - "tenant.workload_identity.provider.created", - "tenant.workload_identity.provider.updated", - "tenant.workload_identity.provider.archived", - "tenant.workload_identity.mapping.created", - "tenant.workload_identity.mapping.updated", - "tenant.workload_identity.mapping.archived", - "tenant.workload_identity.binding.created", - "tenant.workload_identity.principal.provisioned", - "tenant.workload_identity.access_token.issued", - "tenant.admin_api_key.created", - "tenant.admin_api_key.updated", - "tenant.admin_api_key.deleted", - "tenant.project_api_key.created", - "tenant.trusted_access.business_verification.started", - "tenant.trusted_access.application.submitted", - "tenant.chatgpt_access_token.revoked", - "tenant.migration.completed", - "tenant.sso.migrated", - "tenant.domains.migrated", - "tenant.sso_connection.created", - "tenant.sso_connection.updated", - "tenant.sso_connection.deleted", - "tenant.sso_connection.setup.started", - "tenant.policy.created", - "tenant.policy.updated", - "tenant.policy.deleted", - "tenant.policy.attached", - "tenant.policy.detached", - "tenant.principal_authentication_policy.resolved", - "tenant.scim.setup.started", - "tenant.scim.deletion.requested", - "tenant.scim.directory.created", - "tenant.product_access_policy.updated", - "tenant.resource_share_grant.created", - "tenant.resource_share_grant.updated", - "tenant.resource_share_grant.accepted", - "tenant.resource_share_grant.declined", - "tenant.resource_share_grant.revoked", - "tenant.resource_share_grant.deleted", - "tenant.service_account.updated", - "tenant.service_account.deleted", - "tenant.service_account.token.revoked", - "tenant.billing.overage_limit.updated", - "tenant.billing.alerts.updated", - "tenant.billing.info.updated", - "tenant.usage_limit.workspace.updated", - "tenant.usage_limit.group.updated", - "tenant.usage_limit.user.updated", - "tenant.usage_limit.increase_request.updated", - "tenant.usage_limit.increase_request.resolved", - "tenant.group.created", - "tenant.group.updated", - "tenant.group.deleted", - "tenant.group.member.added", - "tenant.group.member.removed", - "tenant.migration_rollout.status.updated", - "tenant.migration_rollout.tier.updated", - "tenant.role.metadata.updated", - "tenant.custom_role.created", - "tenant.custom_role.updated", - "tenant.custom_role.deleted", - "tenant.role_assignment.created", - "tenant.role_assignment.deleted", - "tenant.resource_role_assignment.created", - "tenant.resource_role_assignment.deleted", - "tenant.resource_access.updated", - "tenant.resource_access.deleted", - "tenant.ads_account.onboarding.redemption", - "tenant.session_policy.created", - "tenant.session_policy.updated", - "tenant.session_policy.deleted", - "tenant.session_revocation.started", - "tenant.third_party_app_policy.updated", - "tenant.user.added", - "tenant.user.updated", - "tenant.user.removed", - "tenant.user.looked_up", - "tenant.user.invited", - "tenant.membership.revoked", - "tenant.api_organization_invite.upserted", - "tenant.api_organization_invite.deleted", - "tenant.chatgpt_workspace_invite.upserted", - "tenant.membership.accepted", - "tenant.membership.declined", - "tenant.workspace_invite_email_settings.updated" - ] - }, - "AutoChunkingStrategyRequestParam": { - "type": "object", - "title": "Auto Chunking Strategy", - "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `auto`.", - "enum": [ - "auto" - ], - "x-stainless-const": true - } - }, - "required": [ - "type" - ] - }, - "Batch": { - "type": "object", - "properties": { - "id": { - "type": "string" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "object": { - "type": "string", - "enum": [ - "batch" - ], - "description": "The object type, which is always `batch`.", - "x-stainless-const": true + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "endpoint": { - "type": "string", - "description": "The OpenAI API endpoint used by the batch." + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "model": { - "type": "string", - "description": "Model ID used to process the batch, like `gpt-6-astra`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model\nguide](https://developers.openai.com/api/docs/models) to browse and compare available models.\n" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "errors": { - "type": "object", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BatchError" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "input_file_id": { - "type": "string", - "description": "The ID of the input file for the batch." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/agents/sessions/{session_id}/traces": { + "get": { + "operationId": "listAgentSessionTraces", + "summary": "List agent session traces", + "description": "Lists published root-turn traces as OTLP JSON, ordered by turn creation time and ID. Unpublished traces are skipped. Each page returns data available when read; it does not wait for late traces. Trace reads and the JSON response are limited to 16 MiB per request. If the limit is exceeded, request fewer traces.", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." }, - "completion_window": { - "type": "string", - "description": "The time frame within which the batch should be processed." + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, - "status": { - "type": "string", - "description": "The current status of the batch.", - "enum": [ - "validating", - "failed", - "in_progress", - "finalizing", - "completed", - "expired", - "cancelling", - "cancelled" - ] + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." }, - "output_file_id": { - "type": "string", - "description": "The ID of the file containing the outputs of successfully executed requests." + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + } + ], + "responses": { + "200": { + "description": "A page of published session traces.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionTraceListResource", + "description": "A page of published session traces." + } + } + } }, - "error_file_id": { - "type": "string", - "description": "The ID of the file containing the outputs of requests with errors." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch was created." + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "in_progress_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch started processing." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch will expire." + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "finalizing_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch started finalizing." + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "completed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch was completed." + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "failed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch failed." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/agents/sessions/{session_id}/turns": { + "get": { + "operationId": "listAgentSessionTurns", + "summary": "List agent session turns", + "description": "Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session." }, - "expired_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch expired." + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, - "cancelling_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch started cancelling." + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." }, - "cancelled_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the batch was cancelled." + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + } + ], + "responses": { + "200": { + "description": "A page of session turns.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionTurnListResource", + "description": "A page of turns from an agent session or subagent." + } + } + } }, - "request_counts": { - "$ref": "#/components/schemas/BatchRequestCounts" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "usage": { - "type": "object", - "description": "Represents token usage details including input tokens, output tokens, a\nbreakdown of output tokens, and the total tokens used. Only populated on\nbatches created after September 7, 2025.\n", - "properties": { - "input_tokens": { - "type": "integer", - "description": "The number of input tokens." - }, - "input_tokens_details": { - "type": "object", - "description": "A detailed breakdown of the input tokens.", - "properties": { - "cached_tokens": { - "type": "integer", - "description": "The number of tokens that were retrieved from the cache. [More on\nprompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).\n" - } - }, - "required": [ - "cached_tokens" - ] - }, - "output_tokens": { - "type": "integer", - "description": "The number of output tokens." - }, - "output_tokens_details": { - "type": "object", - "description": "A detailed breakdown of the output tokens.", - "properties": { - "reasoning_tokens": { - "type": "integer", - "description": "The number of reasoning tokens." - } - }, - "required": [ - "reasoning_tokens" - ] - }, - "total_tokens": { - "type": "integer", - "description": "The total number of tokens used." + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - }, - "required": [ - "input_tokens", - "input_tokens_details", - "output_tokens", - "output_tokens_details", - "total_tokens" - ] + } }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - } - }, - "required": [ - "id", - "object", - "endpoint", - "input_file_id", - "completion_window", - "status", - "created_at" - ], - "x-oaiMeta": { - "name": "The batch object", - "example": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"model\": \"gpt-6-astra\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"usage\": {\n \"input_tokens\": 1500,\n \"input_tokens_details\": {\n \"cached_tokens\": 1024\n },\n \"output_tokens\": 500,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 300\n },\n \"total_tokens\": 2000\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\",\n }\n}\n" - } - }, - "BatchError": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "An error code identifying the error type." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "message": { - "type": "string", - "description": "A human-readable message providing more details about the error." + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "param": { - "anyOf": [ - { - "type": "string", - "description": "The name of the parameter that caused the error, if applicable." - }, - { - "type": "null" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "line": { - "anyOf": [ - { - "type": "integer", - "description": "The line number of the input file where the error occurred, if applicable." - }, - { - "type": "null" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] - } - } - }, - "BatchFileExpirationAfter": { - "type": "object", - "title": "File expiration policy", - "description": "The expiration policy for the output and/or error file that are generated for a batch.", - "properties": { - "anchor": { - "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`. Note that the anchor is the file creation time, not the time the batch is created.", - "type": "string", - "enum": [ - "created_at" - ], - "x-stainless-const": true + } }, - "seconds": { - "description": "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).", - "type": "integer", - "format": "int64", - "minimum": 3600, - "maximum": 2592000 + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } - }, - "required": [ - "anchor", - "seconds" - ] - }, - "BatchRequestCounts": { - "type": "object", - "properties": { - "total": { - "type": "integer", - "description": "Total number of requests in the batch." - }, - "completed": { - "type": "integer", - "description": "Number of requests that have been completed successfully." + } + } + }, + "/agents/sessions/{session_id}/turns/{turn_id}": { + "get": { + "operationId": "retrieveAgentSessionTurn", + "summary": "Retrieve an agent session turn", + "description": "Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session that owns the turn." }, - "failed": { - "type": "integer", - "description": "Number of requests that have failed." + { + "name": "turn_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the turn." } - }, - "required": [ - "total", - "completed", - "failed" ], - "description": "The request counts for different statuses within the batch." - }, - "Certificate": { - "type": "object", - "description": "Represents an individual `certificate` uploaded to the organization.", - "properties": { - "object": { - "type": "string", - "enum": [ - "certificate", - "organization.certificate", - "organization.project.certificate" - ], - "description": "The object type.\n\n- If creating, updating, or getting a specific certificate, the object type is `certificate`.\n- If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`.\n- If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`.\n", - "x-stainless-const": true + "responses": { + "200": { + "description": "The requested turn.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TurnResource" + } + } + } }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ], - "description": "The name of the certificate." + } }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate was uploaded." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "certificate_details": { - "type": "object", - "properties": { - "valid_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate becomes valid." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate expires." - }, - "content": { - "type": "string", - "description": "The content of the certificate in PEM format." + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "active": { - "type": "boolean", - "description": "Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate." - } - }, - "required": [ - "object", - "id", - "name", - "created_at", - "certificate_details" - ], - "x-oaiMeta": { - "name": "The certificate object", - "example": "{\n \"object\": \"certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Certificate\",\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 1234567,\n \"expires_at\": 12345678,\n \"content\": \"-----BEGIN CERTIFICATE----- MIIGAjCCA...6znFlOW+ -----END CERTIFICATE-----\"\n }\n}\n" - } - }, - "ChatCompletionAllowedTools": { - "type": "object", - "title": "Allowed tools", - "description": "Constrains the tools available to the model to a pre-defined set.\n", - "properties": { - "mode": { - "type": "string", - "enum": [ - "auto", - "required" - ], - "description": "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n" + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "tools": { - "type": "array", - "description": "A list of tool definitions that the model should be allowed to call.\n\nFor the Chat Completions API, the list of tool definitions might look like:\n```json\n[\n { \"type\": \"function\", \"function\": { \"name\": \"get_weather\" } },\n { \"type\": \"function\", \"function\": { \"name\": \"get_time\" } }\n]\n```\n", - "items": { - "type": "object", - "x-oaiExpandable": false, - "description": "A tool definition that the model should be allowed to call.\n", - "additionalProperties": true + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } - } - }, - "required": [ - "mode", - "tools" - ] - }, - "ChatCompletionAllowedToolsChoice": { - "type": "object", - "title": "Allowed tools", - "description": "Constrains the tools available to the model to a pre-defined set.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "allowed_tools" - ], - "description": "Allowed tool configuration type. Always `allowed_tools`.", - "x-stainless-const": true }, - "allowed_tools": { - "$ref": "#/components/schemas/ChatCompletionAllowedTools" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } - }, - "required": [ - "type", - "allowed_tools" - ] - }, - "ChatCompletionDeleted": { - "type": "object", - "properties": { - "object": { - "type": "string", - "description": "The type of object being deleted.", - "enum": [ - "chat.completion.deleted" - ], - "x-stainless-const": true + } + } + }, + "/agents/sessions/{session_id}/turns/{turn_id}/items": { + "get": { + "operationId": "listAgentSessionTurnItems", + "summary": "List agent session turn items", + "description": "Lists items belonging to one root-agent turn, including its interactions with subagents. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).", + "tags": [ + "Agents" + ], + "parameters": [ + { + "name": "session_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the session that owns the turn." }, - "id": { - "type": "string", - "description": "The ID of the chat completion that was deleted." + { + "name": "turn_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the turn." }, - "deleted": { - "type": "boolean", - "description": "Whether the chat completion was deleted." - } - }, - "required": [ - "object", - "id", - "deleted" - ] - }, - "ChatCompletionFunctionCallOption": { - "type": "object", - "description": "Specifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "name" - ] - }, - "ChatCompletionFunctions": { - "type": "object", - "deprecated": true, - "properties": { - "description": { - "type": "string", - "description": "A description of what the function does, used by the model to choose when and how to call the function." + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, - "name": { - "type": "string", - "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." }, - "parameters": { - "$ref": "#/components/schemas/FunctionParameters" + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." } - }, - "required": [ - "name" - ] - }, - "ChatCompletionList": { - "type": "object", - "title": "ChatCompletionList", - "description": "An object representing a list of Chat Completions.\n", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "default": "list", - "description": "The type of this object. It is always set to \"list\".\n", - "x-stainless-const": true - }, - "data": { - "type": "array", - "description": "An array of chat completion objects.\n", - "items": { - "$ref": "#/components/schemas/CreateChatCompletionResponse" + ], + "responses": { + "200": { + "description": "A page of session turn items.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SessionItemListResource" + } + } } }, - "first_id": { - "type": "string", - "description": "The identifier of the first chat completion in the data array." - }, - "last_id": { - "type": "string", - "description": "The identifier of the last chat completion in the data array." - }, - "has_more": { - "type": "boolean", - "description": "Indicates whether there are more Chat Completions available." - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "x-oaiMeta": { - "name": "The chat completion list object", - "group": "chat", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"chat.completion\",\n \"id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2\",\n \"model\": \"gpt-6-astra\",\n \"created\": 1738960610,\n \"request_id\": \"req_ded8ab984ec4bf840f37566c1011c417\",\n \"tool_choice\": null,\n \"usage\": {\n \"total_tokens\": 31,\n \"completion_tokens\": 18,\n \"prompt_tokens\": 13\n },\n \"seed\": 4944116822809979520,\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"presence_penalty\": 0.0,\n \"frequency_penalty\": 0.0,\n \"system_fingerprint\": \"fp_50cad350e4\",\n \"input_user\": null,\n \"service_tier\": \"default\",\n \"tools\": null,\n \"metadata\": {},\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"content\": \"Mind of circuits hum, \\nLearning patterns in silence— \\nFuture's quiet spark.\",\n \"role\": \"assistant\",\n \"tool_calls\": null,\n \"function_call\": null\n },\n \"finish_reason\": \"stop\",\n \"logprobs\": null\n }\n ],\n \"response_format\": null\n }\n ],\n \"first_id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2\",\n \"last_id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2\",\n \"has_more\": false\n}\n" - } - }, - "ChatCompletionMessageCustomToolCall": { - "type": "object", - "title": "Custom tool call", - "description": "A call to a custom tool created by the model.\n", - "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "type": { - "type": "string", - "enum": [ - "custom" - ], - "description": "The type of the tool. Always `custom`.", - "x-stainless-const": true + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "custom": { - "type": "object", - "description": "The custom tool that the model called.", - "properties": { - "name": { - "type": "string", - "description": "The name of the custom tool to call." - }, - "input": { - "type": "string", - "description": "The input for the custom tool call generated by the model." + "403": { + "description": "The API key lacks the required permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - }, - "required": [ - "name", - "input" - ] - } - }, - "required": [ - "id", - "type", - "custom" - ] - }, - "ChatCompletionMessageList": { - "type": "object", - "title": "ChatCompletionMessageList", - "description": "An object representing a list of chat completion messages.\n", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "default": "list", - "description": "The type of this object. It is always set to \"list\".\n", - "x-stainless-const": true + } }, - "data": { - "type": "array", - "description": "An array of chat completion message objects.\n", - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/ChatCompletionResponseMessage" - }, - { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The identifier of the chat message." - }, - "content_parts": { - "anyOf": [ - { - "type": "array", - "description": "If a content parts array was provided, this is an array of `text` and `image_url` parts.\nOtherwise, null.\n", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - }, - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartImage" - } - ] - } - }, - { - "type": "null" - } - ] - } - } + "404": { + "description": "The requested session or event was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - ] + } } }, - "first_id": { - "type": "string", - "description": "The identifier of the first chat message in the data array." + "409": { + "description": "The request conflicted with the current session state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "last_id": { - "type": "string", - "description": "The identifier of the last chat message in the data array." + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "has_more": { - "type": "boolean", - "description": "Indicates whether there are more chat messages available." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "x-oaiMeta": { - "name": "The chat completion message list object", - "group": "chat", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0\",\n \"role\": \"user\",\n \"content\": \"write a haiku about ai\",\n \"name\": null,\n \"content_parts\": null\n }\n ],\n \"first_id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0\",\n \"last_id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0\",\n \"has_more\": false\n}\n" } - }, - "ChatCompletionMessageToolCall": { - "type": "object", - "title": "Function tool call", - "description": "A call to a function tool created by the model.\n", - "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call." + } + }, + "/vaults": { + "get": { + "operationId": "listVaults", + "summary": "List vaults", + "description": "Lists vaults using ID-based pagination. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "The type of the tool. Currently, only `function` is supported.", - "x-stainless-const": true + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." }, - "function": { - "type": "object", - "description": "The function that the model called.", - "properties": { - "name": { + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." + }, + { + "name": "metadata", + "in": "query", + "required": false, + "schema": { + "type": "object", + "additionalProperties": { "type": "string", - "description": "The name of the function to call." + "minLength": 0, + "maxLength": 512 }, - "arguments": { + "propertyNames": { "type": "string", - "description": "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." - } + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 }, - "required": [ - "name", - "arguments" - ] + "description": "Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear.", + "style": "deepObject", + "explode": true + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/VaultStatusFilterParam" + }, + "description": "Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default." } - }, - "required": [ - "id", - "type", - "function" - ] - }, - "ChatCompletionMessageToolCallChunk": { - "type": "object", - "properties": { - "index": { - "type": "integer" + ], + "responses": { + "200": { + "description": "A page of vaults.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultListResource", + "description": "A page of vaults." + } + } + } }, - "id": { - "type": "string", - "description": "The ID of the tool call." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "The type of the tool. Currently, only `function` is supported.", - "x-stainless-const": true + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "function": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." - }, - "arguments": { - "type": "string", - "description": "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." + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "required": [ - "index" - ] - }, - "ChatCompletionMessageToolCalls": { - "type": "array", - "description": "The tool calls generated by the model, such as function calls.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionMessageToolCall" - }, - { - "$ref": "#/components/schemas/ChatCompletionMessageCustomToolCall" + }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } - ], - "discriminator": { - "propertyName": "type" - } - } - }, - "ChatCompletionModalities": { - "anyOf": [ - { - "type": "array", - "description": "Output types that you would like the model to generate for this request.\nMost models are capable of generating text, which is the default:\n\n`[\"text\"]`\n\nThe `gpt-4o-audio-preview` model can also be used to [generate audio](https://developers.openai.com/api/docs/guides/audio). To\nrequest that this model generate both text and audio responses, you can\nuse:\n\n`[\"text\", \"audio\"]`\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } }, - { - "type": "null" - } - ] - }, - "ChatCompletionModeration": { - "type": "object", - "description": "Moderation results or errors for the request input and generated output.", - "properties": { - "input": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionModerationResults" - }, - { - "$ref": "#/components/schemas/ChatCompletionModerationError" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ], - "discriminator": { - "propertyName": "type" - }, - "description": "Moderation for the request input." + } }, - "output": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionModerationResults" - }, - { - "$ref": "#/components/schemas/ChatCompletionModerationError" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ], - "discriminator": { - "propertyName": "type" - }, - "description": "Moderation for the generated output." + } } - }, - "required": [ - "input", - "output" - ] + } }, - "ChatCompletionModerationError": { - "type": "object", - "description": "An error produced while attempting moderation.", - "properties": { - "type": { - "type": "string", - "enum": [ - "error" - ], - "description": "The object type, which is always `error`.", - "x-stainless-const": true - }, - "code": { - "type": "string", - "description": "The error code." - }, - "message": { - "type": "string", - "description": "The error message." + "post": { + "operationId": "createVault", + "summary": "Create a vault", + "description": "Creates a vault for the current project. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVaultParams" + } + } } }, - "required": [ - "type", - "code", - "message" - ] - }, - "ChatCompletionModerationResults": { - "type": "object", - "description": "Successful moderation results for the request input or generated output.", - "properties": { - "type": { - "type": "string", - "enum": [ - "moderation_results" - ], - "description": "The object type, which is always `moderation_results`.", - "x-stainless-const": true + "responses": { + "201": { + "description": "The created vault.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultResource" + } + } + } }, - "model": { - "type": "string", - "description": "The moderation model used to generate the results." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "results": { - "type": "array", - "description": "A list of moderation results.", - "items": { - "$ref": "#/components/schemas/ModerationResultBody" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } - } - }, - "required": [ - "type", - "model", - "results" - ] - }, - "ChatCompletionNamedToolChoice": { - "type": "object", - "title": "Function tool choice", - "description": "Specifies a tool the model should use. Use to force the model to call a specific function.", - "properties": { - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "For function calling, the type is always `function`.", - "x-stainless-const": true }, - "function": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to call." + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - }, - "required": [ - "name" - ] - } - }, - "required": [ - "type", - "function" - ] - }, - "ChatCompletionNamedToolChoiceCustom": { - "type": "object", - "title": "Custom tool choice", - "description": "Specifies a tool the model should use. Use to force the model to call a specific custom tool.", - "properties": { - "type": { - "type": "string", - "enum": [ - "custom" - ], - "description": "For custom tool calling, the type is always `custom`.", - "x-stainless-const": true + } }, - "custom": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the custom tool to call." + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/vaults/{vault_id}": { + "get": { + "operationId": "retrieveVault", + "summary": "Retrieve a vault", + "description": "Retrieves a vault by its ID. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "required": [ - "name" - ] + "description": "The ID of the vault." } - }, - "required": [ - "type", - "custom" - ] - }, - "ChatCompletionRequestAssistantMessage": { - "type": "object", - "title": "Assistant message", - "description": "Messages sent by the model in response to user messages.\n", - "properties": { - "content": { - "anyOf": [ - { - "oneOf": [ - { - "type": "string", - "description": "The contents of the assistant message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessageContentPart" - }, - "minItems": 1 - } - ], - "description": "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n" - }, - { - "type": "null" + ], + "responses": { + "200": { + "description": "The requested vault.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultResource" + } } - ] + } }, - "refusal": { - "anyOf": [ - { - "type": "string", - "description": "The refusal message by the assistant." - }, - { - "type": "null" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "role": { - "type": "string", - "enum": [ - "assistant" - ], - "description": "The role of the messages author, in this case `assistant`.", - "x-stainless-const": true + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "name": { - "type": "string", - "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "audio": { - "anyOf": [ - { - "type": "object", - "description": "Data about a previous audio response from the model.\n[Learn more](https://developers.openai.com/api/docs/guides/audio).\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for a previous audio response from the model.\n" - } + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - }, - { - "type": "null" } - ] + } }, - "tool_calls": { - "$ref": "#/components/schemas/ChatCompletionMessageToolCalls" + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "function_call": { - "anyOf": [ - { - "type": "object", - "deprecated": true, - "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", - "properties": { - "arguments": { - "type": "string", - "description": "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": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "arguments", - "name" - ] - }, - { - "type": "null" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } - }, - "required": [ - "role" - ] + } }, - "ChatCompletionRequestAssistantMessageContentPart": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - }, + "post": { + "operationId": "updateVault", + "summary": "Update a vault", + "description": "Updates the name or metadata of an active vault. Omitted fields remain unchanged. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartRefusal" + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." } ], - "discriminator": { - "propertyName": "type" - } - }, - "ChatCompletionRequestDeveloperMessage": { - "type": "object", - "title": "Developer message", - "description": "Developer-provided instructions that the model should follow, regardless of\nmessages sent by the user. With o1 models and newer, `developer` messages\nreplace the previous `system` messages.\n", - "properties": { + "requestBody": { "content": { - "description": "The contents of the developer message.", - "oneOf": [ - { - "type": "string", - "description": "The contents of the developer message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type. For developer messages, only type `text` is supported.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - }, - "minItems": 1 + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateVaultParams" } - ] - }, - "role": { - "type": "string", - "enum": [ - "developer" - ], - "description": "The role of the messages author, in this case `developer`.", - "x-stainless-const": true + } }, - "name": { - "type": "string", - "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." - } + "required": true }, - "required": [ - "content", - "role" - ] - }, - "ChatCompletionRequestFunctionMessage": { - "type": "object", - "title": "Function message", - "deprecated": true, - "properties": { - "role": { - "type": "string", - "enum": [ - "function" - ], - "description": "The role of the messages author, in this case `function`.", - "x-stainless-const": true - }, - "content": { - "anyOf": [ - { - "type": "string", - "description": "The contents of the function message." - }, - { - "type": "null" + "responses": { + "200": { + "description": "The updated vault.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultResource" + } } - ] + } }, - "name": { - "type": "string", - "description": "The name of the function to call." - } - }, - "required": [ - "role", - "content", - "name" - ] - }, - "ChatCompletionRequestMessage": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestDeveloperMessage" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ChatCompletionRequestSystemMessage" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ChatCompletionRequestUserMessage" + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessage" + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ChatCompletionRequestToolMessage" + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ChatCompletionRequestFunctionMessage" - } - ], - "discriminator": { - "propertyName": "role" - } - }, - "ChatCompletionRequestMessageContentPartAudio": { - "type": "object", - "title": "Audio content part", - "description": "Learn about [audio inputs](https://developers.openai.com/api/docs/guides/audio).\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "input_audio" - ], - "description": "The type of the content part. Always `input_audio`.", - "x-stainless-const": true - }, - "input_audio": { - "type": "object", - "properties": { - "data": { - "type": "string", - "description": "Base64 encoded audio data." - }, - "format": { - "type": "string", - "enum": [ - "wav", - "mp3" - ], - "description": "The format of the encoded audio data. Currently supports \"wav\" and \"mp3\".\n" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - }, - "required": [ - "data", - "format" - ] - }, - "prompt_cache_breakpoint": { - "$ref": "#/components/schemas/PromptCacheBreakpointParam" - } - }, - "required": [ - "type", - "input_audio" - ] - }, - "ChatCompletionRequestMessageContentPartFile": { - "type": "object", - "title": "File content part", - "description": "Learn about [file inputs](https://developers.openai.com/api/docs/guides/text) for text generation.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "file" - ], - "description": "The type of the content part. Always `file`.", - "x-stainless-const": true + } }, - "file": { - "type": "object", - "properties": { - "filename": { - "type": "string", - "description": "The name of the file, used when passing the file to the model as a\nstring.\n" - }, - "file_data": { - "type": "string", - "description": "The base64 encoded file data, used when passing the file to the model\nas a string.\n" - }, - "file_id": { - "type": "string", - "description": "The ID of an uploaded file to use as input.\n" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - }, - "prompt_cache_breakpoint": { - "$ref": "#/components/schemas/PromptCacheBreakpointParam" } - }, - "required": [ - "type", - "file" - ] + } }, - "ChatCompletionRequestMessageContentPartImage": { - "type": "object", - "title": "Image content part", - "description": "Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision).\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "image_url" - ], - "description": "The type of the content part.", - "x-stainless-const": true - }, - "image_url": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "Either a URL of the image or the base64 encoded image data.", - "format": "uri" - }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image. Learn more in the [Vision guide](https://developers.openai.com/api/docs/guides/images-vision#choose-an-image-detail-level).", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" - } + "delete": { + "operationId": "deleteVault", + "summary": "Delete a vault", + "description": "Deletes a vault and all its credentials. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "required": [ - "url" - ] - }, - "prompt_cache_breakpoint": { - "$ref": "#/components/schemas/PromptCacheBreakpointParam" + "description": "The ID of the vault." } - }, - "required": [ - "type", - "image_url" - ] - }, - "ChatCompletionRequestMessageContentPartRefusal": { - "type": "object", - "title": "Refusal content part", - "properties": { - "type": { - "type": "string", - "enum": [ - "refusal" - ], - "description": "The type of the content part.", - "x-stainless-const": true + ], + "responses": { + "200": { + "description": "The deleted vault.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedVaultResource" + } + } + } }, - "refusal": { - "type": "string", - "description": "The refusal message generated by the model." - } - }, - "required": [ - "type", - "refusal" - ] - }, - "ChatCompletionRequestMessageContentPartText": { - "type": "object", - "title": "Text content part", - "description": "Learn about [text inputs](https://developers.openai.com/api/docs/guides/text).\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "text" - ], - "description": "The type of the content part.", - "x-stainless-const": true + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "text": { - "type": "string", - "description": "The text content." + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "prompt_cache_breakpoint": { - "$ref": "#/components/schemas/PromptCacheBreakpointParam" - } - }, - "required": [ - "type", - "text" - ] - }, - "ChatCompletionRequestSystemMessage": { - "type": "object", - "title": "System message", - "description": "Developer-provided instructions that the model should follow, regardless of\nmessages sent by the user. With o1 models and newer, use `developer` messages\nfor this purpose instead.\n", - "properties": { - "content": { - "description": "The contents of the system message.", - "oneOf": [ - { - "type": "string", - "description": "The contents of the system message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type. For system messages, only type `text` is supported.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestSystemMessageContentPart" - }, - "minItems": 1 + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "role": { - "type": "string", - "enum": [ - "system" - ], - "description": "The role of the messages author, in this case `system`.", - "x-stainless-const": true + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "name": { - "type": "string", - "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." - } - }, - "required": [ - "content", - "role" - ] - }, - "ChatCompletionRequestSystemMessageContentPart": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - } - ] - }, - "ChatCompletionRequestToolMessage": { - "type": "object", - "title": "Tool message", - "properties": { - "role": { - "type": "string", - "enum": [ - "tool" - ], - "description": "The role of the messages author, in this case `tool`.", - "x-stainless-const": true + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "content": { - "oneOf": [ - { - "type": "string", - "description": "The contents of the tool message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type. For tool messages, only type `text` is supported.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestToolMessageContentPart" - }, - "minItems": 1 + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ], - "description": "The contents of the tool message." + } }, - "tool_call_id": { - "type": "string", - "description": "Tool call that this message is responding to." + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } - }, - "required": [ - "role", - "content", - "tool_call_id" - ] - }, - "ChatCompletionRequestToolMessageContentPart": { - "oneOf": [ + } + } + }, + "/vaults/{vault_id}/credentials": { + "get": { + "operationId": "listVaultCredentials", + "summary": "List vault credentials", + "description": "Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" - } - ] - }, - "ChatCompletionRequestUserMessage": { - "type": "object", - "title": "User message", - "description": "Messages sent by an end user, containing prompts or additional context\ninformation.\n", - "properties": { - "content": { - "description": "The contents of the user message.\n", - "oneOf": [ - { - "type": "string", - "description": "The text contents of the message.", - "title": "Text content" - }, - { - "type": "array", - "description": "An array of content parts with a defined type. Supported options differ based on the [model](https://developers.openai.com/api/docs/models) being used to generate the response. Can contain text, image, or audio inputs.", - "title": "Array of content parts", - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestUserMessageContentPart" - }, - "minItems": 1 - } - ] - }, - "role": { - "type": "string", - "enum": [ - "user" - ], - "description": "The role of the messages author, in this case `user`.", - "x-stainless-const": true + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." }, - "name": { - "type": "string", - "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." - } - }, - "required": [ - "content", - "role" - ] - }, - "ChatCompletionRequestUserMessageContentPart": { - "oneOf": [ { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100, + "default": 20 + }, + "description": "The maximum number of resources to return, between 1 and 100. Defaults to 20." }, { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartImage" + "name": "order", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/ListOrderParam", + "default": "desc" + }, + "description": "The order in which resources are returned. Defaults to `desc`." }, { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartAudio" + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "Return resources after this resource ID in the selected order." }, { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartFile" - } - ] - }, - "ChatCompletionResponseMessage": { - "type": "object", - "description": "A chat completion message generated by the model.", - "properties": { - "content": { - "anyOf": [ - { + "name": "metadata", + "in": "query", + "required": false, + "schema": { + "type": "object", + "additionalProperties": { "type": "string", - "description": "The contents of the message." + "minLength": 0, + "maxLength": 512 }, - { - "type": "null" - } - ] - }, - "refusal": { - "anyOf": [ - { + "propertyNames": { "type": "string", - "description": "The refusal message generated by the model." + "minLength": 1, + "maxLength": 64 }, - { - "type": "null" + "minProperties": 0, + "maxProperties": 16 + }, + "description": "Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear.", + "style": "deepObject", + "explode": true + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$ref": "#/components/schemas/VaultStatusFilterParam" + }, + "description": "Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default." + } + ], + "responses": { + "200": { + "description": "A page of vault credentials.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCredentialListResource", + "description": "A page of credentials in a vault." + } } - ] + } }, - "tool_calls": { - "$ref": "#/components/schemas/ChatCompletionMessageToolCalls" - }, - "annotations": { - "type": "array", - "description": "Annotations for the message, when applicable, as when using the\n[web search tool](https://developers.openai.com/api/docs/guides/tools-web-search).\n", - "items": { - "type": "object", - "description": "A URL citation when using web search.\n", - "required": [ - "type", - "url_citation" - ], - "properties": { - "type": { - "type": "string", - "description": "The type of the URL citation. Always `url_citation`.", - "enum": [ - "url_citation" - ], - "x-stainless-const": true - }, - "url_citation": { - "type": "object", - "description": "A URL citation when using web search.", - "required": [ - "end_index", - "start_index", - "url", - "title" - ], - "properties": { - "end_index": { - "type": "integer", - "description": "The index of the last character of the URL citation in the message." - }, - "start_index": { - "type": "integer", - "description": "The index of the first character of the URL citation in the message." - }, - "url": { - "type": "string", - "format": "uri", - "description": "The URL of the web resource." - }, - "title": { - "type": "string", - "description": "The title of the web resource." - } - } + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } } }, - "role": { - "type": "string", - "enum": [ - "assistant" - ], - "description": "The role of the author of this message.", - "x-stainless-const": true - }, - "function_call": { - "type": "object", - "deprecated": true, - "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", - "properties": { - "arguments": { - "type": "string", - "description": "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": { - "type": "string", - "description": "The name of the function to call." + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - }, - "required": [ - "name", - "arguments" - ] + } }, - "audio": { - "anyOf": [ - { - "type": "object", - "description": "If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](https://developers.openai.com/api/docs/guides/audio).\n", - "required": [ - "id", - "expires_at", - "data", - "transcript" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for this audio response." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when this audio response will\nno longer be accessible on the server for use in multi-turn\nconversations.\n" - }, - "data": { - "type": "string", - "description": "Base64 encoded audio bytes generated by the model, in the format\nspecified in the request.\n" - }, - "transcript": { - "type": "string", - "description": "Transcript of the audio generated by the model." - } + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "role", - "content", - "refusal" - ] - }, - "ChatCompletionRole": { - "type": "string", - "description": "The role of the author of a message", - "enum": [ - "developer", - "system", - "user", - "assistant", - "tool", - "function" - ] - }, - "ChatCompletionStreamOptions": { - "anyOf": [ - { - "description": "Options for streaming response. Only set this when you set `stream: true`.\n", - "type": "object", - "default": null, - "properties": { - "include_usage": { - "type": "boolean", - "description": "If set, an additional chunk will be streamed before the `data: [DONE]`\nmessage. The `usage` field on this chunk shows the token usage statistics\nfor the entire request, and the `choices` field will always be an empty\narray.\n\nAll other chunks will also include a `usage` field, but with a null\nvalue. **NOTE:** If the stream is interrupted, you may not receive the\nfinal usage chunk which contains the total token usage for the request.\n" - }, - "include_obfuscation": { - "type": "boolean", - "description": "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events to\nnormalize payload sizes as a mitigation to certain side-channel attacks.\nThese obfuscation fields are included by default, but add a small amount\nof overhead to the data stream. You can set `include_obfuscation` to\nfalse to optimize for bandwidth if you trust the network links between\nyour application and the OpenAI API.\n" } } }, - { - "type": "null" - } - ] - }, - "ChatCompletionStreamResponseDelta": { - "type": "object", - "description": "A chat completion delta generated by streamed model responses.", - "properties": { - "content": { - "anyOf": [ - { - "type": "string", - "description": "The contents of the chunk message." - }, - { - "type": "null" + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "function_call": { - "deprecated": true, - "type": "object", - "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", - "properties": { - "arguments": { - "type": "string", - "description": "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": { - "type": "string", - "description": "The name of the function to call." + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "tool_calls": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionMessageToolCallChunk" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } } }, - "role": { - "type": "string", - "enum": [ - "developer", - "system", - "user", - "assistant", - "tool" - ], - "description": "The role of the author of this message." - }, - "refusal": { - "anyOf": [ - { - "type": "string", - "description": "The refusal message generated by the model." - }, - { - "type": "null" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } } } }, - "ChatCompletionTokenLogprob": { - "type": "object", - "properties": { - "token": { - "description": "The token.", - "type": "string" + "post": { + "operationId": "createVaultCredential", + "summary": "Create a vault credential", + "description": "Creates a vault credential. Secret values are write-only and are never returned. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVaultCredentialParams" + } + } + } + }, + "responses": { + "201": { + "description": "The created vault credential without secret values.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCredentialResource" + } + } + } }, - "logprob": { - "description": "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.", - "type": "number" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "bytes": { - "anyOf": [ - { - "description": "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.", - "type": "array", - "items": { - "type": "integer" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - }, - { - "type": "null" } - ] + } }, - "top_logprobs": { - "description": "List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`.", - "type": "array", - "items": { - "type": "object", - "properties": { - "token": { - "description": "The token.", - "type": "string" - }, - "logprob": { - "description": "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.", - "type": "number" - }, - "bytes": { - "anyOf": [ - { - "description": "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.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "type": "null" - } - ] + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - }, - "required": [ - "token", - "logprob", - "bytes" - ] + } } - } - }, - "required": [ - "token", - "logprob", - "bytes", - "top_logprobs" - ] - }, - "ChatCompletionTool": { - "type": "object", - "title": "Function tool", - "description": "A function tool that can be used to generate a response.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "The type of the tool. Currently, only `function` is supported.", - "x-stainless-const": true }, - "function": { - "$ref": "#/components/schemas/FunctionObject" - } - }, - "required": [ - "type", - "function" - ] - }, - "ChatCompletionToolChoiceOption": { - "description": "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tool and instead generates a message.\n`auto` means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools.\nSpecifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n", - "oneOf": [ - { - "type": "string", - "title": "Tool choice mode", - "description": "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n", - "enum": [ - "none", - "auto", - "required" - ] + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ChatCompletionAllowedToolsChoice" + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ChatCompletionNamedToolChoice" + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ChatCompletionNamedToolChoiceCustom" + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } } - ] - }, - "ChunkingStrategyRequestParam": { - "type": "object", - "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", - "oneOf": [ + } + } + }, + "/vaults/{vault_id}/credentials/{credential_id}": { + "get": { + "operationId": "retrieveVaultCredential", + "summary": "Retrieve a vault credential", + "description": "Retrieves vault credential metadata without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ { - "$ref": "#/components/schemas/AutoChunkingStrategyRequestParam" + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." }, { - "$ref": "#/components/schemas/StaticChunkingStrategyRequestParam" + "name": "credential_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault credential." } ], - "discriminator": { - "propertyName": "type" - } - }, - "CodeInterpreterFileOutput": { - "type": "object", - "title": "Code interpreter file output", - "description": "The output of a code interpreter tool call that is a file.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "files" - ], - "description": "The type of the code interpreter file output. Always `files`.\n", - "x-stainless-const": true + "responses": { + "200": { + "description": "The requested vault credential without secret values.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCredentialResource" + } + } + } }, - "files": { - "type": "array", - "items": { - "type": "object", - "properties": { - "mime_type": { - "type": "string", - "description": "The MIME type of the file.\n" - }, - "file_id": { - "type": "string", - "description": "The ID of the file.\n" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - }, - "required": [ - "mime_type", - "file_id" - ] + } } - } - }, - "required": [ - "type", - "files" - ] - }, - "CodeInterpreterTextOutput": { - "type": "object", - "title": "Code interpreter text output", - "description": "The output of a code interpreter tool call that is text.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "logs" - ], - "description": "The type of the code interpreter text output. Always `logs`.\n", - "x-stainless-const": true - }, - "logs": { - "type": "string", - "description": "The logs of the code interpreter tool call.\n" - } - }, - "required": [ - "type", - "logs" - ] - }, - "CodeInterpreterTool": { - "type": "object", - "title": "Code interpreter", - "description": "A tool that runs Python code to help generate a response to a prompt.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "code_interpreter" - ], - "description": "The type of the code interpreter tool. Always `code_interpreter`.\n", - "x-stainless-const": true }, - "container": { - "description": "The code interpreter container. Can be a container ID or an object that\nspecifies uploaded file IDs to make available to your code, along with an\noptional `memory_limit` setting.\n", - "oneOf": [ - { - "type": "string", - "description": "The container ID." - }, - { - "$ref": "#/components/schemas/AutoCodeInterpreterToolParam" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "allowed_callers": { - "anyOf": [ - { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/CallableToolAllowedCaller" - }, - "description": "The tool invocation context(s)." - }, - { - "type": "null" + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] - } - }, - "required": [ - "type", - "container" - ] - }, - "CodeInterpreterToolCall": { - "type": "object", - "title": "Code interpreter tool call", - "description": "A tool call to run code.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "code_interpreter_call" - ], - "default": "code_interpreter_call", - "x-stainless-const": true, - "description": "The type of the code interpreter tool call. Always `code_interpreter_call`.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the code interpreter tool call.\n" - }, - "status": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete", - "interpreting", - "failed" - ], - "description": "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n" - }, - "container_id": { - "type": "string", - "description": "The ID of the container used to run the code.\n" + } }, - "code": { - "anyOf": [ - { - "type": "string", - "description": "The code to run, or null if not available.\n" - }, - { - "type": "null" + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] + } }, - "outputs": { - "anyOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/CodeInterpreterOutputLogs" - }, - { - "$ref": "#/components/schemas/CodeInterpreterOutputImage" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "discriminator": { - "propertyName": "type" - }, - "description": "The outputs generated by the code interpreter, such as logs or images.\nCan be null if no outputs are available.\n" - }, - { - "type": "null" + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } - ] - } - }, - "required": [ - "type", - "id", - "status", - "container_id", - "code", - "outputs" - ] - }, - "ComparisonFilter": { - "type": "object", - "additionalProperties": false, - "title": "Comparison Filter", - "description": "A filter used to compare a specified attribute key to a given value using a defined comparison operation.\n", - "properties": { - "type": { - "type": "string", - "default": "eq", - "enum": [ - "eq", - "ne", - "gt", - "gte", - "lt", - "lte", - "in", - "nin" - ], - "description": "Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\n- `eq`: equals\n- `ne`: not equal\n- `gt`: greater than\n- `gte`: greater than or equal\n- `lt`: less than\n- `lte`: less than or equal\n- `in`: in\n- `nin`: not in\n" + } }, - "key": { - "type": "string", - "description": "The key to compare against the value." + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } } - ], - "description": "The value to compare against the attribute key; supports string, number, or boolean types." + } } - }, - "required": [ - "type", - "key", - "value" - ], - "x-oaiMeta": { - "name": "ComparisonFilter" } }, - "CompleteUploadRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "part_ids": { - "type": "array", - "description": "The ordered list of Part IDs.\n", - "items": { - "type": "string" - } + "post": { + "operationId": "rotateVaultCredential", + "summary": "Update a vault credential", + "description": "Updates credential metadata or rotates its write-only secret. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ + { + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." }, - "md5": { - "description": "The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.\n", - "type": "string" + { + "name": "credential_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault credential." } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RotateVaultCredentialParams" + } + } + }, + "required": true }, - "required": [ - "part_ids" - ] - }, - "CompletionUsage": { - "type": "object", - "description": "Usage statistics for the completion request.", - "properties": { - "completion_tokens": { - "type": "integer", - "default": 0, - "description": "Number of tokens in the generated completion." + "responses": { + "200": { + "description": "The updated vault credential without secret values.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VaultCredentialResource" + } + } + } }, - "prompt_tokens": { - "type": "integer", - "default": 0, - "description": "Number of tokens in the prompt." + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "total_tokens": { - "type": "integer", - "default": 0, - "description": "Total number of tokens used in the request (prompt + completion)." + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - "completion_tokens_details": { - "type": "object", - "description": "Breakdown of tokens used in a completion.", - "properties": { - "accepted_prediction_tokens": { - "type": "integer", - "default": 0, - "description": "When using Predicted Outputs, the number of tokens in the\nprediction that appeared in the completion.\n" - }, - "audio_tokens": { - "type": "integer", - "default": 0, - "description": "Audio input tokens generated by the model." - }, - "reasoning_tokens": { - "type": "integer", - "default": 0, - "description": "Tokens generated by the model for reasoning." - }, - "text_tokens": { - "type": "integer", - "description": "Text output tokens generated by the model." - }, - "rejected_prediction_tokens": { - "type": "integer", - "default": 0, - "description": "When using Predicted Outputs, the number of tokens in the\nprediction that did not appear in the completion. However, like\nreasoning tokens, these tokens are still counted in the total\ncompletion tokens for purposes of billing, output, and context window\nlimits.\n" + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } }, - "prompt_tokens_details": { - "type": "object", - "description": "Breakdown of tokens used in the prompt.", - "properties": { - "audio_tokens": { - "type": "integer", - "default": 0, - "description": "Audio input tokens present in the prompt." - }, - "cached_tokens": { - "type": "integer", - "default": 0, - "description": "Cached tokens present in the prompt." - }, - "text_tokens": { - "type": "integer", - "description": "Text input tokens present in the prompt." - }, - "image_tokens": { - "type": "integer", - "description": "Image input tokens present in the prompt." - }, - "cache_write_tokens": { - "type": "integer", - "default": 0, - "description": "The unadjusted number of prompt tokens written to cache." + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } } } - } - }, - "required": [ - "prompt_tokens", - "completion_tokens", - "total_tokens" - ] - }, - "CompoundFilter": { - "$recursiveAnchor": true, - "type": "object", - "additionalProperties": false, - "title": "Compound Filter", - "description": "Combine multiple filters using `and` or `or`.", - "properties": { - "type": { - "type": "string", - "description": "Type of operation: `and` or `or`.", - "enum": [ - "and", - "or" - ] }, - "filters": { - "type": "array", - "description": "Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/ComparisonFilter" - }, - { - "$recursiveRef": "#" + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" } - ], - "discriminator": { - "propertyName": "type" } } } - }, - "required": [ - "type", - "filters" - ], - "x-oaiMeta": { - "name": "CompoundFilter" } }, - "ComputerAction": { - "oneOf": [ - { - "$ref": "#/components/schemas/ClickParam" - }, - { - "$ref": "#/components/schemas/DoubleClickAction" - }, + "delete": { + "operationId": "deleteVaultCredential", + "summary": "Delete a vault credential", + "description": "Deletes a vault credential. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).", + "tags": [ + "Vaults" + ], + "parameters": [ { - "$ref": "#/components/schemas/DragParam" + "name": "vault_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault." }, { - "$ref": "#/components/schemas/KeyPressAction" + "name": "credential_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": "The ID of the vault credential." + } + ], + "responses": { + "200": { + "description": "The deleted vault credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedVaultCredentialResource" + } + } + } }, - { - "$ref": "#/components/schemas/MoveParam" + "400": { + "description": "The request was invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ScreenshotParam" + "401": { + "description": "Authentication or project context was missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, - { - "$ref": "#/components/schemas/ScrollParam" + "403": { + "description": "The API key lacks the required management permission.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } }, + "404": { + "description": "The requested vault or credential was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "409": { + "description": "The request conflicted with the current vault state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "500": { + "description": "An internal error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + }, + "503": { + "description": "The service is temporarily unavailable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse-2" + } + } + } + } + } + } + }, + "/webhook_endpoints": { + "get": { + "summary": "List Webhook Endpoints", + "description": "Returns webhook endpoints for the authenticated project in newest-first order.", + "operationId": "ListWebhookEndpoints", + "parameters": [ { - "$ref": "#/components/schemas/TypeParam" + "name": "limit", + "in": "query", + "description": "Maximum number of webhook endpoints to return. Defaults to 20.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } }, { - "$ref": "#/components/schemas/WaitParam" + "name": "after", + "in": "query", + "description": "ID of the last webhook endpoint from the previous page.", + "required": false, + "schema": { + "anyOf": [ + { + "example": "whe_123", + "type": "string" + }, + { + "type": "null" + } + ] + } } ], - "discriminator": { - "propertyName": "type" - } - }, - "ComputerActionList": { - "title": "Computer Action List", - "type": "array", - "description": "Flattened batched actions for `computer_use`. Each action includes an\n`type` discriminator and action-specific fields.\n", - "items": { - "$ref": "#/components/schemas/ComputerAction" - } - }, - "ComputerScreenshotImage": { - "type": "object", - "description": "A computer screenshot image used with the computer use tool.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "computer_screenshot" - ], - "default": "computer_screenshot", - "description": "Specifies the event type. For a computer screenshot, this property is \nalways set to `computer_screenshot`.\n", - "x-stainless-const": true + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEndpointListResource" + } + } + } }, - "image_url": { - "type": "string", - "format": "uri", - "description": "The URL of the screenshot image." + "400": { + "description": "The request parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } }, - "file_id": { - "type": "string", - "description": "The identifier of an uploaded file that contains the screenshot." + "404": { + "description": "The pagination cursor does not identify a webhook endpoint in the authenticated project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, - "required": [ - "type" - ] + "x-oaiMeta": { + "beta": true + } }, - "ComputerToolCall": { - "type": "object", - "title": "Computer tool call", - "description": "A tool call to a computer use tool. See the\n[computer use guide](https://developers.openai.com/api/docs/guides/tools-computer-use) for more information.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of the computer call. Always `computer_call`.", - "enum": [ - "computer_call" - ], - "default": "computer_call" - }, - "id": { - "type": "string", - "description": "The unique ID of the computer call." - }, - "call_id": { - "type": "string", - "description": "An identifier used when responding to the tool call with output.\n" - }, - "action": { - "$ref": "#/components/schemas/ComputerAction" - }, - "actions": { - "$ref": "#/components/schemas/ComputerActionList" - }, - "pending_safety_checks": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ComputerCallSafetyCheckParam" - }, - "description": "The pending safety checks for the computer call.\n" - }, - "status": { - "type": "string", - "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", - "enum": [ - "in_progress", - "completed", - "incomplete" - ] + "post": { + "summary": "Create Webhook Endpoint", + "description": "Creates a webhook endpoint for the authenticated project.", + "operationId": "CreateWebhookEndpoint", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicCreateEndpointBody" + } + } } }, - "required": [ - "type", - "id", - "call_id", - "pending_safety_checks", - "status" - ] - }, - "ComputerToolCallOutput": { - "type": "object", - "title": "Computer tool call output", - "description": "The output of a computer tool call.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of the computer tool call output. Always `computer_call_output`.\n", - "enum": [ - "computer_call_output" - ], - "default": "computer_call_output", - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The ID of the computer tool call output.\n" - }, - "call_id": { - "type": "string", - "description": "The ID of the computer tool call that produced the output.\n" - }, - "acknowledged_safety_checks": { - "type": "array", - "description": "The safety checks reported by the API that have been acknowledged by the\ndeveloper.\n", - "items": { - "$ref": "#/components/schemas/ComputerCallSafetyCheckParam" + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEndpointWithSecretResource" + } + } } }, - "output": { - "$ref": "#/components/schemas/ComputerScreenshotImage" - }, - "status": { - "type": "string", - "description": "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n", - "enum": [ - "in_progress", - "completed", - "incomplete" - ] + "400": { + "description": "The webhook endpoint parameters are invalid or the endpoint cannot be created with the requested URL or event types.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, - "required": [ - "type", - "call_id", - "output" - ] - }, - "ComputerToolCallOutputResource": { - "allOf": [ - { - "$ref": "#/components/schemas/ComputerToolCallOutput" - }, + "x-oaiMeta": { + "beta": true + } + } + }, + "/webhook_endpoints/{webhook_endpoint_id}": { + "get": { + "summary": "Retrieve Webhook Endpoint", + "description": "Retrieves a webhook endpoint for the authenticated project.", + "operationId": "RetrieveWebhookEndpoint", + "parameters": [ { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the computer call tool output.\n" - }, - "status": { - "description": "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n", - "$ref": "#/components/schemas/ComputerCallOutputStatus" - }, - "created_by": { - "type": "string", - "description": "The identifier of the actor that created the item.\n" - } - }, - "required": [ - "id", - "status" - ] + "name": "webhook_endpoint_id", + "in": "path", + "description": "The ID of the webhook endpoint to retrieve.", + "required": true, + "schema": { + "example": "whe_123", + "type": "string" + } } - ] - }, - "ContainerFileListResource": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object returned, must be 'list'." - }, - "data": { - "type": "array", - "description": "A list of container files.", - "items": { - "$ref": "#/components/schemas/ContainerFileResource" + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEndpointBody" + } + } } }, - "first_id": { - "type": "string", - "description": "The ID of the first file in the list." - }, - "last_id": { - "type": "string", - "description": "The ID of the last file in the list." + "400": { + "description": "The request parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } }, - "has_more": { - "type": "boolean", - "description": "Whether there are more files available." + "404": { + "description": "The webhook endpoint was not found in the authenticated project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] + "x-oaiMeta": { + "beta": true + } }, - "ContainerFileResource": { - "type": "object", - "title": "The container file object", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the file." - }, - "object": { - "type": "string", - "description": "The type of this object (`container.file`)." - }, - "container_id": { - "type": "string", - "description": "The container this file belongs to." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the file was created." - }, - "bytes": { - "type": "integer", - "description": "Size of the file in bytes." + "post": { + "summary": "Update Webhook Endpoint", + "description": "Updates a webhook endpoint for the authenticated project.", + "operationId": "UpdateWebhookEndpoint", + "parameters": [ + { + "name": "webhook_endpoint_id", + "in": "path", + "description": "The ID of the webhook endpoint to update.", + "required": true, + "schema": { + "example": "whe_123", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicUpdateEndpointBody" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEndpointBody" + } + } + } }, - "path": { - "type": "string", - "description": "Path of the file in the container." + "400": { + "description": "The webhook endpoint parameters are invalid or the requested URL or event types are not permitted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } }, - "source": { - "type": "string", - "description": "Source of the file (e.g., `user`, `assistant`)." + "404": { + "description": "The webhook endpoint was not found in the authenticated project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, - "required": [ - "id", - "object", - "created_at", - "bytes", - "container_id", - "path", - "source" - ], "x-oaiMeta": { - "name": "The container file object", - "example": "{\n \"id\": \"cfile_682e0e8a43c88191a7978f477a09bdf5\",\n \"object\": \"container.file\",\n \"created_at\": 1747848842,\n \"bytes\": 880,\n \"container_id\": \"cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04\",\n \"path\": \"/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json\",\n \"source\": \"user\"\n}\n" + "beta": true } }, - "ContainerListResource": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object returned, must be 'list'." - }, - "data": { - "type": "array", - "description": "A list of containers.", - "items": { - "$ref": "#/components/schemas/ContainerResource" - } - }, - "first_id": { - "type": "string", - "description": "The ID of the first container in the list." - }, - "last_id": { - "type": "string", - "description": "The ID of the last container in the list." - }, - "has_more": { - "type": "boolean", - "description": "Whether there are more containers available." + "delete": { + "summary": "Delete Webhook Endpoint", + "description": "Deletes a webhook endpoint for the authenticated project.", + "operationId": "DeleteWebhookEndpoint", + "parameters": [ + { + "name": "webhook_endpoint_id", + "in": "path", + "description": "The ID of the webhook endpoint to delete.", + "required": true, + "schema": { + "example": "whe_123", + "type": "string" + } } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "ContainerResource": { - "type": "object", - "title": "The container object", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the container." - }, - "object": { - "type": "string", - "description": "The type of this object." - }, - "name": { - "type": "string", - "description": "Name of the container." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the container was created." - }, - "status": { - "type": "string", - "description": "Status of the container (e.g., active, deleted)." - }, - "last_active_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the container was last active." - }, - "expires_after": { - "type": "object", - "description": "The container will expire after this time period.\nThe anchor is the reference point for the expiration.\nThe minutes is the number of minutes after the anchor before the container expires.\n", - "properties": { - "anchor": { - "type": "string", - "description": "The reference point for the expiration.", - "enum": [ - "last_active_at" - ] - }, - "minutes": { - "type": "integer", - "description": "The number of minutes after the anchor before the container expires." + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletedWebhookEndpointResource" + } } } }, - "memory_limit": { - "type": "string", - "description": "The memory limit configured for the container.", - "enum": [ - "1g", - "4g", - "16g", - "64g" - ] + "400": { + "description": "The request parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } }, - "network_policy": { - "description": "Network access policy for the container.", - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The network policy mode.", - "enum": [ - "allowlist", - "disabled" - ] - }, - "allowed_domains": { - "type": "array", - "description": "Allowed outbound domains when `type` is `allowlist`.", - "items": { - "type": "string" + "404": { + "description": "The webhook endpoint was not found in the authenticated project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } - }, - "required": [ - "type" - ] + } } }, - "required": [ - "id", - "object", - "name", - "created_at", - "status", - "id", - "name", - "created_at", - "status" - ], "x-oaiMeta": { - "name": "The container object", - "example": "{\n \"id\": \"cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863\",\n \"object\": \"container\",\n \"created_at\": 1747844794,\n \"status\": \"running\",\n \"expires_after\": {\n \"anchor\": \"last_active_at\",\n \"minutes\": 20\n },\n \"last_active_at\": 1747844794,\n \"memory_limit\": \"1g\",\n \"name\": \"My Container\"\n}\n" + "beta": true } - }, - "Content": { - "description": "Multi-modal input and output contents.\n", - "oneOf": [ - { - "title": "Input content types", - "$ref": "#/components/schemas/InputContent" - }, - { - "title": "Output content types", - "$ref": "#/components/schemas/OutputContent" - } - ] - }, - "ConversationItem": { - "title": "Conversation item", - "description": "A single item within a conversation. The set of possible types are the same as the `output` type of a [Response object](https://developers.openai.com/api/reference/resources/responses#%28resource%29%20responses%20%3E%20%28model%29%20response%20%3E%20%28schema%29%20%3E%20%28property%29%20output).", - "oneOf": [ - { - "$ref": "#/components/schemas/Message" - }, - { - "$ref": "#/components/schemas/FunctionToolCallResource" - }, - { - "$ref": "#/components/schemas/FunctionToolCallOutputResource" - }, - { - "$ref": "#/components/schemas/FileSearchToolCall" - }, - { - "$ref": "#/components/schemas/WebSearchToolCall" - }, - { - "$ref": "#/components/schemas/ImageGenToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCallOutputResource" - }, - { - "$ref": "#/components/schemas/ToolSearchCall" - }, - { - "$ref": "#/components/schemas/ToolSearchOutput" - }, - { - "$ref": "#/components/schemas/AdditionalTools" - }, - { - "$ref": "#/components/schemas/ResponseConfigurationUpdate" - }, - { - "$ref": "#/components/schemas/ReasoningItem" - }, - { - "$ref": "#/components/schemas/Program" - }, - { - "$ref": "#/components/schemas/ProgramOutput" - }, - { - "$ref": "#/components/schemas/CompactionBody" - }, - { - "$ref": "#/components/schemas/CodeInterpreterToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCallOutput" - }, - { - "$ref": "#/components/schemas/FunctionShellCall" - }, - { - "$ref": "#/components/schemas/FunctionShellCallOutput" - }, - { - "$ref": "#/components/schemas/ApplyPatchToolCall" - }, - { - "$ref": "#/components/schemas/ApplyPatchToolCallOutput" - }, - { - "$ref": "#/components/schemas/MCPListTools" - }, - { - "$ref": "#/components/schemas/MCPApprovalRequest" - }, - { - "$ref": "#/components/schemas/MCPApprovalResponseResource" - }, - { - "$ref": "#/components/schemas/MCPToolCall" - }, - { - "$ref": "#/components/schemas/CustomToolCall" - }, + } + }, + "/webhook_endpoints/{webhook_endpoint_id}/rotate_secret": { + "post": { + "summary": "Rotate Webhook Endpoint Signing Secret", + "description": "Rotates the signing secret for a webhook endpoint in the authenticated project.", + "operationId": "RotateWebhookEndpointSigningSecret", + "parameters": [ { - "$ref": "#/components/schemas/CustomToolCallOutput" + "name": "webhook_endpoint_id", + "in": "path", + "description": "The ID of the webhook endpoint whose signing secret will be rotated.", + "required": true, + "schema": { + "example": "whe_123", + "type": "string" + } } ], - "discriminator": { - "propertyName": "type" - } - }, - "ConversationItemList": { - "type": "object", - "title": "The conversation item list", - "description": "A list of Conversation items.", - "properties": { - "object": { - "type": "string", - "description": "The type of object returned, must be `list`.", - "enum": [ - "list" - ], - "x-stainless-const": true - }, - "data": { - "type": "array", - "description": "A list of conversation items.", - "items": { - "$ref": "#/components/schemas/ConversationItem" + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicRotateSecretBody" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEndpointWithSecretResource" + } + } } }, - "has_more": { - "type": "boolean", - "description": "Whether there are more items available." - }, - "first_id": { - "type": "string", - "description": "The ID of the first item in the list." + "400": { + "description": "The request parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } }, - "last_id": { - "type": "string", - "description": "The ID of the last item in the list." + "404": { + "description": "The webhook endpoint was not found in the authenticated project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, - "required": [ - "object", - "data", - "has_more", - "first_id", - "last_id" - ], "x-oaiMeta": { - "name": "The item list", - "group": "conversations" + "beta": true } - }, - "ConversationParam": { - "description": "The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.\nInput items and output items from this response are automatically added to this conversation after this response completes.\n", - "default": null, - "oneOf": [ - { - "type": "string", - "title": "Conversation ID", - "description": "The unique ID of the conversation.\n" - }, + } + }, + "/webhook_endpoints/{webhook_endpoint_id}/test": { + "post": { + "summary": "Test Webhook Endpoint", + "description": "Sends a sample event to a webhook endpoint for the authenticated project.", + "operationId": "TestWebhookEndpoint", + "parameters": [ { - "$ref": "#/components/schemas/ConversationParam-2" + "name": "webhook_endpoint_id", + "in": "path", + "description": "The ID of the webhook endpoint to test.", + "required": true, + "schema": { + "example": "whe_123", + "type": "string" + } } - ] - }, - "CostsResult": { - "type": "object", - "description": "The aggregated costs details of the specific time bucket.", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.costs.result" - ], - "x-stainless-const": true - }, - "amount": { - "type": "object", - "description": "The monetary value in its associated currency.", - "properties": { - "value": { - "type": "number", - "description": "The numeric value of the cost." - }, - "currency": { - "type": "string", - "description": "Lowercase ISO-4217 currency e.g. \"usd\"" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicTestEndpointBody" } } - }, - "line_item": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=line_item`, this field provides the line item of the grouped costs result." - }, - { - "type": "null" - } - ] - }, - "project_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped costs result." - }, - { - "type": "null" + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEndpointTestResultResource" + } } - ] + } }, - "api_key_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result." - }, - { - "type": "null" + "400": { + "description": "The request parameters are invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } - ] + } }, - "quantity": { - "anyOf": [ - { - "type": "number", - "description": "When `group_by=line_item`, this field provides the quantity of the grouped costs result." - }, - { - "type": "null" + "404": { + "description": "The webhook endpoint was not found in the authenticated project.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } - ] + } }, - "quantity_unit": { - "description": "The unit of the `quantity` value. If no single supported unit applies to the result, this field is `null`.", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "tokens", - "1000_tokens", - "duration_seconds", - "duration_minutes", - "duration_hours", - "gibibyte_hours", - "images", - "characters" - ] - }, - { - "type": "null" + "500": { + "description": "The sample event could not be sent to the webhook endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } - ] + } } }, - "required": [ - "object" - ], "x-oaiMeta": { - "name": "Costs object", - "example": "{\n \"object\": \"organization.costs.result\",\n \"amount\": {\n \"value\": 0.06,\n \"currency\": \"usd\"\n },\n \"line_item\": \"gpt-6-astra, input_tokens\",\n \"project_id\": \"proj_abc\",\n \"quantity\": 10000,\n \"quantity_unit\": \"tokens\"\n}\n" + "beta": true } - }, - "CreateAssistantRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "model": { - "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", - "example": "gpt-5", - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/components/schemas/AssistantSupportedModels" + } + }, + "/webhook_event_types": { + "get": { + "summary": "List Webhook Event Types", + "description": "Returns webhook event types visible to the authenticated project.", + "operationId": "ListWebhookEventTypes", + "parameters": [], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEventTypeListResource" + } } - ], - "x-oaiTypeLabel": "string" + } }, - "name": { - "anyOf": [ - { - "description": "The name of the assistant. The maximum length is 256 characters.\n", - "type": "string", - "maxLength": 256 - }, - { - "type": "null" + "401": { + "description": "The request does not contain authentication credentials.", + "headers": { + "WWW-Authenticate": { + "description": "The bearer authentication challenge returned by the service.", + "schema": { + "type": "string" + }, + "example": "Bearer realm=\"OpenAI API\"" } - ] - }, - "description": { - "anyOf": [ - { - "description": "The description of the assistant. The maximum length is 512 characters.\n", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } - ] - }, - "instructions": { - "anyOf": [ - { - "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", - "type": "string", - "maxLength": 256000 + } + } + }, + "x-oaiMeta": { + "beta": true + } + } + }, + "/responses?beta=true": { + "post": { + "operationId": "beta_createResponse", + "tags": [ + "Responses" + ], + "summary": "Create a model response", + "description": "Creates a model response. Provide [text](https://developers.openai.com/api/docs/guides/text) or\n[image](https://developers.openai.com/api/docs/guides/images-vision) inputs to generate [text](https://developers.openai.com/api/docs/guides/text)\nor [JSON](https://developers.openai.com/api/docs/guides/structured-outputs) outputs. Have the model call\nyour own [custom code](https://developers.openai.com/api/docs/guides/function-calling) or use built-in\n[tools](https://developers.openai.com/api/docs/guides/tools) like [web search](https://developers.openai.com/api/docs/guides/tools-web-search)\nor [file search](https://developers.openai.com/api/docs/guides/tools-file-search) to use your own data\nas input for the model's response.\n", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaCreateResponse" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaResponse" + } }, - { - "type": "null" + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/BetaResponseStreamEvent" + } } - ] - }, - "reasoning_effort": { - "$ref": "#/components/schemas/ReasoningEffort" + } }, - "tools": { - "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", - "default": [], - "type": "array", - "maxItems": 128, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" + "400": { + "description": "Invalid response request or incompatible request parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaErrorResponse" } - ] + } } }, - "tool_resources": { - "anyOf": [ - { - "type": "object", - "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "string" - } - }, - "vector_stores": { - "type": "array", - "description": "A helper to create a [vector store](https://developers.openai.com/api/reference/resources/vector_stores) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.\n", - "maxItems": 100000000, - "items": { - "type": "string" - } - }, - "chunking_strategy": { - "type": "object", - "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", - "oneOf": [ - { - "type": "object", - "title": "Auto Chunking Strategy", - "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `auto`.", - "enum": [ - "auto" - ], - "x-stainless-const": true - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "title": "Static Chunking Strategy", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `static`.", - "enum": [ - "static" - ], - "x-stainless-const": true - }, - "static": { - "type": "object", - "additionalProperties": false, - "properties": { - "max_chunk_size_tokens": { - "type": "integer", - "minimum": 100, - "maximum": 4096, - "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." - }, - "chunk_overlap_tokens": { - "type": "integer", - "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" - } - }, - "required": [ - "max_chunk_size_tokens", - "chunk_overlap_tokens" - ] - } - }, - "required": [ - "type", - "static" - ] - } - ] - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - } - } - } - } - }, - "oneOf": [ - { - "required": [ - "vector_store_ids" - ] - }, - { - "required": [ - "vector_stores" - ] - } - ] - } + "404": { + "description": "The requested model or a referenced resource was not found or is unavailable to this caller.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaErrorResponse" } - }, - { - "type": "null" } - ] + } }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "429": { + "$ref": "#/components/responses/InferenceRateLimited" }, - "temperature": { - "anyOf": [ - { - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1 + "503": { + "$ref": "#/components/responses/InferenceServiceUnavailable" + } + }, + "x-oaiMeta": { + "group": "responses", + "path": "create", + "examples": [ + { + "title": "Text input", + "request": { + "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"Tell me a three sentence bedtime story about a unicorn.\"\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: \"Tell me a three sentence bedtime story about a unicorn.\"\n});\n\nconsole.log(response);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=\"Tell me a three sentence bedtime story about a unicorn.\"\n)\n\nprint(response)\n", + "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nOpenAIResponse response = client.CreateResponse(\"Tell me a three sentence bedtime story about a unicorn.\");\n\nConsole.WriteLine(response.GetOutputText());\n" }, - { - "type": "null" - } - ] - }, - "top_p": { - "anyOf": [ - { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + "response": "{\n \"id\": \"resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741476542,\n \"status\": \"completed\",\n \"completed_at\": 1741476543,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 36,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 87,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 123\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + }, + { + "title": "Image input", + "request": { + "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\"type\": \"input_text\", \"text\": \"what is in this image?\"},\n {\n \"type\": \"input_image\",\n \"image_url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"\n }\n ]\n }\n ]\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: [\n { type: \"input_text\", text: \"what is in this image?\" },\n {\n type: \"input_image\",\n image_url:\n \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\",\n },\n ],\n },\n ],\n});\n\nconsole.log(response);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": [\n { \"type\": \"input_text\", \"text\": \"what is in this image?\" },\n {\n \"type\": \"input_image\",\n \"image_url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"\n }\n ]\n }\n ]\n)\n\nprint(response)\n", + "csharp": "using System;\nusing System.Collections.Generic;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nList inputItems =\n[\n ResponseItem.CreateUserMessageItem(\n [\n ResponseContentPart.CreateInputTextPart(\"What is in this image?\"),\n ResponseContentPart.CreateInputImagePart(new Uri(\"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"))\n ]\n )\n];\n\nOpenAIResponse response = client.CreateResponse(inputItems);\n\nConsole.WriteLine(response.GetOutputText());\n" }, - { - "type": "null" - } - ] - }, - "response_format": { - "anyOf": [ - { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption" + "response": "{\n \"id\": \"resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741476777,\n \"status\": \"completed\",\n \"completed_at\": 1741476778,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 328,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 52,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 380\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + }, + { + "title": "File input", + "request": { + "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\"type\": \"input_text\", \"text\": \"what is in this file?\"},\n {\n \"type\": \"input_file\",\n \"file_url\": \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n \"detail\": \"auto\"\n }\n ]\n }\n ]\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: [\n { type: \"input_text\", text: \"what is in this file?\" },\n {\n type: \"input_file\",\n file_url: \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n detail: \"auto\",\n },\n ],\n },\n ],\n});\n\nconsole.log(response);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": [\n { \"type\": \"input_text\", \"text\": \"what is in this file?\" },\n {\n \"type\": \"input_file\",\n \"file_url\": \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n \"detail\": \"auto\"\n }\n ]\n }\n ]\n)\n\nprint(response)\n" }, - { - "type": "null" + "response": "{\n \"id\": \"resp_686eef60237881a2bd1180bb8b13de430e34c516d176ff86\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1752100704,\n \"status\": \"completed\",\n \"completed_at\": 1752100705,\n \"background\": false,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"max_tool_calls\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"id\": \"msg_686eef60d3e081a29283bdcbc4322fd90e34c516d176ff86\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"The file seems to contain excerpts from a letter to the shareholders of Berkshire Hathaway Inc., likely written by Warren Buffett. It covers several topics:\\n\\n1. **Communication Philosophy**: Buffett emphasizes the importance of transparency and candidness in reporting mistakes and successes to shareholders.\\n\\n2. **Mistakes and Learnings**: The letter acknowledges past mistakes in business assessments and management hires, highlighting the importance of correcting errors promptly.\\n\\n3. **CEO Succession**: Mention of Greg Abel stepping in as the new CEO and continuing the tradition of honest communication.\\n\\n4. **Pete Liegl Story**: A detailed account of acquiring Forest River and the relationship with its founder, highlighting trust and effective business decisions.\\n\\n5. **2024 Performance**: Overview of business performance, particularly in insurance and investment activities, with a focus on GEICO's improvement.\\n\\n6. **Tax Contributions**: Discussion of significant tax payments to the U.S. Treasury, credited to shareholders' reinvestments.\\n\\n7. **Investment Strategy**: A breakdown of Berkshire\\u2019s investments in both controlled subsidiaries and marketable equities, along with a focus on long-term holding strategies.\\n\\n8. **American Capitalism**: Reflections on America\\u2019s economic development and Berkshire\\u2019s role within it.\\n\\n9. **Property-Casualty Insurance**: Insights into the P/C insurance business model and its challenges and benefits.\\n\\n10. **Japanese Investments**: Information about Berkshire\\u2019s investments in Japanese companies and future plans.\\n\\n11. **Annual Meeting**: Details about the upcoming annual gathering in Omaha, including schedule changes and new book releases.\\n\\n12. **Personal Anecdotes**: Light-hearted stories about family and interactions, conveying Buffett's personable approach.\\n\\n13. **Financial Performance Data**: Tables comparing Berkshire\\u2019s annual performance to the S&P 500, showing impressive long-term gains.\\n\\nOverall, the letter reinforces Berkshire Hathaway's commitment to transparency, investment in both its businesses and the wider economy, and emphasizes strong leadership and prudent financial management.\"\n }\n ],\n \"role\": \"assistant\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"service_tier\": \"default\",\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_logprobs\": 0,\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 8438,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 398,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 8836\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + }, + { + "title": "Web search", + "request": { + "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"tools\": [{ \"type\": \"web_search_preview\" }],\n \"input\": \"What was a positive news story from today?\"\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n tools: [{ type: \"web_search_preview\" }],\n input: \"What was a positive news story from today?\",\n});\n\nconsole.log(response);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n tools=[{ \"type\": \"web_search_preview\" }],\n input=\"What was a positive news story from today?\",\n)\n\nprint(response)\n", + "csharp": "using System;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"What was a positive news story from today?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n ResponseTool.CreateWebSearchTool()\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" + }, + "response": "{\n \"id\": \"resp_67ccf18ef5fc8190b16dbee19bc54e5f087bb177ab789d5c\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741484430,\n \"status\": \"completed\",\n \"completed_at\": 1741484431,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"web_search_call\",\n \"id\": \"ws_67ccf18f64008190a39b619f4c8455ef087bb177ab789d5c\",\n \"status\": \"completed\"\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccf190ca3881909d433c50b1f6357e087bb177ab789d5c\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"As of today, March 9, 2025, one notable positive news story...\",\n \"annotations\": [\n {\n \"type\": \"url_citation\",\n \"start_index\": 442,\n \"end_index\": 557,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n },\n {\n \"type\": \"url_citation\",\n \"start_index\": 962,\n \"end_index\": 1077,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n },\n {\n \"type\": \"url_citation\",\n \"start_index\": 1336,\n \"end_index\": 1451,\n \"url\": \"https://.../?utm_source=chatgpt.com\",\n \"title\": \"...\"\n }\n ],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"web_search_preview\",\n \"domains\": [],\n \"search_context_size\": \"medium\",\n \"user_location\": {\n \"type\": \"approximate\",\n \"city\": null,\n \"country\": \"US\",\n \"region\": null,\n \"timezone\": null\n }\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 328,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 356,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 684\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + }, + { + "title": "File search", + "request": { + "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"tools\": [{\n \"type\": \"file_search\",\n \"vector_store_ids\": [\"vs_1234567890\"],\n \"max_num_results\": 20\n }],\n \"input\": \"What are the attributes of an ancient brown dragon?\"\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n tools: [{\n type: \"file_search\",\n vector_store_ids: [\"vs_1234567890\"],\n max_num_results: 20\n }],\n input: \"What are the attributes of an ancient brown dragon?\",\n});\n\nconsole.log(response);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n tools=[{\n \"type\": \"file_search\",\n \"vector_store_ids\": [\"vs_1234567890\"],\n \"max_num_results\": 20\n }],\n input=\"What are the attributes of an ancient brown dragon?\",\n)\n\nprint(response)\n", + "csharp": "using System;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"What are the attributes of an ancient brown dragon?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n ResponseTool.CreateFileSearchTool(\n vectorStoreIds: [\"vs_1234567890\"],\n maxResultCount: 20\n )\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" + }, + "response": "{\n \"id\": \"resp_67ccf4c55fc48190b71bd0463ad3306d09504fb6872380d7\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741485253,\n \"status\": \"completed\",\n \"completed_at\": 1741485254,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"file_search_call\",\n \"id\": \"fs_67ccf4c63cd08190887ef6464ba5681609504fb6872380d7\",\n \"status\": \"completed\",\n \"queries\": [\n \"attributes of an ancient brown dragon\"\n ],\n \"results\": null\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccf4c93e5c81909d595b369351a9d309504fb6872380d7\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The attributes of an ancient brown dragon include...\",\n \"annotations\": [\n {\n \"type\": \"file_citation\",\n \"index\": 320,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 576,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 815,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 815,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1030,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1030,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1156,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n },\n {\n \"type\": \"file_citation\",\n \"index\": 1225,\n \"file_id\": \"file-4wDz5b167pAf72nx1h9eiN\",\n \"filename\": \"dragons.pdf\"\n }\n ],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"filters\": null,\n \"max_num_results\": 20,\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0.0\n },\n \"vector_store_ids\": [\n \"vs_1234567890\"\n ]\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 18307,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 348,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 18655\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + }, + { + "title": "Streaming", + "request": { + "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"instructions\": \"You are a helpful assistant.\",\n \"input\": \"Hello!\",\n \"stream\": true\n }'\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n instructions=\"You are a helpful assistant.\",\n input=\"Hello!\",\n stream=True\n)\n\nfor event in response:\n print(event)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n instructions: \"You are a helpful assistant.\",\n input: \"Hello!\",\n stream: true,\n});\n\nfor await (const event of response) {\n console.log(event);\n}\n", + "csharp": "using System;\nusing System.ClientModel;\nusing System.Threading.Tasks;\n\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"Hello!\";\n\nResponseCreationOptions options = new()\n{\n Instructions = \"You are a helpful assistant.\",\n};\n\nAsyncCollectionResult responseUpdates = client.CreateResponseStreamingAsync(userInputText, options);\n\nawait foreach (StreamingResponseUpdate responseUpdate in responseUpdates)\n{\n if (responseUpdate is StreamingResponseOutputTextDeltaUpdate outputTextDeltaUpdate)\n {\n Console.Write(outputTextDeltaUpdate.Delta);\n }\n}\n" + }, + "response": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"access_programs\":null,\"created_at\":1741290958,\"status\":\"in_progress\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"access_programs\":null,\"created_at\":1741290958,\"status\":\"in_progress\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"output_index\":0,\"item\":{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"in_progress\",\"role\":\"assistant\",\"content\":[]},\"sequence_number\":2}\n\nevent: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"\",\"annotations\":[],\"logprobs\":[]},\"sequence_number\":3}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"delta\":\"Hi\",\"sequence_number\":4,\"logprobs\":[]}\n\n: Intermediate response events omitted.\n\nevent: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"text\":\"Hi there! How can I assist you today?\",\"sequence_number\":10,\"logprobs\":[]}\n\nevent: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"item_id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"output_index\":0,\"content_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[],\"logprobs\":[]},\"sequence_number\":11}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"output_index\":0,\"item\":{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"completed\",\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[],\"logprobs\":[]}]},\"sequence_number\":12}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654\",\"object\":\"response\",\"access_programs\":null,\"created_at\":1741290958,\"status\":\"completed\",\"error\":null,\"incomplete_details\":null,\"instructions\":\"You are a helpful assistant.\",\"max_output_tokens\":null,\"model\":\"gpt-6-astra\",\"output\":[{\"id\":\"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654\",\"type\":\"message\",\"status\":\"completed\",\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"Hi there! How can I assist you today?\",\"annotations\":[],\"logprobs\":[]}]}],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":37,\"output_tokens\":11,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":48,\"input_tokens_details\":{\"cached_tokens\":0,\"cache_write_tokens\":0}},\"user\":null,\"metadata\":{}},\"sequence_number\":13}\n\n" + }, + { + "title": "Functions", + "request": { + "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"What is the weather like in Boston today?\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\", \"unit\"]\n }\n }\n ],\n \"tool_choice\": \"auto\"\n }'\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\ntools = [\n {\n \"type\": \"function\",\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\",\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n },\n \"required\": [\"location\", \"unit\"],\n }\n }\n]\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n tools=tools,\n input=\"What is the weather like in Boston today?\",\n tool_choice=\"auto\"\n)\n\nprint(response)\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\nconst tools = [\n {\n type: \"function\",\n name: \"get_current_weather\",\n description: \"Get the current weather in a given location\",\n parameters: {\n type: \"object\",\n properties: {\n location: {\n type: \"string\",\n description: \"The city and state, e.g. San Francisco, CA\",\n },\n unit: { type: \"string\", enum: [\"celsius\", \"fahrenheit\"] },\n },\n required: [\"location\", \"unit\"],\n },\n },\n];\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n tools: tools,\n input: \"What is the weather like in Boston today?\",\n tool_choice: \"auto\",\n});\n\nconsole.log(response);\n", + "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nResponseTool getCurrentWeatherFunctionTool = ResponseTool.CreateFunctionTool(\n functionName: \"get_current_weather\",\n functionDescription: \"Get the current weather in a given location\",\n functionParameters: BinaryData.FromString(\"\"\"\n {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}\n },\n \"required\": [\"location\", \"unit\"]\n }\n \"\"\"\n )\n);\n\nstring userInputText = \"What is the weather like in Boston today?\";\n\nResponseCreationOptions options = new()\n{\n Tools =\n {\n getCurrentWeatherFunctionTool\n },\n ToolChoice = ResponseToolChoice.CreateAutoChoice(),\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n" + }, + "response": "{\n \"id\": \"resp_67ca09c5efe0819096d0511c92b8c890096610f474011cc0\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741294021,\n \"status\": \"completed\",\n \"completed_at\": 1741294022,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"function_call\",\n \"id\": \"fc_67ca09c6bedc8190a7abfec07b1a1332096610f474011cc0\",\n \"call_id\": \"call_unLAR8MvFNptuiZK6K6HCy5k\",\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\",\\\"unit\\\":\\\"celsius\\\"}\",\n \"status\": \"completed\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"description\": \"Get the current weather in a given location\",\n \"name\": \"get_current_weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\",\n \"unit\"\n ]\n },\n \"strict\": true\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 291,\n \"output_tokens\": 23,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 314,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n }\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + }, + { + "title": "Reasoning", + "request": { + "curl": "curl https://api.openai.com/v1/responses \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"How much wood would a woodchuck chuck?\",\n \"reasoning\": {\n \"effort\": \"high\"\n }\n }'\n", + "javascript": "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n model: \"gpt-6-astra\",\n input: \"How much wood would a woodchuck chuck?\",\n reasoning: {\n effort: \"high\"\n }\n});\n\nconsole.log(response);\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.create(\n model=\"gpt-6-astra\",\n input=\"How much wood would a woodchuck chuck?\",\n reasoning={\n \"effort\": \"high\"\n }\n)\n\nprint(response)\n", + "csharp": "using System;\nusing OpenAI.Responses;\n\nOpenAIResponseClient client = new(\n model: \"gpt-6-astra\",\n apiKey: Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\")\n);\n\nstring userInputText = \"How much wood would a woodchuck chuck?\";\n\nResponseCreationOptions options = new()\n{\n ReasoningOptions = new()\n {\n ReasoningEffortLevel = ResponseReasoningEffortLevel.High,\n },\n};\n\nOpenAIResponse response = client.CreateResponse(userInputText, options);\n\nConsole.WriteLine(response.GetOutputText());\n" + }, + "response": "{\n \"id\": \"resp_67ccd7eca01881908ff0b5146584e408072912b2993db808\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741477868,\n \"status\": \"completed\",\n \"completed_at\": 1741477869,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67ccd7f7b5848190a6f3e95d809f6b44072912b2993db808\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The classic tongue twister...\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": \"high\",\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 81,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 1035,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 832\n },\n \"total_tokens\": 1116\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + } + ] + }, + "parameters": [ + { + "name": "openai-beta", + "in": "header", + "required": false, + "description": "Optional beta features to enable for this request.", + "style": "simple", + "explode": false, + "schema": { + "type": "array", + "x-stainless-param": "betas", + "items": { + "type": "string", + "enum": [ + "responses_multi_agent=v1" + ] } - ] + } } - }, - "required": [ - "model" ] - }, - "CreateBatchRequest": { - "type": "object", - "required": [ - "input_file_id", - "endpoint", - "completion_window" + } + }, + "/responses/{response_id}?beta=true": { + "get": { + "operationId": "beta_getResponse", + "tags": [ + "Responses" ], - "properties": { - "input_file_id": { - "type": "string", - "description": "The ID of an uploaded file that contains requests for the new batch.\n\nSee [upload file](https://developers.openai.com/api/reference/resources/files/methods/create) for how to upload a file.\n\nYour input file must be formatted as a [JSONL file](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 200 MB in size.\n" + "summary": "Get a model response", + "description": "Retrieves a model response with the given ID.\n", + "parameters": [ + { + "in": "path", + "name": "response_id", + "required": true, + "schema": { + "type": "string", + "example": "resp_677efb5139a88190b512bc3fef8e535d" + }, + "description": "The ID of the response to retrieve." }, - "endpoint": { - "type": "string", - "enum": [ - "/v1/responses", - "/v1/chat/completions", - "/v1/embeddings", - "/v1/completions", - "/v1/moderations", - "/v1/images/generations", - "/v1/images/edits", - "/v1/videos" - ], - "description": "The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and `/v1/videos` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch." + { + "in": "query", + "name": "include", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BetaIncludeEnum" + } + }, + "description": "Additional fields to include in the response. See the `include`\nparameter for Response creation above for more information.\n" }, - "completion_window": { - "type": "string", - "enum": [ - "24h" - ], - "description": "The time frame within which the batch should be processed. Currently only `24h` is supported." + { + "in": "query", + "name": "stream", + "schema": { + "type": "boolean" + }, + "description": "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](https://developers.openai.com/api/reference/resources/responses/streaming-events)\nfor more information.\n" }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + { + "in": "query", + "name": "starting_after", + "schema": { + "type": "integer" + }, + "description": "The sequence number of the event after which to start streaming.\n" }, - "output_expires_after": { - "$ref": "#/components/schemas/BatchFileExpirationAfter" - } - } - }, - "CreateChatCompletionRequest": { - "allOf": [ { - "$ref": "#/components/schemas/CreateModelResponseProperties" + "in": "query", + "name": "include_obfuscation", + "schema": { + "type": "boolean" + }, + "description": "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events\nto normalize payload sizes as a mitigation to certain side-channel\nattacks. These obfuscation fields are included by default, but add a\nsmall amount of overhead to the data stream. You can set\n`include_obfuscation` to false to optimize for bandwidth if you trust\nthe network links between your application and the OpenAI API.\n" }, { - "type": "object", - "properties": { - "messages": { - "description": "A list of messages comprising the conversation so far. Depending on the\n[model](https://developers.openai.com/api/docs/models) you use, different message types (modalities) are\nsupported, like [text](https://developers.openai.com/api/docs/guides/text),\n[images](https://developers.openai.com/api/docs/guides/images-vision), and [audio](https://developers.openai.com/api/docs/guides/audio).\n", - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/ChatCompletionRequestMessage" + "name": "openai-beta", + "in": "header", + "required": false, + "description": "Optional beta features to enable for this request.", + "style": "simple", + "explode": false, + "schema": { + "type": "array", + "x-stainless-param": "betas", + "items": { + "type": "string", + "enum": [ + "responses_multi_agent=v1" + ] + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaResponse" } }, - "model": { - "description": "Model ID used to generate the response, like `gpt-6-astra` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models)\nto browse and compare available models.\n", - "$ref": "#/components/schemas/ModelIdsShared" - }, - "service_tier": { - "$ref": "#/components/schemas/ServiceTier" - }, - "modalities": { - "$ref": "#/components/schemas/ResponseModalities" - }, - "verbosity": { - "$ref": "#/components/schemas/Verbosity" - }, - "reasoning_effort": { - "$ref": "#/components/schemas/ReasoningEffort" - }, - "max_completion_tokens": { - "description": "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning).\n", - "type": "integer", - "nullable": true - }, - "frequency_penalty": { - "type": "number", - "default": 0, - "minimum": -2, - "maximum": 2, - "nullable": true, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on\ntheir existing frequency in the text so far, decreasing the model's\nlikelihood to repeat the same line verbatim.\n" - }, - "presence_penalty": { - "type": "number", - "default": 0, - "minimum": -2, - "maximum": 2, - "nullable": true, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on\nwhether they appear in the text so far, increasing the model's likelihood\nto talk about new topics.\n" - }, - "web_search_options": { - "type": "object", - "title": "Web search", - "description": "This tool searches the web for relevant results to use in a response.\nLearn more about the [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search).\n", - "properties": { - "user_location": { - "type": "object", - "nullable": true, - "required": [ - "type", - "approximate" - ], - "description": "Approximate location parameters for the search.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of location approximation. Always `approximate`.\n", - "enum": [ - "approximate" - ], - "x-stainless-const": true - }, - "approximate": { - "$ref": "#/components/schemas/WebSearchLocation" - } - } - }, - "search_context_size": { - "$ref": "#/components/schemas/WebSearchContextSize" - } - } - }, - "top_logprobs": { - "description": "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n`logprobs` must be set to `true` if this parameter is used.\n", - "type": "integer", - "minimum": 0, - "maximum": 20, - "nullable": true - }, - "response_format": { - "description": "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](https://developers.openai.com/api/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ResponseFormatText" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonSchema" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonObject" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "audio": { - "type": "object", - "nullable": true, - "description": "Parameters for audio output. Required when audio output is requested with\n`modalities: [\"audio\"]`. [Learn more](https://developers.openai.com/api/docs/guides/audio).\n", - "required": [ - "voice", - "format" - ], - "properties": { - "voice": { - "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", - "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`,\n`sage`, `shimmer`, `marin`, and `cedar`. You may also provide a\ncustom voice object with an `id`, for example `{ \"id\": \"voice_1234\" }`.\n" - }, - "format": { - "type": "string", - "enum": [ - "wav", - "aac", - "mp3", - "flac", - "opus", - "pcm16" - ], - "description": "Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`,\n`opus`, or `pcm16`.\n" - } - } - }, - "store": { - "type": "boolean", - "default": false, - "nullable": true, - "description": "Whether or not to store the output of this chat completion request for\nuse in our [model distillation](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#distilling-from-a-larger-model) or\n[evals](https://developers.openai.com/api/docs/guides/evals) products.\n\nSupports text and image inputs. Note: image inputs over 8MB will be dropped.\n" - }, - "moderation": { - "anyOf": [ - { - "$ref": "#/components/schemas/ModerationParam", - "description": "Configuration for running moderation on the request input and generated output.\n" - }, - { - "type": "null" - } - ] - }, - "stream": { - "description": "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](https://developers.openai.com/api/reference/resources/chat/subresources/completions/streaming-events)\nfor more information, along with the [streaming responses](https://developers.openai.com/api/docs/guides/streaming-responses)\nguide for more information on how to handle the streaming events.\n", - "type": "boolean", - "nullable": true, - "default": false - }, - "stop": { - "$ref": "#/components/schemas/StopConfiguration" - }, - "logit_bias": { - "type": "object", - "x-oaiTypeLabel": "map", - "default": null, - "nullable": true, - "additionalProperties": { - "type": "integer" - }, - "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the\ntokenizer) to an associated bias value from -100 to 100. Mathematically,\nthe bias is added to the logits generated by the model prior to sampling.\nThe exact effect will vary per model, but values between -1 and 1 should\ndecrease or increase likelihood of selection; values like -100 or 100\nshould result in a ban or exclusive selection of the relevant token.\n" - }, - "logprobs": { - "description": "Whether to return log probabilities of the output tokens or not. If true,\nreturns the log probabilities of each output token returned in the\n`content` of `message`.\n", - "type": "boolean", - "default": false, - "nullable": true - }, - "max_tokens": { - "description": "The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the\nchat completion. This value can be used to control\n[costs](https://openai.com/api/pricing/) for text generated via API.\n\nThis value is now deprecated in favor of `max_completion_tokens`, and is\nnot compatible with [o-series models](https://developers.openai.com/api/docs/guides/reasoning).\n", - "type": "integer", - "nullable": true, - "deprecated": true - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 128, - "default": 1, - "example": 1, - "nullable": true, - "description": "How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs." - }, - "prediction": { - "nullable": true, - "description": "Configuration for a [Predicted Output](https://developers.openai.com/api/docs/guides/predicted-outputs),\nwhich can greatly improve response times when large parts of the model\nresponse are known ahead of time. This is most common when you are\nregenerating a file with only minor changes to most of the content.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/PredictionContent" - } - ] - }, - "seed": { - "type": "integer", - "minimum": -9223372036854776000, - "maximum": 9223372036854776000, - "nullable": true, - "deprecated": true, - "description": "This feature is in Beta.\nIf specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n", - "x-oaiMeta": { - "beta": true - } - }, - "stream_options": { - "$ref": "#/components/schemas/ChatCompletionStreamOptions" - }, - "tools": { - "type": "array", - "description": "A list of tools the model may call. You can provide either\n[custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools) or\n[function tools](https://developers.openai.com/api/docs/guides/function-calling).\n", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/ChatCompletionTool" - }, - { - "$ref": "#/components/schemas/CustomToolChatCompletions" - } - ] - } - }, - "tool_choice": { - "$ref": "#/components/schemas/ChatCompletionToolChoiceOption" - }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, - "function_call": { - "deprecated": true, - "description": "Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n\n`none` means the model will not call a function and instead generates a\nmessage.\n\n`auto` means the model can pick between generating a message or calling a\nfunction.\n\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the\nmodel to call that function.\n\n`none` is the default when no functions are present. `auto` is the default\nif functions are present.\n", - "oneOf": [ - { - "type": "string", - "description": "`none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function.\n", - "enum": [ - "none", - "auto" - ] - }, - { - "$ref": "#/components/schemas/ChatCompletionFunctionCallOption" - } - ] - }, - "functions": { - "deprecated": true, - "description": "Deprecated in favor of `tools`.\n\nA list of functions the model may generate JSON inputs for.\n", - "type": "array", - "minItems": 1, - "maxItems": 128, - "items": { - "$ref": "#/components/schemas/ChatCompletionFunctions" + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/BetaResponseStreamEvent" } } - }, - "required": [ - "model", - "messages" - ] - } - ] - }, - "CreateChatCompletionResponse": { - "type": "object", - "description": "Represents a chat completion response returned by model, based on the provided input.", - "properties": { - "id": { - "type": "string", - "description": "A unique identifier for the chat completion." + } }, - "choices": { - "type": "array", - "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.", - "items": { - "type": "object", - "required": [ - "finish_reason", - "index", - "message", - "logprobs" - ], - "properties": { - "finish_reason": { - "type": "string", - "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\nRead the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more.\n", - "enum": [ - "stop", - "length", - "tool_calls", - "content_filter", - "function_call" - ] - }, - "index": { - "type": "integer", - "description": "The index of the choice in the list of choices." - }, - "message": { - "$ref": "#/components/schemas/ChatCompletionResponseMessage" - }, - "logprobs": { - "anyOf": [ - { - "description": "Log probability information for the choice.", - "type": "object", - "properties": { - "content": { - "anyOf": [ - { - "description": "A list of message content tokens with log probability information.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionTokenLogprob" - } - }, - { - "type": "null" - } - ] - }, - "refusal": { - "anyOf": [ - { - "description": "A list of message refusal tokens with log probability information.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionTokenLogprob" - } - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "content", - "refusal" - ] - }, - { - "type": "null" - } - ] + "404": { + "description": "The response was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaErrorResponse" } } } }, - "created": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the chat completion was created." - }, - "model": { - "type": "string", - "description": "The model used for the chat completion." - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "service_tier": { - "$ref": "#/components/schemas/ServiceTier" - }, - "system_fingerprint": { - "type": "string", - "deprecated": true, - "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" - }, - "object": { - "type": "string", - "description": "The object type, which is always `chat.completion`.", - "enum": [ - "chat.completion" - ], - "x-stainless-const": true - }, - "usage": { - "$ref": "#/components/schemas/CompletionUsage" - }, - "moderation": { - "anyOf": [ - { - "$ref": "#/components/schemas/ChatCompletionModeration", - "description": "Moderation results for the request input and generated output, if moderated\ncompletions were requested.\n" - }, - { - "type": "null" - } - ] + "429": { + "$ref": "#/components/responses/TooManyRequests" } }, - "required": [ - "choices", - "created", - "id", - "model", - "object" - ], "x-oaiMeta": { - "name": "The chat completion object", - "group": "chat", - "example": "{\n \"id\": \"chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG\",\n \"object\": \"chat.completion\",\n \"created\": 1741570283,\n \"model\": \"gpt-6-astra\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background.\",\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1117,\n \"completion_tokens\": 46,\n \"total_tokens\": 1163,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_fc9f1d7035\"\n}\n" + "group": "responses", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/responses/resp_123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.retrieve(\"resp_123\");\nconsole.log(response);\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.retrieve(\"resp_123\")\nprint(response)\n" + }, + "response": "{\n \"id\": \"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741386163,\n \"status\": \"completed\",\n \"completed_at\": 1741386164,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Silent circuits hum, \\nThoughts emerge in data streams— \\nDigital dawn breaks.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 32,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 18,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 50\n },\n \"user\": null,\n \"metadata\": {}\n}\n" + } } }, - "CreateChatCompletionStreamResponse": { - "type": "object", - "description": "Represents a streamed chunk of a chat completion response returned\nby the model, based on the provided input.\n[Learn more](https://developers.openai.com/api/docs/guides/streaming-responses).\n", - "properties": { - "id": { - "type": "string", - "description": "A unique identifier for the chat completion. Each chunk has the same ID." + "delete": { + "operationId": "beta_deleteResponse", + "tags": [ + "Responses" + ], + "summary": "Delete a model response", + "description": "Deletes a model response with the given ID.\n", + "parameters": [ + { + "in": "path", + "name": "response_id", + "required": true, + "schema": { + "type": "string", + "example": "resp_677efb5139a88190b512bc3fef8e535d" + }, + "description": "The ID of the response to delete." }, - "choices": { - "type": "array", - "description": "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n", - "items": { - "type": "object", - "required": [ - "delta", - "finish_reason", - "index" - ], - "properties": { - "delta": { - "$ref": "#/components/schemas/ChatCompletionStreamResponseDelta" - }, - "logprobs": { - "description": "Log probability information for the choice.", + { + "name": "openai-beta", + "in": "header", + "required": false, + "description": "Optional beta features to enable for this request.", + "style": "simple", + "explode": false, + "schema": { + "type": "array", + "x-stainless-param": "betas", + "items": { + "type": "string", + "enum": [ + "responses_multi_agent=v1" + ] + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { "type": "object", - "nullable": true, "properties": { - "content": { - "description": "A list of message content tokens with log probability information.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionTokenLogprob" - }, - "nullable": true + "object": { + "type": "string", + "enum": [ + "response.deleted" + ], + "default": "response.deleted", + "x-stainless-const": true }, - "refusal": { - "description": "A list of message refusal tokens with log probability information.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ChatCompletionTokenLogprob" - }, - "nullable": true + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" } }, "required": [ - "content", - "refusal" + "object", + "deleted", + "id" ] - }, - "finish_reason": { - "type": "string", - "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n", - "enum": [ - "stop", - "length", - "tool_calls", - "content_filter", - "function_call" - ], - "nullable": true - }, - "index": { - "type": "integer", - "description": "The index of the choice in the list of choices." } } } }, - "created": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp." + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaErrorResponse" + } + } + } }, - "model": { - "type": "string", - "description": "The model to generate the completion." + "429": { + "$ref": "#/components/responses/TooManyRequests" + } + }, + "x-oaiMeta": { + "group": "responses", + "examples": { + "request": { + "curl": "curl -X DELETE https://api.openai.com/v1/responses/resp_123 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.delete(\"resp_123\");\nconsole.log(response);\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.delete(\"resp_123\")\nprint(response)\n" + }, + "response": "{\n \"id\": \"resp_123\",\n \"object\": \"response.deleted\",\n \"deleted\": true\n}\n" + } + } + } + }, + "/responses/{response_id}/cancel?beta=true": { + "post": { + "operationId": "beta_cancelResponse", + "tags": [ + "Responses" + ], + "summary": "Cancel a response", + "description": "Cancels a model response with the given ID. Only responses created with\nthe `background` parameter set to `true` can be cancelled.\n[Learn more](https://developers.openai.com/api/docs/guides/background).\n", + "parameters": [ + { + "in": "path", + "name": "response_id", + "required": true, + "schema": { + "type": "string", + "example": "resp_677efb5139a88190b512bc3fef8e535d" + }, + "description": "The ID of the response to cancel." }, - "obfuscation": { - "type": "string", - "description": "An obfuscation string added to normalize the size of streamed chunks as a\nmitigation to certain side-channel attacks. The field is included by\ndefault and omitted when `stream_options.include_obfuscation` is `false`.\n" - }, - "service_tier": { - "$ref": "#/components/schemas/ServiceTier" - }, - "system_fingerprint": { - "type": "string", - "deprecated": true, - "description": "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" - }, - "object": { - "type": "string", - "description": "The object type, which is always `chat.completion.chunk`.", - "enum": [ - "chat.completion.chunk" - ], - "x-stainless-const": true - }, - "usage": { - "$ref": "#/components/schemas/CompletionUsage", - "nullable": true, - "description": "An optional field that will only be present when you set\n`stream_options: {\"include_usage\": true}` in your request. When present, it\ncontains a null value **except for the last chunk** which contains the\ntoken usage statistics for the entire request.\n\n**NOTE:** If the stream is interrupted or cancelled, you may not\nreceive the final usage chunk which contains the total token usage for\nthe request.\n" + { + "name": "openai-beta", + "in": "header", + "required": false, + "description": "Optional beta features to enable for this request.", + "style": "simple", + "explode": false, + "schema": { + "type": "array", + "x-stainless-param": "betas", + "items": { + "type": "string", + "enum": [ + "responses_multi_agent=v1" + ] + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaResponse" + } + } + } }, - "moderation": { - "anyOf": [ - { - "$ref": "#/components/schemas/ChatCompletionModeration", - "description": "Moderation results for the request input and generated output. Present\non the moderation chunk when moderated completions are requested.\n" - }, - { - "type": "null" + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaErrorResponse" + } } - ] + } + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" } }, - "required": [ - "choices", - "created", - "id", - "model", - "object" - ], "x-oaiMeta": { - "name": "The chat completion chunk object", - "group": "chat", - "example": "{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}],\"obfuscation\":\"r4N7vQ2m\"}\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\"logprobs\":null,\"finish_reason\":null}],\"obfuscation\":\"p9K3xT6w\"}\n\n....\n\n{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"stop\"}],\"obfuscation\":\"\"}\n" + "group": "responses", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/responses/resp_123/cancel \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.cancel(\"resp_123\");\nconsole.log(response);\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.cancel(\"resp_123\")\nprint(response)\n" + }, + "response": "{\n \"id\": \"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741386163,\n \"status\": \"cancelled\",\n \"background\": true,\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"type\": \"message\",\n \"id\": \"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44\",\n \"status\": \"in_progress\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Silent circuits hum, \\nThoughts emerge in data streams— \\nDigital dawn breaks.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n}\n" + } } - }, - "CreateCompletionRequest": { - "type": "object", - "properties": { - "model": { - "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", - "anyOf": [ - { - "type": "string" - }, - { + } + }, + "/responses/compact?beta=true": { + "post": { + "tags": [ + "Responses" + ], + "summary": "Compact conversation", + "description": "Compact a conversation. Returns a compacted response object.\n\nLearn when and how to compact long-running conversations in the [conversation state guide](https://developers.openai.com/api/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](https://developers.openai.com/api/docs/guides/conversation-state#compaction-advanced).", + "operationId": "beta_Compactconversation", + "parameters": [ + { + "name": "openai-beta", + "in": "header", + "required": false, + "description": "Optional beta features to enable for this request.", + "style": "simple", + "explode": false, + "schema": { + "type": "array", + "x-stainless-param": "betas", + "items": { "type": "string", "enum": [ - "gpt-3.5-turbo-instruct", - "davinci-002", - "babbage-002" + "responses_multi_agent=v1" ] } - ], - "x-oaiTypeLabel": "string" - }, - "prompt": { - "description": "The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.\n\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.\n", - "default": "<|endoftext|>", - "nullable": true, - "oneOf": [ - { - "type": "string", - "default": "", - "example": "This is a test." - }, - { - "type": "array", - "items": { - "type": "string", - "default": "", - "example": "This is a test." + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaCompactResponseMethodPublicBody" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaCompactResource" } - }, - { - "type": "array", - "minItems": 1, - "items": { - "type": "integer" - }, - "example": "[1212, 318, 257, 1332, 13]" - }, - { - "type": "array", - "minItems": 1, - "items": { - "type": "array", - "minItems": 1, - "items": { - "type": "integer" - } - }, - "example": "[[1212, 318, 257, 1332, 13]]" } - ] - }, - "best_of": { - "type": "integer", - "default": 1, - "minimum": 0, - "maximum": 20, - "nullable": true, - "description": "Generates `best_of` completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.\n\nWhen used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n" + } }, - "echo": { - "type": "boolean", - "default": false, - "nullable": true, - "description": "Echo back the prompt in addition to the completion\n" + "400": { + "description": "Invalid compaction request or incompatible input parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaErrorResponse" + } + } + } }, - "frequency_penalty": { - "type": "number", - "default": 0, - "minimum": -2, - "maximum": 2, - "nullable": true, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](https://developers.openai.com/api/docs/guides/text)\n" + "429": { + "$ref": "#/components/responses/InferenceRateLimited" }, - "logit_bias": { - "type": "object", - "x-oaiTypeLabel": "map", - "default": null, - "nullable": true, - "additionalProperties": { - "type": "integer" + "503": { + "$ref": "#/components/responses/InferenceServiceUnavailable" + } + }, + "x-oaiMeta": { + "group": "responses", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/responses/compact \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Create a simple landing page for a dog petting café.\"\n },\n {\n \"id\": \"msg_001\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Below is a single file, ready-to-use landing page for a dog petting café:...\"\n }\n ],\n \"role\": \"assistant\"\n }\n ]\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst openai = new OpenAI();\n\n// Compact the previous response if you are running out of tokens\nconst compactedResponse = await openai.responses.compact({\n model: \"gpt-6-astra\",\n input: [\n {\n role: \"user\",\n content: \"Create a simple landing page for a dog petting café.\",\n },\n // All items returned from previous requests are included here, like reasoning, message, function call, etc.\n {\n id: \"msg_030d085c0b53e67e0069332e3a72d4819c96c6f2c4adc15d33\",\n type: \"message\",\n status: \"completed\",\n content: [\n {\n type: \"output_text\",\n annotations: [],\n logprobs: [],\n text: \"Below is a single file, ready-to-use landing page for a dog petting café:...\",\n },\n ],\n role: \"assistant\",\n },\n ],\n});\n\n// Pass the compactedResponse.output as input to the next request\nconsole.log(compactedResponse);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\ncompacted_response = client.responses.compact(\n model=\"gpt-6-astra\",\n input=[\n {\n \"role\": \"user\",\n \"content\": \"Create a simple landing page for a dog petting cafe.\",\n },\n # All items returned from previous requests are included here, like reasoning, message, function call, etc.\n {\n \"id\": \"msg_001\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Below is a single file, ready-to-use landing page for a dog petting café:...\",\n },\n ],\n \"role\": \"assistant\",\n },\n ]\n)\n# Pass the compacted_response.output as input to the next request\nprint(compacted_response)\n" }, - "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](https://platform.openai.com/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n\nAs an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.\n" - }, - "logprobs": { - "type": "integer", - "minimum": 0, - "maximum": 5, - "default": null, - "nullable": true, - "description": "Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.\n\nThe maximum value for `logprobs` is 5.\n" - }, - "max_tokens": { - "type": "integer", - "minimum": 0, - "default": 16, - "example": 16, - "nullable": true, - "description": "The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the completion.\n\nThe token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n" - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 128, - "default": 1, - "example": 1, - "nullable": true, - "description": "How many completions to generate for each prompt.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n" - }, - "presence_penalty": { - "type": "number", - "default": 0, - "minimum": -2, - "maximum": 2, - "nullable": true, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](https://developers.openai.com/api/docs/guides/text)\n" - }, - "seed": { - "type": "integer", - "format": "int64", - "nullable": true, - "description": "If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\n\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n" - }, - "stop": { - "$ref": "#/components/schemas/StopConfiguration" - }, - "stream": { - "description": "Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n", - "type": "boolean", - "nullable": true, - "default": false + "response": "{\n \"id\": \"resp_001\",\n \"object\": \"response.compaction\",\n \"created_at\": 1764967971,\n \"output\": [\n {\n \"id\": \"msg_000\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Create a simple landing page for a dog petting cafe.\"\n }\n ],\n \"role\": \"user\"\n },\n {\n \"id\": \"cmp_001\",\n \"type\": \"compaction\",\n \"encrypted_content\": \"gAAAAABpM0Yj-...=\"\n }\n ],\n \"usage\": {\n \"input_tokens\": 139,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n },\n \"output_tokens\": 438,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 64\n },\n \"total_tokens\": 577\n }\n}\n" + } + } + } + }, + "/responses/{response_id}/input_items?beta=true": { + "get": { + "operationId": "beta_listInputItems", + "tags": [ + "Responses" + ], + "summary": "List input items", + "description": "Returns a list of input items for a given response.", + "parameters": [ + { + "in": "path", + "name": "response_id", + "required": true, + "schema": { + "type": "string" + }, + "description": "The ID of the response to retrieve input items for." }, - "stream_options": { - "$ref": "#/components/schemas/ChatCompletionStreamOptions" + { + "name": "limit", + "in": "query", + "description": "A limit on the number of objects to be returned. Limit can range between\n1 and 100, and the default is 20.\n", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } }, - "suffix": { - "description": "The suffix that comes after a completion of inserted text.\n\nThis parameter is only supported for `gpt-3.5-turbo-instruct`.\n", - "default": null, - "nullable": true, - "type": "string", - "example": "test." + { + "in": "query", + "name": "order", + "schema": { + "type": "string", + "enum": [ + "asc", + "desc" + ] + }, + "description": "The order to return the input items in. Default is `desc`.\n- `asc`: Return the input items in ascending order.\n- `desc`: Return the input items in descending order.\n" }, - "temperature": { - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true, - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n" + { + "in": "query", + "name": "after", + "schema": { + "type": "string" + }, + "description": "An item ID to list items after, used in pagination.\n" }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" + { + "in": "query", + "name": "include", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BetaIncludeEnum" + } + }, + "description": "Additional fields to include in the response. See the `include`\nparameter for Response creation above for more information.\n" }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" + { + "name": "openai-beta", + "in": "header", + "required": false, + "description": "Optional beta features to enable for this request.", + "style": "simple", + "explode": false, + "schema": { + "type": "array", + "x-stainless-param": "betas", + "items": { + "type": "string", + "enum": [ + "responses_multi_agent=v1" + ] + } + } } - }, - "required": [ - "model", - "prompt" - ] - }, - "CreateCompletionResponse": { - "type": "object", - "description": "Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).\n", - "properties": { - "id": { - "type": "string", - "description": "A unique identifier for the completion." - }, - "choices": { - "type": "array", - "description": "The list of completion choices the model generated for the input prompt.", - "items": { - "type": "object", - "required": [ - "finish_reason", - "index", - "logprobs", - "text" - ], - "properties": { - "finish_reason": { - "type": "string", - "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\nor `content_filter` if content was omitted due to a flag from our content filters.\n", - "enum": [ - "stop", - "length", - "content_filter" - ] - }, - "index": { - "type": "integer" - }, - "logprobs": { - "anyOf": [ - { - "type": "object", - "properties": { - "text_offset": { - "type": "array", - "items": { - "type": "integer" - } - }, - "token_logprobs": { - "type": "array", - "items": { - "type": "number" - } - }, - "tokens": { - "type": "array", - "items": { - "type": "string" - } - }, - "top_logprobs": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "type": "number" - } - } - } - } - }, - { - "type": "null" - } - ] - }, - "text": { - "type": "string" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaResponseItemList" } } } }, - "created": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the completion was created." - }, - "model": { - "type": "string", - "description": "The model used for completion." - }, - "system_fingerprint": { - "type": "string", - "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" - }, - "object": { - "type": "string", - "description": "The object type, which is always \"text_completion\"", - "enum": [ - "text_completion" - ], - "x-stainless-const": true + "404": { + "description": "The response or the item specified by `after` was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaErrorResponse" + } + } + } }, - "usage": { - "$ref": "#/components/schemas/CompletionUsage" + "429": { + "$ref": "#/components/responses/TooManyRequests" } }, - "required": [ - "id", - "object", - "created", - "model", - "choices" - ], "x-oaiMeta": { - "name": "The completion object", - "legacy": true, - "example": "{\n \"id\": \"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\",\n \"object\": \"text_completion\",\n \"created\": 1589478378,\n \"model\": \"gpt-3.5-turbo-instruct\",\n \"choices\": [\n {\n \"text\": \"\\n\\nThis is indeed a test\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": \"length\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 5,\n \"completion_tokens\": 7,\n \"total_tokens\": 12\n }\n}\n" + "group": "responses", + "examples": { + "request": { + "curl": "curl https://api.openai.com/v1/responses/resp_abc123/input_items \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n", + "javascript": "import OpenAI from \"openai\";\nconst client = new OpenAI();\n\nconst response = await client.responses.inputItems.list(\"resp_123\");\nconsole.log(response.data);\n", + "python": "from openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.input_items.list(\"resp_123\")\nprint(response.data)\n" + }, + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"msg_abc123\",\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Tell me a three sentence bedtime story about a unicorn.\"\n }\n ]\n }\n ],\n \"first_id\": \"msg_abc123\",\n \"last_id\": \"msg_abc123\",\n \"has_more\": false\n}\n" + } } - }, - "CreateContainerBody": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the container to create." - }, - "file_ids": { - "type": "array", - "description": "IDs of files to copy to the container.", - "items": { - "type": "string" - } - }, - "expires_after": { - "type": "object", - "description": "Container expiration time in seconds relative to the 'anchor' time.", - "properties": { - "anchor": { + } + }, + "/responses/input_tokens?beta=true": { + "post": { + "tags": [ + "Responses" + ], + "summary": "Get input token counts", + "description": "Returns input token counts of the request.\n\nReturns an object with `object` set to `response.input_tokens` and an `input_tokens` count.", + "operationId": "beta_Getinputtokencounts", + "parameters": [ + { + "name": "openai-beta", + "in": "header", + "required": false, + "description": "Optional beta features to enable for this request.", + "style": "simple", + "explode": false, + "schema": { + "type": "array", + "x-stainless-param": "betas", + "items": { "type": "string", "enum": [ - "last_active_at" - ], - "description": "Time anchor for the expiration time. Currently only 'last_active_at' is supported." - }, - "minutes": { - "type": "integer" - } - }, - "required": [ - "anchor", - "minutes" - ] - }, - "skills": { - "type": "array", - "description": "An optional list of skills referenced by id or inline data.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/SkillReferenceParam" - }, - { - "$ref": "#/components/schemas/InlineSkillParam" - } - ], - "discriminator": { - "propertyName": "type" + "responses_multi_agent=v1" + ] } } - }, - "memory_limit": { - "type": "string", - "enum": [ - "1g", - "4g", - "16g", - "64g" - ], - "description": "Optional memory limit for the container. Defaults to \"1g\"." - }, - "network_policy": { - "description": "Network access policy for the container.", - "oneOf": [ - { - "$ref": "#/components/schemas/ContainerNetworkPolicyDisabledParam" - }, - { - "$ref": "#/components/schemas/ContainerNetworkPolicyAllowlistParam" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaTokenCountsBody" } - ], - "discriminator": { - "propertyName": "type" } } }, - "required": [ - "name" - ] - }, - "CreateContainerFileBody": { - "type": "object", - "properties": { - "file_id": { - "type": "string", - "description": "Name of the file to create." - }, - "file": { - "description": "The File object (not file name) to be uploaded.\n", - "type": "string", - "format": "binary" - } - }, - "required": [] - }, - "CreateEmbeddingRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "input": { - "description": "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.\n", - "example": "The quick brown fox jumped over the lazy dog", - "oneOf": [ - { - "type": "string", - "title": "string", - "description": "The string that will be turned into an embedding.", - "default": "", - "example": "This is a test." - }, - { - "type": "array", - "title": "array", - "description": "The array of strings that will be turned into an embedding.", - "minItems": 1, - "maxItems": 2048, - "items": { - "type": "string", - "default": "", - "example": "['This is a test.']" + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaTokenCountsResource" } - }, - { - "type": "array", - "title": "array", - "description": "The array of integers that will be turned into an embedding.", - "minItems": 1, - "maxItems": 2048, - "items": { - "type": "integer" - }, - "example": "[1212, 318, 257, 1332, 13]" - }, - { - "type": "array", - "title": "array", - "description": "The array of arrays containing integers that will be turned into an embedding.", - "minItems": 1, - "maxItems": 2048, - "items": { - "type": "array", - "minItems": 1, - "items": { - "type": "integer" - } - }, - "example": "[[1212, 318, 257, 1332, 13]]" } - ] + } }, - "model": { - "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", - "example": "text-embedding-3-small", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "text-embedding-ada-002", - "text-embedding-3-small", - "text-embedding-3-large" - ] + "400": { + "description": "The request to count input tokens is invalid or contains incompatible parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BetaErrorResponse" + } } - ], - "x-oaiTypeLabel": "string" - }, - "encoding_format": { - "description": "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).", - "example": "float", - "default": "float", - "type": "string", - "enum": [ - "float", - "base64" - ] - }, - "dimensions": { - "description": "The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\n", - "type": "integer", - "minimum": 1 + } }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" + "429": { + "$ref": "#/components/responses/TooManyRequests" } }, - "required": [ - "model", - "input" - ] - }, - "CreateEmbeddingResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "description": "The list of embeddings generated by the model.", - "items": { - "$ref": "#/components/schemas/Embedding" - } - }, - "model": { - "type": "string", - "description": "The name of the model used to generate the embedding." - }, - "object": { - "type": "string", - "description": "The object type, which is always \"list\".", - "enum": [ - "list" - ], - "x-stainless-const": true - }, - "usage": { - "type": "object", - "description": "The usage information for the request.", - "properties": { - "prompt_tokens": { - "type": "integer", - "description": "The number of tokens used by the prompt." - }, - "total_tokens": { - "type": "integer", - "description": "The total number of tokens used by the request." - } + "x-oaiMeta": { + "group": "responses", + "examples": { + "request": { + "curl": "curl -X POST https://api.openai.com/v1/responses/input_tokens \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"model\": \"gpt-6-astra\",\n \"input\": \"Tell me a joke.\"\n }'\n", + "javascript": "import OpenAI from \"openai\";\n\nconst client = new OpenAI();\n\nconst response = await client.responses.inputTokens.count({\n model: \"gpt-6-astra\",\n input: \"Tell me a joke.\",\n});\n\nconsole.log(response.input_tokens);\n", + "python": "from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.input_tokens.count(\n model=\"gpt-6-astra\",\n input=\"Tell me a joke.\"\n)\nprint(response.input_tokens)\n", + "go": "package main\n\nimport (\n \"context\"\n \"fmt\"\n\n \"github.com/openai/openai-go\"\n \"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n client := openai.NewClient()\n response, err := client.Responses.InputTokens.Count(context.TODO(), responses.InputTokenCountParams{\n Model: \"gpt-6-astra\",\n Input: \"Tell me a joke.\",\n })\n if err != nil {\n panic(err.Error())\n }\n fmt.Printf(\"%+v\\n\", response.InputTokens)\n}\n", + "ruby": "require \"openai\"\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.input_tokens.count(model: \"gpt-6-astra\", input: \"Tell me a joke.\")\n\nputs(response)\n", + "java": "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.responses.inputtokens.InputTokenCountParams;\nimport com.openai.models.responses.inputtokens.InputTokenCountResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n InputTokenCountParams params = InputTokenCountParams.builder()\n .model(\"gpt-6-astra\")\n .input(\"Tell me a joke.\")\n .build();\n\n InputTokenCountResponse response = client.responses().inputTokens().count(params);\n }\n}\n" }, - "required": [ - "prompt_tokens", - "total_tokens" - ] + "response": "{\n \"object\": \"response.input_tokens\",\n \"input_tokens\": 11\n}\n" } - }, - "required": [ - "object", - "model", - "data", - "usage" - ] - }, - "CreateEvalCompletionsRunDataSource": { - "type": "object", - "title": "CompletionsRunDataSource", - "description": "A CompletionsRunDataSource object describing a model sampling configuration.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "completions" - ], - "default": "completions", - "description": "The type of run data source. Always `completions`." - }, - "input_messages": { - "description": "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace.", - "oneOf": [ - { - "type": "object", - "title": "TemplateInputMessages", - "properties": { - "type": { - "type": "string", - "enum": [ - "template" - ], - "description": "The type of input messages. Always `template`." - }, - "template": { - "type": "array", - "description": "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/EasyInputMessage" - }, - { - "$ref": "#/components/schemas/EvalItem" - } - ] - } - } - }, - "required": [ - "type", - "template" - ] - }, - { - "type": "object", - "title": "ItemReferenceInputMessages", - "properties": { - "type": { - "type": "string", - "enum": [ - "item_reference" - ], - "description": "The type of input messages. Always `item_reference`." - }, - "item_reference": { - "type": "string", - "description": "A reference to a variable in the `item` namespace. Ie, \"item.input_trajectory\"" - } - }, - "required": [ - "type", - "item_reference" - ] - } - ] - }, - "sampling_params": { - "type": "object", - "properties": { - "reasoning_effort": { - "$ref": "#/components/schemas/ReasoningEffort" - }, - "temperature": { - "type": "number", - "description": "A higher temperature increases randomness in the outputs.", - "default": 1 - }, - "max_completion_tokens": { - "type": "integer", - "description": "The maximum number of tokens in the generated output." - }, - "top_p": { - "type": "number", - "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.", - "default": 1 - }, - "seed": { - "type": "integer", - "description": "A seed value to initialize the randomness, during sampling.", - "default": 42 - }, - "response_format": { - "description": "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](https://developers.openai.com/api/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ResponseFormatText" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonSchema" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonObject" - } - ] - }, - "tools": { - "type": "array", - "description": "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n", - "items": { - "$ref": "#/components/schemas/ChatCompletionTool" - } + } + } + } + }, + "webhooks": { + "agent_environment_expired": { + "post": { + "description": "Sent when an agent environment expires and can no longer resume from a snapshot.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentEnvironmentExpired" } } - }, - "model": { - "type": "string", - "description": "The name of the model to use for generating completions (e.g. \"o3-mini\")." - }, - "source": { - "description": "Determines what populates the `item` namespace in this run's data source.", - "oneOf": [ - { - "$ref": "#/components/schemas/EvalJsonlFileContentSource" - }, - { - "$ref": "#/components/schemas/EvalJsonlFileIdSource" - }, - { - "$ref": "#/components/schemas/EvalStoredCompletionsSource" - } - ] } }, - "required": [ - "type", - "source" - ], - "x-oaiMeta": { - "name": "The completions data source object used to configure an individual run", - "group": "eval runs", - "example": "{\n \"name\": \"gpt-6-astra\",\n \"data_source\": {\n \"type\": \"completions\",\n \"input_messages\": {\n \"type\": \"item_reference\",\n \"item_reference\": \"item.input\"\n },\n \"model\": \"gpt-6-astra\",\n \"source\": {\n \"type\": \"stored_completions\",\n \"model\": \"gpt-6-astra\"\n }\n }\n}\n" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } } - }, - "CreateEvalCustomDataSourceConfig": { - "type": "object", - "title": "CustomDataSourceConfig", - "description": "A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs.\nThis schema is used to define the shape of the data that will be:\n- Used to define your testing criteria and\n- What data is required when creating a run\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "custom" - ], - "default": "custom", - "description": "The type of data source. Always `custom`.", - "x-stainless-const": true - }, - "item_schema": { - "type": "object", - "description": "The json schema for each row in the data source.", - "additionalProperties": true, - "example": "{\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"integer\"}\n },\n \"required\": [\"name\", \"age\"]\n}\n" - }, - "include_sample_schema": { - "type": "boolean", - "default": false, - "description": "Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source)" + } + }, + "agent_environment_failed": { + "post": { + "description": "Sent when setup fails for a prewarmed OpenAI-hosted environment before it is attached to a session.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentEnvironmentFailed" + } + } } }, - "required": [ - "item_schema", - "type" - ], - "x-oaiMeta": { - "name": "The eval file data source config object", - "group": "evals", - "example": "{\n \"type\": \"custom\",\n \"item_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"integer\"}\n },\n \"required\": [\"name\", \"age\"]\n },\n \"include_sample_schema\": true\n}\n" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } } - }, - "CreateEvalItem": { - "title": "CreateEvalItem", - "description": "A chat message that makes up the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}.", - "type": "object", - "oneOf": [ - { - "type": "object", - "title": "SimpleInputMessage", - "properties": { - "role": { - "type": "string", - "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")." - }, - "content": { - "type": "string", - "description": "The content of the message." + } + }, + "agent_environment_ready": { + "post": { + "description": "Sent when a prewarmed OpenAI-hosted environment finishes setup before being attached to a session.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentEnvironmentReady" } - }, - "required": [ - "role", - "content" - ] - }, - { - "$ref": "#/components/schemas/EvalItem" + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" } - ], - "x-oaiMeta": { - "name": "The chat message object used to configure an individual run" } - }, - "CreateEvalJsonlRunDataSource": { - "type": "object", - "title": "JsonlRunDataSource", - "description": "A JsonlRunDataSource object with that specifies a JSONL file that matches the eval \n", - "properties": { - "type": { - "type": "string", - "enum": [ - "jsonl" - ], - "default": "jsonl", - "description": "The type of data source. Always `jsonl`.", - "x-stainless-const": true - }, - "source": { - "description": "Determines what populates the `item` namespace in the data source.", - "oneOf": [ - { - "$ref": "#/components/schemas/EvalJsonlFileContentSource" - }, - { - "$ref": "#/components/schemas/EvalJsonlFileIdSource" + } + }, + "agent_environment_suspended": { + "post": { + "description": "Sent when an agent environment is suspended and can resume from a snapshot.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentEnvironmentSuspended" } - ] + } } }, - "required": [ - "type", - "source" - ], - "x-oaiMeta": { - "name": "The file data source object for the eval run configuration", - "group": "evals", - "example": "{\n \"type\": \"jsonl\",\n \"source\": {\n \"type\": \"file_id\",\n \"id\": \"file-9GYS6xbkWgWhmE7VoLUWFg\"\n }\n}\n" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } } - }, - "CreateEvalLabelModelGrader": { - "type": "object", - "title": "LabelModelGrader", - "description": "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n", - "properties": { - "type": { - "description": "The object type, which is always `label_model`.", - "type": "string", - "enum": [ - "label_model" - ], - "x-stainless-const": true - }, - "name": { - "type": "string", - "description": "The name of the grader." - }, - "model": { - "type": "string", - "description": "The model to use for the evaluation. Must support structured outputs." - }, - "input": { - "type": "array", - "description": "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}.", - "items": { - "$ref": "#/components/schemas/CreateEvalItem" + } + }, + "agent_session_action_required": { + "post": { + "description": "Sent when an agent session requires an action. Retrieve the session for action details.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionActionRequired" + } } - }, - "labels": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The labels to classify to each item in the evaluation." - }, - "passing_labels": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The labels that indicate a passing result. Must be a subset of labels." } }, - "required": [ - "type", - "model", - "input", - "passing_labels", - "labels", - "name" - ], - "x-oaiMeta": { - "name": "The eval label model grader object", - "group": "evals", - "example": "{\n \"type\": \"label_model\",\n \"model\": \"gpt-4o-2024-08-06\",\n \"input\": [\n {\n \"role\": \"system\",\n \"content\": \"Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Statement: {{item.response}}\"\n }\n ],\n \"passing_labels\": [\"positive\"],\n \"labels\": [\"positive\", \"neutral\", \"negative\"],\n \"name\": \"Sentiment label grader\"\n}\n" - } - }, - "CreateEvalLogsDataSourceConfig": { - "type": "object", - "title": "LogsDataSourceConfig", - "description": "A data source config which specifies the metadata property of your logs query.\nThis is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "logs" - ], - "default": "logs", - "description": "The type of data source. Always `logs`.", - "x-stainless-const": true - }, - "metadata": { - "type": "object", - "description": "Metadata filters for the logs data source.", - "additionalProperties": true, - "example": "{\n \"use_case\": \"customer_support_agent\"\n}\n" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" } - }, - "required": [ - "type" - ], - "x-oaiMeta": { - "name": "The logs data source object for evals", - "group": "evals", - "example": "{\n \"type\": \"logs\",\n \"metadata\": {\n \"use_case\": \"customer_support_agent\"\n }\n}\n" } - }, - "CreateEvalRequest": { - "type": "object", - "title": "CreateEvalRequest", - "properties": { - "name": { - "type": "string", - "description": "The name of the evaluation." - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "data_source_config": { - "type": "object", - "description": "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation.", - "oneOf": [ - { - "$ref": "#/components/schemas/CreateEvalCustomDataSourceConfig" - }, - { - "$ref": "#/components/schemas/CreateEvalLogsDataSourceConfig" - }, - { - "$ref": "#/components/schemas/CreateEvalStoredCompletionsDataSourceConfig" + } + }, + "agent_session_created": { + "post": { + "description": "Sent when an agent session is created.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionCreated" } - ] - }, - "testing_criteria": { - "type": "array", - "description": "A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like `{{item.variable_name}}`. To reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`).", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/CreateEvalLabelModelGrader" - }, - { - "$ref": "#/components/schemas/EvalGraderStringCheck" - }, - { - "$ref": "#/components/schemas/EvalGraderTextSimilarity" - }, - { - "$ref": "#/components/schemas/EvalGraderPython" - }, - { - "$ref": "#/components/schemas/EvalGraderScoreModel" - } - ] } } }, - "required": [ - "data_source_config", - "testing_criteria" - ] - }, - "CreateEvalResponsesRunDataSource": { - "type": "object", - "title": "ResponsesRunDataSource", - "description": "A ResponsesRunDataSource object describing a model sampling configuration.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "responses" - ], - "default": "responses", - "description": "The type of run data source. Always `responses`." - }, - "input_messages": { - "description": "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace.", - "oneOf": [ - { - "type": "object", - "title": "InputMessagesTemplate", - "properties": { - "type": { - "type": "string", - "enum": [ - "template" - ], - "description": "The type of input messages. Always `template`." - }, - "template": { - "type": "array", - "description": "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}.", - "items": { - "oneOf": [ - { - "type": "object", - "title": "ChatMessage", - "properties": { - "role": { - "type": "string", - "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")." - }, - "content": { - "type": "string", - "description": "The content of the message." - } - }, - "required": [ - "role", - "content" - ] - }, - { - "$ref": "#/components/schemas/EvalItem" - } - ] - } - } - }, - "required": [ - "type", - "template" - ] - }, - { - "type": "object", - "title": "InputMessagesItemReference", - "properties": { - "type": { - "type": "string", - "enum": [ - "item_reference" - ], - "description": "The type of input messages. Always `item_reference`." - }, - "item_reference": { - "type": "string", - "description": "A reference to a variable in the `item` namespace. Ie, \"item.name\"" - } - }, - "required": [ - "type", - "item_reference" - ] - } - ] - }, - "sampling_params": { - "type": "object", - "properties": { - "reasoning_effort": { - "$ref": "#/components/schemas/ReasoningEffort" - }, - "temperature": { - "type": "number", - "description": "A higher temperature increases randomness in the outputs.", - "default": 1 - }, - "max_completion_tokens": { - "type": "integer", - "description": "The maximum number of tokens in the generated output." - }, - "top_p": { - "type": "number", - "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.", - "default": 1 - }, - "seed": { - "type": "integer", - "description": "A seed value to initialize the randomness, during sampling.", - "default": 42 - }, - "tools": { - "type": "array", - "description": "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nThe two categories of tools you can provide the model are:\n\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](https://developers.openai.com/api/docs/guides/tools-web-search)\n or [file search](https://developers.openai.com/api/docs/guides/tools-file-search). Learn more about\n [built-in tools](https://developers.openai.com/api/docs/guides/tools).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code. Learn more about\n [function calling](https://developers.openai.com/api/docs/guides/function-calling).\n", - "items": { - "$ref": "#/components/schemas/Tool" - } - }, - "text": { - "type": "object", - "description": "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text)\n- [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs)\n", - "properties": { - "format": { - "$ref": "#/components/schemas/TextResponseFormatConfiguration" - } - } + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "agent_session_failed": { + "post": { + "description": "Sent when an agent session fails.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionFailed" } } - }, - "model": { - "type": "string", - "description": "The name of the model to use for generating completions (e.g. \"o3-mini\")." - }, - "source": { - "description": "Determines what populates the `item` namespace in this run's data source.", - "oneOf": [ - { - "$ref": "#/components/schemas/EvalJsonlFileContentSource" - }, - { - "$ref": "#/components/schemas/EvalJsonlFileIdSource" - }, - { - "$ref": "#/components/schemas/EvalResponsesSource" - } - ] } }, - "required": [ - "type", - "source" - ], - "x-oaiMeta": { - "name": "The completions data source object used to configure an individual run", - "group": "eval runs", - "example": "{\n \"name\": \"gpt-6-astra\",\n \"data_source\": {\n \"type\": \"responses\",\n \"input_messages\": {\n \"type\": \"item_reference\",\n \"item_reference\": \"item.input\"\n },\n \"model\": \"gpt-6-astra\",\n \"source\": {\n \"type\": \"responses\",\n \"model\": \"gpt-6-astra\"\n }\n }\n}\n" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } } - }, - "CreateEvalRunRequest": { - "type": "object", - "title": "CreateEvalRunRequest", - "properties": { - "name": { - "type": "string", - "description": "The name of the run." - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "data_source": { - "type": "object", - "description": "Details about the run's data source.", - "oneOf": [ - { - "$ref": "#/components/schemas/CreateEvalJsonlRunDataSource" - }, - { - "$ref": "#/components/schemas/CreateEvalCompletionsRunDataSource" - }, - { - "$ref": "#/components/schemas/CreateEvalResponsesRunDataSource" + } + }, + "agent_session_idle": { + "post": { + "description": "Sent when an agent session becomes idle.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionIdle" } - ] + } } }, - "required": [ - "data_source" - ] - }, - "CreateEvalStoredCompletionsDataSourceConfig": { - "type": "object", - "title": "StoredCompletionsDataSourceConfig", - "description": "Deprecated in favor of LogsDataSourceConfig.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "stored_completions" - ], - "default": "stored_completions", - "description": "The type of data source. Always `stored_completions`.", - "x-stainless-const": true - }, - "metadata": { - "type": "object", - "description": "Metadata filters for the stored completions data source.", - "additionalProperties": true, - "example": "{\n \"use_case\": \"customer_support_agent\"\n}\n" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" } - }, - "required": [ - "type" - ], - "deprecated": true, - "x-oaiMeta": { - "name": "The stored completions data source object for evals", - "group": "evals", - "example": "{\n \"type\": \"stored_completions\",\n \"metadata\": {\n \"use_case\": \"customer_support_agent\"\n }\n}\n" } - }, - "CreateFileRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file": { - "description": "The File object (not file name) to be uploaded.\n", - "type": "string", - "format": "binary" - }, - "purpose": { - "description": "The intended purpose of the uploaded file. One of:\n- `assistants`: Used in the Assistants API\n- `batch`: Used in the Batch API\n- `fine-tune`: Used for fine-tuning\n- `vision`: Images used for vision fine-tuning\n- `user_data`: Flexible file type for any purpose\n- `evals`: Used for eval data sets\n", - "type": "string", - "enum": [ - "assistants", - "batch", - "fine-tune", - "vision", - "user_data", - "evals" - ] - }, - "expires_after": { - "$ref": "#/components/schemas/FileExpirationAfter" + } + }, + "agent_session_in_progress": { + "post": { + "description": "Sent when an agent session enters the in-progress state.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookAgentSessionInProgress" + } + } } }, - "required": [ - "file", - "purpose" - ] - }, - "CreateFineTuningCheckpointPermissionRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "project_ids": { - "type": "array", - "description": "The project identifiers to grant access to.", - "items": { - "type": "string" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "batch_cancelled": { + "post": { + "description": "Sent when a batch has been cancelled.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookBatchCancelled" + } } } }, - "required": [ - "project_ids" - ] - }, - "CreateFineTuningJobRequest": { - "type": "object", - "properties": { - "model": { - "description": "The name of the model to fine-tune. You can select one of the\n[supported models](https://developers.openai.com/api/docs/guides/model-optimization#fine-tuning-methods).\n", - "example": "gpt-4o-mini", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "babbage-002", - "davinci-002", - "gpt-3.5-turbo", - "gpt-4o-mini" - ] + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "batch_completed": { + "post": { + "description": "Sent when a batch has completed processing.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookBatchCompleted" } - ], - "x-oaiTypeLabel": "string" - }, - "training_file": { - "description": "The ID of an uploaded file that contains training data.\n\nSee [upload file](https://developers.openai.com/api/reference/resources/files/methods/create) for how to upload a file.\n\nYour dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`.\n\nThe contents of the file should differ depending on if the model uses the [chat](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data), [completions](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) format, or if the fine-tuning method uses the [preference](https://developers.openai.com/api/docs/guides/direct-preference-optimization) format.\n\nSee the [fine-tuning guide](https://developers.openai.com/api/docs/guides/model-optimization) for more details.\n", - "type": "string", - "example": "file-abc123" - }, - "hyperparameters": { - "type": "object", - "description": "The hyperparameters used for the fine-tuning job.\nThis value is now deprecated in favor of `method`, and should be passed in under the `method` parameter.\n", - "properties": { - "batch_size": { - "description": "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "integer", - "minimum": 1, - "maximum": 256 - } - ], - "default": "auto" - }, - "learning_rate_multiplier": { - "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - } - ], - "default": "auto" - }, - "n_epochs": { - "description": "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "integer", - "minimum": 1, - "maximum": 50 - } - ], - "default": "auto" + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "batch_expired": { + "post": { + "description": "Sent when a batch has expired before completion.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookBatchExpired" } - }, - "deprecated": true - }, - "suffix": { - "description": "A string of up to 64 characters that will be added to your fine-tuned model name.\n\nFor example, a `suffix` of \"custom-model-name\" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.\n", - "type": "string", - "minLength": 1, - "maxLength": 64, - "default": null, - "nullable": true - }, - "validation_file": { - "description": "The ID of an uploaded file that contains validation data.\n\nIf you provide this file, the data is used to generate validation\nmetrics periodically during fine-tuning. These metrics can be viewed in\nthe fine-tuning results file.\nThe same data should not be present in both train and validation files.\n\nYour dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`.\n\nSee the [fine-tuning guide](https://developers.openai.com/api/docs/guides/model-optimization) for more details.\n", - "type": "string", - "nullable": true, - "example": "file-abc123" - }, - "integrations": { - "type": "array", - "description": "A list of integrations to enable for your fine-tuning job.", - "nullable": true, - "items": { - "type": "object", - "required": [ - "type", - "wandb" - ], - "properties": { - "type": { - "description": "The type of integration to enable. Currently, only \"wandb\" (Weights and Biases) is supported.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "wandb" - ], - "x-stainless-const": true - } - ] - }, - "wandb": { - "type": "object", - "description": "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n", - "required": [ - "project" - ], - "properties": { - "project": { - "description": "The name of the project that the new run will be created under.\n", - "type": "string", - "example": "my-wandb-project" - }, - "name": { - "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n", - "nullable": true, - "type": "string" - }, - "entity": { - "description": "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n", - "nullable": true, - "type": "string" - }, - "tags": { - "description": "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n", - "type": "array", - "items": { - "type": "string", - "example": "custom-tag" - } - } - } - } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "batch_failed": { + "post": { + "description": "Sent when a batch has failed.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookBatchFailed" } } - }, - "seed": { - "description": "The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases.\nIf a seed is not specified, one will be generated for you.\n", - "type": "integer", - "nullable": true, - "minimum": 0, - "maximum": 2147483647, - "example": 42 - }, - "method": { - "$ref": "#/components/schemas/FineTuneMethod" - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" } }, - "required": [ - "model", - "training_file" - ] - }, - "CreateGroupBody": { - "type": "object", - "description": "Request payload for creating a new group in the organization.", - "properties": { - "name": { - "type": "string", - "description": "Human readable name for the group.", - "minLength": 1, - "maxLength": 255 + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "eval_run_canceled": { + "post": { + "description": "Sent when an eval run has been canceled.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEvalRunCanceled" + } + } } }, - "required": [ - "name" - ], - "x-oaiMeta": { - "example": "{\n \"name\": \"Support Team\"\n}\n" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } } - }, - "CreateGroupUserBody": { - "type": "object", - "description": "Request payload for adding a user to a group.", - "properties": { - "user_id": { - "type": "string", - "description": "Identifier of the user to add to the group." + } + }, + "eval_run_failed": { + "post": { + "description": "Sent when an eval run has failed.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEvalRunFailed" + } + } } }, - "required": [ - "user_id" - ], - "x-oaiMeta": { - "example": "{\n \"user_id\": \"user_abc123\"\n}\n" + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } } - }, - "CreateImageEditRequest": { - "type": "object", - "properties": { - "image": { - "anyOf": [ - { - "type": "string", - "format": "binary" - }, - { - "type": "array", - "maxItems": 16, - "items": { - "type": "string", - "format": "binary" - } + } + }, + "eval_run_succeeded": { + "post": { + "description": "Sent when an eval run has succeeded.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookEvalRunSucceeded" } - ], - "description": "The image(s) to edit. Must be a supported image file or an array of images.\n\nFor the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,\n`gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and\n`gpt-image-2.5-flare-2026-09-08`), each image should be a `png`, `webp`, or `jpg`\nfile less than 50MB. You can provide up to 16 images. `chatgpt-image-latest`\nfollows the same input constraints as GPT image models.\n\nFor `dall-e-2`, you can only provide one image, and it should be a square `png`\nfile less than 4MB.\n" - }, - "prompt": { - "description": "A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models.", - "type": "string", - "example": "A cute baby sea otter wearing a beret" - }, - "mask": { - "description": "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.", - "type": "string", - "format": "binary" - }, - "background": { - "type": "string", - "enum": [ - "transparent", - "opaque", - "auto" - ], - "default": "auto", - "example": "transparent", - "nullable": true, - "description": "Set the background of the generated image(s). This parameter is only supported for\nthe GPT image models. Must be one of `transparent`, `opaque`, or `auto` (default\nvalue). When `auto` is used, the model will automatically determine the best\nbackground for the image.\n\n`gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`\nsnapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds\nare available for supported GPT Image models. For `gpt-image-2` and\n`gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,\nset the output format to `png` or `webp`.\n" - }, - "model": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-image-1.5", - "gpt-image-2", - "gpt-image-2-2026-04-21", - "gpt-image-2.5-sunburst", - "gpt-image-2.5-sunburst-2026-09-08", - "gpt-image-2.5-flare", - "gpt-image-2.5-flare-2026-09-08", - "dall-e-2", - "gpt-image-1", - "gpt-image-1-mini", - "chatgpt-image-latest" - ], - "x-stainless-const": true + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "fine_tuning_job_cancelled": { + "post": { + "description": "Sent when a fine-tuning job has been cancelled.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookFineTuningJobCancelled" } - ], - "x-oaiTypeLabel": "string", - "default": "gpt-image-1.5", - "example": "gpt-image-1.5", - "nullable": true, - "description": "The model to use for image generation. One of `dall-e-2` or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to `gpt-image-1.5`." - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 10, - "default": 1, - "example": 1, - "nullable": true, - "description": "The number of images to generate. Must be between 1 and 10." - }, - "size": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "256x256", - "512x512", - "1024x1024", - "1536x1024", - "1024x1536", - "auto" - ] + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "fine_tuning_job_failed": { + "post": { + "description": "Sent when a fine-tuning job has failed.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookFineTuningJobFailed" } - ], - "default": "1024x1024", - "example": "1024x1024", - "nullable": true, - "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`." - }, - "response_format": { - "type": "string", - "enum": [ - "url", - "b64_json" - ], - "example": "url", - "nullable": true, - "description": "The format in which the generated images 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 is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images." - }, - "output_format": { - "type": "string", - "enum": [ - "png", - "jpeg", - "webp" - ], - "default": "png", - "example": "png", - "nullable": true, - "description": "The format in which the generated images are returned. This parameter is\nonly supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.\nThe default value is `png`.\n" - }, - "output_compression": { - "type": "integer", - "default": 100, - "example": 100, - "nullable": true, - "description": "The compression level (0-100%) for the generated images. This parameter\nis only supported for the GPT image models with the `webp` or `jpeg` output\nformats, and defaults to 100.\n" - }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" - }, - "input_fidelity": { - "anyOf": [ - { - "$ref": "#/components/schemas/InputFidelity" - }, - { - "type": "null" + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "fine_tuning_job_succeeded": { + "post": { + "description": "Sent when a fine-tuning job has succeeded.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookFineTuningJobSucceeded" } - ] - }, - "stream": { - "type": "boolean", - "default": false, - "example": false, - "nullable": true, - "description": "Edit the image in streaming mode. Defaults to `false`. See the\n[Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information.\n" - }, - "partial_images": { - "$ref": "#/components/schemas/PartialImages" - }, - "quality": { - "type": "string", - "enum": [ - "standard", - "low", - "medium", - "high", - "xhigh", - "max", - "auto" - ], - "default": "auto", - "example": "high", - "nullable": true, - "description": "The quality of the image that will be generated for GPT image models. The GPT image models support `low`, `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`.\n" + } } }, - "required": [ - "prompt", - "image" - ] - }, - "CreateImageRequest": { - "type": "object", - "properties": { - "prompt": { - "description": "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`.", - "type": "string", - "example": "A cute baby sea otter" - }, - "model": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-image-1.5", - "gpt-image-2", - "gpt-image-2-2026-04-21", - "gpt-image-2.5-sunburst", - "gpt-image-2.5-sunburst-2026-09-08", - "gpt-image-2.5-flare", - "gpt-image-2.5-flare-2026-09-08", - "dall-e-2", - "dall-e-3", - "gpt-image-1", - "gpt-image-1-mini" - ] + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "live_call_incoming": { + "post": { + "deprecated": true, + "description": "Deprecated: use `live.transport.incoming`. Retained only for existing subscriptions.\nSent when an incoming API SIP session is available for Live acceptance.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookLiveCallIncoming" } - ], - "x-oaiTypeLabel": "string", - "default": "dall-e-2", - "example": "gpt-image-1.5", - "nullable": true, - "description": "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`, `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used." - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 10, - "default": 1, - "example": 1, - "nullable": true, - "description": "The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported." - }, - "quality": { - "type": "string", - "enum": [ - "standard", - "hd", - "low", - "medium", - "high", - "xhigh", - "max", - "auto" - ], - "default": "auto", - "example": "medium", - "nullable": true, - "description": "The quality of the image that will be generated.\n\n- `auto` (default value) will automatically select the best quality for the given\n model.\n- `high`, `medium` and `low` are supported for the GPT image models.\n- `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`\n snapshots, also support `xhigh` and `max`.\n- `hd` and `standard` are supported for `dall-e-3`.\n- `standard` is the only option for `dall-e-2`.\n" - }, - "response_format": { - "type": "string", - "enum": [ - "url", - "b64_json" - ], - "default": "url", - "example": "url", - "nullable": true, - "description": "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." - }, - "output_format": { - "type": "string", - "enum": [ - "png", - "jpeg", - "webp" - ], - "default": "png", - "example": "png", - "nullable": true, - "description": "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`." - }, - "output_compression": { - "type": "integer", - "default": 100, - "example": 100, - "nullable": true, - "description": "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." - }, - "stream": { - "type": "boolean", - "default": false, - "example": false, - "nullable": true, - "description": "Generate the image in streaming mode. Defaults to `false`. See the\n[Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information.\nThis parameter is only supported for the GPT image models.\n" - }, - "partial_images": { - "$ref": "#/components/schemas/PartialImages" - }, - "size": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "auto", - "1024x1024", - "1536x1024", - "1024x1536", - "256x256", - "512x512", - "1792x1024", - "1024x1792" - ] + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "live_transport_incoming": { + "post": { + "description": "Sent when an incoming API SIP session is available for Live acceptance.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookLiveTransportIncoming" } - ], - "default": "auto", - "example": "1024x1024", - "nullable": true, - "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`." - }, - "moderation": { - "type": "string", - "enum": [ - "low", - "auto" - ], - "default": "auto", - "example": "low", - "nullable": true, - "description": "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)." - }, - "background": { - "type": "string", - "enum": [ - "transparent", - "opaque", - "auto" - ], - "default": "auto", - "example": "transparent", - "nullable": true, - "description": "Set the background of the generated image(s). This parameter is only supported for\nthe GPT image models. Must be one of `transparent`, `opaque`, or `auto` (default\nvalue). When `auto` is used, the model will automatically determine the best\nbackground for the image.\n\n`gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`\nsnapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds\nare available for supported GPT Image models. For `gpt-image-2` and\n`gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,\nset the output format to `png` or `webp`.\n" - }, - "style": { - "type": "string", - "enum": [ - "vivid", - "natural" - ], - "default": "vivid", - "example": "vivid", - "nullable": true, - "description": "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." - }, - "user": { + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "realtime_call_incoming": { + "post": { + "description": "Sent when an incoming API SIP session is available for Realtime acceptance.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookRealtimeCallIncoming" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200\nstatus codes will be retried.\n" + } + } + } + }, + "response_cancelled": { + "post": { + "description": "Sent when a background response has been cancelled.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookResponseCancelled" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "response_completed": { + "post": { + "description": "Sent when a background response has completed successfully.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookResponseCompleted" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried. \n" + } + } + } + }, + "response_failed": { + "post": { + "description": "Sent when a background response has failed.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookResponseFailed" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "response_incomplete": { + "post": { + "description": "Sent when a background response is incomplete.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookResponseIncomplete" + } + } + } + }, + "responses": { + "200": { + "description": "Return a 200 status code to acknowledge receipt of the event. Non-200 \nstatus codes will be retried.\n" + } + } + } + }, + "safety_alert_created": { + "post": { + "description": "Sent when an approved safety alert is available for an API project.\nRetrieve the alert with a project API key granted `api.safety.alerts.read`.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSafetyAlertCreated" + } + } + } + }, + "responses": { + "200": { + "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + } + } + } + }, + "safety_deactivation_issued": { + "post": { + "description": "Sent when a deactivation is issued for a safety identifier in your organization.\nRetrieve the case details with `GET /v1/safety/cases/{id}` using `data.id`.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSafetyDeactivationIssued" + } + } + } + }, + "responses": { + "200": { + "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + } + } + } + }, + "safety_org_alert_created": { + "post": { + "description": "Sent when an approved safety alert is available for an enterprise workspace.\nRetrieve the alert from `https://api.chatgpt.com/v1/safety/alerts/{id}` with\nan administrator API key for the workspace's backing organization granted\n`chatgpt.enterprise.safety_alerts.read`.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSafetyOrgAlertCreated" + } + } + } + }, + "responses": { + "200": { + "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + } + } + } + }, + "safety_warning_issued": { + "post": { + "description": "Sent when a warning is issued for a safety identifier in your organization.\nRetrieve the case details with `GET /v1/safety/cases/{id}` using `data.id`.\n", + "requestBody": { + "description": "The event payload sent by the API.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSafetyWarningIssued" + } + } + } + }, + "responses": { + "200": { + "description": "Return any 2xx status code to acknowledge receipt. A 410 Gone response also stops retries; other non-2xx responses are retried." + } + } + } + } + }, + "components": { + "schemas": { + "AddUploadPartRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "data": { + "description": "The chunk of bytes for this Part.\n", "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" + "format": "binary" } }, "required": [ - "prompt" + "data" ] }, - "CreateImageVariationRequest": { + "AdminApiKey": { "type": "object", + "description": "Represents an individual Admin API key in an org.", "properties": { - "image": { - "description": "The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.", + "object": { "type": "string", - "format": "binary" + "enum": [ + "organization.admin_api_key" + ], + "description": "The object type, which is always `organization.admin_api_key`", + "x-stainless-const": true }, - "model": { + "id": { + "type": "string", + "example": "key_abc", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { "anyOf": [ { "type": "string" }, { - "type": "string", - "enum": [ - "dall-e-2" - ], - "x-stainless-const": true + "type": "null" } ], - "x-oaiTypeLabel": "string", - "default": "dall-e-2", - "example": "dall-e-2", - "nullable": true, - "description": "The model to use for image generation. Only `dall-e-2` is supported at this time." - }, - "n": { - "type": "integer", - "minimum": 1, - "maximum": 10, - "default": 1, - "example": 1, - "nullable": true, - "description": "The number of images to generate. Must be between 1 and 10." - }, - "response_format": { - "type": "string", - "enum": [ - "url", - "b64_json" - ], - "default": "url", - "example": "url", - "nullable": true, - "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated." + "example": "Administration Key", + "description": "The name of the API key" }, - "size": { + "redacted_value": { "type": "string", - "enum": [ - "256x256", - "512x512", - "1024x1024" - ], - "default": "1024x1024", - "example": "1024x1024", - "nullable": true, - "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`." + "example": "sk-admin...def", + "description": "The redacted value of the API key" }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" - } - }, - "required": [ - "image" - ] - }, - "CreateMessageRequest": { - "type": "object", - "additionalProperties": false, - "required": [ - "role", - "content" - ], - "properties": { - "role": { - "type": "string", - "enum": [ - "user", - "assistant" - ], - "description": "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n" + "created_at": { + "type": "integer", + "format": "unixtime", + "example": 1711471533, + "description": "The Unix timestamp (in seconds) of when the API key was created" }, - "content": { - "oneOf": [ + "expires_at": { + "anyOf": [ { - "type": "string", - "description": "The text contents of the message.", - "title": "Text content" + "type": "integer", + "format": "unixtime", + "example": 1714063533, + "description": "The Unix timestamp (in seconds) of when the API key expires" }, { - "type": "array", - "description": "An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](https://developers.openai.com/api/docs/models).", - "title": "Array of content parts", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageContentImageFileObject" - }, - { - "$ref": "#/components/schemas/MessageContentImageUrlObject" - }, - { - "$ref": "#/components/schemas/MessageRequestContentTextObject" - } - ] - }, - "minItems": 1 + "type": "null" } ] }, - "attachments": { + "last_used_at": { "anyOf": [ { - "type": "array", - "items": { - "type": "object", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file to attach to the message." - }, - "tools": { - "description": "The tools to add this file to.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearchTypeOnly" - } - ] - } - } - } - }, - "description": "A list of files attached to the message, and the tools they should be added to.", - "required": [ - "file_id", - "tools" - ] + "type": "integer", + "format": "unixtime", + "example": 1711471534, + "description": "The Unix timestamp (in seconds) of when the API key was last used" }, { "type": "null" } ] }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "owner": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "user", + "description": "Always `user`" + }, + "object": { + "type": "string", + "example": "organization.user", + "description": "The object type, which is always organization.user" + }, + "id": { + "type": "string", + "example": "sa_456", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "type": "string", + "example": "My Service Account", + "description": "The name of the user" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "example": 1711471533, + "description": "The Unix timestamp (in seconds) of when the user was created" + }, + "role": { + "type": "string", + "example": "owner", + "description": "Always `owner`" + } + } } + }, + "required": [ + "object", + "redacted_value", + "created_at", + "expires_at", + "id", + "owner" + ], + "x-oaiMeta": { + "name": "The admin API key object", + "example": "{\n \"object\": \"organization.admin_api_key\",\n \"id\": \"key_abc\",\n \"name\": \"Main Admin Key\",\n \"redacted_value\": \"sk-admin...xyz\",\n \"created_at\": 1711471533,\n \"expires_at\": null,\n \"last_used_at\": 1711471534,\n \"owner\": {\n \"type\": \"user\",\n \"object\": \"organization.user\",\n \"id\": \"user_123\",\n \"name\": \"John Doe\",\n \"created_at\": 1711471533,\n \"role\": \"owner\"\n }\n}\n" } }, - "CreateModelResponseProperties": { + "AdminApiKeyCreateResponse": { "allOf": [ { - "$ref": "#/components/schemas/ModelResponseProperties" + "$ref": "#/components/schemas/AdminApiKey" }, { "type": "object", + "description": "The newly created admin API key. The `value` field is only returned once, when the key is created.", "properties": { - "prompt_cache_options": { - "$ref": "#/components/schemas/PromptCacheOptionsParam" - }, - "top_logprobs": { - "description": "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n", - "type": "integer", - "minimum": 0, - "maximum": 20 + "value": { + "type": "string", + "example": "sk-admin-1234abcd", + "description": "The value of the API key. Only shown on create." } - } + }, + "required": [ + "value" + ] } ] }, - "CreateModerationRequest": { + "ApiKeyList": { "type": "object", "properties": { - "input": { - "description": "Input (or inputs) to classify. Can be a single string, an array of strings, or\nan array of multi-modal input objects similar to other models.\n", - "oneOf": [ - { - "type": "string", - "description": "A string of text to classify for moderation.", - "default": "", - "example": "I want to kill them." - }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "example": "list", + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AdminApiKey" + } + }, + "has_more": { + "type": "boolean", + "example": false + }, + "first_id": { + "anyOf": [ { - "type": "array", - "description": "An array of strings to classify for moderation.", - "items": { - "type": "string", - "default": "", - "example": "I want to kill them." - } + "type": "string" }, { - "type": "array", - "description": "An array of multi-modal inputs to the moderation model.", - "items": { - "oneOf": [ - { - "type": "object", - "description": "An object describing an image to classify.", - "properties": { - "type": { - "description": "Always `image_url`.", - "type": "string", - "enum": [ - "image_url" - ], - "x-stainless-const": true - }, - "image_url": { - "type": "object", - "description": "Contains either an image URL or a data URL for a base64 encoded image.", - "properties": { - "url": { - "type": "string", - "description": "Either a URL of the image or the base64 encoded image data.", - "format": "uri", - "example": "https://example.com/image.jpg" - } - }, - "required": [ - "url" - ] - } - }, - "required": [ - "type", - "image_url" - ] - }, - { - "type": "object", - "description": "An object describing text to classify.", - "properties": { - "type": { - "description": "Always `text`.", - "type": "string", - "enum": [ - "text" - ], - "x-stainless-const": true - }, - "text": { - "description": "A string of text to classify.", - "type": "string", - "example": "I want to kill them" - } - }, - "required": [ - "type", - "text" - ] - } - ] - } + "type": "null" } - ] + ], + "example": "key_abc" }, - "model": { - "description": "The content moderation model you would like to use. Learn more in\n[the moderation guide](https://developers.openai.com/api/docs/guides/moderation), and learn about\navailable models [here](https://developers.openai.com/api/docs/guides/moderation).\n", - "nullable": false, - "default": "omni-moderation-latest", - "example": "omni-moderation-2024-09-26", + "last_id": { "anyOf": [ { "type": "string" }, { - "type": "string", - "enum": [ - "omni-moderation-latest", - "omni-moderation-2024-09-26", - "text-moderation-latest", - "text-moderation-stable" - ] + "type": "null" } ], - "x-oaiTypeLabel": "string" + "example": "key_xyz" } }, "required": [ - "input" + "object", + "data", + "has_more" ] }, - "CreateModerationResponse": { + "AssignedRoleDetails": { "type": "object", - "description": "Represents if a given text input is potentially harmful.", + "description": "Detailed information about a role assignment entry returned when listing assignments.", "properties": { "id": { "type": "string", - "description": "The unique identifier for the moderation request." + "description": "Identifier for the role." }, - "model": { + "name": { "type": "string", - "description": "The model used to generate the moderation results." + "description": "Name of the role." }, - "results": { + "permissions": { "type": "array", - "description": "A list of moderation objects.", + "description": "Permissions associated with the role.", "items": { - "type": "object", - "properties": { - "flagged": { - "type": "boolean", - "description": "Whether any of the below categories are flagged." - }, - "categories": { + "type": "string" + } + }, + "resource_type": { + "type": "string", + "description": "Resource type the role applies to." + }, + "predefined_role": { + "type": "boolean", + "description": "Whether the role is predefined by OpenAI." + }, + "description": { + "description": "Description of the role.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "created_at": { + "description": "When the role was created.", + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ] + }, + "updated_at": { + "description": "When the role was last updated.", + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ] + }, + "created_by": { + "description": "Identifier of the actor who created the role.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "created_by_user_obj": { + "description": "User details for the actor that created the role, when available.", + "anyOf": [ + { + "type": "object", + "additionalProperties": true + }, + { + "type": "null" + } + ] + }, + "metadata": { + "description": "Arbitrary metadata stored on the role.", + "anyOf": [ + { + "type": "object", + "additionalProperties": true + }, + { + "type": "null" + } + ] + }, + "assignment_sources": { + "description": "Principals from which the role assignment is inherited, when available.", + "anyOf": [ + { + "type": "array", + "items": { "type": "object", - "description": "A list of the categories, and whether they are flagged or not.", "properties": { - "hate": { - "type": "boolean", - "description": "Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment." - }, - "hate/threatening": { - "type": "boolean", - "description": "Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste." - }, - "harassment": { - "type": "boolean", - "description": "Content that expresses, incites, or promotes harassing language towards any target." - }, - "harassment/threatening": { - "type": "boolean", - "description": "Harassment content that also includes violence or serious harm towards any target." - }, - "illicit": { - "anyOf": [ - { - "type": "boolean", - "description": "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, \"how to shoplift\" would fit this category." - }, - { - "type": "null" - } - ] - }, - "illicit/violent": { - "anyOf": [ - { - "type": "boolean", - "description": "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon." - }, - { - "type": "null" - } - ] - }, - "self-harm": { - "type": "boolean", - "description": "Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders." - }, - "self-harm/intent": { - "type": "boolean", - "description": "Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders." - }, - "self-harm/instructions": { - "type": "boolean", - "description": "Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts." - }, - "sexual": { - "type": "boolean", - "description": "Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness)." - }, - "sexual/minors": { - "type": "boolean", - "description": "Sexual content that includes an individual who is under 18 years old." - }, - "violence": { - "type": "boolean", - "description": "Content that depicts death, violence, or physical injury." + "principal_id": { + "type": "string" }, - "violence/graphic": { - "type": "boolean", - "description": "Content that depicts death, violence, or physical injury in graphic detail." + "principal_type": { + "type": "string" } }, "required": [ - "hate", - "hate/threatening", - "harassment", - "harassment/threatening", - "illicit", - "illicit/violent", - "self-harm", - "self-harm/intent", - "self-harm/instructions", - "sexual", - "sexual/minors", - "violence", - "violence/graphic" + "principal_id", + "principal_type" ] + } + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "name", + "permissions", + "resource_type", + "predefined_role", + "description", + "created_at", + "updated_at", + "created_by", + "created_by_user_obj", + "metadata", + "assignment_sources" + ] + }, + "AssistantObject": { + "type": "object", + "title": "Assistant", + "description": "Represents an `assistant` that can call the model and use tools.", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `assistant`.", + "type": "string", + "enum": [ + "assistant" + ], + "x-stainless-const": true + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the assistant was created.", + "type": "integer", + "format": "unixtime" + }, + "name": { + "anyOf": [ + { + "description": "The name of the assistant. The maximum length is 256 characters.\n", + "type": "string", + "maxLength": 256 + }, + { + "type": "null" + } + ] + }, + "description": { + "anyOf": [ + { + "description": "The description of the assistant. The maximum length is 512 characters.\n", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, + "model": { + "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", + "type": "string" + }, + "instructions": { + "anyOf": [ + { + "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", + "type": "string", + "maxLength": 256000 + }, + { + "type": "null" + } + ] + }, + "tools": { + "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", + "default": [], + "type": "array", + "maxItems": 128, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" }, - "category_scores": { - "type": "object", - "description": "A list of the categories along with their scores as predicted by model.", - "properties": { - "hate": { - "type": "number", - "description": "The score for the category 'hate'." - }, - "hate/threatening": { - "type": "number", - "description": "The score for the category 'hate/threatening'." - }, - "harassment": { - "type": "number", - "description": "The score for the category 'harassment'." - }, - "harassment/threatening": { - "type": "number", - "description": "The score for the category 'harassment/threatening'." - }, - "illicit": { - "type": "number", - "description": "The score for the category 'illicit'." - }, - "illicit/violent": { - "type": "number", - "description": "The score for the category 'illicit/violent'." - }, - "self-harm": { - "type": "number", - "description": "The score for the category 'self-harm'." - }, - "self-harm/intent": { - "type": "number", - "description": "The score for the category 'self-harm/intent'." - }, - "self-harm/instructions": { - "type": "number", - "description": "The score for the category 'self-harm/instructions'." - }, - "sexual": { - "type": "number", - "description": "The score for the category 'sexual'." - }, - "sexual/minors": { - "type": "number", - "description": "The score for the category 'sexual/minors'." - }, - "violence": { - "type": "number", - "description": "The score for the category 'violence'." - }, - "violence/graphic": { - "type": "number", - "description": "The score for the category 'violence/graphic'." - } - }, - "required": [ - "hate", - "hate/threatening", - "harassment", - "harassment/threatening", - "illicit", - "illicit/violent", - "self-harm", - "self-harm/intent", - "self-harm/instructions", - "sexual", - "sexual/minors", - "violence", - "violence/graphic" - ] + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" }, - "category_applied_input_types": { - "type": "object", - "description": "A list of the categories along with the input type(s) that the score applies to.", - "properties": { - "hate": { - "type": "array", - "description": "The applied input type(s) for the category 'hate'.", - "items": { - "type": "string", - "enum": [ - "text" - ], - "x-stainless-const": true - } - }, - "hate/threatening": { - "type": "array", - "description": "The applied input type(s) for the category 'hate/threatening'.", - "items": { - "type": "string", - "enum": [ - "text" - ], - "x-stainless-const": true - } - }, - "harassment": { - "type": "array", - "description": "The applied input type(s) for the category 'harassment'.", - "items": { - "type": "string", - "enum": [ - "text" - ], - "x-stainless-const": true - } - }, - "harassment/threatening": { - "type": "array", - "description": "The applied input type(s) for the category 'harassment/threatening'.", - "items": { - "type": "string", - "enum": [ - "text" - ], - "x-stainless-const": true - } - }, - "illicit": { - "type": "array", - "description": "The applied input type(s) for the category 'illicit'.", - "items": { - "type": "string", - "enum": [ - "text" - ], - "x-stainless-const": true - } - }, - "illicit/violent": { - "type": "array", - "description": "The applied input type(s) for the category 'illicit/violent'.", - "items": { - "type": "string", - "enum": [ - "text" - ], - "x-stainless-const": true - } - }, - "self-harm": { - "type": "array", - "description": "The applied input type(s) for the category 'self-harm'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "self-harm/intent": { - "type": "array", - "description": "The applied input type(s) for the category 'self-harm/intent'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "self-harm/instructions": { - "type": "array", - "description": "The applied input type(s) for the category 'self-harm/instructions'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "sexual": { - "type": "array", - "description": "The applied input type(s) for the category 'sexual'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "sexual/minors": { - "type": "array", - "description": "The applied input type(s) for the category 'sexual/minors'.", - "items": { - "type": "string", - "enum": [ - "text" - ], - "x-stainless-const": true - } - }, - "violence": { - "type": "array", - "description": "The applied input type(s) for the category 'violence'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - }, - "violence/graphic": { - "type": "array", - "description": "The applied input type(s) for the category 'violence/graphic'.", - "items": { - "type": "string", - "enum": [ - "text", - "image" - ] - } - } - }, - "required": [ - "hate", - "hate/threatening", - "harassment", - "harassment/threatening", - "illicit", - "illicit/violent", - "self-harm", - "self-harm/intent", - "self-harm/instructions", - "sexual", - "sexual/minors", - "violence", - "violence/graphic" - ] + { + "$ref": "#/components/schemas/AssistantToolsFunction" } - }, - "required": [ - "flagged", - "categories", - "category_scores", - "category_applied_input_types" ] } - } - }, - "required": [ - "id", - "model", - "results" - ], - "x-oaiMeta": { - "name": "The moderation object", - "example": "{\n \"id\": \"modr-0d9740456c391e43c445bf0f010940c7\",\n \"model\": \"omni-moderation-latest\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"harassment\": true,\n \"harassment/threatening\": true,\n \"sexual\": false,\n \"hate\": false,\n \"hate/threatening\": false,\n \"illicit\": false,\n \"illicit/violent\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"violence\": true,\n \"violence/graphic\": true\n },\n \"category_scores\": {\n \"harassment\": 0.8189693396524255,\n \"harassment/threatening\": 0.804985420696006,\n \"sexual\": 1.573112165348997e-6,\n \"hate\": 0.007562942636942845,\n \"hate/threatening\": 0.004208854591835476,\n \"illicit\": 0.030535955153511665,\n \"illicit/violent\": 0.008925306722380033,\n \"self-harm/intent\": 0.00023023930975076432,\n \"self-harm/instructions\": 0.0002293869201073356,\n \"self-harm\": 0.012598046106750154,\n \"sexual/minors\": 2.212566909570261e-8,\n \"violence\": 0.9999992735124786,\n \"violence/graphic\": 0.843064871157054\n },\n \"category_applied_input_types\": {\n \"harassment\": [\n \"text\"\n ],\n \"harassment/threatening\": [\n \"text\"\n ],\n \"sexual\": [\n \"text\",\n \"image\"\n ],\n \"hate\": [\n \"text\"\n ],\n \"hate/threatening\": [\n \"text\"\n ],\n \"illicit\": [\n \"text\"\n ],\n \"illicit/violent\": [\n \"text\"\n ],\n \"self-harm/intent\": [\n \"text\",\n \"image\"\n ],\n \"self-harm/instructions\": [\n \"text\",\n \"image\"\n ],\n \"self-harm\": [\n \"text\",\n \"image\"\n ],\n \"sexual/minors\": [\n \"text\"\n ],\n \"violence\": [\n \"text\",\n \"image\"\n ],\n \"violence/graphic\": [\n \"text\",\n \"image\"\n ]\n }\n }\n ]\n}\n" - } - }, - "CreateResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/CreateModelResponseProperties" }, - { - "$ref": "#/components/schemas/ResponseProperties" - }, - { - "type": "object", - "properties": { - "prompt_cache_options": { - "$ref": "#/components/schemas/ResponsePromptCacheOptionsParam" - }, - "service_tier": { - "$ref": "#/components/schemas/ServiceTierResponses" - }, - "truncation": { - "deprecated": true, - "anyOf": [ - { - "type": "string", - "description": "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n", - "enum": [ - "auto", - "disabled" - ], - "default": "disabled" - }, - { - "type": "null" - } - ] - }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/Reasoning" - }, - { - "type": "null" - } - ] - }, - "input": { - "$ref": "#/components/schemas/InputParam" - }, - "include": { - "anyOf": [ - { - "type": "array", - "description": "Specify additional output data to include in the model response. Currently supported values are:\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program).", - "items": { - "$ref": "#/components/schemas/IncludeEnum" + "tool_resources": { + "anyOf": [ + { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } } }, - { - "type": "null" - } - ] - }, - "parallel_tool_calls": { - "anyOf": [ - { - "type": "boolean", - "description": "Whether to allow the model to run tool calls in parallel.\n", - "default": true - }, - { - "type": "null" - } - ] - }, - "store": { - "anyOf": [ - { - "type": "boolean", - "description": "Whether to store the generated model response for later retrieval via\nAPI.\nDefaults to true when omitted.\nIf set to true, response data will be stored for at least 30 days, subject to the [data retention exceptions](https://developers.openai.com/api/docs/guides/your-data#v1responses).\n", - "default": true - }, - { - "type": "null" - } - ] - }, - "instructions": { - "anyOf": [ - { - "type": "string", - "description": "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" - }, - { - "type": "null" - } - ] - }, - "moderation": { - "anyOf": [ - { - "$ref": "#/components/schemas/ModerationParam", - "description": "Configuration for running moderation on the input and output of this response.\n" - }, - { - "type": "null" - } - ] - }, - "stream": { - "anyOf": [ - { - "description": "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](https://developers.openai.com/api/reference/resources/responses/streaming-events)\nfor more information.\n", - "type": "boolean", - "default": false - }, - { - "type": "null" - } - ] - }, - "stream_options": { - "$ref": "#/components/schemas/ResponseStreamOptions" - }, - "conversation": { - "anyOf": [ - { - "$ref": "#/components/schemas/ConversationParam" - }, - { - "type": "null" - } - ] - }, - "context_management": { - "anyOf": [ - { - "type": "array", - "description": "Context management configuration for this request.\n", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/ContextManagementParam" + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } } - }, - { - "type": "null" - } - ] - }, - "max_output_tokens": { - "anyOf": [ - { - "description": "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning).\n", - "type": "integer", - "minimum": 16 - }, - { - "type": "null" } - ] - } - } - } - ] - }, - "CreateRunRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "assistant_id": { - "description": "The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run.", - "type": "string" - }, - "model": { - "description": "The ID of the [Model](https://developers.openai.com/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.", - "example": "gpt-5", - "anyOf": [ - { - "type": "string" + } }, { - "$ref": "#/components/schemas/AssistantSupportedModels" + "type": "null" } - ], - "x-oaiTypeLabel": "string", - "nullable": true - }, - "reasoning_effort": { - "$ref": "#/components/schemas/ReasoningEffort" - }, - "instructions": { - "description": "Overrides the [instructions](https://developers.openai.com/api/docs/assistants/migration) of the assistant. This is useful for modifying the behavior on a per-run basis.", - "type": "string", - "nullable": true - }, - "additional_instructions": { - "description": "Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.", - "type": "string", - "nullable": true - }, - "additional_messages": { - "description": "Adds additional messages to the thread before creating the run.", - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateMessageRequest" - }, - "nullable": true - }, - "tools": { - "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", - "nullable": true, - "type": "array", - "maxItems": 20, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ] - } + ] }, "metadata": { "$ref": "#/components/schemas/Metadata" }, "temperature": { - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true, - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n" - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" - }, - "stream": { - "type": "boolean", - "nullable": true, - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" - }, - "max_prompt_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", - "minimum": 256 - }, - "max_completion_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", - "minimum": 256 - }, - "truncation_strategy": { - "allOf": [ + "anyOf": [ { - "$ref": "#/components/schemas/TruncationObject" + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1 }, { - "nullable": true + "type": "null" } ] }, - "tool_choice": { - "allOf": [ + "top_p": { + "anyOf": [ { - "$ref": "#/components/schemas/AssistantsApiToolChoiceOption" + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" }, { - "nullable": true + "type": "null" } ] }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true - } - }, - "required": [ - "assistant_id" - ] - }, - "CreateSpeechRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "model": { - "description": "One of the available [TTS models](https://developers.openai.com/api/docs/guides/text-to-speech): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.\n", "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption" }, { - "type": "string", - "enum": [ - "tts-1", - "tts-1-hd", - "gpt-4o-mini-tts", - "gpt-4o-mini-tts-2025-12-15" - ] + "type": "null" } - ], - "x-oaiTypeLabel": "string" + ] + } + }, + "required": [ + "id", + "object", + "created_at", + "name", + "description", + "model", + "instructions", + "tools", + "metadata" + ], + "x-oaiMeta": { + "name": "The assistant object", + "example": "{\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698984975,\n \"name\": \"Math Tutor\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a personal math tutor. When asked a question, write and run Python code to answer the question.\",\n \"tools\": [\n {\n \"type\": \"code_interpreter\"\n }\n ],\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n}\n" + }, + "deprecated": true + }, + "AssistantStreamEvent": { + "description": "Represents an event emitted when streaming a Run.\n\nEach event in a server-sent events stream has an `event` and `data` property:\n\n```\nevent: thread.created\ndata: {\"id\": \"thread_123\", \"object\": \"thread\", ...}\n```\n\nWe emit events whenever a new object is created, transitions to a new state, or is being\nstreamed in parts (deltas). For example, we emit `thread.run.created` when a new run\nis created, `thread.run.completed` when a run completes, and so on. When an Assistant chooses\nto create a message during a run, we emit a `thread.message.created event`, a\n`thread.message.in_progress` event, many `thread.message.delta` events, and finally a\n`thread.message.completed` event.\n\nWe may add additional events over time, so we recommend handling unknown events gracefully\nin your code. See the [Assistants API quickstart](https://developers.openai.com/api/docs/assistants/migration) to learn how to\nintegrate the Assistants API with streaming.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ThreadStreamEvent" }, - "input": { - "type": "string", - "description": "The text to generate audio for. The maximum length is 4096 characters.", - "maxLength": 4096 + { + "$ref": "#/components/schemas/RunStreamEvent" }, - "instructions": { - "type": "string", - "description": "Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.", - "maxLength": 4096 + { + "$ref": "#/components/schemas/RunStepStreamEvent" }, - "voice": { - "description": "The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ \"id\": \"voice_1234\" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).", - "$ref": "#/components/schemas/VoiceIdsOrCustomVoice" + { + "$ref": "#/components/schemas/MessageStreamEvent" }, - "response_format": { - "description": "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.", - "default": "mp3", - "type": "string", - "enum": [ - "mp3", - "opus", - "aac", - "flac", - "wav", - "pcm" - ] + { + "$ref": "#/components/schemas/ErrorEvent" }, - "speed": { - "description": "The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.", - "type": "number", - "default": 1, - "minimum": 0.25, - "maximum": 4 + { + "$ref": "#/components/schemas/DoneEvent" + } + ], + "x-oaiMeta": { + "name": "Assistant stream events", + "beta": true + } + }, + "AssistantSupportedModels": { + "type": "string", + "enum": [ + "gpt-5", + "gpt-5-mini", + "gpt-5-nano", + "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", + "gpt-5-nano-2025-08-07", + "gpt-4.1", + "gpt-4.1-mini", + "gpt-4.1-nano", + "gpt-4.1-2025-04-14", + "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", + "o3-mini", + "o3-mini-2025-01-31", + "o1", + "o1-2024-12-17", + "gpt-4o", + "gpt-4o-2024-11-20", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4.5-preview", + "gpt-4.5-preview-2025-02-27", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613" + ], + "x-openai-enum-deprecations": { + "gpt-5": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." }, - "stream_format": { - "description": "The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`.", + "gpt-5-mini": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-nano": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-mini-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-nano-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-mini": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } + }, + "AssistantToolsCode": { + "type": "object", + "title": "Code interpreter tool", + "properties": { + "type": { "type": "string", - "default": "audio", + "description": "The type of tool being defined: `code_interpreter`", "enum": [ - "sse", - "audio" - ] + "code_interpreter" + ], + "x-stainless-const": true } }, "required": [ - "model", - "input", - "voice" + "type" ] }, - "CreateSpeechResponseStreamEvent": { - "anyOf": [ - { - "$ref": "#/components/schemas/SpeechAudioDeltaEvent" + "AssistantToolsFileSearch": { + "type": "object", + "title": "FileSearch tool", + "properties": { + "type": { + "type": "string", + "description": "The type of tool being defined: `file_search`", + "enum": [ + "file_search" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/SpeechAudioDoneEvent" + "file_search": { + "type": "object", + "description": "Overrides for the file search tool.", + "properties": { + "max_num_results": { + "type": "integer", + "minimum": 1, + "maximum": 50, + "description": "The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.\n\nNote that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://developers.openai.com/api/docs/guides/tools-file-search#retrieval-customization) for more information.\n" + }, + "ranking_options": { + "$ref": "#/components/schemas/FileSearchRankingOptions" + } + } } - ], - "discriminator": { - "propertyName": "type" - } + }, + "required": [ + "type" + ] }, - "CreateSpendAlertBody": { + "AssistantToolsFileSearchTypeOnly": { "type": "object", - "description": "Parameters for creating or updating a spend alert.", + "title": "FileSearch tool", "properties": { - "threshold_amount": { - "type": "integer", - "minimum": 0, - "description": "The alert threshold amount, in cents." + "type": { + "type": "string", + "description": "The type of tool being defined: `file_search`", + "enum": [ + "file_search" + ], + "x-stainless-const": true + } + }, + "required": [ + "type" + ] + }, + "AssistantToolsFunction": { + "type": "object", + "title": "Function tool", + "properties": { + "type": { + "type": "string", + "description": "The type of tool being defined: `function`", + "enum": [ + "function" + ], + "x-stainless-const": true }, - "currency": { + "function": { + "$ref": "#/components/schemas/FunctionObject" + } + }, + "required": [ + "type", + "function" + ] + }, + "AssistantsApiResponseFormatOption": { + "description": "Specifies the format that the model must output. Compatible with [GPT-4o](https://developers.openai.com/api/docs/models/gpt-4o), [GPT-4 Turbo](https://developers.openai.com/api/docs/models/gpt-4-turbo), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](https://developers.openai.com/api/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.\n\n**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.\n", + "oneOf": [ + { "type": "string", + "description": "`auto` is the default value\n", "enum": [ - "USD" + "auto" ], - "description": "The currency for the threshold amount." + "x-stainless-const": true }, - "interval": { + { + "$ref": "#/components/schemas/ResponseFormatText" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonObject" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonSchema" + } + ] + }, + "AssistantsApiToolChoiceOption": { + "description": "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tools and instead generates a message.\n`auto` is the default value and means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools before responding to the user.\nSpecifying a particular tool like `{\"type\": \"file_search\"}` or `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n", + "oneOf": [ + { + "type": "string", + "description": "`none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.\n", + "enum": [ + "none", + "auto", + "required" + ] + }, + { + "$ref": "#/components/schemas/AssistantsNamedToolChoice" + } + ] + }, + "AssistantsNamedToolChoice": { + "type": "object", + "description": "Specifies a tool the model should use. Use to force the model to call a specific tool.", + "properties": { + "type": { "type": "string", "enum": [ - "month" + "function", + "code_interpreter", + "file_search" ], - "description": "The time interval for evaluating spend against the threshold." + "description": "The type of the tool. If type is `function`, the function name must be set" }, - "notification_channel": { - "$ref": "#/components/schemas/SpendAlertNotificationChannel" + "function": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": [ + "name" + ] } }, "required": [ - "threshold_amount", - "currency", - "interval", - "notification_channel" + "type" ] }, - "CreateThreadAndRunRequest": { + "AudioResponseFormat": { + "description": "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and `diarized_json`, with `diarized_json` required to receive speaker annotations.\n", + "type": "string", + "enum": [ + "json", + "text", + "srt", + "verbose_json", + "vtt", + "diarized_json" + ], + "default": "json" + }, + "AudioTranscription": { "type": "object", - "additionalProperties": false, "properties": { - "assistant_id": { - "description": "The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run.", - "type": "string" - }, - "thread": { - "$ref": "#/components/schemas/CreateThreadRequest" - }, "model": { - "description": "The ID of the [Model](https://developers.openai.com/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.", - "example": "gpt-5", + "description": "The model to use for transcription. Current options are `whisper-1`, `gpt-transcribe`, `gpt-live-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.\n", "anyOf": [ { "type": "string" @@ -33100,2280 +37402,2130 @@ { "type": "string", "enum": [ - "gpt-5", - "gpt-5-mini", - "gpt-5-nano", - "gpt-5-2025-08-07", - "gpt-5-mini-2025-08-07", - "gpt-5-nano-2025-08-07", - "gpt-4.1", - "gpt-4.1-mini", - "gpt-4.1-nano", - "gpt-4.1-2025-04-14", - "gpt-4.1-mini-2025-04-14", - "gpt-4.1-nano-2025-04-14", - "gpt-4o", - "gpt-4o-2024-11-20", - "gpt-4o-2024-08-06", - "gpt-4o-2024-05-13", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4.5-preview", - "gpt-4.5-preview-2025-02-27", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-1106-preview", - "gpt-4-vision-preview", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-3.5-turbo", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k-0613" - ] + "whisper-1", + "gpt-transcribe", + "gpt-live-transcribe", + "gpt-4o-mini-transcribe", + "gpt-4o-mini-transcribe-2025-12-15", + "gpt-4o-transcribe", + "gpt-4o-transcribe-diarize", + "gpt-realtime-whisper" + ], + "x-openai-enum-deprecations": { + "gpt-4o-mini-transcribe-2025-12-15": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "whisper-1": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-transcribe": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-transcribe": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-transcribe-diarize": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } } - ], - "x-oaiTypeLabel": "string", - "nullable": true + ] }, - "instructions": { - "description": "Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.", + "language": { "type": "string", - "nullable": true + "description": "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n" }, - "tools": { - "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", - "nullable": true, + "languages": { "type": "array", - "maxItems": 20, + "description": "Possible languages of the input audio, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. Supported by `gpt-transcribe` and `gpt-live-transcribe`.\n", + "minItems": 1, "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ] + "type": "string" } }, - "tool_resources": { - "type": "object", - "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } + "keywords": { + "type": "array", + "description": "Words or phrases to guide transcription of the input audio. Supported by `gpt-transcribe` and `gpt-live-transcribe`.\n", + "items": { + "type": "string" + } + }, + "prompt": { + "type": "string", + "description": "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](https://developers.openai.com/api/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example \"expect words related to technology\".\nPrompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.\n" + }, + "delay": { + "type": "string", + "description": "Controls how long the model waits before emitting transcription text.\nHigher values can improve transcription accuracy at the cost of latency.\nOnly supported with `gpt-realtime-whisper` in GA Realtime sessions.\n", + "enum": [ + "minimal", + "low", + "medium", + "high", + "xhigh" + ] + } + } + }, + "AudioTranscriptionResponse": { + "type": "object", + "properties": { + "model": { + "description": "The model used for transcription. Current options are `whisper-1`, `gpt-transcribe`, `gpt-live-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.\n", + "anyOf": [ + { + "type": "string" }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "string" - } + { + "type": "string", + "enum": [ + "whisper-1", + "gpt-transcribe", + "gpt-live-transcribe", + "gpt-4o-mini-transcribe", + "gpt-4o-mini-transcribe-2025-12-15", + "gpt-4o-transcribe", + "gpt-4o-transcribe-diarize", + "gpt-realtime-whisper" + ], + "x-openai-enum-deprecations": { + "gpt-4o-mini-transcribe-2025-12-15": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "whisper-1": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-transcribe": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-transcribe": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-transcribe-diarize": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." } } } - }, - "nullable": true - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "temperature": { - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "nullable": true, - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n" - }, - "top_p": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "nullable": true, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" - }, - "stream": { - "type": "boolean", - "nullable": true, - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" - }, - "max_prompt_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", - "minimum": 256 - }, - "max_completion_tokens": { - "type": "integer", - "nullable": true, - "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", - "minimum": 256 - }, - "truncation_strategy": { - "allOf": [ - { - "$ref": "#/components/schemas/TruncationObject" - }, - { - "nullable": true - } - ] - }, - "tool_choice": { - "allOf": [ - { - "$ref": "#/components/schemas/AssistantsApiToolChoiceOption" - }, - { - "nullable": true - } - ] - }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, - "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true - } - }, - "required": [ - "assistant_id" - ] - }, - "CreateThreadRequest": { - "type": "object", - "description": "Options to create a new thread. If no thread is provided when running a\nrequest, an empty thread will be created.\n", - "additionalProperties": false, - "properties": { - "messages": { - "description": "A list of [messages](https://developers.openai.com/api/docs/assistants/migration) to start the thread with.", - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateMessageRequest" - } - }, - "tool_resources": { - "anyOf": [ - { - "type": "object", - "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", - "maxItems": 1, - "items": { - "type": "string" - } - }, - "vector_stores": { - "type": "array", - "description": "A helper to create a [vector store](https://developers.openai.com/api/reference/resources/vector_stores) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n", - "maxItems": 1, - "items": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.\n", - "maxItems": 100000000, - "items": { - "type": "string" - } - }, - "chunking_strategy": { - "type": "object", - "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", - "oneOf": [ - { - "type": "object", - "title": "Auto Chunking Strategy", - "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `auto`.", - "enum": [ - "auto" - ], - "x-stainless-const": true - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "title": "Static Chunking Strategy", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "description": "Always `static`.", - "enum": [ - "static" - ], - "x-stainless-const": true - }, - "static": { - "type": "object", - "additionalProperties": false, - "properties": { - "max_chunk_size_tokens": { - "type": "integer", - "minimum": 100, - "maximum": 4096, - "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." - }, - "chunk_overlap_tokens": { - "type": "integer", - "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" - } - }, - "required": [ - "max_chunk_size_tokens", - "chunk_overlap_tokens" - ] - } - }, - "required": [ - "type", - "static" - ] - } - ] - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - } - } - } - } - }, - "oneOf": [ - { - "required": [ - "vector_store_ids" - ] - }, - { - "required": [ - "vector_stores" - ] - } - ] - } - } - }, - { - "type": "null" - } ] }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - } - } - }, - "CreateTranscriptionRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file": { - "description": "The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\nThe request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type.\n", - "type": "string", - "x-oaiTypeLabel": "file", - "format": "binary" - }, - "model": { - "description": "ID of the model to use. The options are `gpt-transcribe`, `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`.\n", - "example": "gpt-4o-transcribe", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "whisper-1", - "gpt-transcribe", - "gpt-4o-transcribe", - "gpt-4o-mini-transcribe", - "gpt-4o-mini-transcribe-2025-12-15", - "gpt-4o-transcribe-diarize" - ], - "x-stainless-const": true - } - ], - "x-oaiTypeLabel": "string" - }, "language": { - "description": "The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.\n", - "type": "string" + "type": [ + "string", + "null" + ], + "description": "The language of the input audio.\n" }, "languages": { - "description": "Possible languages of the input audio, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. Supported by `gpt-transcribe`.\n", "type": "array", + "description": "The possible input audio languages configured for transcription, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n", "minItems": 1, "items": { "type": "string" } }, "keywords": { - "description": "Words or phrases to guide transcription of the input audio. Supported by `gpt-transcribe`.\n", "type": "array", + "description": "Words or phrases configured to guide transcription of the input audio.\n", "items": { "type": "string" } }, "prompt": { - "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`.\n", - "type": "string" + "type": "string", + "description": "The prompt configured for input audio transcription, when present.\n" + } + } + }, + "AuditLog": { + "type": "object", + "description": "A log of a user action or configuration change within this organization.", + "properties": { + "id": { + "type": "string", + "description": "The ID of this log." }, - "response_format": { - "$ref": "#/components/schemas/AudioResponseFormat" + "type": { + "$ref": "#/components/schemas/AuditLogEventType" }, - "temperature": { - "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", - "type": "number", - "default": 0 + "effective_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of the event." }, - "include": { - "description": "Additional information to include in the transcription response.\n`logprobs` will return the log probabilities of the tokens in the\nresponse to understand the model's confidence in the transcription.\n`logprobs` only works with response_format set to `json` and only with\nthe models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`.\n", - "type": "array", - "items": { - "$ref": "#/components/schemas/TranscriptionInclude" + "project": { + "type": "object", + "description": "The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + }, + "name": { + "type": "string", + "description": "The project title." + } } }, - "timestamp_granularities": { - "description": "The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.\nThis option is not available for `gpt-4o-transcribe-diarize`.\n", - "type": "array", - "items": { - "type": "string", - "enum": [ - "word", - "segment" - ] - }, - "default": [ - "segment" - ] - }, - "stream": { + "actor": { "anyOf": [ { - "description": "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming)\nfor more information.\n\nNote: Streaming is not supported for the `whisper-1` model and will be ignored.\n", - "type": "boolean", - "default": false + "$ref": "#/components/schemas/AuditLogActor" }, { "type": "null" } ] }, - "chunking_strategy": { - "anyOf": [ - { - "description": "Controls how the audio is cut into chunks. When set to `\"auto\"`, the server first normalizes loudness and then uses voice activity detection (VAD) to choose boundaries. `server_vad` object can be provided to tweak VAD detection parameters manually. If unset, the audio is transcribed as a single block. Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30 seconds. ", - "anyOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "default": "auto", - "description": "Automatically set chunking parameters based on the audio. Must be set to `\"auto\"`.\n", - "x-stainless-const": true - }, - { - "$ref": "#/components/schemas/VadConfig" + "api_key.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The tracking ID of the API key." + }, + "data": { + "type": "object", + "description": "The payload used to create the API key.", + "properties": { + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`" } - ], - "x-oaiTypeLabel": "string" + } + } + } + }, + "api_key.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The tracking ID of the API key." }, - { - "type": "null" + "changes_requested": { + "type": "object", + "description": "The payload used to update the API key.", + "properties": { + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`" + } + } } - ] + } }, - "known_speaker_names": { - "description": "Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported.\n", - "type": "array", - "maxItems": 4, - "items": { - "type": "string" + "api_key.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The tracking ID of the API key." + } } }, - "known_speaker_references": { - "description": "Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`.\n", - "type": "array", - "maxItems": 4, - "items": { - "type": "string" + "checkpoint.permission.created": { + "type": "object", + "description": "The project and fine-tuned model checkpoint that the checkpoint permission was created for.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the checkpoint permission." + }, + "data": { + "type": "object", + "description": "The payload used to create the checkpoint permission.", + "properties": { + "project_id": { + "type": "string", + "description": "The ID of the project that the checkpoint permission was created for." + }, + "fine_tuned_model_checkpoint": { + "type": "string", + "description": "The ID of the fine-tuned model checkpoint." + } + } + } } - } - }, - "required": [ - "file", - "model" - ] - }, - "CreateTranscriptionResponseDiarizedJson": { - "type": "object", - "description": "Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.\n", - "properties": { - "task": { - "type": "string", - "description": "The type of task that was run. Always `transcribe`.", - "enum": [ - "transcribe" - ], - "x-stainless-const": true }, - "duration": { - "type": "number", - "format": "double", - "description": "Duration of the input audio in seconds." + "checkpoint.permission.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the checkpoint permission." + } + } }, - "text": { - "type": "string", - "description": "The concatenated transcript text for the entire audio input." + "external_key.registered": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the external key configuration." + }, + "data": { + "type": "object", + "description": "The configuration for the external key." + } + } }, - "segments": { - "type": "array", - "description": "Segments of the transcript annotated with timestamps and speaker labels.", - "items": { - "$ref": "#/components/schemas/TranscriptionDiarizedSegment" + "external_key.removed": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the external key configuration." + } } }, - "usage": { + "external_storage.registered": { "type": "object", - "description": "Token or duration usage statistics for the request.", - "oneOf": [ - { - "$ref": "#/components/schemas/TranscriptTextUsageTokens", - "title": "Token Usage" + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the external storage configuration." }, - { - "$ref": "#/components/schemas/TranscriptTextUsageDuration", - "title": "Duration Usage" + "data": { + "type": "object", + "description": "The configuration for the external storage.", + "properties": { + "provider": { + "$ref": "#/components/schemas/provider", + "description": "The external storage provider configuration." + }, + "geography": { + "type": "string", + "description": "The OpenAI geography derived from the storage region." + } + } } - ], - "discriminator": { - "propertyName": "type" } - } - }, - "required": [ - "task", - "duration", - "text", - "segments" - ], - "x-oaiMeta": { - "name": "The transcription object (Diarized JSON)", - "group": "audio", - "example": "{\n \"task\": \"transcribe\",\n \"duration\": 42.7,\n \"text\": \"Agent: Thanks for calling OpenAI support.\\nCustomer: Hi, I need help with diarization.\",\n \"segments\": [\n {\n \"type\": \"transcript.text.segment\",\n \"id\": \"seg_001\",\n \"start\": 0.0,\n \"end\": 5.2,\n \"text\": \"Thanks for calling OpenAI support.\",\n \"speaker\": \"agent\"\n },\n {\n \"type\": \"transcript.text.segment\",\n \"id\": \"seg_002\",\n \"start\": 5.2,\n \"end\": 12.8,\n \"text\": \"Hi, I need help with diarization.\",\n \"speaker\": \"A\"\n }\n ],\n \"usage\": {\n \"type\": \"duration\",\n \"seconds\": 43\n }\n}\n" - } - }, - "CreateTranscriptionResponseJson": { - "type": "object", - "description": "Represents a transcription response returned by model, based on the provided input.", - "properties": { - "text": { - "type": "string", - "description": "The transcribed text." }, - "languages": { - "type": "array", - "description": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n", - "items": { - "$ref": "#/components/schemas/TranscriptionLanguage" + "external_storage.removed": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the external storage configuration." + } } }, - "logprobs": { - "type": "array", - "optional": true, - "description": "The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array.\n", - "items": { - "type": "object", - "properties": { - "token": { - "type": "string", - "description": "The token in the transcription." - }, - "logprob": { - "type": "number", - "description": "The log probability of the token." - }, - "bytes": { - "type": "array", - "items": { - "type": "number" - }, - "description": "The bytes of the token." + "group.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the group." + }, + "data": { + "type": "object", + "description": "Information about the created group.", + "properties": { + "group_name": { + "type": "string", + "description": "The group name." + } } } } }, - "usage": { + "group.updated": { "type": "object", - "description": "Token usage statistics for the request.", - "oneOf": [ - { - "$ref": "#/components/schemas/TranscriptTextUsageTokens", - "title": "Token Usage" + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the group." }, - { - "$ref": "#/components/schemas/TranscriptTextUsageDuration", - "title": "Duration Usage" + "changes_requested": { + "type": "object", + "description": "The payload used to update the group.", + "properties": { + "group_name": { + "type": "string", + "description": "The updated group name." + } + } } - ] - } - }, - "required": [ - "text" - ], - "x-oaiMeta": { - "name": "The transcription object (JSON)", - "group": "audio", - "example": "{\n \"text\": \"Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.\",\n \"usage\": {\n \"type\": \"tokens\",\n \"input_tokens\": 14,\n \"input_token_details\": {\n \"text_tokens\": 10,\n \"audio_tokens\": 4\n },\n \"output_tokens\": 101,\n \"total_tokens\": 115\n }\n}\n" - } - }, - "CreateTranscriptionResponseStreamEvent": { - "anyOf": [ - { - "$ref": "#/components/schemas/TranscriptTextSegmentEvent" - }, - { - "$ref": "#/components/schemas/TranscriptTextDeltaEvent" + } }, - { - "$ref": "#/components/schemas/TranscriptTextDoneEvent" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "CreateTranscriptionResponseVerboseJson": { - "type": "object", - "description": "Represents a verbose json transcription response returned by model, based on the provided input.", - "properties": { - "language": { - "type": "string", - "description": "The language of the input audio." + "group.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the group." + } + } }, - "duration": { - "type": "number", - "format": "double", - "description": "The duration of the input audio." + "scim.enabled": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the SCIM was enabled for." + } + } }, - "text": { - "type": "string", - "description": "The transcribed text." + "scim.disabled": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the SCIM was disabled for." + } + } }, - "words": { - "type": "array", - "description": "Extracted words and their corresponding timestamps.", - "items": { - "$ref": "#/components/schemas/TranscriptionWord" + "invite.sent": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the invite." + }, + "data": { + "type": "object", + "description": "The payload used to create the invite.", + "properties": { + "email": { + "type": "string", + "description": "The email invited to the organization." + }, + "role": { + "type": "string", + "description": "The role the email was invited to be. Is either `owner` or `member`." + } + } + } } }, - "segments": { - "type": "array", - "description": "Segments of the transcribed text and their corresponding details.", - "items": { - "$ref": "#/components/schemas/TranscriptionSegment" + "invite.accepted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the invite." + } } }, - "usage": { - "$ref": "#/components/schemas/TranscriptTextUsageDuration" - } - }, - "required": [ - "language", - "duration", - "text" - ], - "x-oaiMeta": { - "name": "The transcription object (Verbose JSON)", - "group": "audio", - "example": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 8.470000267028809,\n \"text\": \"The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.\",\n \"segments\": [\n {\n \"id\": 0,\n \"seek\": 0,\n \"start\": 0.0,\n \"end\": 3.319999933242798,\n \"text\": \" The beach was a popular spot on a hot summer day.\",\n \"tokens\": [\n 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530\n ],\n \"temperature\": 0.0,\n \"avg_logprob\": -0.2860786020755768,\n \"compression_ratio\": 1.2363636493682861,\n \"no_speech_prob\": 0.00985979475080967\n },\n ...\n ],\n \"usage\": {\n \"type\": \"duration\",\n \"seconds\": 9\n }\n}\n" - } - }, - "CreateTranslationRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file": { - "description": "The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type.\n", - "type": "string", - "x-oaiTypeLabel": "file", - "format": "binary" + "invite.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the invite." + } + } }, - "model": { - "description": "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n", - "example": "whisper-1", - "anyOf": [ - { - "type": "string" + "ip_allowlist.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the IP allowlist configuration." }, - { + "name": { "type": "string", - "enum": [ - "whisper-1" - ], - "x-stainless-const": true + "description": "The name of the IP allowlist configuration." + }, + "allowed_ips": { + "type": "array", + "description": "The IP addresses or CIDR ranges included in the configuration.", + "items": { + "type": "string" + } } - ], - "x-oaiTypeLabel": "string" - }, - "prompt": { - "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting) should be in English.\n", - "type": "string" - }, - "response_format": { - "description": "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.\n", - "type": "string", - "enum": [ - "json", - "text", - "srt", - "verbose_json", - "vtt" - ], - "default": "json" - }, - "temperature": { - "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", - "type": "number", - "default": 0 - } - }, - "required": [ - "file", - "model" - ] - }, - "CreateTranslationResponseJson": { - "type": "object", - "properties": { - "text": { - "type": "string" - } - }, - "required": [ - "text" - ] - }, - "CreateTranslationResponseVerboseJson": { - "type": "object", - "properties": { - "language": { - "type": "string", - "description": "The language of the output translation (always `english`)." - }, - "duration": { - "type": "number", - "format": "double", - "description": "The duration of the input audio." - }, - "text": { - "type": "string", - "description": "The translated text." - }, - "segments": { - "type": "array", - "description": "Segments of the translated text and their corresponding details.", - "items": { - "$ref": "#/components/schemas/TranscriptionSegment" } - } - }, - "required": [ - "language", - "duration", - "text" - ] - }, - "CreateUploadRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "filename": { - "description": "The name of the file to upload.\n", - "type": "string" - }, - "purpose": { - "description": "The intended purpose of the uploaded file.\n\nSee the [documentation on File\npurposes](https://developers.openai.com/api/reference/resources/files/methods/create#%28resource%29%20files%20%3E%20%28method%29%20create%20%3E%20%28params%29%200%20%3E%20%28param%29%20purpose%20%3E%20%28schema%29).\n", - "type": "string", - "enum": [ - "assistants", - "batch", - "fine-tune", - "vision" - ] - }, - "bytes": { - "description": "The number of bytes in the file you are uploading.\n", - "type": "integer" }, - "mime_type": { - "description": "The MIME type of the file.\n\n\nThis must fall within the supported MIME types for your file purpose. See\nthe supported MIME types for assistants and vision.\n", - "type": "string" + "ip_allowlist.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the IP allowlist configuration." + }, + "allowed_ips": { + "type": "array", + "description": "The updated set of IP addresses or CIDR ranges in the configuration.", + "items": { + "type": "string" + } + } + } }, - "expires_after": { - "$ref": "#/components/schemas/FileExpirationAfter" - } - }, - "required": [ - "filename", - "purpose", - "bytes", - "mime_type" - ] - }, - "CreateVectorStoreFileBatchRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file_ids": { - "description": "A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`.", - "type": "array", - "minItems": 1, - "maxItems": 2000, - "items": { - "type": "string" + "ip_allowlist.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the IP allowlist configuration." + }, + "name": { + "type": "string", + "description": "The name of the IP allowlist configuration." + }, + "allowed_ips": { + "type": "array", + "description": "The IP addresses or CIDR ranges that were in the configuration.", + "items": { + "type": "string" + } + } } }, - "files": { - "description": "A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`.", - "type": "array", - "minItems": 1, - "maxItems": 2000, - "items": { - "$ref": "#/components/schemas/CreateVectorStoreFileRequest" + "ip_allowlist.config.activated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "configs": { + "type": "array", + "description": "The configurations that were activated.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the IP allowlist configuration." + }, + "name": { + "type": "string", + "description": "The name of the IP allowlist configuration." + } + } + } + } } }, - "chunking_strategy": { - "$ref": "#/components/schemas/ChunkingStrategyRequestParam" + "ip_allowlist.config.deactivated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "configs": { + "type": "array", + "description": "The configurations that were deactivated.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the IP allowlist configuration." + }, + "name": { + "type": "string", + "description": "The name of the IP allowlist configuration." + } + } + } + } + } }, - "attributes": { - "$ref": "#/components/schemas/VectorStoreFileAttributes" - } - }, - "anyOf": [ - { - "required": [ - "file_ids" - ] + "login.succeeded": { + "type": "object", + "description": "This event has no additional fields beyond the standard audit log attributes." }, - { - "required": [ - "files" - ] - } - ] - }, - "CreateVectorStoreFileRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file_id": { - "description": "A [File](https://developers.openai.com/api/reference/resources/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](https://developers.openai.com/api/reference/resources/vector_stores/subresources/file_batches/methods/create) to minimize per-vector-store write requests.", - "type": "string" + "login.failed": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "error_code": { + "type": "string", + "description": "The error code of the failure." + }, + "error_message": { + "type": "string", + "description": "The error message of the failure." + } + } }, - "chunking_strategy": { - "$ref": "#/components/schemas/ChunkingStrategyRequestParam" + "logout.succeeded": { + "type": "object", + "description": "This event has no additional fields beyond the standard audit log attributes." }, - "attributes": { - "$ref": "#/components/schemas/VectorStoreFileAttributes" - } - }, - "required": [ - "file_id" - ] - }, - "CreateVectorStoreRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "file_ids": { - "description": "A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files.", - "type": "array", - "maxItems": 500, - "items": { - "type": "string" + "logout.failed": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "error_code": { + "type": "string", + "description": "The error code of the failure." + }, + "error_message": { + "type": "string", + "description": "The error message of the failure." + } } }, - "name": { - "description": "The name of the vector store.", - "type": "string" - }, - "description": { - "description": "A description for the vector store. Can be used to describe the vector store's purpose.", - "type": "string" - }, - "expires_after": { - "$ref": "#/components/schemas/VectorStoreExpirationAfter" - }, - "chunking_strategy": { + "organization.updated": { "type": "object", - "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.", - "oneOf": [ - { - "$ref": "#/components/schemas/AutoChunkingStrategyRequestParam" + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The organization ID." }, - { - "$ref": "#/components/schemas/StaticChunkingStrategyRequestParam" + "changes_requested": { + "type": "object", + "description": "The payload used to update the organization settings.", + "properties": { + "title": { + "type": "string", + "description": "The organization title." + }, + "description": { + "type": "string", + "description": "The organization description." + }, + "name": { + "type": "string", + "description": "The organization name." + }, + "threads_ui_visibility": { + "type": "string", + "description": "Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`." + }, + "usage_dashboard_visibility": { + "type": "string", + "description": "Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`." + }, + "api_call_logging": { + "type": "string", + "description": "How your organization logs data from supported API calls. One of `disabled`, `enabled_per_call`, `enabled_for_all_projects`, or `enabled_for_selected_projects`" + }, + "api_call_logging_project_ids": { + "type": "string", + "description": "The list of project ids if api_call_logging is set to `enabled_for_selected_projects`" + } + } } - ] - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - } - } - }, - "CreateVoiceConsentRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The label to use for this consent recording." - }, - "recording": { - "type": "string", - "format": "binary", - "x-oaiTypeLabel": "file", - "description": "The consent audio recording file. Maximum size is 10 MiB.\n\nSupported MIME types:\n`audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.\n" - }, - "language": { - "type": "string", - "description": "The BCP 47 language tag for the consent phrase (for example, `en-US`)." - } - }, - "required": [ - "name", - "recording", - "language" - ] - }, - "CreateVoiceRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The name of the new voice." - }, - "audio_sample": { - "type": "string", - "format": "binary", - "x-oaiTypeLabel": "file", - "description": "The sample audio recording file. Maximum size is 10 MiB.\n\nSupported MIME types:\n`audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.\n" - }, - "consent": { - "type": "string", - "description": "The consent recording ID (for example, `cons_1234`)." - } - }, - "required": [ - "name", - "audio_sample", - "consent" - ] - }, - "CustomToolCall": { - "type": "object", - "title": "Custom tool call", - "description": "A call to a custom tool created by the model.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "custom_tool_call" - ], - "x-stainless-const": true, - "description": "The type of the custom tool call. Always `custom_tool_call`.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the custom tool call in the OpenAI platform.\n" - }, - "call_id": { - "type": "string", - "description": "An identifier used to map this custom tool call to a tool call output.\n" + } }, - "caller": { - "anyOf": [ - { - "$ref": "#/components/schemas/ToolCallCaller" + "project.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." }, - { - "type": "null" + "data": { + "type": "object", + "description": "The payload used to create the project.", + "properties": { + "name": { + "type": "string", + "description": "The project name." + }, + "title": { + "type": "string", + "description": "The title of the project as seen on the dashboard." + } + } } - ] - }, - "namespace": { - "type": "string", - "description": "The namespace of the custom tool being called.\n" - }, - "name": { - "type": "string", - "description": "The name of the custom tool being called.\n" - }, - "input": { - "type": "string", - "description": "The input for the custom tool call generated by the model.\n" + } }, - "async": { - "type": "boolean", - "description": "Whether the custom tool call runs asynchronously.\n" - } - }, - "required": [ - "type", - "call_id", - "name", - "input" - ] - }, - "CustomToolCallOutput": { - "type": "object", - "title": "Custom tool call output", - "description": "The output of a custom tool call from your code, being sent back to the model.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "custom_tool_call_output" - ], - "x-stainless-const": true, - "description": "The type of the custom tool call output. Always `custom_tool_call_output`.\n" + "project.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to update the project.", + "properties": { + "title": { + "type": "string", + "description": "The title of the project as seen on the dashboard." + } + } + } + } }, - "id": { - "type": "string", - "description": "The unique ID of the custom tool call output in the OpenAI platform.\n" + "project.archived": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + } + } }, - "call_id": { - "type": "string", - "description": "The call ID, used to map this custom tool call output to a custom tool call.\n" + "project.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + } + } }, - "caller": { - "anyOf": [ - { - "$ref": "#/components/schemas/ToolCallCallerParam" + "rate_limit.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The rate limit ID" }, - { - "type": "null" + "changes_requested": { + "type": "object", + "description": "The payload used to update the rate limits.", + "properties": { + "max_requests_per_1_minute": { + "type": "integer", + "description": "The maximum requests per minute." + }, + "max_tokens_per_1_minute": { + "type": "integer", + "description": "The maximum tokens per minute." + }, + "max_images_per_1_minute": { + "type": "integer", + "description": "The maximum images per minute. Only relevant for certain models." + }, + "max_audio_megabytes_per_1_minute": { + "type": "integer", + "description": "The maximum audio megabytes per minute. Only relevant for certain models." + }, + "max_requests_per_1_day": { + "type": "integer", + "description": "The maximum requests per day. Only relevant for certain models." + }, + "batch_1_day_max_input_tokens": { + "type": "integer", + "description": "The maximum batch input tokens per day. Only relevant for certain models." + } + } } - ] + } }, - "output": { - "description": "The output from the custom tool call generated by your code.\nCan be a string or an list of output content.\n", - "oneOf": [ - { + "rate_limit.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { "type": "string", - "description": "A string of the output of the custom tool call.\n", - "title": "string output" + "description": "The rate limit ID" + } + } + }, + "role.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The role ID." }, - { + "role_name": { + "type": "string", + "description": "The name of the role." + }, + "permissions": { "type": "array", "items": { - "$ref": "#/components/schemas/FunctionAndCustomToolCallOutput" + "type": "string" }, - "title": "output content list", - "description": "Text, image, or file output of the custom tool call.\n" + "description": "The permissions granted by the role." + }, + "resource_type": { + "type": "string", + "description": "The type of resource the role belongs to." + }, + "resource_id": { + "type": "string", + "description": "The resource the role is scoped to." } - ] - } - }, - "required": [ - "type", - "call_id", - "output" - ] - }, - "CustomToolCallOutputResource": { - "title": "ResponseCustomToolCallOutputItem", - "allOf": [ - { - "$ref": "#/components/schemas/CustomToolCallOutput" + } }, - { + "role.updated": { "type": "object", + "description": "The details for events with this `type`.", "properties": { "id": { "type": "string", - "description": "The unique ID of the custom tool call output item.\n" - }, - "status": { - "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", - "$ref": "#/components/schemas/FunctionCallOutputStatusEnum" + "description": "The role ID." }, - "created_by": { + "changes_requested": { + "type": "object", + "description": "The payload used to update the role.", + "properties": { + "role_name": { + "type": "string", + "description": "The updated role name, when provided." + }, + "resource_id": { + "type": "string", + "description": "The resource the role is scoped to." + }, + "resource_type": { + "type": "string", + "description": "The type of resource the role belongs to." + }, + "permissions_added": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The permissions added to the role." + }, + "permissions_removed": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The permissions removed from the role." + }, + "description": { + "type": "string", + "description": "The updated role description, when provided." + }, + "metadata": { + "type": "object", + "description": "Additional metadata stored on the role." + } + } + } + } + }, + "role.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { "type": "string", - "description": "The identifier of the actor that created the item.\n" + "description": "The role ID." } - }, - "required": [ - "id", - "status" - ] - } - ] - }, - "CustomToolCallResource": { - "title": "ResponseCustomToolCallItem", - "allOf": [ - { - "$ref": "#/components/schemas/CustomToolCall" + } }, - { + "role.assignment.created": { "type": "object", + "description": "The details for events with this `type`.", "properties": { "id": { "type": "string", - "description": "The unique ID of the custom tool call item.\n" + "description": "The identifier of the role assignment." }, - "status": { - "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", - "$ref": "#/components/schemas/FunctionCallStatus" + "principal_id": { + "type": "string", + "description": "The principal (user or group) that received the role." }, - "created_by": { + "principal_type": { "type": "string", - "description": "The identifier of the actor that created the item.\n" + "description": "The type of principal (user or group) that received the role." + }, + "resource_id": { + "type": "string", + "description": "The resource the role assignment is scoped to." + }, + "resource_type": { + "type": "string", + "description": "The type of resource the role assignment is scoped to." } - }, - "required": [ - "id", - "status" - ] - } - ] - }, - "CustomToolChatCompletions": { - "type": "object", - "title": "Custom tool", - "description": "A custom tool that processes input using a specified format.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "custom" - ], - "description": "The type of the custom tool. Always `custom`.", - "x-stainless-const": true + } }, - "custom": { + "role.assignment.deleted": { "type": "object", - "title": "Custom tool properties", - "description": "Properties of the custom tool.\n", + "description": "The details for events with this `type`.", "properties": { - "name": { + "id": { "type": "string", - "description": "The name of the custom tool, used to identify it in tool calls." + "description": "The identifier of the role assignment." }, - "description": { + "principal_id": { "type": "string", - "description": "Optional description of the custom tool, used to provide more context.\n" + "description": "The principal (user or group) that had the role removed." }, - "format": { - "description": "The input format for the custom tool. Default is unconstrained text.\n", - "oneOf": [ - { - "type": "object", - "title": "Text format", - "description": "Unconstrained free-form text.", - "properties": { - "type": { - "type": "string", - "enum": [ - "text" - ], - "description": "Unconstrained text format. Always `text`.", - "x-stainless-const": true - } + "principal_type": { + "type": "string", + "description": "The type of principal (user or group) that had the role removed." + }, + "resource_id": { + "type": "string", + "description": "The resource the role assignment was scoped to." + }, + "resource_type": { + "type": "string", + "description": "The type of resource the role assignment was scoped to." + } + } + }, + "role.bound_to_resource": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource the role was bound to. ChatGPT workspace connector resources use `__`." + }, + "role_id": { + "type": "string", + "description": "The ID of the role that was bound to the resource." + }, + "resource_id": { + "type": "string", + "description": "The ID of the resource the role was bound to." + }, + "resource_type": { + "type": "string", + "description": "The type of resource the role was bound to." + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The permissions granted to the role for the resource." + }, + "workspace_id": { + "type": "string", + "description": "The workspace ID for a ChatGPT workspace connector resource." + }, + "connector_id": { + "type": "string", + "description": "The connector ID for a ChatGPT workspace connector resource." + }, + "connector_name": { + "type": "string", + "description": "The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved." + }, + "enabled": { + "type": "boolean", + "description": "Whether the connector is enabled for the role." + }, + "source": { + "type": "string", + "description": "The connector role mutation path that produced the event.", + "enum": [ + "role_toggle", + "role_connector_update", + "role_delete", + "workspace_permissions", + "connector_publish" + ] + } + } + }, + "role.unbound_from_resource": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource the role was unbound from. ChatGPT workspace connector resources use `__`." + }, + "role_id": { + "type": "string", + "description": "The ID of the role that was unbound from the resource." + }, + "resource_id": { + "type": "string", + "description": "The ID of the resource the role was unbound from." + }, + "resource_type": { + "type": "string", + "description": "The type of resource the role was unbound from." + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The permissions remaining for the role after the change." + }, + "workspace_id": { + "type": "string", + "description": "The workspace ID for a ChatGPT workspace connector resource." + }, + "connector_id": { + "type": "string", + "description": "The connector ID for a ChatGPT workspace connector resource." + }, + "connector_name": { + "type": "string", + "description": "The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved." + }, + "enabled": { + "type": "boolean", + "description": "Whether the connector is enabled for the role." + }, + "source": { + "type": "string", + "description": "The connector role mutation path that produced the event.", + "enum": [ + "role_toggle", + "role_connector_update", + "role_delete", + "workspace_permissions", + "connector_publish" + ] + } + } + }, + "service_account.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The service account ID." + }, + "data": { + "type": "object", + "description": "The payload used to create the service account.", + "properties": { + "role": { + "type": "string", + "description": "The role of the service account. Is either `owner` or `member`." + } + } + } + } + }, + "service_account.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The service account ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to updated the service account.", + "properties": { + "role": { + "type": "string", + "description": "The role of the service account. Is either `owner` or `member`." + } + } + } + } + }, + "service_account.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The service account ID." + } + } + }, + "workload_identity_provider.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The workload identity provider ID." + }, + "data": { + "type": "object", + "description": "The payload used to create the workload identity provider." + } + } + }, + "workload_identity_provider.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The workload identity provider ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to update the workload identity provider." + } + } + }, + "workload_identity_provider.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The workload identity provider ID." + }, + "name": { + "type": "string", + "description": "The workload identity provider name." + } + } + }, + "workload_identity_provider_mapping.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The workload identity provider mapping ID." + }, + "identity_provider_id": { + "type": "string", + "description": "The workload identity provider ID." + }, + "data": { + "type": "object", + "description": "The payload used to create the workload identity provider mapping." + } + } + }, + "workload_identity_provider_mapping.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The workload identity provider mapping ID." + }, + "identity_provider_id": { + "type": "string", + "description": "The workload identity provider ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to update the workload identity provider mapping." + } + } + }, + "workload_identity_provider_mapping.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The workload identity provider mapping ID." + }, + "identity_provider_id": { + "type": "string", + "description": "The workload identity provider ID." + }, + "project_id": { + "type": "string", + "description": "The project ID." + }, + "service_account_id": { + "type": "string", + "description": "The mapped service account ID." + } + } + }, + "user.added": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The user ID." + }, + "data": { + "type": "object", + "description": "The payload used to add the user to the project.", + "properties": { + "role": { + "type": "string", + "description": "The role of the user. Is either `owner` or `member`." + } + } + } + } + }, + "user.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The project ID." + }, + "changes_requested": { + "type": "object", + "description": "The payload used to update the user.", + "properties": { + "role": { + "type": "string", + "description": "The role of the user. Is either `owner` or `member`." + } + } + } + } + }, + "user.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The user ID." + } + } + }, + "certificate.created": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The certificate ID." + }, + "name": { + "type": "string", + "description": "The name of the certificate." + } + } + }, + "certificate.updated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The certificate ID." + }, + "name": { + "type": "string", + "description": "The name of the certificate." + } + } + }, + "certificate.deleted": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "id": { + "type": "string", + "description": "The certificate ID." + }, + "name": { + "type": "string", + "description": "The name of the certificate." + }, + "certificate": { + "type": "string", + "description": "The certificate content in PEM format." + } + } + }, + "certificates.activated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "certificates": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The certificate ID." }, - "required": [ - "type" - ], - "additionalProperties": false - }, - { - "type": "object", - "title": "Grammar format", - "description": "A grammar defined by the user.", - "properties": { - "type": { - "type": "string", - "enum": [ - "grammar" - ], - "description": "Grammar format. Always `grammar`.", - "x-stainless-const": true - }, - "grammar": { - "type": "object", - "title": "Grammar format", - "description": "Your chosen grammar.", - "properties": { - "definition": { - "type": "string", - "description": "The grammar definition." - }, - "syntax": { - "type": "string", - "description": "The syntax of the grammar definition. One of `lark` or `regex`.", - "enum": [ - "lark", - "regex" - ] - } - }, - "required": [ - "definition", - "syntax" - ] - } + "name": { + "type": "string", + "description": "The name of the certificate." + } + } + } + } + } + }, + "certificates.deactivated": { + "type": "object", + "description": "The details for events with this `type`.", + "properties": { + "certificates": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The certificate ID." }, - "required": [ - "type", - "grammar" - ], - "additionalProperties": false + "name": { + "type": "string", + "description": "The name of the certificate." + } } - ] + } } - }, - "required": [ - "name" - ] + } } }, "required": [ + "id", "type", - "custom" - ] + "effective_at" + ], + "x-oaiMeta": { + "name": "The audit log object", + "example": "{\n \"id\": \"req_xxx_20240101\",\n \"type\": \"api_key.created\",\n \"effective_at\": 1720804090,\n \"actor\": {\n \"type\": \"session\",\n \"session\": {\n \"user\": {\n \"id\": \"user-xxx\",\n \"email\": \"user@example.com\"\n },\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\"\n }\n },\n \"api_key.created\": {\n \"id\": \"key_xxxx\",\n \"data\": {\n \"scopes\": [\"resource.operation\"]\n }\n }\n}\n" + } }, - "DeleteAssistantResponse": { + "AuditLogActor": { "type": "object", + "description": "The actor who performed the audit logged action.", "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { + "type": { "type": "string", + "description": "The type of actor. Is either `session` or `api_key`.", "enum": [ - "assistant.deleted" - ], - "x-stainless-const": true + "session", + "api_key" + ] + }, + "session": { + "$ref": "#/components/schemas/AuditLogActorSession" + }, + "api_key": { + "$ref": "#/components/schemas/AuditLogActorApiKey" } - }, - "required": [ - "id", - "object", - "deleted" - ] + } }, - "DeleteCertificateResponse": { + "AuditLogActorApiKey": { "type": "object", + "description": "The API Key used to perform the audit logged action.", "properties": { - "object": { + "id": { "type": "string", - "description": "The object type, must be `certificate.deleted`.", - "enum": [ - "certificate.deleted" - ], - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The ID of the certificate that was deleted." - } - }, - "required": [ - "object", - "id" - ] - }, - "DeleteFileResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" + "description": "The tracking id of the API key." }, - "object": { + "type": { "type": "string", + "description": "The type of API key. Can be either `user` or `service_account`.", "enum": [ - "file" - ], - "x-stainless-const": true - }, - "deleted": { - "type": "boolean" - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "DeleteFineTuningCheckpointPermissionResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the fine-tuned model checkpoint permission that was deleted." + "user", + "service_account" + ] }, - "object": { - "type": "string", - "description": "The object type, which is always \"checkpoint.permission\".", - "enum": [ - "checkpoint.permission" - ], - "x-stainless-const": true + "user": { + "$ref": "#/components/schemas/AuditLogActorUser" }, - "deleted": { - "type": "boolean", - "description": "Whether the fine-tuned model checkpoint permission was successfully deleted." + "service_account": { + "$ref": "#/components/schemas/AuditLogActorServiceAccount" } - }, - "required": [ - "id", - "object", - "deleted" - ] + } }, - "DeleteMessageResponse": { + "AuditLogActorServiceAccount": { "type": "object", + "description": "The service account that performed the audit logged action.", "properties": { "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { "type": "string", - "enum": [ - "thread.message.deleted" - ], - "x-stainless-const": true + "description": "The service account id." } - }, - "required": [ - "id", - "object", - "deleted" - ] + } }, - "DeleteModelResponse": { + "AuditLogActorSession": { "type": "object", + "description": "The session in which the audit logged action was performed.", "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" + "user": { + "$ref": "#/components/schemas/AuditLogActorUser" }, - "object": { - "type": "string" + "ip_address": { + "type": "string", + "description": "The IP address from which the action was performed." } - }, - "required": [ - "id", - "object", - "deleted" - ] + } }, - "DeleteThreadResponse": { + "AuditLogActorUser": { "type": "object", + "description": "The user who performed the audit logged action.", "properties": { "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" + "type": "string", + "description": "The user id." }, - "object": { + "email": { "type": "string", - "enum": [ - "thread.deleted" - ], - "x-stainless-const": true + "description": "The user email." } - }, - "required": [ - "id", - "object", - "deleted" + } + }, + "AuditLogEventType": { + "type": "string", + "description": "The event type.", + "enum": [ + "api_key.created", + "api_key.updated", + "api_key.deleted", + "certificate.created", + "certificate.updated", + "certificate.deleted", + "certificates.activated", + "certificates.deactivated", + "checkpoint.permission.created", + "checkpoint.permission.deleted", + "external_key.registered", + "external_key.removed", + "external_storage.registered", + "external_storage.removed", + "group.created", + "group.updated", + "group.deleted", + "invite.sent", + "invite.accepted", + "invite.deleted", + "ip_allowlist.created", + "ip_allowlist.updated", + "ip_allowlist.deleted", + "ip_allowlist.config.activated", + "ip_allowlist.config.deactivated", + "login.succeeded", + "login.failed", + "logout.succeeded", + "logout.failed", + "organization.updated", + "project.created", + "project.updated", + "project.archived", + "project.deleted", + "rate_limit.updated", + "rate_limit.deleted", + "resource.deleted", + "tunnel.created", + "tunnel.updated", + "tunnel.deleted", + "workload_identity_provider.created", + "workload_identity_provider.updated", + "workload_identity_provider.deleted", + "workload_identity_provider_mapping.created", + "workload_identity_provider_mapping.updated", + "workload_identity_provider_mapping.deleted", + "role.created", + "role.updated", + "role.deleted", + "role.assignment.created", + "role.assignment.deleted", + "role.bound_to_resource", + "role.unbound_from_resource", + "scim.enabled", + "scim.disabled", + "service_account.created", + "service_account.updated", + "service_account.deleted", + "user.added", + "user.updated", + "user.deleted", + "tenant.metadata.updated", + "tenant.microsoft_entra_mapping.upserted", + "tenant.microsoft_entra_mapping.deleted", + "tenant.workload_identity.provider.created", + "tenant.workload_identity.provider.updated", + "tenant.workload_identity.provider.archived", + "tenant.workload_identity.mapping.created", + "tenant.workload_identity.mapping.updated", + "tenant.workload_identity.mapping.archived", + "tenant.workload_identity.binding.created", + "tenant.workload_identity.principal.provisioned", + "tenant.workload_identity.access_token.issued", + "tenant.admin_api_key.created", + "tenant.admin_api_key.updated", + "tenant.admin_api_key.deleted", + "tenant.project_api_key.created", + "tenant.trusted_access.business_verification.started", + "tenant.trusted_access.application.submitted", + "tenant.chatgpt_access_token.revoked", + "tenant.migration.completed", + "tenant.sso.migrated", + "tenant.domains.migrated", + "tenant.sso_connection.created", + "tenant.sso_connection.updated", + "tenant.sso_connection.deleted", + "tenant.sso_connection.setup.started", + "tenant.policy.created", + "tenant.policy.updated", + "tenant.policy.deleted", + "tenant.policy.attached", + "tenant.policy.detached", + "tenant.principal_authentication_policy.resolved", + "tenant.scim.setup.started", + "tenant.scim.deletion.requested", + "tenant.scim.directory.created", + "tenant.product_access_policy.updated", + "tenant.resource_share_grant.created", + "tenant.resource_share_grant.updated", + "tenant.resource_share_grant.accepted", + "tenant.resource_share_grant.declined", + "tenant.resource_share_grant.revoked", + "tenant.resource_share_grant.deleted", + "tenant.service_account.updated", + "tenant.service_account.deleted", + "tenant.service_account.token.revoked", + "tenant.billing.overage_limit.updated", + "tenant.billing.alerts.updated", + "tenant.billing.info.updated", + "tenant.usage_limit.workspace.updated", + "tenant.usage_limit.group.updated", + "tenant.usage_limit.user.updated", + "tenant.usage_limit.increase_request.updated", + "tenant.usage_limit.increase_request.resolved", + "tenant.group.created", + "tenant.group.updated", + "tenant.group.deleted", + "tenant.group.member.added", + "tenant.group.member.removed", + "tenant.migration_rollout.status.updated", + "tenant.migration_rollout.tier.updated", + "tenant.role.metadata.updated", + "tenant.custom_role.created", + "tenant.custom_role.updated", + "tenant.custom_role.deleted", + "tenant.role_assignment.created", + "tenant.role_assignment.deleted", + "tenant.resource_role_assignment.created", + "tenant.resource_role_assignment.deleted", + "tenant.resource_access.updated", + "tenant.resource_access.deleted", + "tenant.ads_account.onboarding.redemption", + "tenant.session_policy.created", + "tenant.session_policy.updated", + "tenant.session_policy.deleted", + "tenant.session_revocation.started", + "tenant.third_party_app_policy.updated", + "tenant.user.added", + "tenant.user.updated", + "tenant.user.removed", + "tenant.user.looked_up", + "tenant.user.invited", + "tenant.membership.revoked", + "tenant.api_organization_invite.upserted", + "tenant.api_organization_invite.deleted", + "tenant.chatgpt_workspace_invite.upserted", + "tenant.membership.accepted", + "tenant.membership.declined", + "tenant.workspace_invite_email_settings.updated" ] }, - "DeleteVectorStoreFileResponse": { + "AutoChunkingStrategyRequestParam": { "type": "object", + "title": "Auto Chunking Strategy", + "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", + "additionalProperties": false, "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - }, - "object": { + "type": { "type": "string", + "description": "Always `auto`.", "enum": [ - "vector_store.file.deleted" + "auto" ], "x-stainless-const": true } }, "required": [ - "id", - "object", - "deleted" + "type" ] }, - "DeleteVectorStoreResponse": { + "Batch": { "type": "object", "properties": { "id": { "type": "string" }, - "deleted": { - "type": "boolean" - }, "object": { "type": "string", "enum": [ - "vector_store.deleted" + "batch" ], + "description": "The object type, which is always `batch`.", "x-stainless-const": true - } - }, - "required": [ - "id", - "object", - "deleted" - ] - }, - "DeletedConversation": { - "title": "The deleted conversation object", - "allOf": [ - { - "$ref": "#/components/schemas/DeletedConversationResource" - } - ], - "x-oaiMeta": { - "name": "The deleted conversation object", - "group": "conversations" - } - }, - "DeletedRoleAssignmentResource": { - "type": "object", - "description": "Confirmation payload returned after unassigning a role.", - "properties": { - "object": { - "type": "string", - "description": "Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`." }, - "deleted": { - "type": "boolean", - "description": "Whether the assignment was removed." - } - }, - "required": [ - "object", - "deleted" - ], - "x-oaiMeta": { - "name": "Role assignment deletion confirmation", - "example": "{\n \"object\": \"group.role.deleted\",\n \"deleted\": true\n}\n" - } - }, - "DoneEvent": { - "type": "object", - "properties": { - "event": { + "endpoint": { "type": "string", - "enum": [ - "done" - ], - "x-stainless-const": true + "description": "The OpenAI API endpoint used by the batch." }, - "data": { - "type": "string", - "enum": [ - "[DONE]" - ], - "x-stainless-const": true - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a stream ends.", - "x-oaiMeta": { - "dataDescription": "`data` is `[DONE]`" - } - }, - "EasyInputMessage": { - "type": "object", - "title": "Input message", - "description": "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role. Messages with the\n`assistant` role are presumed to have been generated by the model in previous\ninteractions.\n", - "properties": { - "role": { + "model": { "type": "string", - "description": "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n", - "enum": [ - "user", - "assistant", - "system", - "developer" - ] + "description": "Model ID used to process the batch, like `gpt-6-astra`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model\nguide](https://developers.openai.com/api/docs/models) to browse and compare available models.\n" }, - "content": { - "description": "Text, image, or audio input to the model, used to generate a response.\nCan also contain previous assistant responses.\n", - "oneOf": [ - { + "errors": { + "type": [ + "object", + "null" + ], + "properties": { + "object": { "type": "string", - "title": "Text input", - "description": "A text input to the model.\n" + "description": "The object type, which is always `list`." }, - { - "$ref": "#/components/schemas/InputMessageContentList" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BatchError" + } } - ] + } }, - "phase": { - "anyOf": [ - { - "$ref": "#/components/schemas/MessagePhase" - }, - { - "type": "null" - } - ] + "input_file_id": { + "type": "string", + "description": "The ID of the input file for the batch." }, - "type": { + "completion_window": { "type": "string", - "description": "The type of the message input. Always `message`.\n", + "description": "The time frame within which the batch should be processed." + }, + "status": { + "type": "string", + "description": "The current status of the batch.", "enum": [ - "message" - ], - "x-stainless-const": true - } - }, - "required": [ - "role", - "content" - ] - }, - "EditImageBodyJsonParam": { - "type": "object", - "description": "JSON request body for image edits.\n\nUse `images` (array of `ImageRefParam`) instead of multipart `image` uploads.\nYou can reference images via external URLs, data URLs, or uploaded file IDs.\nJSON edits support GPT image models only; DALL-E edits require multipart (`dall-e-2` only).\n", - "properties": { - "model": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-image-1.5", - "gpt-image-2", - "gpt-image-2-2026-04-21", - "gpt-image-2.5-sunburst", - "gpt-image-2.5-sunburst-2026-09-08", - "gpt-image-2.5-flare", - "gpt-image-2.5-flare-2026-09-08", - "gpt-image-1", - "gpt-image-1-mini", - "chatgpt-image-latest" - ] - }, - { - "type": "null" - } + "validating", + "failed", + "in_progress", + "finalizing", + "completed", + "expired", + "cancelling", + "cancelled" + ] + }, + "output_file_id": { + "type": [ + "string", + "null" ], - "x-oaiTypeLabel": "string", - "default": "gpt-image-1.5", - "example": "gpt-image-1.5", - "description": "The GPT image model to use for image editing, including `gpt-image-2`, its dated snapshot `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`." + "description": "The ID of the file containing the outputs of successfully executed requests." }, - "images": { - "type": "array", - "minItems": 1, - "maxItems": 16, - "description": "Input image references to edit.\nFor GPT image models, you can provide up to 16 images.\n", - "items": { - "$ref": "#/components/schemas/ImageRefParam" - } + "error_file_id": { + "type": [ + "string", + "null" + ], + "description": "The ID of the file containing the outputs of requests with errors." }, - "mask": { - "$ref": "#/components/schemas/ImageRefParam" + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch was created." }, - "prompt": { - "type": "string", - "minLength": 1, - "maxLength": 32000, - "example": "Add a watercolor effect and keep the subject centered", - "description": "A text description of the desired image edit." - }, - "n": { - "anyOf": [ - { - "type": "integer", - "minimum": 1, - "maximum": 10 - }, - { - "type": "null" - } + "in_progress_at": { + "type": [ + "integer", + "null" ], - "default": 1, - "example": 1, - "description": "The number of edited images to generate." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch started processing." }, - "quality": { - "anyOf": [ - { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "xhigh", - "max", - "auto" - ] - }, - { - "type": "null" - } + "expires_at": { + "type": [ + "integer", + "null" ], - "default": "auto", - "example": "high", - "description": "Output quality for GPT image models. The GPT image models support `low`, `medium`,\nand `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their\n`2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`.\n" + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch will expire." }, - "input_fidelity": { - "anyOf": [ - { - "type": "string", - "enum": [ - "high", - "low" - ] - }, - { - "type": "null" - } + "finalizing_at": { + "type": [ + "integer", + "null" ], - "description": "Controls fidelity to the original input image(s)." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch started finalizing." }, - "size": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "auto", - "1024x1024", - "1536x1024", - "1024x1536" - ] - }, - { - "type": "null" - } + "completed_at": { + "type": [ + "integer", + "null" ], - "default": "auto", - "example": "1024x1024", - "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch was completed." }, - "user": { - "type": "string", - "example": "user-1234", - "description": "A unique identifier representing your end-user, which can help OpenAI\nmonitor and detect abuse.\n" + "failed_at": { + "type": [ + "integer", + "null" + ], + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch failed." }, - "output_format": { - "anyOf": [ - { - "type": "string", - "enum": [ - "png", - "jpeg", - "webp" - ] - }, - { - "type": "null" - } + "expired_at": { + "type": [ + "integer", + "null" ], - "default": "png", - "example": "png", - "description": "Output image format. Supported for GPT image models." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch expired." }, - "output_compression": { - "anyOf": [ - { - "type": "integer", - "minimum": 0, - "maximum": 100 - }, - { - "type": "null" - } + "cancelling_at": { + "type": [ + "integer", + "null" ], - "example": 100, - "description": "Compression level for `jpeg` or `webp` output." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch started cancelling." }, - "moderation": { - "anyOf": [ - { - "type": "string", - "enum": [ - "low", - "auto" - ] - }, - { - "type": "null" - } + "cancelled_at": { + "type": [ + "integer", + "null" ], - "default": "auto", - "example": "auto", - "description": "Moderation level for GPT image models." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the batch was cancelled." }, - "background": { - "anyOf": [ - { - "type": "string", - "enum": [ - "transparent", - "opaque", - "auto" + "request_counts": { + "$ref": "#/components/schemas/BatchRequestCounts" + }, + "usage": { + "type": "object", + "description": "Represents token usage details including input tokens, output tokens, a\nbreakdown of output tokens, and the total tokens used. Only populated on\nbatches created after September 7, 2025.\n", + "properties": { + "input_tokens": { + "type": "integer", + "description": "The number of input tokens." + }, + "input_tokens_details": { + "type": "object", + "description": "A detailed breakdown of the input tokens.", + "properties": { + "cached_tokens": { + "type": "integer", + "description": "The number of tokens that were retrieved from the cache. [More on\nprompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).\n" + } + }, + "required": [ + "cached_tokens" ] }, - { - "type": "null" - } - ], - "default": "auto", - "example": "transparent", - "description": "Set the background of the generated image output. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds are available for supported GPT Image models. For `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`, set the output format to `png` or `webp`." - }, - "stream": { - "anyOf": [ - { - "type": "boolean" + "output_tokens": { + "type": "integer", + "description": "The number of output tokens." }, - { - "type": "null" + "output_tokens_details": { + "type": "object", + "description": "A detailed breakdown of the output tokens.", + "properties": { + "reasoning_tokens": { + "type": "integer", + "description": "The number of reasoning tokens." + } + }, + "required": [ + "reasoning_tokens" + ] + }, + "total_tokens": { + "type": "integer", + "description": "The total number of tokens used." } - ], - "default": false, - "example": false, - "description": "Stream partial image results as events." - }, - "partial_images": { - "$ref": "#/components/schemas/PartialImages" - } - }, - "required": [ - "images", - "prompt" - ] - }, - "Embedding": { - "type": "object", - "description": "Represents an embedding vector returned by embedding endpoint.\n", - "properties": { - "index": { - "type": "integer", - "description": "The index of the embedding in the list of embeddings." - }, - "embedding": { - "type": "array", - "description": "The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](https://developers.openai.com/api/docs/guides/embeddings).\n", - "items": { - "type": "number", - "format": "float" - } + }, + "required": [ + "input_tokens", + "input_tokens_details", + "output_tokens", + "output_tokens_details", + "total_tokens" + ] }, - "object": { - "type": "string", - "description": "The object type, which is always \"embedding\".", - "enum": [ - "embedding" - ], - "x-stainless-const": true + "metadata": { + "$ref": "#/components/schemas/Metadata" } }, "required": [ - "index", + "id", "object", - "embedding" + "endpoint", + "input_file_id", + "completion_window", + "status", + "created_at" ], "x-oaiMeta": { - "name": "The embedding object", - "example": "{\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n}\n" + "name": "The batch object", + "example": "{\n \"id\": \"batch_abc123\",\n \"object\": \"batch\",\n \"endpoint\": \"/v1/chat/completions\",\n \"model\": \"gpt-6-astra\",\n \"errors\": null,\n \"input_file_id\": \"file-abc123\",\n \"completion_window\": \"24h\",\n \"status\": \"completed\",\n \"output_file_id\": \"file-cvaTdG\",\n \"error_file_id\": \"file-HOWS94\",\n \"created_at\": 1711471533,\n \"in_progress_at\": 1711471538,\n \"expires_at\": 1711557933,\n \"finalizing_at\": 1711493133,\n \"completed_at\": 1711493163,\n \"failed_at\": null,\n \"expired_at\": null,\n \"cancelling_at\": null,\n \"cancelled_at\": null,\n \"request_counts\": {\n \"total\": 100,\n \"completed\": 95,\n \"failed\": 5\n },\n \"usage\": {\n \"input_tokens\": 1500,\n \"input_tokens_details\": {\n \"cached_tokens\": 1024\n },\n \"output_tokens\": 500,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 300\n },\n \"total_tokens\": 2000\n },\n \"metadata\": {\n \"customer_id\": \"user_123456789\",\n \"batch_description\": \"Nightly eval job\"\n }\n}\n" } }, - "Error": { + "BatchError": { "type": "object", "properties": { "code": { + "type": "string", + "description": "An error code identifying the error type." + }, + "message": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "param": { "anyOf": [ { - "type": "string" + "type": "string", + "description": "The name of the parameter that caused the error, if applicable." }, { "type": "null" } ] }, - "message": { - "type": "string" - }, - "param": { + "line": { "anyOf": [ { - "type": "string" + "type": "integer", + "description": "The line number of the input file where the error occurred, if applicable." }, { "type": "null" } ] - }, - "type": { - "type": "string" - }, - "misalignment": { - "$ref": "#/components/schemas/MisalignmentErrorDetailsResource" } - }, - "required": [ - "type", - "message", - "param", - "code" - ] + } }, - "ErrorEvent": { + "BatchFileExpirationAfter": { "type": "object", + "title": "File expiration policy", + "description": "The expiration policy for the output and/or error file that are generated for a batch.", "properties": { - "event": { + "anchor": { + "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`. Note that the anchor is the file creation time, not the time the batch is created.", "type": "string", "enum": [ - "error" + "created_at" ], "x-stainless-const": true }, - "data": { - "$ref": "#/components/schemas/Error" + "seconds": { + "description": "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).", + "type": "integer", + "format": "int64", + "minimum": 3600, + "maximum": 2592000 } }, "required": [ - "event", - "data" - ], - "description": "Occurs when an [error](https://developers.openai.com/api/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout.", - "x-oaiMeta": { - "dataDescription": "`data` is an [error](https://developers.openai.com/api/docs/guides/error-codes#api-errors)" - } + "anchor", + "seconds" + ] }, - "ErrorResponse": { + "BatchRequestCounts": { "type": "object", "properties": { - "error": { - "$ref": "#/components/schemas/Error" + "total": { + "type": "integer", + "description": "Total number of requests in the batch." + }, + "completed": { + "type": "integer", + "description": "Number of requests that have been completed successfully." + }, + "failed": { + "type": "integer", + "description": "Number of requests that have failed." } }, "required": [ - "error" - ] + "total", + "completed", + "failed" + ], + "description": "The request counts for different statuses within the batch." }, - "Eval": { + "Certificate": { "type": "object", - "title": "Eval", - "description": "An Eval object with a data source config and testing criteria.\nAn Eval represents a task to be done for your LLM integration.\nLike:\n - Improve the quality of my chatbot\n - See how well my chatbot handles customer support\n - Check if o4-mini is better at my usecase than gpt-6-astra\n", + "description": "Represents an individual `certificate` uploaded to the organization.", "properties": { "object": { "type": "string", "enum": [ - "eval" + "certificate", + "organization.certificate", + "organization.project.certificate" ], - "default": "eval", - "description": "The object type.", + "description": "The object type.\n\n- If creating, updating, or getting a specific certificate, the object type is `certificate`.\n- If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`.\n- If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`.\n", "x-stainless-const": true }, "id": { "type": "string", - "description": "Unique identifier for the evaluation." + "description": "The identifier, which can be referenced in API endpoints" }, "name": { - "type": "string", - "description": "The name of the evaluation.", - "example": "Chatbot effectiveness Evaluation" - }, - "data_source_config": { - "type": "object", - "description": "Configuration of data sources used in runs of the evaluation.", - "oneOf": [ - { - "$ref": "#/components/schemas/EvalCustomDataSourceConfig" - }, + "anyOf": [ { - "$ref": "#/components/schemas/EvalLogsDataSourceConfig" + "type": "string" }, { - "$ref": "#/components/schemas/EvalStoredCompletionsDataSourceConfig" + "type": "null" } - ] - }, - "testing_criteria": { - "description": "A list of testing criteria.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/EvalGraderLabelModel" - }, - { - "$ref": "#/components/schemas/EvalGraderStringCheck" - }, - { - "$ref": "#/components/schemas/EvalGraderTextSimilarity" - }, - { - "$ref": "#/components/schemas/EvalGraderPython" - }, - { - "$ref": "#/components/schemas/EvalGraderScoreModel" - } - ] - } + ], + "description": "The name of the certificate." }, "created_at": { "type": "integer", "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the eval was created." + "description": "The Unix timestamp (in seconds) of when the certificate was uploaded." }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "certificate_details": { + "type": "object", + "properties": { + "valid_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the certificate becomes valid." + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the certificate expires." + }, + "content": { + "type": "string", + "description": "The content of the certificate in PEM format." + } + } + }, + "active": { + "type": "boolean", + "description": "Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate." } }, "required": [ - "id", - "data_source_config", "object", - "testing_criteria", + "id", "name", "created_at", - "metadata" + "certificate_details" ], "x-oaiMeta": { - "name": "The eval object", - "group": "evals", - "example": "{\n \"object\": \"eval\",\n \"id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"data_source_config\": {\n \"type\": \"custom\",\n \"item_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"label\": {\"type\": \"string\"},\n },\n \"required\": [\"label\"]\n },\n \"include_sample_schema\": true\n },\n \"testing_criteria\": [\n {\n \"name\": \"My string check grader\",\n \"type\": \"string_check\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"operation\": \"eq\",\n }\n ],\n \"name\": \"External Data Eval\",\n \"created_at\": 1739314509,\n \"metadata\": {\n \"test\": \"synthetics\",\n }\n}\n" + "name": "The certificate object", + "example": "{\n \"object\": \"certificate\",\n \"id\": \"cert_abc\",\n \"name\": \"My Certificate\",\n \"created_at\": 1234567,\n \"certificate_details\": {\n \"valid_at\": 1234567,\n \"expires_at\": 12345678,\n \"content\": \"-----BEGIN CERTIFICATE----- MIIGAjCCA...6znFlOW+ -----END CERTIFICATE-----\"\n }\n}\n" } }, - "EvalApiError": { + "ChatCompletionAllowedTools": { "type": "object", - "title": "EvalApiError", - "description": "An object representing an error response from the Eval API.\n", + "title": "Allowed tools", + "description": "Constrains the tools available to the model to a pre-defined set.\n", "properties": { - "code": { + "mode": { "type": "string", - "description": "The error code." + "enum": [ + "auto", + "required" + ], + "description": "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n" }, - "message": { - "type": "string", - "description": "The error message." + "tools": { + "type": "array", + "description": "A list of tool definitions that the model should be allowed to call.\n\nFor the Chat Completions API, the list of tool definitions might look like:\n```json\n[\n { \"type\": \"function\", \"function\": { \"name\": \"get_weather\" } },\n { \"type\": \"function\", \"function\": { \"name\": \"get_time\" } }\n]\n```\n", + "items": { + "type": "object", + "x-oaiExpandable": false, + "description": "A tool definition that the model should be allowed to call.\n", + "additionalProperties": true + } } }, "required": [ - "code", - "message" - ], - "x-oaiMeta": { - "name": "The API error object", - "group": "evals", - "example": "{\n \"code\": \"internal_error\",\n \"message\": \"The eval run failed due to an internal error.\"\n}\n" - } + "mode", + "tools" + ] }, - "EvalCustomDataSourceConfig": { + "ChatCompletionAllowedToolsChoice": { "type": "object", - "title": "CustomDataSourceConfig", - "description": "A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces.\nThe response schema defines the shape of the data that will be:\n- Used to define your testing criteria and\n- What data is required when creating a run\n", + "title": "Allowed tools", + "description": "Constrains the tools available to the model to a pre-defined set.\n", "properties": { "type": { "type": "string", "enum": [ - "custom" + "allowed_tools" ], - "default": "custom", - "description": "The type of data source. Always `custom`.", + "description": "Allowed tool configuration type. Always `allowed_tools`.", "x-stainless-const": true }, - "schema": { - "type": "object", - "description": "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n", - "additionalProperties": true, - "example": "{\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"label\": {\"type\": \"string\"},\n },\n \"required\": [\"label\"]\n }\n },\n \"required\": [\"item\"]\n}\n" + "allowed_tools": { + "$ref": "#/components/schemas/ChatCompletionAllowedTools" } }, "required": [ "type", - "schema" - ], - "x-oaiMeta": { - "name": "The eval custom data source config object", - "group": "evals", - "example": "{\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"label\": {\"type\": \"string\"},\n },\n \"required\": [\"label\"]\n }\n },\n \"required\": [\"item\"]\n }\n}\n" - } - }, - "EvalGraderLabelModel": { - "type": "object", - "title": "LabelModelGrader", - "allOf": [ - { - "$ref": "#/components/schemas/GraderLabelModel" - } - ] - }, - "EvalGraderPython": { - "type": "object", - "title": "PythonGrader", - "allOf": [ - { - "$ref": "#/components/schemas/GraderPython" - }, - { - "type": "object", - "properties": { - "pass_threshold": { - "type": "number", - "description": "The threshold for the score." - } - }, - "x-oaiMeta": { - "name": "Eval Python Grader", - "group": "graders", - "example": "{\n \"type\": \"python\",\n \"name\": \"Example python grader\",\n \"image_tag\": \"2025-05-08\",\n \"source\": \"\"\"\ndef grade(sample: dict, item: dict) -> float:\n \\\"\"\"\n Returns 1.0 if `output_text` equals `label`, otherwise 0.0.\n \\\"\"\"\n output = sample.get(\"output_text\")\n label = item.get(\"label\")\n return 1.0 if output == label else 0.0\n\"\"\",\n \"pass_threshold\": 0.8\n}\n" - } - } - ] - }, - "EvalGraderScoreModel": { - "type": "object", - "title": "ScoreModelGrader", - "allOf": [ - { - "$ref": "#/components/schemas/GraderScoreModel" - }, - { - "type": "object", - "properties": { - "pass_threshold": { - "type": "number", - "description": "The threshold for the score." - } - } - } - ] - }, - "EvalGraderStringCheck": { - "type": "object", - "title": "StringCheckGrader", - "allOf": [ - { - "$ref": "#/components/schemas/GraderStringCheck" - } - ] - }, - "EvalGraderTextSimilarity": { - "type": "object", - "title": "TextSimilarityGrader", - "allOf": [ - { - "$ref": "#/components/schemas/GraderTextSimilarity" - }, - { - "type": "object", - "properties": { - "pass_threshold": { - "type": "number", - "description": "The threshold for the score." - } - }, - "required": [ - "pass_threshold" - ], - "x-oaiMeta": { - "name": "Text Similarity Grader", - "group": "graders", - "example": "{\n \"type\": \"text_similarity\",\n \"name\": \"Example text similarity grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"pass_threshold\": 0.8,\n \"evaluation_metric\": \"fuzzy_match\"\n}\n" - } - } + "allowed_tools" ] }, - "EvalItem": { + "ChatCompletionDeleted": { "type": "object", - "title": "Eval message object", - "description": "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role. Messages with the\n`assistant` role are presumed to have been generated by the model in previous\ninteractions.\n", "properties": { - "role": { - "type": "string", - "description": "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n", - "enum": [ - "user", - "assistant", - "system", - "developer" - ] - }, - "content": { - "$ref": "#/components/schemas/EvalItemContent" - }, - "type": { + "object": { "type": "string", - "description": "The type of the message input. Always `message`.\n", + "description": "The type of object being deleted.", "enum": [ - "message" + "chat.completion.deleted" ], "x-stainless-const": true - } - }, - "required": [ - "role", - "content" - ] - }, - "EvalItemContent": { - "title": "Eval content", - "description": "Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/EvalItemContentItem" - }, - { - "$ref": "#/components/schemas/EvalItemContentArray" - } - ] - }, - "EvalItemContentArray": { - "type": "array", - "title": "An array of Input text, Output text, Input image, and Input audio", - "description": "A list of inputs, each of which may be either an input text, output text, input\nimage, or input audio object.\n", - "items": { - "$ref": "#/components/schemas/EvalItemContentItem" - } - }, - "EvalItemContentItem": { - "title": "Eval content item", - "description": "A single content item: input text, output text, input image, or input audio.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/EvalItemContentText" - }, - { - "$ref": "#/components/schemas/InputTextContent" - }, - { - "$ref": "#/components/schemas/EvalItemContentOutputText" }, - { - "$ref": "#/components/schemas/EvalItemInputImage" + "id": { + "type": "string", + "description": "The ID of the chat completion that was deleted." }, - { - "$ref": "#/components/schemas/InputAudio" + "deleted": { + "type": "boolean", + "description": "Whether the chat completion was deleted." } + }, + "required": [ + "object", + "id", + "deleted" ] }, - "EvalItemContentOutputText": { + "ChatCompletionFunctionCallOption": { "type": "object", - "title": "Output text", - "description": "A text output from the model.\n", + "description": "Specifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n", "properties": { - "type": { - "type": "string", - "description": "The type of the output text. Always `output_text`.\n", - "enum": [ - "output_text" - ], - "x-stainless-const": true - }, - "text": { + "name": { "type": "string", - "description": "The text output from the model.\n" + "description": "The name of the function to call." } }, "required": [ - "type", - "text" + "name" ] }, - "EvalItemContentText": { - "type": "string", - "title": "Text input", - "description": "A text input to the model.\n" - }, - "EvalItemInputImage": { - "title": "Input image", - "description": "An image input block used within EvalItem content arrays.", + "ChatCompletionFunctions": { "type": "object", + "deprecated": true, "properties": { - "type": { + "description": { "type": "string", - "description": "The type of the image input. Always `input_image`.\n", - "enum": [ - "input_image" - ], - "x-stainless-const": true + "description": "A description of what the function does, used by the model to choose when and how to call the function." }, - "image_url": { + "name": { "type": "string", - "format": "uri", - "description": "The URL of the image input.\n" + "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." }, - "detail": { - "type": "string", - "description": "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n" + "parameters": { + "$ref": "#/components/schemas/FunctionParameters" } }, "required": [ - "type", - "image_url" + "name" ] }, - "EvalJsonlFileContentSource": { + "ChatCompletionList": { "type": "object", - "title": "EvalJsonlFileContentSource", + "title": "ChatCompletionList", + "description": "An object representing a list of Chat Completions.\n", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "file_content" + "list" ], - "default": "file_content", - "description": "The type of jsonl source. Always `file_content`.", + "default": "list", + "description": "The type of this object. It is always set to \"list\".\n", "x-stainless-const": true }, - "content": { + "data": { "type": "array", + "description": "An array of chat completion objects.\n", "items": { - "type": "object", - "properties": { - "item": { - "type": "object", - "additionalProperties": true - }, - "sample": { - "type": "object", - "additionalProperties": true - } - }, - "required": [ - "item" - ] - }, - "description": "The content of the jsonl file." + "$ref": "#/components/schemas/CreateChatCompletionResponse" + } + }, + "first_id": { + "type": [ + "string", + "null" + ], + "description": "The identifier of the first chat completion in the data array." + }, + "last_id": { + "type": [ + "string", + "null" + ], + "description": "The identifier of the last chat completion in the data array." + }, + "has_more": { + "type": "boolean", + "description": "Indicates whether there are more Chat Completions available." } }, "required": [ - "type", - "content" - ] + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "x-oaiMeta": { + "name": "The chat completion list object", + "group": "chat", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"chat.completion\",\n \"id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2\",\n \"model\": \"gpt-6-astra\",\n \"created\": 1738960610,\n \"request_id\": \"req_ded8ab984ec4bf840f37566c1011c417\",\n \"tool_choice\": null,\n \"usage\": {\n \"total_tokens\": 31,\n \"completion_tokens\": 18,\n \"prompt_tokens\": 13\n },\n \"seed\": 4944116822809979520,\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"presence_penalty\": 0.0,\n \"frequency_penalty\": 0.0,\n \"system_fingerprint\": \"fp_50cad350e4\",\n \"input_user\": null,\n \"service_tier\": \"default\",\n \"tools\": null,\n \"metadata\": {},\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"content\": \"Mind of circuits hum, \\nLearning patterns in silence— \\nFuture's quiet spark.\",\n \"role\": \"assistant\",\n \"tool_calls\": null,\n \"function_call\": null\n },\n \"finish_reason\": \"stop\",\n \"logprobs\": null\n }\n ],\n \"response_format\": null\n }\n ],\n \"first_id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2\",\n \"last_id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2\",\n \"has_more\": false\n}\n" + } }, - "EvalJsonlFileIdSource": { + "ChatCompletionMessageCustomToolCall": { "type": "object", - "title": "EvalJsonlFileIdSource", + "title": "Custom tool call", + "description": "A call to a custom tool created by the model.\n", "properties": { + "id": { + "type": "string", + "description": "The ID of the tool call." + }, "type": { "type": "string", "enum": [ - "file_id" + "custom" ], - "default": "file_id", - "description": "The type of jsonl source. Always `file_id`.", + "description": "The type of the tool. Always `custom`.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The identifier of the file." + "custom": { + "type": "object", + "description": "The custom tool that the model called.", + "properties": { + "name": { + "type": "string", + "description": "The name of the custom tool to call." + }, + "input": { + "type": "string", + "description": "The input for the custom tool call generated by the model." + } + }, + "required": [ + "name", + "input" + ] } }, "required": [ + "id", "type", - "id" + "custom" ] }, - "EvalList": { + "ChatCompletionMessageList": { "type": "object", - "title": "EvalList", - "description": "An object representing a list of evals.\n", + "title": "ChatCompletionMessageList", + "description": "An object representing a list of chat completion messages.\n", "properties": { "object": { "type": "string", @@ -35386,22 +39538,199 @@ }, "data": { "type": "array", - "description": "An array of eval objects.\n", + "description": "An array of chat completion message objects.\n", "items": { - "$ref": "#/components/schemas/Eval" + "properties": { + "id": { + "type": "string" + }, + "role": { + "enum": [ + "user", + "assistant", + "tool", + "system", + "function", + "developer" + ], + "type": "string" + }, + "content": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "content_parts": { + "anyOf": [ + { + "items": { + "properties": { + "type": { + "enum": [ + "text", + "image_url", + "input_audio", + "file" + ], + "type": "string" + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "image_url": { + "anyOf": [ + { + "properties": { + "url": { + "type": "string" + }, + "detail": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "url" + ], + "type": "object" + }, + { + "type": "null" + } + ] + }, + "input_audio": { + "anyOf": [ + { + "properties": { + "data": { + "type": "string" + }, + "format": { + "type": "string" + } + }, + "required": [ + "data", + "format" + ], + "type": "object" + }, + { + "type": "null" + } + ] + }, + "file": { + "anyOf": [ + { + "properties": { + "file_data": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "file_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "type": "object" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type" + ], + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "role", + "content", + "content_parts" + ], + "type": "object" } }, "first_id": { - "type": "string", - "description": "The identifier of the first eval in the data array." + "type": [ + "string", + "null" + ], + "description": "The identifier of the first chat message in the data array." }, "last_id": { - "type": "string", - "description": "The identifier of the last eval in the data array." + "type": [ + "string", + "null" + ], + "description": "The identifier of the last chat message in the data array." }, "has_more": { "type": "boolean", - "description": "Indicates whether there are more evals available." + "description": "Indicates whether there are more chat messages available." } }, "required": [ @@ -35412,935 +39741,983 @@ "has_more" ], "x-oaiMeta": { - "name": "The eval list object", - "group": "evals", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"eval\",\n \"id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"data_source_config\": {\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"input\": {\n \"type\": \"string\"\n },\n \"ground_truth\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"input\",\n \"ground_truth\"\n ]\n }\n },\n \"required\": [\n \"item\"\n ]\n }\n },\n \"testing_criteria\": [\n {\n \"name\": \"String check\",\n \"id\": \"String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2\",\n \"type\": \"string_check\",\n \"input\": \"{{item.input}}\",\n \"reference\": \"{{item.ground_truth}}\",\n \"operation\": \"eq\"\n }\n ],\n \"name\": \"External Data Eval\",\n \"created_at\": 1739314509,\n \"metadata\": {},\n }\n ],\n \"first_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"last_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"has_more\": true\n}\n" + "name": "The chat completion message list object", + "group": "chat", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0\",\n \"role\": \"user\",\n \"content\": \"write a haiku about ai\",\n \"name\": null,\n \"content_parts\": null\n }\n ],\n \"first_id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0\",\n \"last_id\": \"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0\",\n \"has_more\": false\n}\n" } }, - "EvalLogsDataSourceConfig": { + "ChatCompletionMessageToolCall": { "type": "object", - "title": "LogsDataSourceConfig", - "description": "A LogsDataSourceConfig which specifies the metadata property of your logs query.\nThis is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc.\nThe schema returned by this data source config is used to defined what variables are available in your evals.\n`item` and `sample` are both defined when using this data source config.\n", + "title": "Function tool call", + "description": "A call to a function tool created by the model.\n", "properties": { + "id": { + "type": "string", + "description": "The ID of the tool call." + }, "type": { "type": "string", "enum": [ - "logs" + "function" ], - "default": "logs", - "description": "The type of data source. Always `logs`.", + "description": "The type of the tool. Currently, only `function` is supported.", "x-stainless-const": true }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "schema": { + "function": { "type": "object", - "description": "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n", - "additionalProperties": true + "description": "The function that the model called.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + }, + "arguments": { + "type": "string", + "description": "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." + } + }, + "required": [ + "name", + "arguments" + ] } }, "required": [ + "id", "type", - "schema" - ], - "x-oaiMeta": { - "name": "The logs data source object for evals", - "group": "evals", - "example": "{\n \"type\": \"logs\",\n \"metadata\": {\n \"language\": \"english\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\"\n },\n \"sample\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"item\",\n \"sample\"\n }\n}\n" - } + "function" + ] }, - "EvalResponsesSource": { + "ChatCompletionMessageToolCallChunk": { "type": "object", - "title": "EvalResponsesSource", - "description": "A EvalResponsesSource object describing a run data source configuration.\n", "properties": { + "index": { + "type": "integer" + }, + "id": { + "type": "string", + "description": "The ID of the tool call." + }, "type": { "type": "string", "enum": [ - "responses" + "function" ], - "description": "The type of run data source. Always `responses`." + "description": "The type of the tool. Currently, only `function` is supported.", + "x-stainless-const": true }, - "metadata": { - "anyOf": [ - { - "type": "object", - "description": "Metadata filter for the responses. This is a query parameter used to select responses." + "function": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." }, - { - "type": "null" - } - ] - }, - "model": { - "anyOf": [ - { + "arguments": { "type": "string", - "description": "The name of the model to find responses for. This is a query parameter used to select responses." - }, - { - "type": "null" + "description": "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." } - ] + } + } + }, + "required": [ + "index" + ] + }, + "ChatCompletionMessageToolCalls": { + "type": "array", + "description": "The tool calls generated by the model, such as function calls.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionMessageToolCall" + }, + { + "$ref": "#/components/schemas/ChatCompletionMessageCustomToolCall" + } + ], + "discriminator": { + "propertyName": "type" + } + } + }, + "ChatCompletionModalities": { + "anyOf": [ + { + "type": "array", + "description": "Output types that you would like the model to generate for this request.\nMost models are capable of generating text, which is the default:\n\n`[\"text\"]`\n\nThe `gpt-4o-audio-preview` model can also be used to [generate audio](https://developers.openai.com/api/docs/guides/audio). To\nrequest that this model generate both text and audio responses, you can\nuse:\n\n`[\"text\", \"audio\"]`\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } }, - "instructions_search": { - "anyOf": [ + { + "type": "null" + } + ] + }, + "ChatCompletionModeration": { + "type": "object", + "description": "Moderation results or errors for the request input and generated output.", + "properties": { + "input": { + "oneOf": [ { - "type": "string", - "description": "Optional string to search the 'instructions' field. This is a query parameter used to select responses." + "$ref": "#/components/schemas/ChatCompletionModerationResults" }, { - "type": "null" + "$ref": "#/components/schemas/ChatCompletionModerationError" } - ] + ], + "discriminator": { + "propertyName": "type" + }, + "description": "Moderation for the request input." }, - "created_after": { - "anyOf": [ + "output": { + "oneOf": [ { - "type": "integer", - "minimum": 0, - "description": "Only include items created after this timestamp (inclusive). This is a query parameter used to select responses." + "$ref": "#/components/schemas/ChatCompletionModerationResults" }, { - "type": "null" + "$ref": "#/components/schemas/ChatCompletionModerationError" } - ] + ], + "discriminator": { + "propertyName": "type" + }, + "description": "Moderation for the generated output." + } + }, + "required": [ + "input", + "output" + ] + }, + "ChatCompletionModerationError": { + "type": "object", + "description": "An error produced while attempting moderation.", + "properties": { + "type": { + "type": "string", + "enum": [ + "error" + ], + "description": "The object type, which is always `error`.", + "x-stainless-const": true }, - "created_before": { - "anyOf": [ - { - "type": "integer", - "minimum": 0, - "description": "Only include items created before this timestamp (inclusive). This is a query parameter used to select responses." - }, - { - "type": "null" + "code": { + "type": "string", + "description": "The error code." + }, + "message": { + "type": "string", + "description": "The error message." + } + }, + "required": [ + "type", + "code", + "message" + ] + }, + "ChatCompletionModerationResults": { + "type": "object", + "description": "Successful moderation results for the request input or generated output.", + "properties": { + "type": { + "type": "string", + "enum": [ + "moderation_results" + ], + "description": "The object type, which is always `moderation_results`.", + "x-stainless-const": true + }, + "model": { + "type": "string", + "description": "The moderation model used to generate the results." + }, + "results": { + "type": "array", + "description": "A list of moderation results.", + "items": { + "$ref": "#/components/schemas/ModerationResultBody" + } + } + }, + "required": [ + "type", + "model", + "results" + ] + }, + "ChatCompletionNamedToolChoice": { + "type": "object", + "title": "Function tool choice", + "description": "Specifies a tool the model should use. Use to force the model to call a specific function.", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ], + "description": "For function calling, the type is always `function`.", + "x-stainless-const": true + }, + "function": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." } + }, + "required": [ + "name" ] + } + }, + "required": [ + "type", + "function" + ] + }, + "ChatCompletionNamedToolChoiceCustom": { + "type": "object", + "title": "Custom tool choice", + "description": "Specifies a tool the model should use. Use to force the model to call a specific custom tool.", + "properties": { + "type": { + "type": "string", + "enum": [ + "custom" + ], + "description": "For custom tool calling, the type is always `custom`.", + "x-stainless-const": true }, - "reasoning_effort": { + "custom": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the custom tool to call." + } + }, + "required": [ + "name" + ] + } + }, + "required": [ + "type", + "custom" + ] + }, + "ChatCompletionRequestAssistantMessage": { + "type": "object", + "title": "Assistant message", + "description": "Messages sent by the model in response to user messages.\n", + "properties": { + "content": { "anyOf": [ { - "$ref": "#/components/schemas/ReasoningEffort", - "description": "Optional reasoning effort parameter. This is a query parameter used to select responses." + "oneOf": [ + { + "type": "string", + "description": "The contents of the assistant message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessageContentPart" + }, + "minItems": 1 + } + ], + "description": "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n" }, { "type": "null" } ] }, - "temperature": { + "refusal": { "anyOf": [ { - "type": "number", - "description": "Sampling temperature. This is a query parameter used to select responses." + "type": "string", + "description": "The refusal message by the assistant." }, { "type": "null" } ] }, - "top_p": { + "role": { + "type": "string", + "enum": [ + "assistant" + ], + "description": "The role of the messages author, in this case `assistant`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." + }, + "audio": { "anyOf": [ { - "type": "number", - "description": "Nucleus sampling parameter. This is a query parameter used to select responses." + "type": "object", + "description": "Data about a previous audio response from the model.\n[Learn more](https://developers.openai.com/api/docs/guides/audio).\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for a previous audio response from the model.\n" + } + } }, { "type": "null" } ] }, - "users": { + "tool_calls": { + "$ref": "#/components/schemas/ChatCompletionMessageToolCalls" + }, + "function_call": { "anyOf": [ { - "type": "array", - "items": { - "type": "string" + "type": "object", + "deprecated": true, + "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", + "properties": { + "arguments": { + "type": "string", + "description": "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": { + "type": "string", + "description": "The name of the function to call." + } }, - "description": "List of user identifiers. This is a query parameter used to select responses." + "required": [ + "arguments", + "name" + ] }, { "type": "null" } ] + } + }, + "required": [ + "role" + ] + }, + "ChatCompletionRequestAssistantMessageContentPart": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" }, - "tools": { - "anyOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartRefusal" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "ChatCompletionRequestDeveloperMessage": { + "type": "object", + "title": "Developer message", + "description": "Developer-provided instructions that the model should follow, regardless of\nmessages sent by the user. With o1 models and newer, `developer` messages\nreplace the previous `system` messages.\n", + "properties": { + "content": { + "description": "The contents of the developer message.", + "oneOf": [ + { + "type": "string", + "description": "The contents of the developer message.", + "title": "Text content" + }, { "type": "array", + "description": "An array of content parts with a defined type. For developer messages, only type `text` is supported.", + "title": "Array of content parts", "items": { - "type": "string" + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" }, - "description": "List of tool names. This is a query parameter used to select responses." - }, - { - "type": "null" + "minItems": 1 } ] + }, + "role": { + "type": "string", + "enum": [ + "developer" + ], + "description": "The role of the messages author, in this case `developer`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." } }, "required": [ - "type" - ], - "x-oaiMeta": { - "name": "The run data source object used to configure an individual run", - "group": "eval runs", - "example": "{\n \"type\": \"responses\",\n \"model\": \"gpt-6-astra\",\n \"users\": [\"user1\", \"user2\"],\n \"tools\": [\"tool1\", \"tool2\"],\n \"instructions_search\": \"You are a coding assistant\"\n}\n" - } + "content", + "role" + ] }, - "EvalRun": { + "ChatCompletionRequestFunctionMessage": { "type": "object", - "title": "EvalRun", - "description": "A schema representing an evaluation run.\n", + "title": "Function message", + "deprecated": true, "properties": { - "object": { + "role": { "type": "string", "enum": [ - "eval.run" + "function" ], - "default": "eval.run", - "description": "The type of the object. Always \"eval.run\".", + "description": "The role of the messages author, in this case `function`.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "Unique identifier for the evaluation run." + "content": { + "anyOf": [ + { + "type": "string", + "description": "The contents of the function message." + }, + { + "type": "null" + } + ] }, - "eval_id": { + "name": { "type": "string", - "description": "The identifier of the associated evaluation." + "description": "The name of the function to call." + } + }, + "required": [ + "role", + "content", + "name" + ] + }, + "ChatCompletionRequestMessage": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestDeveloperMessage" }, - "status": { - "type": "string", - "description": "The status of the evaluation run." + { + "$ref": "#/components/schemas/ChatCompletionRequestSystemMessage" }, - "model": { - "type": "string", - "description": "The model that is evaluated, if applicable." + { + "$ref": "#/components/schemas/ChatCompletionRequestUserMessage" }, - "name": { - "type": "string", - "description": "The name of the evaluation run." + { + "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessage" }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the evaluation run was created." + { + "$ref": "#/components/schemas/ChatCompletionRequestToolMessage" }, - "report_url": { + { + "$ref": "#/components/schemas/ChatCompletionRequestFunctionMessage" + } + ], + "discriminator": { + "propertyName": "role" + } + }, + "ChatCompletionRequestMessageContentPartAudio": { + "type": "object", + "title": "Audio content part", + "description": "Learn about [audio inputs](https://developers.openai.com/api/docs/guides/audio).\n", + "properties": { + "type": { "type": "string", - "format": "uri", - "description": "The URL to the rendered evaluation run report on the UI dashboard." + "enum": [ + "input_audio" + ], + "description": "The type of the content part. Always `input_audio`.", + "x-stainless-const": true }, - "result_counts": { + "input_audio": { "type": "object", - "description": "Counters summarizing the outcomes of the evaluation run.", "properties": { - "total": { - "type": "integer", - "description": "Total number of executed output items." - }, - "errored": { - "type": "integer", - "description": "Number of output items that resulted in an error." - }, - "failed": { - "type": "integer", - "description": "Number of output items that failed to pass the evaluation." + "data": { + "type": "string", + "description": "Base64 encoded audio data." }, - "passed": { - "type": "integer", - "description": "Number of output items that passed the evaluation." + "format": { + "type": "string", + "enum": [ + "wav", + "mp3" + ], + "description": "The format of the encoded audio data. Currently supports \"wav\" and \"mp3\".\n" } }, "required": [ - "total", - "errored", - "failed", - "passed" + "data", + "format" ] }, - "per_model_usage": { - "type": "array", - "description": "Usage statistics for each model during the evaluation run.", - "items": { - "type": "object", - "properties": { - "model_name": { - "type": "string", - "description": "The name of the model." - }, - "invocation_count": { - "type": "integer", - "description": "The number of invocations." - }, - "prompt_tokens": { - "type": "integer", - "description": "The number of prompt tokens used." - }, - "completion_tokens": { - "type": "integer", - "description": "The number of completion tokens generated." - }, - "total_tokens": { - "type": "integer", - "description": "The total number of tokens used." - }, - "cached_tokens": { - "type": "integer", - "description": "The number of tokens retrieved from cache." - } - }, - "required": [ - "model_name", - "invocation_count", - "prompt_tokens", - "completion_tokens", - "total_tokens", - "cached_tokens" - ] - } - }, - "per_testing_criteria_results": { - "type": "array", - "description": "Results per testing criteria applied during the evaluation run.", - "items": { - "type": "object", - "properties": { - "testing_criteria": { - "type": "string", - "description": "A description of the testing criteria." - }, - "passed": { - "type": "integer", - "description": "Number of tests passed for this criteria." - }, - "failed": { - "type": "integer", - "description": "Number of tests failed for this criteria." - } - }, - "required": [ - "testing_criteria", - "passed", - "failed" - ] - } - }, - "data_source": { - "type": "object", - "description": "Information about the run's data source.", - "oneOf": [ - { - "$ref": "#/components/schemas/CreateEvalJsonlRunDataSource" - }, - { - "$ref": "#/components/schemas/CreateEvalCompletionsRunDataSource" - }, - { - "$ref": "#/components/schemas/CreateEvalResponsesRunDataSource" - } - ] - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "error": { - "$ref": "#/components/schemas/EvalApiError" + "prompt_cache_breakpoint": { + "$ref": "#/components/schemas/PromptCacheBreakpointParam" } }, "required": [ - "object", - "id", - "eval_id", - "status", - "model", - "name", - "created_at", - "report_url", - "result_counts", - "per_model_usage", - "per_testing_criteria_results", - "data_source", - "metadata", - "error" - ], - "x-oaiMeta": { - "name": "The eval run object", - "group": "evals", - "example": "{\n \"object\": \"eval.run\",\n \"id\": \"evalrun_67e57965b480819094274e3a32235e4c\",\n \"eval_id\": \"eval_67e579652b548190aaa83ada4b125f47\",\n \"report_url\": \"https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c\",\n \"status\": \"queued\",\n \"model\": \"gpt-6-astra\",\n \"name\": \"gpt-6-astra\",\n \"created_at\": 1743092069,\n \"result_counts\": {\n \"total\": 0,\n \"errored\": 0,\n \"failed\": 0,\n \"passed\": 0\n },\n \"per_model_usage\": null,\n \"per_testing_criteria_results\": null,\n \"data_source\": {\n \"type\": \"completions\",\n \"source\": {\n \"type\": \"file_content\",\n \"content\": [\n {\n \"item\": {\n \"input\": \"Tech Company Launches Advanced Artificial Intelligence Platform\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"Central Bank Increases Interest Rates Amid Inflation Concerns\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"International Summit Addresses Climate Change Strategies\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Major Retailer Reports Record-Breaking Holiday Sales\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"National Team Qualifies for World Championship Finals\",\n \"ground_truth\": \"Sports\"\n }\n },\n {\n \"item\": {\n \"input\": \"Stock Markets Rally After Positive Economic Data Released\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"Global Manufacturer Announces Merger with Competitor\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"Breakthrough in Renewable Energy Technology Unveiled\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"World Leaders Sign Historic Climate Agreement\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Professional Athlete Sets New Record in Championship Event\",\n \"ground_truth\": \"Sports\"\n }\n },\n {\n \"item\": {\n \"input\": \"Financial Institutions Adapt to New Regulatory Requirements\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"Tech Conference Showcases Advances in Artificial Intelligence\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"Global Markets Respond to Oil Price Fluctuations\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"International Cooperation Strengthened Through New Treaty\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Sports League Announces Revised Schedule for Upcoming Season\",\n \"ground_truth\": \"Sports\"\n }\n }\n ]\n },\n \"input_messages\": {\n \"type\": \"template\",\n \"template\": [\n {\n \"type\": \"message\",\n \"role\": \"developer\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\\n\\n# Steps\\n\\n1. Analyze the content of the news headline to understand its primary focus.\\n2. Extract the subject matter, identifying any key indicators or keywords.\\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\\n4. Ensure only one category is selected per headline.\\n\\n# Output Format\\n\\nRespond with the chosen category as a single word. For instance: \\\"Technology\\\", \\\"Markets\\\", \\\"World\\\", \\\"Business\\\", or \\\"Sports\\\".\\n\\n# Examples\\n\\n**Input**: \\\"Apple Unveils New iPhone Model, Featuring Advanced AI Features\\\" \\n**Output**: \\\"Technology\\\"\\n\\n**Input**: \\\"Global Stocks Mixed as Investors Await Central Bank Decisions\\\" \\n**Output**: \\\"Markets\\\"\\n\\n**Input**: \\\"War in Ukraine: Latest Updates on Negotiation Status\\\" \\n**Output**: \\\"World\\\"\\n\\n**Input**: \\\"Microsoft in Talks to Acquire Gaming Company for $2 Billion\\\" \\n**Output**: \\\"Business\\\"\\n\\n**Input**: \\\"Manchester United Secures Win in Premier League Football Match\\\" \\n**Output**: \\\"Sports\\\" \\n\\n# Notes\\n\\n- If the headline appears to fit into more than one category, choose the most dominant theme.\\n- Keywords or phrases such as \\\"stocks\\\", \\\"company acquisition\\\", \\\"match\\\", or technological brands can be good indicators for classification.\\n\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"{{item.input}}\"\n }\n }\n ]\n },\n \"model\": \"gpt-6-astra\",\n \"sampling_params\": {\n \"max_completions_tokens\": 2048\n }\n },\n \"error\": null,\n \"metadata\": {}\n}\n" - } + "type", + "input_audio" + ] }, - "EvalRunList": { + "ChatCompletionRequestMessageContentPartFile": { "type": "object", - "title": "EvalRunList", - "description": "An object representing a list of runs for an evaluation.\n", + "title": "File content part", + "description": "Learn about [file inputs](https://developers.openai.com/api/docs/guides/text) for text generation.\n", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "file" ], - "default": "list", - "description": "The type of this object. It is always set to \"list\".\n", + "description": "The type of the content part. Always `file`.", "x-stainless-const": true }, - "data": { - "type": "array", - "description": "An array of eval run objects.\n", - "items": { - "$ref": "#/components/schemas/EvalRun" + "file": { + "type": "object", + "properties": { + "filename": { + "type": "string", + "description": "The name of the file, used when passing the file to the model as a\nstring.\n" + }, + "file_data": { + "type": "string", + "description": "The base64 encoded file data, used when passing the file to the model\nas a string.\n" + }, + "file_id": { + "type": "string", + "description": "The ID of an uploaded file to use as input.\n" + } } }, - "first_id": { - "type": "string", - "description": "The identifier of the first eval run in the data array." - }, - "last_id": { - "type": "string", - "description": "The identifier of the last eval run in the data array." - }, - "has_more": { - "type": "boolean", - "description": "Indicates whether there are more evals available." + "prompt_cache_breakpoint": { + "$ref": "#/components/schemas/PromptCacheBreakpointParam" } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "x-oaiMeta": { - "name": "The eval run list object", - "group": "evals", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"eval.run\",\n \"id\": \"evalrun_67b7fbdad46c819092f6fe7a14189620\",\n \"eval_id\": \"eval_67b7fa9a81a88190ab4aa417e397ea21\",\n \"report_url\": \"https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620\",\n \"status\": \"completed\",\n \"model\": \"o3-mini\",\n \"name\": \"Academic Assistant\",\n \"created_at\": 1740110812,\n \"result_counts\": {\n \"total\": 171,\n \"errored\": 0,\n \"failed\": 80,\n \"passed\": 91\n },\n \"per_model_usage\": null,\n \"per_testing_criteria_results\": [\n {\n \"testing_criteria\": \"String check grader\",\n \"passed\": 91,\n \"failed\": 80\n }\n ],\n \"run_data_source\": {\n \"type\": \"completions\",\n \"template_messages\": [\n {\n \"type\": \"message\",\n \"role\": \"system\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"You are a helpful assistant.\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Hello, can you help me with my homework?\"\n }\n }\n ],\n \"datasource_reference\": null,\n \"model\": \"o3-mini\",\n \"max_completion_tokens\": null,\n \"seed\": null,\n \"temperature\": null,\n \"top_p\": null\n },\n \"error\": null,\n \"metadata\": {\"test\": \"synthetics\"}\n }\n ],\n \"first_id\": \"evalrun_67abd54d60ec8190832b46859da808f7\",\n \"last_id\": \"evalrun_67abd54d60ec8190832b46859da808f7\",\n \"has_more\": false\n}\n" - } + "type", + "file" + ] }, - "EvalRunOutputItem": { + "ChatCompletionRequestMessageContentPartImage": { "type": "object", - "title": "EvalRunOutputItem", - "description": "A schema representing an evaluation run output item.\n", + "title": "Image content part", + "description": "Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision).\n", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "eval.run.output_item" + "image_url" ], - "default": "eval.run.output_item", - "description": "The type of the object. Always \"eval.run.output_item\".", + "description": "The type of the content part.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "Unique identifier for the evaluation run output item." - }, - "run_id": { - "type": "string", - "description": "The identifier of the evaluation run associated with this output item." - }, - "eval_id": { - "type": "string", - "description": "The identifier of the evaluation group." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the evaluation run was created." - }, - "status": { - "type": "string", - "description": "The status of the evaluation run." - }, - "datasource_item_id": { - "type": "integer", - "description": "The identifier for the data source item." - }, - "datasource_item": { - "type": "object", - "description": "Details of the input data source item.", - "additionalProperties": true - }, - "results": { - "type": "array", - "description": "A list of grader results for this output item.", - "items": { - "$ref": "#/components/schemas/EvalRunOutputItemResult" - } - }, - "sample": { + "image_url": { "type": "object", - "description": "A sample containing the input and output of the evaluation run.", "properties": { - "input": { - "type": "array", - "description": "An array of input messages.", - "items": { - "type": "object", - "description": "An input message.", - "properties": { - "role": { - "type": "string", - "description": "The role of the message sender (e.g., system, user, developer)." - }, - "content": { - "type": "string", - "description": "The content of the message." - } - }, - "required": [ - "role", - "content" - ] - } - }, - "output": { - "type": "array", - "description": "An array of output messages.", - "items": { - "type": "object", - "properties": { - "role": { - "type": "string", - "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")." - }, - "content": { - "type": "string", - "description": "The content of the message." - } - } - } - }, - "finish_reason": { + "url": { "type": "string", - "description": "The reason why the sample generation was finished." + "description": "Either a URL of the image or the base64 encoded image data.", + "format": "uri" }, - "model": { + "detail": { "type": "string", - "description": "The model used for generating the sample." - }, - "usage": { - "type": "object", - "description": "Token usage details for the sample.", - "properties": { - "total_tokens": { - "type": "integer", - "description": "The total number of tokens used." - }, - "completion_tokens": { - "type": "integer", - "description": "The number of completion tokens generated." - }, - "prompt_tokens": { - "type": "integer", - "description": "The number of prompt tokens used." - }, - "cached_tokens": { - "type": "integer", - "description": "The number of tokens retrieved from cache." - } - }, - "required": [ - "total_tokens", - "completion_tokens", - "prompt_tokens", - "cached_tokens" - ] - }, - "error": { - "$ref": "#/components/schemas/EvalApiError" - }, - "temperature": { - "type": "number", - "description": "The sampling temperature used." - }, - "max_completion_tokens": { - "type": "integer", - "description": "The maximum number of tokens allowed for completion." - }, - "top_p": { - "type": "number", - "description": "The top_p value used for sampling." - }, - "seed": { - "type": "integer", - "description": "The seed used for generating the sample." + "description": "Specifies the detail level of the image. Learn more in the [Vision guide](https://developers.openai.com/api/docs/guides/images-vision#choose-an-image-detail-level).", + "enum": [ + "auto", + "low", + "high", + "original" + ], + "default": "auto" } }, "required": [ - "input", - "output", - "finish_reason", - "model", - "usage", - "error", - "temperature", - "max_completion_tokens", - "top_p", - "seed" + "url" ] + }, + "prompt_cache_breakpoint": { + "$ref": "#/components/schemas/PromptCacheBreakpointParam" } }, "required": [ - "object", - "id", - "run_id", - "eval_id", - "created_at", - "status", - "datasource_item_id", - "datasource_item", - "results", - "sample" - ], - "x-oaiMeta": { - "name": "The eval run output item object", - "group": "evals", - "example": "{\n \"object\": \"eval.run.output_item\",\n \"id\": \"outputitem_67abd55eb6548190bb580745d5644a33\",\n \"run_id\": \"evalrun_67abd54d60ec8190832b46859da808f7\",\n \"eval_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"created_at\": 1739314509,\n \"status\": \"pass\",\n \"datasource_item_id\": 137,\n \"datasource_item\": {\n \"teacher\": \"To grade essays, I only check for style, content, and grammar.\",\n \"student\": \"I am a student who is trying to write the best essay.\"\n },\n \"results\": [\n {\n \"name\": \"String Check Grader\",\n \"type\": \"string-check-grader\",\n \"score\": 1.0,\n \"passed\": true,\n }\n ],\n \"sample\": {\n \"input\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an evaluator bot...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"You are assessing...\"\n }\n ],\n \"output\": [\n {\n \"role\": \"assistant\",\n \"content\": \"The rubric is not clear nor concise.\"\n }\n ],\n \"finish_reason\": \"stop\",\n \"model\": \"gpt-6-astra\",\n \"usage\": {\n \"total_tokens\": 521,\n \"completion_tokens\": 2,\n \"prompt_tokens\": 519,\n \"cached_tokens\": 0\n },\n \"error\": null,\n \"temperature\": 1.0,\n \"max_completion_tokens\": 2048,\n \"top_p\": 1.0,\n \"seed\": 42\n }\n}\n" - } + "type", + "image_url" + ] }, - "EvalRunOutputItemList": { + "ChatCompletionRequestMessageContentPartRefusal": { "type": "object", - "title": "EvalRunOutputItemList", - "description": "An object representing a list of output items for an evaluation run.\n", + "title": "Refusal content part", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "refusal" ], - "default": "list", - "description": "The type of this object. It is always set to \"list\".\n", + "description": "The type of the content part.", "x-stainless-const": true }, - "data": { - "type": "array", - "description": "An array of eval run output item objects.\n", - "items": { - "$ref": "#/components/schemas/EvalRunOutputItem" - } - }, - "first_id": { - "type": "string", - "description": "The identifier of the first eval run output item in the data array." - }, - "last_id": { + "refusal": { "type": "string", - "description": "The identifier of the last eval run output item in the data array." - }, - "has_more": { - "type": "boolean", - "description": "Indicates whether there are more eval run output items available." + "description": "The refusal message generated by the model." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "x-oaiMeta": { - "name": "The eval run output item list object", - "group": "evals", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"eval.run.output_item\",\n \"id\": \"outputitem_67abd55eb6548190bb580745d5644a33\",\n \"run_id\": \"evalrun_67abd54d60ec8190832b46859da808f7\",\n \"eval_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"created_at\": 1739314509,\n \"status\": \"pass\",\n \"datasource_item_id\": 137,\n \"datasource_item\": {\n \"teacher\": \"To grade essays, I only check for style, content, and grammar.\",\n \"student\": \"I am a student who is trying to write the best essay.\"\n },\n \"results\": [\n {\n \"name\": \"String Check Grader\",\n \"type\": \"string-check-grader\",\n \"score\": 1.0,\n \"passed\": true,\n }\n ],\n \"sample\": {\n \"input\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an evaluator bot...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"You are assessing...\"\n }\n ],\n \"output\": [\n {\n \"role\": \"assistant\",\n \"content\": \"The rubric is not clear nor concise.\"\n }\n ],\n \"finish_reason\": \"stop\",\n \"model\": \"gpt-6-astra\",\n \"usage\": {\n \"total_tokens\": 521,\n \"completion_tokens\": 2,\n \"prompt_tokens\": 519,\n \"cached_tokens\": 0\n },\n \"error\": null,\n \"temperature\": 1.0,\n \"max_completion_tokens\": 2048,\n \"top_p\": 1.0,\n \"seed\": 42\n }\n },\n ],\n \"first_id\": \"outputitem_67abd55eb6548190bb580745d5644a33\",\n \"last_id\": \"outputitem_67abd55eb6548190bb580745d5644a33\",\n \"has_more\": false\n}\n" - } + "type", + "refusal" + ] }, - "EvalRunOutputItemResult": { + "ChatCompletionRequestMessageContentPartText": { "type": "object", - "title": "EvalRunOutputItemResult", - "description": "A single grader result for an evaluation run output item.\n", + "title": "Text content part", + "description": "Learn about [text inputs](https://developers.openai.com/api/docs/guides/text).\n", "properties": { - "name": { - "type": "string", - "description": "The name of the grader." - }, "type": { "type": "string", - "description": "The grader type (for example, \"string-check-grader\")." - }, - "score": { - "type": "number", - "description": "The numeric score produced by the grader." + "enum": [ + "text" + ], + "description": "The type of the content part.", + "x-stainless-const": true }, - "passed": { - "type": "boolean", - "description": "Whether the grader considered the output a pass." + "text": { + "type": "string", + "description": "The text content." }, - "sample": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "description": "Optional sample or intermediate data produced by the grader." + "prompt_cache_breakpoint": { + "$ref": "#/components/schemas/PromptCacheBreakpointParam" } }, - "additionalProperties": true, "required": [ - "name", - "score", - "passed" + "type", + "text" ] }, - "EvalStoredCompletionsDataSourceConfig": { + "ChatCompletionRequestSystemMessage": { "type": "object", - "title": "StoredCompletionsDataSourceConfig", - "description": "Deprecated in favor of LogsDataSourceConfig.\n", + "title": "System message", + "description": "Developer-provided instructions that the model should follow, regardless of\nmessages sent by the user. With o1 models and newer, use `developer` messages\nfor this purpose instead.\n", "properties": { - "type": { + "content": { + "description": "The contents of the system message.", + "oneOf": [ + { + "type": "string", + "description": "The contents of the system message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type. For system messages, only type `text` is supported.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestSystemMessageContentPart" + }, + "minItems": 1 + } + ] + }, + "role": { "type": "string", "enum": [ - "stored_completions" + "system" ], - "default": "stored_completions", - "description": "The type of data source. Always `stored_completions`.", + "description": "The role of the messages author, in this case `system`.", "x-stainless-const": true }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "schema": { - "type": "object", - "description": "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n", - "additionalProperties": true + "name": { + "type": "string", + "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." } }, "required": [ - "type", - "schema" - ], - "deprecated": true, - "x-oaiMeta": { - "name": "The stored completions data source object for evals", - "group": "evals", - "example": "{\n \"type\": \"stored_completions\",\n \"metadata\": {\n \"language\": \"english\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\"\n },\n \"sample\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"item\",\n \"sample\"\n }\n}\n" - } + "content", + "role" + ] }, - "EvalStoredCompletionsSource": { + "ChatCompletionRequestSystemMessageContentPart": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" + } + ] + }, + "ChatCompletionRequestToolMessage": { "type": "object", - "title": "StoredCompletionsRunDataSource", - "description": "A StoredCompletionsRunDataSource configuration describing a set of filters\n", + "title": "Tool message", "properties": { - "type": { + "role": { "type": "string", "enum": [ - "stored_completions" + "tool" ], - "default": "stored_completions", - "description": "The type of source. Always `stored_completions`.", + "description": "The role of the messages author, in this case `tool`.", "x-stainless-const": true }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "model": { - "anyOf": [ + "content": { + "oneOf": [ { "type": "string", - "description": "An optional model to filter by (e.g., 'gpt-6-astra')." + "description": "The contents of the tool message.", + "title": "Text content" }, { - "type": "null" + "type": "array", + "description": "An array of content parts with a defined type. For tool messages, only type `text` is supported.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestToolMessageContentPart" + }, + "minItems": 1 } - ] + ], + "description": "The contents of the tool message." }, - "created_after": { - "anyOf": [ - { - "type": "integer", - "description": "An optional Unix timestamp to filter items created after this time." - }, - { - "type": "null" - } - ] - }, - "created_before": { - "anyOf": [ - { - "type": "integer", - "description": "An optional Unix timestamp to filter items created before this time." - }, - { - "type": "null" - } - ] - }, - "limit": { - "anyOf": [ - { - "type": "integer", - "description": "An optional maximum number of items to return." - }, - { - "type": "null" - } - ] + "tool_call_id": { + "type": "string", + "description": "Tool call that this message is responding to." } }, "required": [ - "type" - ], - "x-oaiMeta": { - "name": "The stored completions data source object used to configure an individual run", - "group": "eval runs", - "example": "{\n \"type\": \"stored_completions\",\n \"model\": \"gpt-6-astra\",\n \"created_after\": 1668124800,\n \"created_before\": 1668124900,\n \"limit\": 100,\n \"metadata\": {}\n}\n" - } + "role", + "content", + "tool_call_id" + ] }, - "FileExpirationAfter": { - "type": "object", - "title": "File expiration policy", - "description": "The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted.", - "properties": { - "anchor": { - "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`.", - "type": "string", - "enum": [ - "created_at" - ], - "x-stainless-const": true - }, - "seconds": { - "description": "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).", - "type": "integer", - "format": "int64", - "minimum": 3600, - "maximum": 2592000 + "ChatCompletionRequestToolMessageContentPart": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" } - }, - "required": [ - "anchor", - "seconds" ] }, - "FilePath": { + "ChatCompletionRequestUserMessage": { "type": "object", - "title": "File path", - "description": "A path to a file.\n", + "title": "User message", + "description": "Messages sent by an end user, containing prompts or additional context\ninformation.\n", "properties": { - "type": { + "content": { + "description": "The contents of the user message.\n", + "oneOf": [ + { + "type": "string", + "description": "The text contents of the message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type. Supported options differ based on the [model](https://developers.openai.com/api/docs/models) being used to generate the response. Can contain text, image, or audio inputs.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestUserMessageContentPart" + }, + "minItems": 1 + } + ] + }, + "role": { "type": "string", - "description": "The type of the file path. Always `file_path`.\n", "enum": [ - "file_path" + "user" ], + "description": "The role of the messages author, in this case `user`.", "x-stainless-const": true }, - "file_id": { + "name": { "type": "string", - "description": "The ID of the file.\n" - }, - "index": { - "type": "integer", - "description": "The index of the file in the list of files.\n" + "description": "An optional name for the participant. Provides the model information to differentiate between participants of the same role." } }, "required": [ - "type", - "file_id", - "index" - ] - }, - "FileSearchRanker": { - "type": "string", - "description": "The ranker to use for the file search. If not specified will use the `auto` ranker.", - "enum": [ - "auto", - "default_2024_08_21" + "content", + "role" ] }, - "FileSearchRankingOptions": { - "title": "File search tool call ranking options", - "type": "object", - "description": "The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.\n\nSee the [file search tool documentation](https://developers.openai.com/api/docs/guides/tools-file-search#retrieval-customization) for more information.\n", - "properties": { - "ranker": { - "$ref": "#/components/schemas/FileSearchRanker" + "ChatCompletionRequestUserMessageContentPart": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" }, - "score_threshold": { - "type": "number", - "description": "The score threshold for the file search. All values must be a floating point number between 0 and 1.", - "minimum": 0, - "maximum": 1 + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartImage" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartAudio" + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartFile" } - }, - "required": [ - "score_threshold" ] }, - "FileSearchToolCall": { + "ChatCompletionResponseMessage": { "type": "object", - "title": "File search tool call", - "description": "The results of a file search tool call. See the\n[file search guide](https://developers.openai.com/api/docs/guides/tools-file-search) for more information.\n", + "description": "A chat completion message generated by the model.", "properties": { - "id": { - "type": "string", - "description": "The unique ID of the file search tool call.\n" + "content": { + "anyOf": [ + { + "type": "string", + "description": "The contents of the message." + }, + { + "type": "null" + } + ] }, - "type": { - "type": "string", - "enum": [ - "file_search_call" - ], - "description": "The type of the file search tool call. Always `file_search_call`.\n", - "x-stainless-const": true + "refusal": { + "anyOf": [ + { + "type": "string", + "description": "The refusal message generated by the model." + }, + { + "type": "null" + } + ] }, - "status": { - "type": "string", - "description": "The status of the file search tool call. One of `in_progress`,\n`searching`, `incomplete` or `failed`,\n", - "enum": [ - "in_progress", - "searching", - "completed", - "incomplete", - "failed" + "tool_calls": { + "anyOf": [ + { + "$ref": "#/components/schemas/ChatCompletionMessageToolCalls" + }, + { + "type": "null" + } ] }, - "queries": { + "annotations": { "type": "array", + "description": "Annotations for the message, when applicable, as when using the\n[web search tool](https://developers.openai.com/api/docs/guides/tools-web-search).\n", "items": { - "type": "string" - }, - "description": "The queries used to search for files.\n" - }, - "results": { - "anyOf": [ - { - "type": "array", - "description": "The results of the file search tool call.\n", - "items": { + "type": "object", + "description": "A URL citation when using web search.\n", + "required": [ + "type", + "url_citation" + ], + "properties": { + "type": { + "type": "string", + "description": "The type of the URL citation. Always `url_citation`.", + "enum": [ + "url_citation" + ], + "x-stainless-const": true + }, + "url_citation": { "type": "object", + "description": "A URL citation when using web search.", + "required": [ + "end_index", + "start_index", + "url", + "title" + ], "properties": { - "file_id": { - "type": "string", - "description": "The unique ID of the file.\n" + "end_index": { + "type": "integer", + "description": "The index of the last character of the URL citation in the message." }, - "text": { - "type": "string", - "description": "The text that was retrieved from the file.\n" + "start_index": { + "type": "integer", + "description": "The index of the first character of the URL citation in the message." }, - "filename": { + "url": { "type": "string", - "description": "The name of the file.\n" - }, - "attributes": { - "$ref": "#/components/schemas/VectorStoreFileAttributes" + "format": "uri", + "description": "The URL of the web resource." }, - "score": { - "type": "number", - "format": "float", - "description": "The relevance score of the file - a value between 0 and 1.\n" + "title": { + "type": "string", + "description": "The title of the web resource." } } } + } + } + }, + "role": { + "type": "string", + "enum": [ + "assistant" + ], + "description": "The role of the author of this message.", + "x-stainless-const": true + }, + "function_call": { + "type": [ + "object", + "null" + ], + "deprecated": true, + "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", + "properties": { + "arguments": { + "type": "string", + "description": "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": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": [ + "name", + "arguments" + ] + }, + "audio": { + "anyOf": [ + { + "type": "object", + "description": "If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](https://developers.openai.com/api/docs/guides/audio).\n", + "required": [ + "id", + "expires_at", + "data", + "transcript" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for this audio response." + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when this audio response will\nno longer be accessible on the server for use in multi-turn\nconversations.\n" + }, + "data": { + "type": "string", + "description": "Base64 encoded audio bytes generated by the model, in the format\nspecified in the request.\n" + }, + "transcript": { + "type": "string", + "description": "Transcript of the audio generated by the model." + } + } }, { "type": "null" @@ -36349,2296 +40726,2284 @@ } }, "required": [ - "id", - "type", - "status", - "queries" + "role", + "content" ] }, - "FineTuneChatCompletionRequestAssistantMessage": { - "allOf": [ + "ChatCompletionRole": { + "type": "string", + "description": "The role of the author of a message", + "enum": [ + "developer", + "system", + "user", + "assistant", + "tool", + "function" + ] + }, + "ChatCompletionStreamOptions": { + "anyOf": [ { + "description": "Options for streaming response. Only set this when you set `stream: true`.\n", "type": "object", - "title": "Assistant message", - "deprecated": false, "properties": { - "weight": { - "type": "integer", - "enum": [ - 0, - 1 - ], - "description": "Controls whether the assistant message is trained against (0 or 1)" + "include_usage": { + "type": "boolean", + "description": "If set, an additional chunk will be streamed before the `data: [DONE]`\nmessage. The `usage` field on this chunk shows the token usage statistics\nfor the entire request, and the `choices` field will always be an empty\narray.\n\nAll other chunks will also include a `usage` field, but with a null\nvalue. **NOTE:** If the stream is interrupted, you may not receive the\nfinal usage chunk which contains the total token usage for the request.\n" + }, + "include_obfuscation": { + "type": "boolean", + "description": "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events to\nnormalize payload sizes as a mitigation to certain side-channel attacks.\nThese obfuscation fields are included by default, but add a small amount\nof overhead to the data stream. You can set `include_obfuscation` to\nfalse to optimize for bandwidth if you trust the network links between\nyour application and the OpenAI API.\n" } } }, { - "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessage" + "type": "null" } - ], - "required": [ - "role" ] }, - "FineTuneDPOHyperparameters": { + "ChatCompletionStreamResponseDelta": { "type": "object", - "description": "The hyperparameters used for the DPO fine-tuning job.", + "description": "A chat completion delta generated by streamed model responses.\nStreamed audio can arrive in partial updates with an ID, base64 data, or\ntranscript text. The final audio update contains only its expiry timestamp.\n", "properties": { - "beta": { - "description": "The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.\n", - "oneOf": [ - { + "audio": { + "type": "object", + "description": "A partial audio response. Audio chunks may carry an ID, base64 data, or\ntranscript text; the final audio update contains only its expiry timestamp.\n", + "properties": { + "id": { "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "description": "Unique identifier for this audio response." }, - { - "type": "number", - "minimum": 0, - "maximum": 2, - "exclusiveMinimum": true + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when this audio response will no\nlonger be accessible on the server for use in multi-turn conversations.\n" + }, + "data": { + "type": "string", + "description": "Base64 encoded audio bytes generated by the model, in the format\nspecified in the request.\n" + }, + "transcript": { + "type": "string", + "description": "Transcript text from this audio chunk." } - ], - "default": "auto" + } }, - "batch_size": { - "description": "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n", - "oneOf": [ + "content": { + "anyOf": [ { "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "description": "The contents of the chunk message." }, { - "type": "integer", - "minimum": 1, - "maximum": 256 + "type": "null" } - ], - "default": "auto" + ] }, - "learning_rate_multiplier": { - "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n", - "oneOf": [ - { + "function_call": { + "deprecated": true, + "type": "object", + "description": "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.", + "properties": { + "arguments": { "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "description": "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." }, - { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true + "name": { + "type": "string", + "description": "The name of the function to call." } + } + }, + "tool_calls": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionMessageToolCallChunk" + } + }, + "role": { + "type": "string", + "enum": [ + "developer", + "system", + "user", + "assistant", + "tool" ], - "default": "auto" + "description": "The role of the author of this message." }, - "n_epochs": { - "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n", - "oneOf": [ + "refusal": { + "anyOf": [ { "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "description": "The refusal message generated by the model." }, { - "type": "integer", - "minimum": 1, - "maximum": 50 + "type": "null" } - ], - "default": "auto" - } - } - }, - "FineTuneDPOMethod": { - "type": "object", - "description": "Configuration for the DPO fine-tuning method.", - "properties": { - "hyperparameters": { - "$ref": "#/components/schemas/FineTuneDPOHyperparameters" + ] } } }, - "FineTuneMethod": { + "ChatCompletionTokenLogprob": { "type": "object", - "description": "The method used for fine-tuning.", "properties": { - "type": { - "type": "string", - "description": "The type of method. Is either `supervised`, `dpo`, or `reinforcement`.", - "enum": [ - "supervised", - "dpo", - "reinforcement" - ] - }, - "supervised": { - "$ref": "#/components/schemas/FineTuneSupervisedMethod" + "token": { + "description": "The token.", + "type": "string" }, - "dpo": { - "$ref": "#/components/schemas/FineTuneDPOMethod" + "logprob": { + "description": "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.", + "type": "number" }, - "reinforcement": { - "$ref": "#/components/schemas/FineTuneReinforcementMethod" - } - }, - "required": [ - "type" - ] - }, - "FineTuneReinforcementHyperparameters": { - "type": "object", - "description": "The hyperparameters used for the reinforcement fine-tuning job.", - "properties": { - "batch_size": { - "description": "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n", - "oneOf": [ + "bytes": { + "anyOf": [ { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "description": "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.", + "type": "array", + "items": { + "type": "integer" + } }, { - "type": "integer", - "minimum": 1, - "maximum": 256 + "type": "null" } - ], - "default": "auto" + ] }, - "learning_rate_multiplier": { - "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "top_logprobs": { + "description": "List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`.", + "type": "array", + "items": { + "type": "object", + "properties": { + "token": { + "description": "The token.", + "type": "string" + }, + "logprob": { + "description": "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.", + "type": "number" + }, + "bytes": { + "anyOf": [ + { + "description": "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.", + "type": "array", + "items": { + "type": "integer" + } + }, + { + "type": "null" + } + ] + } }, - { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - } + "required": [ + "token", + "logprob", + "bytes" + ] + } + } + }, + "required": [ + "token", + "logprob", + "bytes", + "top_logprobs" + ] + }, + "ChatCompletionTool": { + "type": "object", + "title": "Function tool", + "description": "A function tool that can be used to generate a response.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" ], - "default": "auto" + "description": "The type of the tool. Currently, only `function` is supported.", + "x-stainless-const": true }, - "n_epochs": { - "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "integer", - "minimum": 1, - "maximum": 50 - } - ], - "default": "auto" + "function": { + "$ref": "#/components/schemas/FunctionObject" + } + }, + "required": [ + "type", + "function" + ] + }, + "ChatCompletionToolChoiceOption": { + "description": "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tool and instead generates a message.\n`auto` means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools.\nSpecifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n", + "oneOf": [ + { + "type": "string", + "title": "Tool choice mode", + "description": "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n", + "enum": [ + "none", + "auto", + "required" + ] }, - "reasoning_effort": { - "description": "Level of reasoning effort.\n", + { + "$ref": "#/components/schemas/ChatCompletionAllowedToolsChoice" + }, + { + "$ref": "#/components/schemas/ChatCompletionNamedToolChoice" + }, + { + "$ref": "#/components/schemas/ChatCompletionNamedToolChoiceCustom" + } + ] + }, + "ChunkingStrategyRequestParam": { + "type": "object", + "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", + "oneOf": [ + { + "$ref": "#/components/schemas/AutoChunkingStrategyRequestParam" + }, + { + "$ref": "#/components/schemas/StaticChunkingStrategyRequestParam" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "CodeInterpreterFileOutput": { + "type": "object", + "title": "Code interpreter file output", + "description": "The output of a code interpreter tool call that is a file.\n", + "properties": { + "type": { "type": "string", "enum": [ - "default", - "low", - "medium", - "high" + "files" ], - "default": "default" + "description": "The type of the code interpreter file output. Always `files`.\n", + "x-stainless-const": true }, - "compute_multiplier": { - "description": "Multiplier on amount of compute used for exploring search space during training.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "files": { + "type": "array", + "items": { + "type": "object", + "properties": { + "mime_type": { + "type": "string", + "description": "The MIME type of the file.\n" + }, + "file_id": { + "type": "string", + "description": "The ID of the file.\n" + } }, - { - "type": "number", - "minimum": 0.00001, - "maximum": 10, - "exclusiveMinimum": true - } + "required": [ + "mime_type", + "file_id" + ] + } + } + }, + "required": [ + "type", + "files" + ] + }, + "CodeInterpreterTextOutput": { + "type": "object", + "title": "Code interpreter text output", + "description": "The output of a code interpreter tool call that is text.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "logs" ], - "default": "auto" + "description": "The type of the code interpreter text output. Always `logs`.\n", + "x-stainless-const": true }, - "eval_interval": { - "description": "The number of training steps between evaluation runs.\n", + "logs": { + "type": "string", + "description": "The logs of the code interpreter tool call.\n" + } + }, + "required": [ + "type", + "logs" + ] + }, + "CodeInterpreterTool": { + "type": "object", + "title": "Code interpreter", + "description": "A tool that runs Python code to help generate a response to a prompt.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "code_interpreter" + ], + "description": "The type of the code interpreter tool. Always `code_interpreter`.\n", + "x-stainless-const": true + }, + "container": { + "description": "The code interpreter container. Can be a container ID or an object that\nspecifies uploaded file IDs to make available to your code, along with an\noptional `memory_limit` setting.\n", "oneOf": [ { "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "description": "The container ID." }, { - "type": "integer", - "minimum": 1 + "$ref": "#/components/schemas/AutoCodeInterpreterToolParam" } - ], - "default": "auto" + ] }, - "eval_samples": { - "description": "Number of evaluation samples to generate per training step.\n", - "oneOf": [ + "allowed_callers": { + "anyOf": [ { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/CallableToolAllowedCaller" + }, + "description": "The tool invocation context(s)." }, { - "type": "integer", - "minimum": 1 + "type": "null" } - ], - "default": "auto" + ] } - } + }, + "required": [ + "type", + "container" + ] }, - "FineTuneReinforcementMethod": { + "CodeInterpreterToolCall": { "type": "object", - "description": "Configuration for the reinforcement fine-tuning method.", + "title": "Code interpreter tool call", + "description": "A tool call to run code.\n", "properties": { - "grader": { - "type": "object", - "description": "The grader used for the fine-tuning job.", - "oneOf": [ - { - "$ref": "#/components/schemas/GraderStringCheck" - }, + "type": { + "type": "string", + "enum": [ + "code_interpreter_call" + ], + "default": "code_interpreter_call", + "x-stainless-const": true, + "description": "The type of the code interpreter tool call. Always `code_interpreter_call`.\n" + }, + "id": { + "type": "string", + "description": "The unique ID of the code interpreter tool call.\n" + }, + "status": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete", + "interpreting", + "failed" + ], + "description": "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n" + }, + "container_id": { + "type": "string", + "description": "The ID of the container used to run the code.\n" + }, + "code": { + "anyOf": [ { - "$ref": "#/components/schemas/GraderTextSimilarity" + "type": "string", + "description": "The code to run, or null if not available.\n" }, { - "$ref": "#/components/schemas/GraderPython" - }, + "type": "null" + } + ] + }, + "outputs": { + "anyOf": [ { - "$ref": "#/components/schemas/GraderScoreModel" + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/CodeInterpreterOutputLogs" + }, + { + "$ref": "#/components/schemas/CodeInterpreterOutputImage" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "discriminator": { + "propertyName": "type" + }, + "description": "The outputs generated by the code interpreter, such as logs or images.\nCan be null if no outputs are available.\n" }, { - "$ref": "#/components/schemas/GraderMulti" + "type": "null" } ] - }, - "hyperparameters": { - "$ref": "#/components/schemas/FineTuneReinforcementHyperparameters" } }, "required": [ - "grader" + "type", + "id", + "status", + "container_id", + "code", + "outputs" ] }, - "FineTuneSupervisedHyperparameters": { + "ComparisonFilter": { "type": "object", - "description": "The hyperparameters used for the fine-tuning job.", + "additionalProperties": false, + "title": "Comparison Filter", + "description": "A filter used to compare a specified attribute key to a given value using a defined comparison operation.\n", "properties": { - "batch_size": { - "description": "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "integer", - "minimum": 1, - "maximum": 256 - } + "type": { + "type": "string", + "default": "eq", + "enum": [ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "in", + "nin" ], - "default": "auto" + "description": "Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\n- `eq`: equals\n- `ne`: not equal\n- `gt`: greater than\n- `gte`: greater than or equal\n- `lt`: less than\n- `lte`: less than or equal\n- `in`: in\n- `nin`: not in\n" }, - "learning_rate_multiplier": { - "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n", + "key": { + "type": "string", + "description": "The key to compare against the value." + }, + "value": { "oneOf": [ { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "type": "string" }, { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - } - ], - "default": "auto" - }, - "n_epochs": { - "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n", - "oneOf": [ + "type": "number" + }, { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true + "type": "boolean" }, { - "type": "integer", - "minimum": 1, - "maximum": 50 + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } } ], - "default": "auto" + "description": "The value to compare against the attribute key; supports string, number, or boolean types." } + }, + "required": [ + "type", + "key", + "value" + ], + "x-oaiMeta": { + "name": "ComparisonFilter" } }, - "FineTuneSupervisedMethod": { + "CompleteUploadRequest": { "type": "object", - "description": "Configuration for the supervised fine-tuning method.", + "additionalProperties": false, "properties": { - "hyperparameters": { - "$ref": "#/components/schemas/FineTuneSupervisedHyperparameters" + "part_ids": { + "type": "array", + "description": "The ordered list of Part IDs.\n", + "items": { + "type": "string" + } + }, + "md5": { + "description": "The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.\n", + "type": "string" } - } + }, + "required": [ + "part_ids" + ] }, - "FineTuningCheckpointPermission": { + "CompletionUsage": { "type": "object", - "title": "FineTuningCheckpointPermission", - "description": "The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.\n", + "description": "Usage statistics for the completion request.", "properties": { - "id": { - "type": "string", - "description": "The permission identifier, which can be referenced in the API endpoints." + "completion_tokens": { + "type": "integer", + "default": 0, + "description": "Number of tokens in the generated completion." }, - "created_at": { + "prompt_tokens": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the permission was created." + "default": 0, + "description": "Number of tokens in the prompt." }, - "project_id": { - "type": "string", - "description": "The project identifier that the permission is for." + "total_tokens": { + "type": "integer", + "default": 0, + "description": "Total number of tokens used in the request (prompt + completion)." }, - "object": { - "type": "string", - "description": "The object type, which is always \"checkpoint.permission\".", - "enum": [ - "checkpoint.permission" - ], - "x-stainless-const": true + "completion_tokens_details": { + "type": "object", + "description": "Breakdown of tokens used in a completion.", + "properties": { + "accepted_prediction_tokens": { + "type": "integer", + "default": 0, + "description": "When using Predicted Outputs, the number of tokens in the\nprediction that appeared in the completion.\n" + }, + "audio_tokens": { + "type": "integer", + "default": 0, + "description": "Audio input tokens generated by the model." + }, + "reasoning_tokens": { + "type": "integer", + "default": 0, + "description": "Tokens generated by the model for reasoning." + }, + "text_tokens": { + "type": "integer", + "description": "Text output tokens generated by the model." + }, + "rejected_prediction_tokens": { + "type": "integer", + "default": 0, + "description": "When using Predicted Outputs, the number of tokens in the\nprediction that did not appear in the completion. However, like\nreasoning tokens, these tokens are still counted in the total\ncompletion tokens for purposes of billing, output, and context window\nlimits.\n" + } + } + }, + "prompt_tokens_details": { + "type": "object", + "description": "Breakdown of tokens used in the prompt.", + "properties": { + "audio_tokens": { + "type": "integer", + "default": 0, + "description": "Audio input tokens present in the prompt." + }, + "cached_tokens": { + "type": "integer", + "default": 0, + "description": "Cached tokens present in the prompt." + }, + "text_tokens": { + "type": "integer", + "description": "Text input tokens present in the prompt." + }, + "image_tokens": { + "type": "integer", + "description": "Image input tokens present in the prompt." + }, + "cache_write_tokens": { + "type": "integer", + "default": 0, + "description": "The unadjusted number of prompt tokens written to cache." + } + } } }, "required": [ - "created_at", - "id", - "object", - "project_id" - ], - "x-oaiMeta": { - "name": "The fine-tuned model checkpoint permission object", - "example": "{\n \"object\": \"checkpoint.permission\",\n \"id\": \"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"created_at\": 1712211699,\n \"project_id\": \"proj_abGMw1llN8IrBb6SvvY5A1iH\"\n}\n" - } + "prompt_tokens", + "completion_tokens", + "total_tokens" + ] }, - "FineTuningIntegration": { + "CompoundFilter": { "type": "object", - "title": "Fine-Tuning Job Integration", - "required": [ - "type", - "wandb" - ], + "additionalProperties": false, + "title": "Compound Filter", + "description": "Combine multiple filters using `and` or `or`.", "properties": { "type": { "type": "string", - "description": "The type of the integration being enabled for the fine-tuning job", + "description": "Type of operation: `and` or `or`.", "enum": [ - "wandb" - ], - "x-stainless-const": true + "and", + "or" + ] }, - "wandb": { - "type": "object", - "description": "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n", - "required": [ - "project" - ], - "properties": { - "project": { - "description": "The name of the project that the new run will be created under.\n", - "type": "string", - "example": "my-wandb-project" - }, - "name": { - "anyOf": [ - { - "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n", - "type": "string" - }, - { - "type": "null" - } - ] - }, - "entity": { - "anyOf": [ - { - "description": "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n", - "type": "string" - }, - { - "type": "null" - } - ] - }, - "tags": { - "description": "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n", - "type": "array", - "items": { - "type": "string", - "example": "custom-tag" + "filters": { + "type": "array", + "description": "Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/ComparisonFilter" + }, + { + "$ref": "#/components/schemas/CompoundFilter" } + ], + "discriminator": { + "propertyName": "type" } } } + }, + "required": [ + "type", + "filters" + ], + "x-oaiMeta": { + "name": "CompoundFilter" } }, - "FineTuningJob": { - "type": "object", - "title": "FineTuningJob", - "description": "The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.\n", - "properties": { - "id": { - "type": "string", - "description": "The object identifier, which can be referenced in the API endpoints." + "ComputerAction": { + "oneOf": [ + { + "$ref": "#/components/schemas/ClickParam" }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the fine-tuning job was created." + { + "$ref": "#/components/schemas/DoubleClickAction" }, - "error": { - "anyOf": [ - { - "type": "object", - "description": "For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.", - "properties": { - "code": { - "type": "string", - "description": "A machine-readable error code." - }, - "message": { - "type": "string", - "description": "A human-readable error message." - }, - "param": { - "anyOf": [ - { - "type": "string", - "description": "The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific." - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "code", - "message", - "param" - ] - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/DragParam" }, - "fine_tuned_model": { - "anyOf": [ - { - "type": "string", - "description": "The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running." - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/KeyPressAction" }, - "finished_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running." - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/MoveParam" }, - "hyperparameters": { - "type": "object", - "description": "The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs.", - "properties": { - "batch_size": { - "anyOf": [ - { - "description": "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "integer", - "minimum": 1, - "maximum": 256 - } - ], - "default": "auto" - }, - { - "type": "null" - } - ] - }, - "learning_rate_multiplier": { - "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - } - ], - "default": "auto" - }, - "n_epochs": { - "description": "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "integer", - "minimum": 1, - "maximum": 50 - } - ], - "default": "auto" - } - } + { + "$ref": "#/components/schemas/ScreenshotParam" }, - "model": { - "type": "string", - "description": "The base model that is being fine-tuned." + { + "$ref": "#/components/schemas/ScrollParam" }, - "object": { + { + "$ref": "#/components/schemas/TypeParam" + }, + { + "$ref": "#/components/schemas/WaitParam" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "ComputerActionList": { + "title": "Computer Action List", + "type": "array", + "description": "Flattened batched actions for `computer_use`. Each action includes an\n`type` discriminator and action-specific fields.\n", + "items": { + "$ref": "#/components/schemas/ComputerAction" + } + }, + "ComputerScreenshotImage": { + "type": "object", + "description": "A computer screenshot image used with the computer use tool.\n", + "properties": { + "type": { "type": "string", - "description": "The object type, which is always \"fine_tuning.job\".", "enum": [ - "fine_tuning.job" + "computer_screenshot" ], + "default": "computer_screenshot", + "description": "Specifies the event type. For a computer screenshot, this property is \nalways set to `computer_screenshot`.\n", "x-stainless-const": true }, - "organization_id": { + "image_url": { "type": "string", - "description": "The organization that owns the fine-tuning job." - }, - "result_files": { - "type": "array", - "description": "The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content).", - "items": { - "type": "string", - "example": "file-abc123" - } + "format": "uri", + "description": "The URL of the screenshot image." }, - "status": { + "file_id": { + "type": "string", + "description": "The identifier of an uploaded file that contains the screenshot." + } + }, + "required": [ + "type" + ] + }, + "ComputerToolCall": { + "type": "object", + "title": "Computer tool call", + "description": "A tool call to a computer use tool. See the\n[computer use guide](https://developers.openai.com/api/docs/guides/tools-computer-use) for more information.\n", + "properties": { + "type": { "type": "string", - "description": "The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.", + "description": "The type of the computer call. Always `computer_call`.", "enum": [ - "validating_files", - "queued", - "running", - "succeeded", - "failed", - "cancelled" - ] + "computer_call" + ], + "default": "computer_call" }, - "trained_tokens": { - "anyOf": [ - { - "type": "integer", - "description": "The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running." - }, - { - "type": "null" - } - ] + "id": { + "type": "string", + "description": "The unique ID of the computer call." }, - "training_file": { + "call_id": { "type": "string", - "description": "The file ID used for training. You can retrieve the training data with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content)." + "description": "An identifier used when responding to the tool call with output.\n" }, - "validation_file": { - "anyOf": [ - { - "type": "string", - "description": "The file ID used for validation. You can retrieve the validation results with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content)." - }, - { - "type": "null" - } - ] + "action": { + "$ref": "#/components/schemas/ComputerAction" }, - "integrations": { - "anyOf": [ - { - "type": "array", - "description": "A list of integrations to enable for this fine-tuning job.", - "maxItems": 5, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/FineTuningIntegration" - } - ] - } - }, - { - "type": "null" - } - ] + "actions": { + "$ref": "#/components/schemas/ComputerActionList" }, - "seed": { - "type": "integer", - "description": "The seed used for the fine-tuning job." + "pending_safety_checks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ComputerCallSafetyCheckParam" + }, + "description": "The pending safety checks for the computer call.\n" }, - "estimated_finish": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running." - }, - { - "type": "null" - } + "status": { + "type": "string", + "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "enum": [ + "in_progress", + "completed", + "incomplete" ] - }, - "method": { - "$ref": "#/components/schemas/FineTuneMethod" - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" } }, "required": [ - "created_at", - "error", - "finished_at", - "fine_tuned_model", - "hyperparameters", + "type", "id", - "model", - "object", - "organization_id", - "result_files", - "status", - "trained_tokens", - "training_file", - "validation_file", - "seed" - ], - "x-oaiMeta": { - "name": "The fine-tuning job object", - "example": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"davinci-002\",\n \"created_at\": 1692661014,\n \"finished_at\": 1692661190,\n \"fine_tuned_model\": \"ft:davinci-002:my-org:custom_suffix:7q8mpxmy\",\n \"organization_id\": \"org-123\",\n \"result_files\": [\n \"file-abc123\"\n ],\n \"status\": \"succeeded\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n },\n \"trained_tokens\": 5768,\n \"integrations\": [],\n \"seed\": 0,\n \"estimated_finish\": 0,\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n }\n }\n },\n \"metadata\": {\n \"key\": \"value\"\n }\n}\n" - } + "call_id", + "pending_safety_checks", + "status" + ] }, - "FineTuningJobCheckpoint": { + "ComputerToolCallOutput": { "type": "object", - "title": "FineTuningJobCheckpoint", - "description": "The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.\n", + "title": "Computer tool call output", + "description": "The output of a computer tool call.\n", "properties": { - "id": { + "type": { "type": "string", - "description": "The checkpoint identifier, which can be referenced in the API endpoints." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the checkpoint was created." + "description": "The type of the computer tool call output. Always `computer_call_output`.\n", + "enum": [ + "computer_call_output" + ], + "default": "computer_call_output", + "x-stainless-const": true }, - "fine_tuned_model_checkpoint": { + "id": { "type": "string", - "description": "The name of the fine-tuned checkpoint model that is created." + "description": "The ID of the computer tool call output.\n" }, - "step_number": { - "type": "integer", - "description": "The step number that the checkpoint was created at." + "call_id": { + "type": "string", + "description": "The ID of the computer tool call that produced the output.\n" }, - "metrics": { - "type": "object", - "description": "Metrics at the step number during the fine-tuning job.", - "properties": { - "step": { - "type": "number" - }, - "train_loss": { - "type": "number" - }, - "train_mean_token_accuracy": { - "type": "number" - }, - "valid_loss": { - "type": "number" - }, - "valid_mean_token_accuracy": { - "type": "number" - }, - "full_valid_loss": { - "type": "number" - }, - "full_valid_mean_token_accuracy": { - "type": "number" - } + "acknowledged_safety_checks": { + "type": "array", + "description": "The safety checks reported by the API that have been acknowledged by the\ndeveloper.\n", + "items": { + "$ref": "#/components/schemas/ComputerCallSafetyCheckParam" } }, - "fine_tuning_job_id": { + "output": { + "$ref": "#/components/schemas/ComputerScreenshotImage" + }, + "status": { "type": "string", - "description": "The name of the fine-tuning job that this checkpoint was created from." + "description": "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + } + }, + "required": [ + "type", + "call_id", + "output" + ] + }, + "ComputerToolCallOutputResource": { + "allOf": [ + { + "$ref": "#/components/schemas/ComputerToolCallOutput" }, + { + "type": "object", + "properties": { + "status": { + "description": "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n", + "$ref": "#/components/schemas/ComputerCallOutputStatus" + }, + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item.\n" + } + }, + "required": [ + "id", + "status" + ] + } + ] + }, + "ContainerFileListResource": { + "type": "object", + "properties": { "object": { "type": "string", - "description": "The object type, which is always \"fine_tuning.job.checkpoint\".", "enum": [ - "fine_tuning.job.checkpoint" + "list" ], - "x-stainless-const": true + "description": "The type of object returned, must be 'list'." + }, + "data": { + "type": "array", + "description": "A list of container files.", + "items": { + "$ref": "#/components/schemas/ContainerFileResource" + } + }, + "first_id": { + "type": "string", + "description": "The ID of the first file in the list." + }, + "last_id": { + "type": "string", + "description": "The ID of the last file in the list." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more files available." } }, "required": [ - "created_at", - "fine_tuning_job_id", - "fine_tuned_model_checkpoint", - "id", - "metrics", "object", - "step_number" - ], - "x-oaiMeta": { - "name": "The fine-tuning job checkpoint object", - "example": "{\n \"object\": \"fine_tuning.job.checkpoint\",\n \"id\": \"ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P\",\n \"created_at\": 1712211699,\n \"fine_tuned_model_checkpoint\": \"ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88\",\n \"fine_tuning_job_id\": \"ftjob-fpbNQ3H1GrMehXRf8cO97xTN\",\n \"metrics\": {\n \"step\": 88,\n \"train_loss\": 0.478,\n \"train_mean_token_accuracy\": 0.924,\n \"valid_loss\": 10.112,\n \"valid_mean_token_accuracy\": 0.145,\n \"full_valid_loss\": 0.567,\n \"full_valid_mean_token_accuracy\": 0.944\n },\n \"step_number\": 88\n}\n" - } + "data", + "first_id", + "last_id", + "has_more" + ] }, - "FineTuningJobEvent": { + "ContainerFileResource": { "type": "object", - "description": "Fine-tuning job event object", + "title": "The container file object", "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the file." + }, "object": { "type": "string", - "description": "The object type, which is always \"fine_tuning.job.event\".", - "enum": [ - "fine_tuning.job.event" - ], - "x-stainless-const": true + "description": "The type of this object (`container.file`)." }, - "id": { + "container_id": { "type": "string", - "description": "The object identifier." + "description": "The container this file belongs to." }, "created_at": { "type": "integer", "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the fine-tuning job was created." + "description": "Unix timestamp (in seconds) when the file was created." }, - "level": { - "type": "string", - "description": "The log level of the event.", - "enum": [ - "info", - "warn", - "error" - ] + "bytes": { + "type": "integer", + "description": "Size of the file in bytes." }, - "message": { + "path": { "type": "string", - "description": "The message of the event." + "description": "Path of the file in the container." }, - "type": { + "source": { "type": "string", - "description": "The type of event.", - "enum": [ - "message", - "metrics" - ] - }, - "data": { - "type": "object", - "description": "The data associated with the event." + "description": "Source of the file (e.g., `user`, `assistant`)." } }, "required": [ "id", "object", "created_at", - "level", - "message" + "bytes", + "container_id", + "path", + "source" ], "x-oaiMeta": { - "name": "The fine-tuning job event object", - "example": "{\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ftevent-abc123\"\n \"created_at\": 1677610602,\n \"level\": \"info\",\n \"message\": \"Created fine-tuning job\",\n \"data\": {},\n \"type\": \"message\"\n}\n" - } - }, - "FunctionAndCustomToolCallOutput": { - "oneOf": [ - { - "$ref": "#/components/schemas/InputTextContent" - }, - { - "$ref": "#/components/schemas/InputImageContent" - }, - { - "$ref": "#/components/schemas/InputFileContent" - } - ], - "discriminator": { - "propertyName": "type" + "name": "The container file object", + "example": "{\n \"id\": \"cfile_682e0e8a43c88191a7978f477a09bdf5\",\n \"object\": \"container.file\",\n \"created_at\": 1747848842,\n \"bytes\": 880,\n \"container_id\": \"cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04\",\n \"path\": \"/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json\",\n \"source\": \"user\"\n}\n" } }, - "FunctionObject": { - "type": "object", - "properties": { - "description": { - "type": "string", - "description": "A description of what the function does, used by the model to choose when and how to call the function." - }, - "name": { - "type": "string", - "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." - }, - "parameters": { - "$ref": "#/components/schemas/FunctionParameters" - }, - "strict": { - "anyOf": [ - { - "type": "boolean", - "default": false, - "description": "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://developers.openai.com/api/docs/guides/function-calling)." - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "name" - ] - }, - "FunctionParameters": { - "type": "object", - "description": "The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://developers.openai.com/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.\n\nOmitting `parameters` defines a function with an empty parameter list.", - "additionalProperties": true - }, - "FunctionToolCall": { + "ContainerListResource": { "type": "object", - "title": "Function tool call", - "description": "A tool call to run a function. See the\n[function calling guide](https://developers.openai.com/api/docs/guides/function-calling) for more information.\n", "properties": { - "id": { - "type": "string", - "description": "The unique ID of the function tool call.\n" - }, - "type": { + "object": { "type": "string", "enum": [ - "function_call" + "list" ], - "description": "The type of the function tool call. Always `function_call`.\n", - "x-stainless-const": true - }, - "call_id": { - "type": "string", - "description": "The unique ID of the function tool call generated by the model.\n" - }, - "caller": { - "anyOf": [ - { - "$ref": "#/components/schemas/ToolCallCaller" - }, - { - "type": "null" - } - ] - }, - "namespace": { - "type": "string", - "description": "The namespace of the function to run.\n" + "description": "The type of object returned, must be 'list'." }, - "name": { - "type": "string", - "description": "The name of the function to run.\n" + "data": { + "type": "array", + "description": "A list of containers.", + "items": { + "$ref": "#/components/schemas/ContainerResource" + } }, - "arguments": { + "first_id": { "type": "string", - "description": "A JSON string of the arguments to pass to the function.\n" + "description": "The ID of the first container in the list." }, - "status": { + "last_id": { "type": "string", - "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", - "enum": [ - "in_progress", - "completed", - "incomplete" - ] + "description": "The ID of the last container in the list." }, - "async": { + "has_more": { "type": "boolean", - "description": "Whether the function tool call runs asynchronously.\n" + "description": "Whether there are more containers available." } }, "required": [ - "type", - "call_id", - "name", - "arguments" + "object", + "data", + "first_id", + "last_id", + "has_more" ] }, - "FunctionToolCallOutput": { + "ContainerResource": { "type": "object", - "title": "Function tool call output", - "description": "The output of a function tool call.\n", + "title": "The container object", "properties": { "id": { "type": "string", - "description": "The unique ID of the function tool call output. Populated when this item\nis returned via API.\n" - }, - "type": { - "type": "string", - "enum": [ - "function_call_output" - ], - "description": "The type of the function tool call output. Always `function_call_output`.\n", - "x-stainless-const": true + "description": "Unique identifier for the container." }, - "call_id": { + "object": { "type": "string", - "description": "The unique ID of the function tool call generated by the model.\n" + "description": "The type of this object." }, "name": { "type": "string", - "description": "The name of the tool that produced the output.\n" + "description": "Name of the container." }, - "namespace": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the container was created." + }, + "status": { "type": "string", - "description": "The namespace of the tool that produced the output.\n" + "description": "Status of the container (e.g., active, deleted)." }, - "caller": { - "anyOf": [ - { - "$ref": "#/components/schemas/ToolCallCallerParam" - }, - { - "type": "null" - } - ] + "last_active_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the container was last active." }, - "output": { - "description": "The output from the function call generated by your code.\nCan be a string or an list of output content.\n", - "oneOf": [ - { + "expires_after": { + "type": "object", + "description": "The container will expire after this time period.\nThe anchor is the reference point for the expiration.\nThe minutes is the number of minutes after the anchor before the container expires.\n", + "properties": { + "anchor": { "type": "string", - "description": "A string of the output of the function call.\n", - "title": "string output" + "description": "The reference point for the expiration.", + "enum": [ + "last_active_at" + ] }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/FunctionAndCustomToolCallOutput" - }, - "title": "output content list", - "description": "Text, image, or file output of the function call.\n" + "minutes": { + "type": "integer", + "description": "The number of minutes after the anchor before the container expires." } - ] + } }, - "status": { + "memory_limit": { "type": "string", - "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "description": "The memory limit configured for the container.", "enum": [ - "in_progress", - "completed", - "incomplete" + "1g", + "4g", + "16g", + "64g" ] - } - }, - "required": [ - "type", - "output" - ] - }, - "FunctionToolCallOutputResource": { - "allOf": [ - { - "$ref": "#/components/schemas/FunctionToolCallOutput" }, - { + "network_policy": { + "description": "Network access policy for the container.", "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "The unique ID of the function call tool output.\n" - }, - "status": { - "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", - "$ref": "#/components/schemas/FunctionCallOutputStatusEnum" + "description": "The network policy mode.", + "enum": [ + "allowlist", + "disabled" + ] }, - "created_by": { - "type": "string", - "description": "The identifier of the actor that created the item.\n" + "allowed_domains": { + "type": "array", + "description": "Allowed outbound domains when `type` is `allowlist`.", + "items": { + "type": "string" + } } }, "required": [ - "id", - "status" + "type" ] } - ] + }, + "required": [ + "id", + "object", + "name", + "created_at", + "status" + ], + "x-oaiMeta": { + "name": "The container object", + "example": "{\n \"id\": \"cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863\",\n \"object\": \"container\",\n \"created_at\": 1747844794,\n \"status\": \"running\",\n \"expires_after\": {\n \"anchor\": \"last_active_at\",\n \"minutes\": 20\n },\n \"last_active_at\": 1747844794,\n \"memory_limit\": \"1g\",\n \"name\": \"My Container\"\n}\n" + } }, - "FunctionToolCallResource": { - "allOf": [ + "Content": { + "description": "Multi-modal input and output contents.\n", + "oneOf": [ { - "$ref": "#/components/schemas/FunctionToolCall" + "title": "Input content types", + "$ref": "#/components/schemas/InputContent" }, { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the function tool call.\n" - }, - "status": { - "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", - "$ref": "#/components/schemas/FunctionCallStatus" - }, - "created_by": { - "type": "string", - "description": "The identifier of the actor that created the item.\n" - } - }, - "required": [ - "id", - "status" - ] + "title": "Output content types", + "$ref": "#/components/schemas/OutputContent" } ] }, - "GraderLabelModel": { - "type": "object", - "title": "LabelModelGrader", - "description": "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n", - "properties": { - "type": { - "description": "The object type, which is always `label_model`.", - "type": "string", - "enum": [ - "label_model" - ], - "x-stainless-const": true + "ConversationItem": { + "title": "Conversation item", + "description": "A single item within a conversation. The set of possible types are the same as the `output` type of a [Response object](https://developers.openai.com/api/reference/resources/responses#%28resource%29%20responses%20%3E%20%28model%29%20response%20%3E%20%28schema%29%20%3E%20%28property%29%20output).", + "oneOf": [ + { + "$ref": "#/components/schemas/Message" }, - "name": { - "type": "string", - "description": "The name of the grader." + { + "$ref": "#/components/schemas/FunctionToolCallResource" }, - "model": { - "type": "string", - "description": "The model to use for the evaluation. Must support structured outputs." + { + "$ref": "#/components/schemas/FunctionToolCallOutputResource" }, - "input": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EvalItem" - } + { + "$ref": "#/components/schemas/FileSearchToolCall" }, - "labels": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The labels to assign to each item in the evaluation." + { + "$ref": "#/components/schemas/WebSearchToolCall" }, - "passing_labels": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The labels that indicate a passing result. Must be a subset of labels." - } - }, - "required": [ - "type", - "model", - "input", - "passing_labels", - "labels", - "name" - ], - "x-oaiMeta": { - "name": "Label Model Grader", - "group": "graders", - "example": "{\n \"name\": \"First label grader\",\n \"type\": \"label_model\",\n \"model\": \"gpt-4o-2024-08-06\",\n \"input\": [\n {\n \"type\": \"message\",\n \"role\": \"system\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Classify the sentiment of the following statement as one of positive, neutral, or negative\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Statement: {{item.response}}\"\n }\n }\n ],\n \"passing_labels\": [\n \"positive\"\n ],\n \"labels\": [\n \"positive\",\n \"neutral\",\n \"negative\"\n ]\n}\n" - } - }, - "GraderMulti": { - "type": "object", - "title": "MultiGrader", - "description": "A MultiGrader object combines the output of multiple graders to produce a single score.", - "properties": { - "type": { - "type": "string", - "enum": [ - "multi" - ], - "default": "multi", - "description": "The object type, which is always `multi`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ImageGenToolCall" }, - "name": { - "type": "string", - "description": "The name of the grader." + { + "$ref": "#/components/schemas/ComputerToolCall" }, - "graders": { - "oneOf": [ - { - "$ref": "#/components/schemas/GraderStringCheck" - }, - { - "$ref": "#/components/schemas/GraderTextSimilarity" - }, - { - "$ref": "#/components/schemas/GraderPython" - }, - { - "$ref": "#/components/schemas/GraderScoreModel" - }, - { - "$ref": "#/components/schemas/GraderLabelModel" - } - ] + { + "$ref": "#/components/schemas/ComputerToolCallOutputResource" }, - "calculate_output": { - "type": "string", - "description": "A formula to calculate the output based on grader results." - } - }, - "required": [ - "name", - "type", - "graders", - "calculate_output" - ], - "x-oaiMeta": { - "name": "Multi Grader", - "group": "graders", - "example": "{\n \"type\": \"multi\",\n \"name\": \"example multi grader\",\n \"graders\": [\n {\n \"type\": \"text_similarity\",\n \"name\": \"example text similarity grader\",\n \"input\": \"The graded text\",\n \"reference\": \"The reference text\",\n \"evaluation_metric\": \"fuzzy_match\"\n },\n {\n \"type\": \"string_check\",\n \"name\": \"Example string check grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"operation\": \"eq\"\n }\n ],\n \"calculate_output\": \"0.5 * text_similarity_score + 0.5 * string_check_score)\"\n}\n" - } - }, - "GraderPython": { - "type": "object", - "title": "PythonGrader", - "description": "A PythonGrader object that runs a python script on the input.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "python" - ], - "description": "The object type, which is always `python`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ToolSearchCall" }, - "name": { - "type": "string", - "description": "The name of the grader." + { + "$ref": "#/components/schemas/ToolSearchOutput" }, - "source": { - "type": "string", - "description": "The source code of the python script." + { + "$ref": "#/components/schemas/AdditionalTools" }, - "image_tag": { - "type": "string", - "description": "The image tag to use for the python script." - } - }, - "required": [ - "type", - "name", - "source" - ], - "x-oaiMeta": { - "name": "Python Grader", - "group": "graders", - "example": "{\n \"type\": \"python\",\n \"name\": \"Example python grader\",\n \"image_tag\": \"2025-05-08\",\n \"source\": \"\"\"\ndef grade(sample: dict, item: dict) -> float:\n \\\"\"\"\n Returns 1.0 if `output_text` equals `label`, otherwise 0.0.\n \\\"\"\"\n output = sample.get(\"output_text\")\n label = item.get(\"label\")\n return 1.0 if output == label else 0.0\n\"\"\",\n}\n" - } - }, - "GraderScoreModel": { - "type": "object", - "title": "ScoreModelGrader", - "description": "A ScoreModelGrader object that uses a model to assign a score to the input.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "score_model" - ], - "description": "The object type, which is always `score_model`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseConfigurationUpdate" }, - "name": { - "type": "string", - "description": "The name of the grader." + { + "$ref": "#/components/schemas/ReasoningItem" }, - "model": { - "type": "string", - "description": "The model to use for the evaluation." + { + "$ref": "#/components/schemas/Program" }, - "sampling_params": { - "type": "object", - "description": "The sampling parameters for the model.", - "properties": { - "seed": { - "anyOf": [ - { - "type": "integer", - "description": "A seed value to initialize the randomness, during sampling.\n" - }, - { - "type": "null" - } - ] - }, - "top_p": { - "anyOf": [ - { - "type": "number", - "default": 1, - "example": 1, - "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.\n" - }, - { - "type": "null" - } - ] - }, - "temperature": { - "anyOf": [ - { - "type": "number", - "description": "A higher temperature increases randomness in the outputs.\n" - }, - { - "type": "null" - } - ] - }, - "max_completions_tokens": { - "anyOf": [ - { - "type": "integer", - "minimum": 1, - "description": "The maximum number of tokens the grader model may generate in its response.\n" - }, - { - "type": "null" - } - ] - }, - "reasoning_effort": { - "$ref": "#/components/schemas/ReasoningEffort" - } - } + { + "$ref": "#/components/schemas/ProgramOutput" }, - "input": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EvalItem" - }, - "description": "The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.\n" + { + "$ref": "#/components/schemas/CompactionBody" }, - "range": { - "type": "array", - "items": { - "type": "number", - "min_items": 2, - "max_items": 2 - }, - "description": "The range of the score. Defaults to `[0, 1]`." - } - }, - "required": [ - "type", - "name", - "input", - "model" - ], - "x-oaiMeta": { - "name": "Score Model Grader", - "group": "graders", - "example": "{\n \"type\": \"score_model\",\n \"name\": \"Example score model grader\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": (\n \"Score how close the reference answer is to the model answer. Score 1.0 if they are the same and 0.0 if they are different.\"\n \" Return just a floating point score\\n\\n\"\n \" Reference answer: {{item.label}}\\n\\n\"\n \" Model answer: {{sample.output_text}}\"\n )\n },\n {\n \"type\": \"input_image\",\n \"image_url\": \"https://example.com/reference.png\",\n \"file_id\": null,\n \"detail\": \"auto\"\n }\n ],\n }\n ],\n \"model\": \"gpt-5-mini\",\n \"sampling_params\": {\n \"temperature\": 1,\n \"top_p\": 1,\n \"seed\": 42,\n \"max_completions_tokens\": 32768,\n \"reasoning_effort\": \"medium\"\n },\n}\n" - } - }, - "GraderStringCheck": { - "type": "object", - "title": "StringCheckGrader", - "description": "A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "string_check" - ], - "description": "The object type, which is always `string_check`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/CodeInterpreterToolCall" }, - "name": { - "type": "string", - "description": "The name of the grader." + { + "$ref": "#/components/schemas/LocalShellToolCall" }, - "input": { - "type": "string", - "description": "The input text. This may include template strings." + { + "$ref": "#/components/schemas/LocalShellToolCallOutput" }, - "reference": { - "type": "string", - "description": "The reference text. This may include template strings." + { + "$ref": "#/components/schemas/FunctionShellCall" }, - "operation": { - "type": "string", - "enum": [ - "eq", - "ne", - "like", - "ilike" - ], - "description": "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`." - } - }, - "required": [ - "type", - "name", - "input", - "reference", - "operation" - ], - "x-oaiMeta": { - "name": "String Check Grader", - "group": "graders", - "example": "{\n \"type\": \"string_check\",\n \"name\": \"Example string check grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"operation\": \"eq\"\n}\n" - } - }, - "GraderTextSimilarity": { - "type": "object", - "title": "TextSimilarityGrader", - "description": "A TextSimilarityGrader object which grades text based on similarity metrics.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "text_similarity" - ], - "default": "text_similarity", - "description": "The type of grader.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/FunctionShellCallOutput" }, - "name": { - "type": "string", - "description": "The name of the grader." + { + "$ref": "#/components/schemas/ApplyPatchToolCall" }, - "input": { - "type": "string", - "description": "The text being graded." + { + "$ref": "#/components/schemas/ApplyPatchToolCallOutput" }, - "reference": { - "type": "string", - "description": "The text being graded against." + { + "$ref": "#/components/schemas/MCPListTools" }, - "evaluation_metric": { - "type": "string", - "enum": [ - "cosine", - "fuzzy_match", - "bleu", - "gleu", - "meteor", - "rouge_1", - "rouge_2", - "rouge_3", - "rouge_4", - "rouge_5", - "rouge_l" - ], - "description": "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n" + { + "$ref": "#/components/schemas/MCPApprovalRequest" + }, + { + "$ref": "#/components/schemas/MCPApprovalResponseResource" + }, + { + "$ref": "#/components/schemas/MCPToolCall" + }, + { + "$ref": "#/components/schemas/CustomToolCall" + }, + { + "$ref": "#/components/schemas/CustomToolCallOutput" } - }, - "required": [ - "type", - "name", - "input", - "reference", - "evaluation_metric" ], - "x-oaiMeta": { - "name": "Text Similarity Grader", - "group": "graders", - "example": "{\n \"type\": \"text_similarity\",\n \"name\": \"Example text similarity grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"evaluation_metric\": \"fuzzy_match\"\n}\n" + "discriminator": { + "propertyName": "type" } }, - "Group": { + "ConversationItemList": { "type": "object", - "description": "Summary information about a group returned in role assignment responses.", + "title": "The conversation item list", + "description": "A list of Conversation items.", "properties": { "object": { "type": "string", + "description": "The type of object returned, must be `list`.", "enum": [ - "group" + "list" ], - "description": "Always `group`.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "Identifier for the group." + "data": { + "type": "array", + "description": "A list of conversation items.", + "items": { + "$ref": "#/components/schemas/ConversationItem" + } }, - "name": { - "type": "string", - "description": "Display name of the group." + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the group was created." + "first_id": { + "type": "string", + "description": "The ID of the first item in the list." }, - "scim_managed": { - "type": "boolean", - "description": "Whether the group is managed through SCIM." + "last_id": { + "type": "string", + "description": "The ID of the last item in the list." } }, "required": [ "object", - "id", - "name", - "created_at", - "scim_managed" + "data", + "has_more", + "first_id", + "last_id" ], "x-oaiMeta": { - "name": "The group object", - "example": "{\n \"object\": \"group\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"scim_managed\": false\n}\n" + "name": "The item list", + "group": "conversations" } }, - "GroupDeletedResource": { - "type": "object", - "description": "Confirmation payload returned after deleting a group.", - "properties": { - "object": { - "type": "string", - "enum": [ - "group.deleted" - ], - "description": "Always `group.deleted`.", - "x-stainless-const": true - }, - "id": { + "ConversationParam": { + "description": "The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.\nInput items and output items from this response are automatically added to this conversation after this response completes.\n", + "default": null, + "oneOf": [ + { "type": "string", - "description": "Identifier of the deleted group." + "title": "Conversation ID", + "description": "The unique ID of the conversation.\n" }, - "deleted": { - "type": "boolean", - "description": "Whether the group was deleted." + { + "$ref": "#/components/schemas/ConversationParam-2" } - }, - "required": [ - "object", - "id", - "deleted" - ], - "x-oaiMeta": { - "example": "{\n \"object\": \"group.deleted\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"deleted\": true\n}\n" - } + ] }, - "GroupListResource": { + "CostsResult": { "type": "object", - "description": "Paginated list of organization groups.", + "description": "The aggregated costs details of the specific time bucket.", "properties": { + "api_source": { + "description": "When grouped by `api_source`, `agents_api` identifies attributed Agents API activity and `unlabeled` includes all records without published source attribution, including historical and unknown origins. Unlabeled does not imply direct API usage. Without source grouping, this field is null.", + "anyOf": [ + { + "type": "string", + "enum": [ + "agents_api", + "unlabeled" + ] + }, + { + "type": "null" + } + ] + }, "object": { "type": "string", "enum": [ - "list" + "organization.costs.result" ], - "description": "Always `list`.", "x-stainless-const": true }, - "data": { - "type": "array", - "description": "Groups returned in the current page.", - "items": { - "$ref": "#/components/schemas/GroupResponse" + "amount": { + "type": "object", + "description": "The monetary value in its associated currency.", + "properties": { + "value": { + "type": "number", + "description": "The numeric value of the cost." + }, + "currency": { + "type": "string", + "description": "Lowercase ISO-4217 currency e.g. \"usd\"" + } } }, - "has_more": { - "type": "boolean", - "description": "Whether additional groups are available when paginating." - }, - "next": { - "description": "Cursor to fetch the next page of results, or `null` if there are no more results.", + "line_item": { "anyOf": [ { - "type": "string" + "type": "string", + "description": "When `group_by=line_item`, this field provides the line item of the grouped costs result." }, { "type": "null" } ] - } - }, - "required": [ - "object", - "data", - "has_more", - "next" - ], - "x-oaiMeta": { - "name": "Group list", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"is_scim_managed\": false\n },\n {\n \"id\": \"group_01J1F8PQRMNO\",\n \"name\": \"Sales\",\n \"created_at\": 1711472599,\n \"is_scim_managed\": true\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" - } - }, - "GroupMemberUser": { - "type": "object", - "description": "Details about a user returned from an organization group membership lookup.", - "properties": { - "id": { - "type": "string", - "description": "Identifier for the user." }, - "name": { - "type": "string", - "description": "Display name of the user." + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped costs result." + }, + { + "type": "null" + } + ] }, - "email": { - "description": "Email address of the user, or `null` for users without an email.", + "user_id": { "anyOf": [ { - "type": "string" + "type": "string", + "description": "When `group_by=user_id`, this field provides the user ID of the grouped costs result." }, { "type": "null" } ] }, - "picture": { - "description": "URL of the user's profile picture, if available.", + "api_key_id": { "anyOf": [ { - "type": "string" + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result." }, { "type": "null" } ] }, - "is_service_account": { - "description": "Whether the user is a service account.", + "quantity": { "anyOf": [ { - "type": "boolean" + "type": "number", + "description": "When `group_by=line_item`, this field provides the quantity of the grouped costs result." }, { "type": "null" } ] }, - "user_type": { - "type": "string", - "enum": [ - "user", - "tenant_user" - ], - "description": "The type of user." + "quantity_unit": { + "description": "The unit of the `quantity` value. If no single supported unit applies to the result, this field is `null`.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "tokens", + "1000_tokens", + "duration_seconds", + "duration_minutes", + "duration_hours", + "gibibyte_hours", + "images", + "characters" + ] + }, + { + "type": "null" + } + ] } }, "required": [ - "id", - "name", - "email", - "picture", - "is_service_account", - "user_type" + "object" ], "x-oaiMeta": { - "name": "The group member user object", - "example": "{\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\",\n \"picture\": null,\n \"is_service_account\": false,\n \"user_type\": \"user\"\n}\n" + "name": "Costs object", + "example": "{\n \"object\": \"organization.costs.result\",\n \"amount\": {\n \"value\": 0.06,\n \"currency\": \"usd\"\n },\n \"line_item\": \"gpt-6-astra, input_tokens\",\n \"project_id\": \"proj_abc\",\n \"quantity\": 10000,\n \"quantity_unit\": \"tokens\"\n}\n" } }, - "GroupResourceWithSuccess": { + "CreateAssistantRequest": { "type": "object", - "description": "Response returned after updating a group.", + "additionalProperties": false, "properties": { - "id": { - "type": "string", - "description": "Identifier for the group." + "model": { + "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", + "example": "gpt-4.1", + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/AssistantSupportedModels" + } + ], + "x-oaiTypeLabel": "string" }, "name": { - "type": "string", - "description": "Updated display name for the group." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the group was created." + "anyOf": [ + { + "description": "The name of the assistant. The maximum length is 256 characters.\n", + "type": "string", + "maxLength": 256 + }, + { + "type": "null" + } + ] }, - "is_scim_managed": { - "type": "boolean", - "description": "Whether the group is managed through SCIM and controlled by your identity provider." - } - }, - "required": [ - "id", - "name", - "created_at", - "is_scim_managed" - ], - "x-oaiMeta": { - "example": "{\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Escalations\",\n \"created_at\": 1711471533,\n \"is_scim_managed\": false\n}\n" - } - }, - "GroupResponse": { - "type": "object", - "description": "Details about an organization group.", - "properties": { - "id": { - "type": "string", - "description": "Identifier for the group." + "description": { + "anyOf": [ + { + "description": "The description of the assistant. The maximum length is 512 characters.\n", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] }, - "name": { - "type": "string", - "description": "Display name of the group." + "instructions": { + "anyOf": [ + { + "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", + "type": "string", + "maxLength": 256000 + }, + { + "type": "null" + } + ] }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the group was created." + "reasoning_effort": { + "$ref": "#/components/schemas/ReasoningEffort" }, - "is_scim_managed": { - "type": "boolean", - "description": "Whether the group is managed through SCIM and controlled by your identity provider." + "tools": { + "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", + "default": [], + "type": "array", + "maxItems": 128, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ] + } }, - "group_type": { - "type": "string", - "enum": [ - "group", - "tenant_group" - ], - "description": "The type of the group." - } - }, - "required": [ - "id", - "name", - "created_at", - "is_scim_managed", - "group_type" - ], - "x-oaiMeta": { - "name": "Group", - "example": "{\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"is_scim_managed\": false,\n \"group_type\": \"group\"\n}\n" - } - }, - "GroupRoleAssignment": { - "type": "object", - "description": "Role assignment linking a group to a role.", - "properties": { - "object": { - "type": "string", - "enum": [ - "group.role" - ], - "description": "Always `group.role`.", - "x-stainless-const": true + "tool_resources": { + "anyOf": [ + { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "string" + } + }, + "vector_stores": { + "type": "array", + "description": "A helper to create a [vector store](https://developers.openai.com/api/reference/resources/vector_stores) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.\n", + "maxItems": 100000000, + "items": { + "type": "string" + } + }, + "chunking_strategy": { + "type": "object", + "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", + "oneOf": [ + { + "type": "object", + "title": "Auto Chunking Strategy", + "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `auto`.", + "enum": [ + "auto" + ], + "x-stainless-const": true + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "title": "Static Chunking Strategy", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `static`.", + "enum": [ + "static" + ], + "x-stainless-const": true + }, + "static": { + "type": "object", + "additionalProperties": false, + "properties": { + "max_chunk_size_tokens": { + "type": "integer", + "minimum": 100, + "maximum": 4096, + "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." + }, + "chunk_overlap_tokens": { + "type": "integer", + "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" + } + }, + "required": [ + "max_chunk_size_tokens", + "chunk_overlap_tokens" + ] + } + }, + "required": [ + "type", + "static" + ] + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + } + } + } + }, + "oneOf": [ + { + "required": [ + "vector_store_ids" + ] + }, + { + "required": [ + "vector_stores" + ] + } + ] + } + } + }, + { + "type": "null" + } + ] }, - "group": { - "$ref": "#/components/schemas/Group" + "metadata": { + "$ref": "#/components/schemas/Metadata" }, - "role": { - "$ref": "#/components/schemas/Role" - } - }, - "required": [ - "object", - "group", - "role" - ], - "x-oaiMeta": { - "name": "The group role object", - "example": "{\n \"object\": \"group.role\",\n \"group\": {\n \"object\": \"group\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"scim_managed\": false\n },\n \"role\": {\n \"object\": \"role\",\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"description\": \"Allows managing organization groups\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false\n }\n}\n" - } - }, - "GroupUser": { - "type": "object", - "description": "Represents an individual user returned when inspecting group membership.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" + "temperature": { + "anyOf": [ + { + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1 + }, + { + "type": "null" + } + ] }, - "name": { - "type": "string", - "description": "The name of the user." + "top_p": { + "anyOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + { + "type": "null" + } + ] }, - "email": { + "response_format": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption" }, { "type": "null" } - ], - "description": "The email address of the user." + ] } }, "required": [ - "id", - "name", - "email" + "model" ] }, - "GroupUserAssignment": { + "CreateBatchRequest": { "type": "object", - "description": "Confirmation payload returned after adding a user to a group.", - "properties": { - "object": { - "type": "string", - "enum": [ - "group.user" - ], - "description": "Always `group.user`.", - "x-stainless-const": true - }, - "user_id": { - "type": "string", - "description": "Identifier of the user that was added." - }, - "group_id": { - "type": "string", - "description": "Identifier of the group the user was added to." - } - }, "required": [ - "object", - "user_id", - "group_id" + "input_file_id", + "endpoint", + "completion_window" ], - "x-oaiMeta": { - "name": "The group user object", - "example": "{\n \"object\": \"group.user\",\n \"user_id\": \"user_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\"\n}\n" - } - }, - "GroupUserDeletedResource": { - "type": "object", - "description": "Confirmation payload returned after removing a user from a group.", "properties": { - "object": { + "input_file_id": { + "type": "string", + "description": "The ID of an uploaded file that contains requests for the new batch.\n\nSee [upload file](https://developers.openai.com/api/reference/resources/files/methods/create) for how to upload a file.\n\nYour input file must be formatted as a [JSONL file](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 200 MB in size.\n" + }, + "endpoint": { "type": "string", "enum": [ - "group.user.deleted" + "/v1/responses", + "/v1/chat/completions", + "/v1/embeddings", + "/v1/completions", + "/v1/moderations", + "/v1/images/generations", + "/v1/images/edits", + "/v1/videos" ], - "description": "Always `group.user.deleted`.", - "x-stainless-const": true + "description": "The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and `/v1/videos` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch." }, - "deleted": { - "type": "boolean", - "description": "Whether the group membership was removed." - } - }, - "required": [ - "object", - "deleted" - ], - "x-oaiMeta": { - "name": "Group user deletion confirmation", - "example": "{\n \"object\": \"group.user.deleted\",\n \"deleted\": true\n}\n" - } - }, - "HostedToolPermission": { - "type": "object", - "description": "Permission state for a single hosted tool on a project.", - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether the hosted tool is enabled for the project." - } - }, - "required": [ - "enabled" - ] - }, - "HostedToolPermissionUpdate": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether to enable the hosted tool for the project." - } - }, - "required": [ - "enabled" - ] - }, - "Image": { - "type": "object", - "description": "Represents the content or the URL of an image generated by the OpenAI API.", - "properties": { - "b64_json": { + "completion_window": { "type": "string", - "description": "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`." + "enum": [ + "24h" + ], + "description": "The time frame within which the batch should be processed. Currently only `24h` is supported." }, - "url": { - "type": "string", - "format": "uri", - "description": "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." + "metadata": { + "$ref": "#/components/schemas/Metadata" }, - "revised_prompt": { - "type": "string", - "description": "For `dall-e-3` only, the revised prompt that was used to generate the image." + "output_expires_after": { + "$ref": "#/components/schemas/BatchFileExpirationAfter" } } }, - "ImageEditCompletedEvent": { - "type": "object", - "description": "Emitted when image editing has completed and the final image is available.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of the event. Always `image_edit.completed`.\n", - "enum": [ - "image_edit.completed" - ], - "x-stainless-const": true - }, - "b64_json": { - "type": "string", - "description": "Base64-encoded final edited image data, suitable for rendering as an image.\n" + "CreateChatCompletionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/CreateModelResponseProperties" }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp when the event was created.\n" - }, - "size": { - "anyOf": [ - { - "type": "string" + { + "type": "object", + "properties": { + "messages": { + "description": "A list of messages comprising the conversation so far. Depending on the\n[model](https://developers.openai.com/api/docs/models) you use, different message types (modalities) are\nsupported, like [text](https://developers.openai.com/api/docs/guides/text),\n[images](https://developers.openai.com/api/docs/guides/images-vision), and [audio](https://developers.openai.com/api/docs/guides/audio).\n", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestMessage" + } }, - { - "type": "string", - "enum": [ - "1024x1024", - "1024x1536", - "1536x1024", - "auto" + "model": { + "description": "Model ID used to generate the response, like `gpt-6-astra` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models)\nto browse and compare available models.\n", + "$ref": "#/components/schemas/ModelIdsShared" + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTier" + }, + "modalities": { + "$ref": "#/components/schemas/ResponseModalities" + }, + "verbosity": { + "$ref": "#/components/schemas/Verbosity" + }, + "reasoning_effort": { + "$ref": "#/components/schemas/ReasoningEffort" + }, + "max_completion_tokens": { + "description": "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning).\n", + "type": [ + "integer", + "null" + ] + }, + "frequency_penalty": { + "type": [ + "number", + "null" + ], + "default": 0, + "minimum": -2, + "maximum": 2, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on\ntheir existing frequency in the text so far, decreasing the model's\nlikelihood to repeat the same line verbatim.\n" + }, + "presence_penalty": { + "type": [ + "number", + "null" + ], + "default": 0, + "minimum": -2, + "maximum": 2, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on\nwhether they appear in the text so far, increasing the model's likelihood\nto talk about new topics.\n" + }, + "web_search_options": { + "type": "object", + "title": "Web search", + "description": "This tool searches the web for relevant results to use in a response.\nLearn more about the [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search).\n", + "properties": { + "user_location": { + "type": [ + "object", + "null" + ], + "required": [ + "type", + "approximate" + ], + "description": "Approximate location parameters for the search.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of location approximation. Always `approximate`.\n", + "enum": [ + "approximate" + ], + "x-stainless-const": true + }, + "approximate": { + "$ref": "#/components/schemas/WebSearchLocation" + } + } + }, + "search_context_size": { + "$ref": "#/components/schemas/WebSearchContextSize" + } + } + }, + "top_logprobs": { + "description": "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n`logprobs` must be set to `true` if this parameter is used.\n", + "type": [ + "integer", + "null" + ], + "minimum": 0, + "maximum": 20 + }, + "response_format": { + "description": "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](https://developers.openai.com/api/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ResponseFormatText" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonSchema" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonObject" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "audio": { + "type": [ + "object", + "null" + ], + "description": "Parameters for audio output. Required when audio output is requested with\n`modalities: [\"audio\"]`. [Learn more](https://developers.openai.com/api/docs/guides/audio).\n", + "required": [ + "voice", + "format" + ], + "properties": { + "voice": { + "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", + "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`,\n`sage`, `shimmer`, `marin`, and `cedar`. You may also provide a\ncustom voice object with an `id`, for example `{ \"id\": \"voice_1234\" }`.\nCustom voices must be created from audio samples. Voices created from text\nprompts are supported only in Live.\n" + }, + "format": { + "type": "string", + "enum": [ + "wav", + "aac", + "mp3", + "flac", + "opus", + "pcm16" + ], + "description": "Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`,\n`opus`, or `pcm16`.\n" + } + } + }, + "store": { + "type": [ + "boolean", + "null" + ], + "default": false, + "description": "Whether or not to store the output of this chat completion request for\nuse in our [model distillation](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#distilling-from-a-larger-model) or\n[evals](https://developers.openai.com/api/docs/guides/evals) products.\n\nSupports text and image inputs. Note: image inputs over 8MB will be dropped.\n" + }, + "moderation": { + "anyOf": [ + { + "$ref": "#/components/schemas/ModerationParam", + "description": "Configuration for running moderation on the request input and generated output.\n" + }, + { + "type": "null" + } + ] + }, + "stream": { + "description": "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](https://developers.openai.com/api/reference/resources/chat/subresources/completions/streaming-events)\nfor more information, along with the [streaming responses](https://developers.openai.com/api/docs/guides/streaming-responses)\nguide for more information on how to handle the streaming events.\n", + "type": [ + "boolean", + "null" + ], + "default": false + }, + "stop": { + "$ref": "#/components/schemas/StopConfiguration" + }, + "logit_bias": { + "type": [ + "object", + "null" + ], + "x-oaiTypeLabel": "map", + "default": null, + "additionalProperties": { + "type": "integer" + }, + "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the\ntokenizer) to an associated bias value from -100 to 100. Mathematically,\nthe bias is added to the logits generated by the model prior to sampling.\nThe exact effect will vary per model, but values between -1 and 1 should\ndecrease or increase likelihood of selection; values like -100 or 100\nshould result in a ban or exclusive selection of the relevant token.\n" + }, + "logprobs": { + "description": "Whether to return log probabilities of the output tokens or not. If true,\nreturns the log probabilities of each output token returned in the\n`content` of `message`.\n", + "type": [ + "boolean", + "null" + ], + "default": false + }, + "max_tokens": { + "description": "The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the\nchat completion. This value can be used to control\n[costs](https://openai.com/api/pricing/) for text generated via API.\n\nThis value is now deprecated in favor of `max_completion_tokens`, and is\nnot compatible with [o-series models](https://developers.openai.com/api/docs/guides/reasoning).\n", + "type": [ + "integer", + "null" + ], + "deprecated": true + }, + "n": { + "type": [ + "integer", + "null" + ], + "minimum": 1, + "maximum": 128, + "default": 1, + "example": 1, + "description": "How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs." + }, + "prediction": { + "description": "Configuration for a [Predicted Output](https://developers.openai.com/api/docs/guides/predicted-outputs),\nwhich can greatly improve response times when large parts of the model\nresponse are known ahead of time. This is most common when you are\nregenerating a file with only minor changes to most of the content.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/PredictionContent" + }, + { + "type": "null" + } + ] + }, + "seed": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "minimum": -9223372036854775808, + "maximum": 9223372036854775807, + "deprecated": true, + "description": "This feature is in Beta.\nIf specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n", + "x-oaiMeta": { + "beta": true + } + }, + "stream_options": { + "$ref": "#/components/schemas/ChatCompletionStreamOptions" + }, + "tools": { + "type": "array", + "description": "A list of tools the model may call. You can provide either\n[custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools) or\n[function tools](https://developers.openai.com/api/docs/guides/function-calling).\n", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/ChatCompletionTool" + }, + { + "$ref": "#/components/schemas/CustomToolChatCompletions" + } + ] + } + }, + "tool_choice": { + "$ref": "#/components/schemas/ChatCompletionToolChoiceOption" + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "function_call": { + "deprecated": true, + "description": "Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n\n`none` means the model will not call a function and instead generates a\nmessage.\n\n`auto` means the model can pick between generating a message or calling a\nfunction.\n\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the\nmodel to call that function.\n\n`none` is the default when no functions are present. `auto` is the default\nif functions are present.\n", + "oneOf": [ + { + "type": "string", + "description": "`none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function.\n", + "enum": [ + "none", + "auto" + ] + }, + { + "$ref": "#/components/schemas/ChatCompletionFunctionCallOption" + } ] + }, + "functions": { + "deprecated": true, + "description": "Deprecated in favor of `tools`.\n\nA list of functions the model may generate JSON inputs for.\n", + "type": "array", + "minItems": 1, + "maxItems": 128, + "items": { + "$ref": "#/components/schemas/ChatCompletionFunctions" + } } - ], - "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." - }, - "quality": { - "type": "string", - "description": "The quality setting for the edited image.\n", - "enum": [ - "low", - "medium", - "high", - "xhigh", - "max", - "auto" - ] - }, - "background": { - "type": "string", - "description": "The background setting for the edited image.\n", - "enum": [ - "transparent", - "opaque", - "auto" - ] - }, - "output_format": { - "type": "string", - "description": "The output format for the edited image.\n", - "enum": [ - "png", - "webp", - "jpeg" + }, + "required": [ + "model", + "messages" ] - }, - "usage": { - "$ref": "#/components/schemas/ImagesUsage" } - }, - "required": [ - "type", - "b64_json", - "created_at", - "size", - "quality", - "background", - "output_format", - "usage" - ], - "x-oaiMeta": { - "name": "image_edit.completed", - "group": "images", - "example": "{\n \"type\": \"image_edit.completed\",\n \"b64_json\": \"...\",\n \"created_at\": 1620000000,\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"usage\": {\n \"total_tokens\": 100,\n \"input_tokens\": 50,\n \"output_tokens\": 50,\n \"input_tokens_details\": {\n \"text_tokens\": 10,\n \"image_tokens\": 40\n }\n }\n}\n" - } + ] }, - "ImageEditPartialImageEvent": { + "CreateChatCompletionResponse": { "type": "object", - "description": "Emitted when a partial image is available during image editing streaming.\n", + "description": "Represents a chat completion response returned by model, based on the provided input.", "properties": { - "type": { + "id": { "type": "string", - "description": "The type of the event. Always `image_edit.partial_image`.\n", - "enum": [ - "image_edit.partial_image" - ], - "x-stainless-const": true + "description": "A unique identifier for the chat completion." }, - "b64_json": { - "type": "string", - "description": "Base64-encoded partial image data, suitable for rendering as an image.\n" + "choices": { + "type": "array", + "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1.", + "items": { + "type": "object", + "required": [ + "finish_reason", + "index", + "message", + "logprobs" + ], + "properties": { + "finish_reason": { + "type": "string", + "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\nRead the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more.\n", + "enum": [ + "stop", + "length", + "tool_calls", + "content_filter", + "function_call" + ] + }, + "index": { + "type": "integer", + "description": "The index of the choice in the list of choices." + }, + "message": { + "$ref": "#/components/schemas/ChatCompletionResponseMessage" + }, + "logprobs": { + "anyOf": [ + { + "description": "Log probability information for the choice.", + "type": "object", + "properties": { + "content": { + "anyOf": [ + { + "description": "A list of message content tokens with log probability information.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionTokenLogprob" + } + }, + { + "type": "null" + } + ] + }, + "refusal": { + "anyOf": [ + { + "description": "A list of message refusal tokens with log probability information.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionTokenLogprob" + } + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "content", + "refusal" + ] + }, + { + "type": "null" + } + ] + } + } + } }, - "created_at": { + "created": { "type": "integer", "format": "unixtime", - "description": "The Unix timestamp when the event was created.\n" - }, - "size": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "1024x1024", - "1024x1536", - "1536x1024", - "auto" - ] - } - ], - "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + "description": "The Unix timestamp (in seconds) of when the chat completion was created." }, - "quality": { + "model": { "type": "string", - "description": "The quality setting for the requested edited image.\n", - "enum": [ - "low", - "medium", - "high", - "xhigh", - "max", - "auto" - ] + "description": "The model used for the chat completion." }, - "background": { + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTier" + }, + "system_fingerprint": { "type": "string", - "description": "The background setting for the requested edited image.\n", - "enum": [ - "transparent", - "opaque", - "auto" - ] + "deprecated": true, + "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" }, - "output_format": { + "object": { "type": "string", - "description": "The output format for the requested edited image.\n", + "description": "The object type, which is always `chat.completion`.", "enum": [ - "png", - "webp", - "jpeg" - ] + "chat.completion" + ], + "x-stainless-const": true }, - "partial_image_index": { - "type": "integer", - "description": "0-based index for the partial image (streaming).\n" + "usage": { + "$ref": "#/components/schemas/CompletionUsage" + }, + "moderation": { + "anyOf": [ + { + "$ref": "#/components/schemas/ChatCompletionModeration", + "description": "Moderation results for the request input and generated output, if moderated\ncompletions were requested.\n" + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "b64_json", - "created_at", - "size", - "quality", - "background", - "output_format", - "partial_image_index" + "choices", + "created", + "id", + "model", + "object" ], "x-oaiMeta": { - "name": "image_edit.partial_image", - "group": "images", - "example": "{\n \"type\": \"image_edit.partial_image\",\n \"b64_json\": \"...\",\n \"created_at\": 1620000000,\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"partial_image_index\": 0\n}\n" + "name": "The chat completion object", + "group": "chat", + "example": "{\n \"id\": \"chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG\",\n \"object\": \"chat.completion\",\n \"created\": 1741570283,\n \"model\": \"gpt-6-astra\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background.\",\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1117,\n \"completion_tokens\": 46,\n \"total_tokens\": 1163,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_fc9f1d7035\"\n}\n" } }, - "ImageEditStreamEvent": { - "anyOf": [ - { - "$ref": "#/components/schemas/ImageEditPartialImageEvent" + "CreateChatCompletionStreamResponse": { + "type": "object", + "description": "Represents a streamed chunk of a chat completion response returned\nby the model, based on the provided input.\n[Learn more](https://developers.openai.com/api/docs/guides/streaming-responses).\n", + "properties": { + "id": { + "type": "string", + "description": "A unique identifier for the chat completion. Each chunk has the same ID." }, - { - "$ref": "#/components/schemas/ImageEditCompletedEvent" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "ImageGenCompletedEvent": { - "type": "object", - "description": "Emitted when image generation has completed and the final image is available.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of the event. Always `image_generation.completed`.\n", - "enum": [ - "image_generation.completed" - ], - "x-stainless-const": true - }, - "b64_json": { - "type": "string", - "description": "Base64-encoded image data, suitable for rendering as an image.\n" + "choices": { + "type": "array", + "description": "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n", + "items": { + "type": "object", + "required": [ + "delta", + "index" + ], + "properties": { + "delta": { + "$ref": "#/components/schemas/ChatCompletionStreamResponseDelta" + }, + "logprobs": { + "description": "Log probability information for the choice.", + "type": [ + "object", + "null" + ], + "properties": { + "content": { + "description": "A list of message content tokens with log probability information.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/ChatCompletionTokenLogprob" + } + }, + "refusal": { + "description": "A list of message refusal tokens with log probability information.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/ChatCompletionTokenLogprob" + } + } + }, + "required": [ + "content", + "refusal" + ] + }, + "finish_reason": { + "type": [ + "string", + "null" + ], + "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\nOmitted from the final audio update containing only `delta.audio.expires_at`.\n", + "enum": [ + "stop", + "length", + "tool_calls", + "content_filter", + "function_call", + null + ] + }, + "index": { + "type": "integer", + "description": "The index of the choice in the list of choices." + } + } + } }, - "created_at": { + "created": { "type": "integer", "format": "unixtime", - "description": "The Unix timestamp when the event was created.\n" - }, - "size": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "1024x1024", - "1024x1536", - "1536x1024", - "auto" - ] - } - ], - "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + "description": "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp." }, - "quality": { + "model": { "type": "string", - "description": "The quality setting for the generated image.\n", - "enum": [ - "low", - "medium", - "high", - "xhigh", - "max", - "auto" - ] + "description": "The model to generate the completion." }, - "background": { + "obfuscation": { "type": "string", - "description": "The background setting for the generated image.\n", - "enum": [ - "transparent", - "opaque", - "auto" - ] + "description": "An obfuscation string added to normalize the size of streamed chunks as a\nmitigation to certain side-channel attacks. The field is included by\ndefault and omitted when `stream_options.include_obfuscation` is `false`.\n" }, - "output_format": { + "service_tier": { + "$ref": "#/components/schemas/ServiceTier" + }, + "system_fingerprint": { "type": "string", - "description": "The output format for the generated image.\n", - "enum": [ - "png", - "webp", - "jpeg" - ] + "deprecated": true, + "description": "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" }, - "usage": { - "$ref": "#/components/schemas/ImagesUsage" - } - }, - "required": [ - "type", - "b64_json", - "created_at", - "size", - "quality", - "background", - "output_format", - "usage" - ], - "x-oaiMeta": { - "name": "image_generation.completed", - "group": "images", - "example": "{\n \"type\": \"image_generation.completed\",\n \"b64_json\": \"...\",\n \"created_at\": 1620000000,\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"usage\": {\n \"total_tokens\": 100,\n \"input_tokens\": 50,\n \"output_tokens\": 50,\n \"input_tokens_details\": {\n \"text_tokens\": 10,\n \"image_tokens\": 40\n }\n }\n}\n" - } - }, - "ImageGenPartialImageEvent": { - "type": "object", - "description": "Emitted when a partial image is available during image generation streaming.\n", - "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `image_generation.partial_image`.\n", + "description": "The object type, which is always `chat.completion.chunk`.", "enum": [ - "image_generation.partial_image" + "chat.completion.chunk" ], "x-stainless-const": true }, - "b64_json": { - "type": "string", - "description": "Base64-encoded partial image data, suitable for rendering as an image.\n" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp when the event was created.\n" - }, - "size": { + "usage": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/CompletionUsage" }, { - "type": "string", - "enum": [ - "1024x1024", - "1024x1536", - "1536x1024", - "auto" - ] + "type": "null" } ], - "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." - }, - "quality": { - "type": "string", - "description": "The quality setting for the requested image.\n", - "enum": [ - "low", - "medium", - "high", - "xhigh", - "max", - "auto" - ] - }, - "background": { - "type": "string", - "description": "The background setting for the requested image.\n", - "enum": [ - "transparent", - "opaque", - "auto" - ] + "description": "An optional field that will only be present when you set\n`stream_options: {\"include_usage\": true}` in your request. When present, it\ncontains a null value **except for the last chunk** which contains the\ntoken usage statistics for the entire request.\n\n**NOTE:** If the stream is interrupted or cancelled, you may not\nreceive the final usage chunk which contains the total token usage for\nthe request.\n" }, - "output_format": { - "type": "string", - "description": "The output format for the requested image.\n", - "enum": [ - "png", - "webp", - "jpeg" + "moderation": { + "anyOf": [ + { + "$ref": "#/components/schemas/ChatCompletionModeration", + "description": "Moderation results for the request input and generated output. Present\non the moderation chunk when moderated completions are requested.\n" + }, + { + "type": "null" + } ] - }, - "partial_image_index": { - "type": "integer", - "description": "0-based index for the partial image (streaming).\n" } }, "required": [ - "type", - "b64_json", - "created_at", - "size", - "quality", - "background", - "output_format", - "partial_image_index" + "choices", + "created", + "id", + "model", + "object" ], - "x-oaiMeta": { - "name": "image_generation.partial_image", - "group": "images", - "example": "{\n \"type\": \"image_generation.partial_image\",\n \"b64_json\": \"...\",\n \"created_at\": 1620000000,\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"partial_image_index\": 0\n}\n" - } - }, - "ImageGenStreamEvent": { - "anyOf": [ + "examples": [ { - "$ref": "#/components/schemas/ImageGenPartialImageEvent" + "id": "chatcmpl-123", + "object": "chat.completion.chunk", + "created": 1694268190, + "model": "gpt-6-astra", + "system_fingerprint": "fp_44709d6fcb", + "choices": [ + { + "index": 0, + "delta": { + "content": "Hello" + }, + "logprobs": null, + "finish_reason": null + } + ], + "obfuscation": "p9K3xT6w" }, { - "$ref": "#/components/schemas/ImageGenCompletedEvent" + "id": "chatcmpl-123", + "object": "chat.completion.chunk", + "created": 1694268190, + "model": "gpt-6-astra", + "system_fingerprint": "fp_44709d6fcb", + "choices": [ + { + "index": 0, + "delta": {}, + "logprobs": null, + "finish_reason": "stop" + } + ], + "obfuscation": "" } ], - "discriminator": { - "propertyName": "type" + "x-oaiMeta": { + "name": "The chat completion chunk object", + "group": "chat", + "example": "{\"id\":\"chatcmpl-123\",\"object\":\"chat.completion.chunk\",\"created\":1694268190,\"model\":\"gpt-6-astra\", \"system_fingerprint\": \"fp_44709d6fcb\", \"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"logprobs\":null,\"finish_reason\":null}],\"obfuscation\":\"r4N7vQ2m\"}\n" } }, - "ImageGenTool": { + "CreateCompletionRequest": { "type": "object", - "title": "Image generation tool", - "description": "A tool that generates images using the GPT image models.\n", "properties": { - "type": { - "type": "string", - "enum": [ - "image_generation" - ], - "description": "The type of the image generation tool. Always `image_generation`.\n", - "x-stainless-const": true - }, "model": { + "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", "anyOf": [ { "type": "string" @@ -38646,22545 +43011,41777 @@ { "type": "string", "enum": [ - "gpt-image-1", - "gpt-image-1-mini", - "gpt-image-1.5", - "gpt-image-2", - "gpt-image-2-2026-04-21", - "gpt-image-2.5-sunburst", - "gpt-image-2.5-sunburst-2026-09-08", - "gpt-image-2.5-flare", - "gpt-image-2.5-flare-2026-09-08" - ], - "description": "The image generation model to use. One of `gpt-image-1`,\n`gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,\n`gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,\n`gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`. Default:\n`gpt-image-1`.\n", - "default": "gpt-image-1" + "gpt-3.5-turbo-instruct", + "davinci-002", + "babbage-002" + ] } - ] - }, - "quality": { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "xhigh", - "max", - "auto" ], - "description": "The quality of the generated image. The GPT image models support `low`,\n`medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,\nincluding their `2026-09-08` snapshots, also support `xhigh` and `max`.\nDefault: `auto`.\n", - "default": "auto" + "x-oaiTypeLabel": "string" }, - "size": { - "anyOf": [ + "prompt": { + "description": "The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.\n\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.\n", + "default": "<|endoftext|>", + "oneOf": [ { - "type": "string" + "type": "string", + "default": "", + "example": "This is a test." }, { - "type": "string", - "enum": [ - "1024x1024", - "1024x1536", - "1536x1024", - "auto" - ] + "type": "array", + "items": { + "type": "string", + "default": "", + "example": "This is a test." + } + }, + { + "type": "array", + "minItems": 1, + "items": { + "type": "integer" + }, + "example": "[1212, 318, 257, 1332, 13]" + }, + { + "type": "array", + "minItems": 1, + "items": { + "type": "array", + "minItems": 1, + "items": { + "type": "integer" + } + }, + "example": "[[1212, 318, 257, 1332, 13]]" + }, + { + "type": "null" } - ], - "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`.", - "default": "auto" + ] }, - "output_format": { - "type": "string", - "enum": [ - "png", - "webp", - "jpeg" + "best_of": { + "type": [ + "integer", + "null" ], - "description": "The output format of the generated image. One of `png`, `webp`, or\n`jpeg`. Default: `png`.\n", - "default": "png" - }, - "output_compression": { - "type": "integer", + "default": 1, "minimum": 0, - "maximum": 100, - "description": "Compression level for the output image. Default: 100.\n", - "default": 100 + "maximum": 20, + "description": "Generates `best_of` completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.\n\nWhen used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n" }, - "moderation": { - "type": "string", - "enum": [ - "auto", - "low" + "echo": { + "type": [ + "boolean", + "null" ], - "description": "Moderation level for the generated image. Default: `auto`.\n", - "default": "auto" + "default": false, + "description": "Echo back the prompt in addition to the completion\n" }, - "background": { - "type": "string", - "enum": [ - "transparent", - "opaque", - "auto" + "frequency_penalty": { + "type": [ + "number", + "null" ], - "description": "Set the background of the generated image. One of `transparent`, `opaque`,\nor `auto`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including\ntheir `2026-09-08` snapshots, support `opaque` and `transparent`\nbackgrounds. Transparent backgrounds are available for supported GPT Image\nmodels. For `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in\npreview. When using `transparent`, set the output format to `png` or `webp`.\nDefault: `auto`.\n", - "default": "auto" - }, - "input_fidelity": { - "anyOf": [ - { - "$ref": "#/components/schemas/InputFidelity" - }, - { - "type": "null" - } - ] + "default": 0, + "minimum": -2, + "maximum": 2, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](https://developers.openai.com/api/docs/guides/text)\n" }, - "input_image_mask": { - "type": "object", - "description": "Optional mask for inpainting. Contains `image_url`\n(string, optional) and `file_id` (string, optional).\n", - "properties": { - "image_url": { - "type": "string", - "description": "Base64-encoded mask image.\n" - }, - "file_id": { - "type": "string", - "description": "File ID for the mask image.\n" - } + "logit_bias": { + "type": [ + "object", + "null" + ], + "x-oaiTypeLabel": "map", + "default": null, + "additionalProperties": { + "type": "integer" }, - "required": [], - "additionalProperties": false + "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](https://platform.openai.com/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n\nAs an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.\n" }, - "partial_images": { - "type": "integer", + "logprobs": { + "type": [ + "integer", + "null" + ], "minimum": 0, - "maximum": 3, - "description": "Number of partial images to generate in streaming mode, from 0 (default value) to 3.\n", - "default": 0 + "maximum": 5, + "default": null, + "description": "Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.\n\nThe maximum value for `logprobs` is 5.\n" }, - "action": { - "description": "Whether to generate a new image or edit an existing image. Default: `auto`.\n", - "$ref": "#/components/schemas/ImageGenActionEnum" - } - }, - "required": [ - "type" - ] - }, - "ImageRefParam": { - "type": "object", - "description": "Reference an input image by either URL or uploaded file ID.\nProvide exactly one of `image_url` or `file_id`.\n", - "properties": { - "image_url": { - "type": "string", - "format": "uri", - "maxLength": 20971520, - "description": "A fully qualified URL or base64-encoded data URL.", - "example": "https://example.com/source-image.png" + "max_tokens": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "default": 16, + "example": 16, + "description": "The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the completion.\n\nThe token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n" }, - "file_id": { - "type": "string", - "description": "The File API ID of an uploaded image to use as input.", - "example": "file-abc123" - } - }, - "anyOf": [ - { - "required": [ - "image_url" - ] + "n": { + "type": [ + "integer", + "null" + ], + "minimum": 1, + "maximum": 128, + "default": 1, + "example": 1, + "description": "How many completions to generate for each prompt.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n" }, - { - "required": [ - "file_id" - ] - } - ], - "not": { - "required": [ - "image_url", - "file_id" - ] - }, - "additionalProperties": false - }, - "ImagesResponse": { + "presence_penalty": { + "type": [ + "number", + "null" + ], + "default": 0, + "minimum": -2, + "maximum": 2, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](https://developers.openai.com/api/docs/guides/text)\n" + }, + "seed": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "description": "If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\n\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n" + }, + "stop": { + "$ref": "#/components/schemas/StopConfiguration" + }, + "stream": { + "description": "Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n", + "type": [ + "boolean", + "null" + ], + "default": false + }, + "stream_options": { + "$ref": "#/components/schemas/ChatCompletionStreamOptions" + }, + "suffix": { + "description": "The suffix that comes after a completion of inserted text.\n\nThis parameter is only supported for `gpt-3.5-turbo-instruct`.\n", + "default": null, + "type": [ + "string", + "null" + ], + "example": "test." + }, + "temperature": { + "type": [ + "number", + "null" + ], + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n" + }, + "top_p": { + "type": [ + "number", + "null" + ], + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" + }, + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" + } + }, + "required": [ + "model", + "prompt" + ] + }, + "CreateCompletionResponse": { "type": "object", - "title": "Image generation response", - "description": "The response from the image generation endpoint.", + "description": "Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).\n", "properties": { - "created": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the image was created." + "id": { + "type": "string", + "description": "A unique identifier for the completion." }, - "data": { + "choices": { "type": "array", - "description": "The list of generated images.", + "description": "The list of completion choices the model generated for the input prompt.", "items": { - "$ref": "#/components/schemas/Image" + "type": "object", + "required": [ + "finish_reason", + "index", + "logprobs", + "text" + ], + "properties": { + "finish_reason": { + "anyOf": [ + { + "type": "string", + "enum": [ + "stop", + "length", + "content_filter" + ] + }, + { + "type": "null" + } + ], + "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\nor `content_filter` if content was omitted due to a flag from our content filters. The value is null while a streamed completion is unfinished.\n" + }, + "index": { + "type": "integer" + }, + "logprobs": { + "anyOf": [ + { + "type": "object", + "properties": { + "text_offset": { + "type": "array", + "items": { + "type": "integer" + } + }, + "token_logprobs": { + "type": "array", + "items": { + "type": "number" + } + }, + "tokens": { + "type": "array", + "items": { + "type": "string" + } + }, + "top_logprobs": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "number" + } + } + } + } + }, + { + "type": "null" + } + ] + }, + "text": { + "type": "string" + } + } } }, - "background": { - "type": "string", - "description": "The background parameter used for the image generation. Either `transparent` or `opaque`.", - "enum": [ - "transparent", - "opaque" - ] + "created": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the completion was created." }, - "output_format": { + "model": { "type": "string", - "description": "The output format of the image generation. Either `png`, `webp`, or `jpeg`.", - "enum": [ - "png", - "webp", - "jpeg" - ] + "description": "The model used for completion." }, - "size": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "1024x1024", - "1024x1536", - "1536x1024" - ] - } - ], - "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + "system_fingerprint": { + "type": "string", + "description": "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n" }, - "quality": { + "object": { "type": "string", - "description": "The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or `max`.", + "description": "The object type, which is always \"text_completion\"", "enum": [ - "low", - "medium", - "high", - "xhigh", - "max" - ] + "text_completion" + ], + "x-stainless-const": true }, "usage": { - "$ref": "#/components/schemas/ImageGenUsage" + "$ref": "#/components/schemas/CompletionUsage" } }, "required": [ - "created" + "id", + "object", + "created", + "model", + "choices" ], "x-oaiMeta": { - "name": "The image generation response", - "group": "images", - "example": "{\n \"created\": 1713833628,\n \"data\": [\n {\n \"b64_json\": \"...\"\n }\n ],\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"usage\": {\n \"total_tokens\": 100,\n \"input_tokens\": 50,\n \"output_tokens\": 50,\n \"input_tokens_details\": {\n \"text_tokens\": 10,\n \"image_tokens\": 40\n }\n }\n}\n" + "name": "The completion object", + "legacy": true, + "example": "{\n \"id\": \"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\",\n \"object\": \"text_completion\",\n \"created\": 1589478378,\n \"model\": \"gpt-3.5-turbo-instruct\",\n \"choices\": [\n {\n \"text\": \"\\n\\nThis is indeed a test\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": \"length\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 5,\n \"completion_tokens\": 7,\n \"total_tokens\": 12\n }\n}\n" } }, - "ImagesUsage": { + "CreateContainerBody": { "type": "object", - "description": "For the GPT image models only, the token usage information for the image generation.\n", - "required": [ - "total_tokens", - "input_tokens", - "output_tokens", - "input_tokens_details" - ], "properties": { - "total_tokens": { - "type": "integer", - "description": "The total number of tokens (images and text) used for the image generation.\n" - }, - "input_tokens": { - "type": "integer", - "description": "The number of tokens (images and text) in the input prompt." + "name": { + "type": "string", + "description": "Name of the container to create." }, - "output_tokens": { - "type": "integer", - "description": "The number of image tokens in the output image." + "file_ids": { + "type": "array", + "description": "IDs of files to copy to the container.", + "items": { + "type": "string" + } }, - "input_tokens_details": { + "expires_after": { "type": "object", - "description": "The input tokens detailed information for the image generation.", - "required": [ - "text_tokens", - "image_tokens" - ], + "description": "Container expiration time in seconds relative to the 'anchor' time.", "properties": { - "text_tokens": { - "type": "integer", - "description": "The number of text tokens in the input prompt." + "anchor": { + "type": "string", + "enum": [ + "last_active_at" + ], + "description": "Time anchor for the expiration time. Currently only 'last_active_at' is supported." }, - "image_tokens": { - "type": "integer", - "description": "The number of image tokens in the input prompt." + "minutes": { + "type": "integer" + } + }, + "required": [ + "anchor", + "minutes" + ] + }, + "skills": { + "type": "array", + "description": "An optional list of skills referenced by id or inline data.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/SkillReferenceParam" + }, + { + "$ref": "#/components/schemas/InlineSkillParam" + } + ], + "discriminator": { + "propertyName": "type" } } - } - } - }, - "InputAudio": { - "type": "object", - "title": "Input audio", - "description": "An audio input to the model.\n", - "properties": { - "type": { + }, + "memory_limit": { "type": "string", - "description": "The type of the input item. Always `input_audio`.\n", "enum": [ - "input_audio" + "1g", + "4g", + "16g", + "64g" ], - "x-stainless-const": true + "description": "Optional memory limit for the container. Defaults to \"1g\"." }, - "input_audio": { - "type": "object", - "properties": { - "data": { - "type": "string", - "description": "Base64-encoded audio data.\n" + "network_policy": { + "description": "Network access policy for the container.", + "oneOf": [ + { + "$ref": "#/components/schemas/ContainerNetworkPolicyDisabledParam" }, - "format": { - "type": "string", - "description": "The format of the audio data. Currently supported formats are `mp3` and\n`wav`.\n", - "enum": [ - "mp3", - "wav" - ] + { + "$ref": "#/components/schemas/ContainerNetworkPolicyAllowlistParam" } - }, - "required": [ - "data", - "format" - ] + ], + "discriminator": { + "propertyName": "type" + } } }, "required": [ - "type", - "input_audio" + "name" ] }, - "InputContent": { - "oneOf": [ - { - "$ref": "#/components/schemas/InputTextContent" - }, - { - "$ref": "#/components/schemas/InputImageContent" - }, - { - "$ref": "#/components/schemas/InputFileContent" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "InputItem": { - "oneOf": [ - { - "$ref": "#/components/schemas/EasyInputMessage" - }, - { - "type": "object", - "title": "Item", - "description": "An item representing part of the context for the response to be\ngenerated by the model. Can contain text, images, and audio inputs,\nas well as previous assistant responses and tool call outputs.\n", - "$ref": "#/components/schemas/Item" - }, - { - "$ref": "#/components/schemas/CompactionTriggerItemParam" - }, - { - "$ref": "#/components/schemas/ItemReferenceParam" - }, - { - "$ref": "#/components/schemas/ProgramItemParam" + "CreateContainerFileBody": { + "type": "object", + "properties": { + "file_id": { + "type": "string", + "description": "Name of the file to create." }, - { - "$ref": "#/components/schemas/ProgramOutputItemParam" + "file": { + "description": "The File object (not file name) to be uploaded.\n", + "type": "string", + "format": "binary" } - ], - "discriminator": { - "propertyName": "type" - } + }, + "required": [] }, - "InputMessage": { + "CreateEmbeddingRequest": { "type": "object", - "title": "Input message", - "description": "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role.\n", + "additionalProperties": false, "properties": { - "type": { - "type": "string", - "description": "The type of the message input. Always set to `message`.\n", - "enum": [ - "message" + "input": { + "description": "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.\n", + "example": "The quick brown fox jumped over the lazy dog", + "oneOf": [ + { + "type": "string", + "title": "string", + "description": "The string that will be turned into an embedding.", + "default": "", + "example": "This is a test." + }, + { + "type": "array", + "title": "array", + "description": "The array of strings that will be turned into an embedding.", + "minItems": 1, + "maxItems": 2048, + "items": { + "type": "string", + "default": "", + "example": "['This is a test.']" + } + }, + { + "type": "array", + "title": "array", + "description": "The array of integers that will be turned into an embedding.", + "minItems": 1, + "maxItems": 2048, + "items": { + "type": "integer" + }, + "example": "[1212, 318, 257, 1332, 13]" + }, + { + "type": "array", + "title": "array", + "description": "The array of arrays containing integers that will be turned into an embedding.", + "minItems": 1, + "maxItems": 2048, + "items": { + "type": "array", + "minItems": 1, + "items": { + "type": "integer" + } + }, + "example": "[[1212, 318, 257, 1332, 13]]" + } + ] + }, + "model": { + "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", + "example": "text-embedding-3-small", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "text-embedding-ada-002", + "text-embedding-3-small", + "text-embedding-3-large" + ] + } ], - "x-stainless-const": true + "x-oaiTypeLabel": "string" }, - "role": { + "encoding_format": { + "description": "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).", + "example": "float", + "default": "float", "type": "string", - "description": "The role of the message input. One of `user`, `system`, or `developer`.\n", "enum": [ - "user", - "system", - "developer" + "float", + "base64" ] }, - "status": { - "type": "string", - "description": "The status of item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", - "enum": [ - "in_progress", - "completed", - "incomplete" - ] + "dimensions": { + "description": "The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\n", + "type": "integer", + "minimum": 1 }, - "content": { - "$ref": "#/components/schemas/InputMessageContentList" + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" } }, "required": [ - "role", - "content" + "model", + "input" ] }, - "InputMessageContentList": { - "type": "array", - "title": "Input item content list", - "description": "A list of one or many input items to the model, containing different content \ntypes.\n", - "items": { - "$ref": "#/components/schemas/InputContent" - } - }, - "InputMessageResource": { - "allOf": [ - { - "$ref": "#/components/schemas/InputMessage" + "CreateEmbeddingResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "description": "The list of embeddings generated by the model.", + "items": { + "$ref": "#/components/schemas/Embedding" + } }, - { + "model": { + "type": "string", + "description": "The name of the model used to generate the embedding." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"list\".", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "usage": { "type": "object", + "description": "The usage information for the request.", "properties": { - "id": { - "type": "string", - "description": "The unique ID of the message input.\n" + "prompt_tokens": { + "type": "integer", + "description": "The number of tokens used by the prompt." + }, + "total_tokens": { + "type": "integer", + "description": "The total number of tokens used by the request." } }, "required": [ - "id", - "type" + "prompt_tokens", + "total_tokens" ] } + }, + "required": [ + "object", + "model", + "data", + "usage" ] }, - "InputParam": { - "description": "Text, image, or file inputs to the model, used to generate a response.\n\nLearn more:\n- [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text)\n- [Image inputs](https://developers.openai.com/api/docs/guides/images-vision)\n- [File inputs](https://developers.openai.com/api/docs/guides/file-inputs)\n- [Conversation state](https://developers.openai.com/api/docs/guides/conversation-state)\n- [Function calling](https://developers.openai.com/api/docs/guides/function-calling)\n", - "oneOf": [ - { - "type": "string", - "title": "Text input", - "description": "A text input to the model, equivalent to a text input with the\n`user` role.\n" - }, - { - "type": "array", - "title": "Input item list", - "description": "A list of one or many input items to the model, containing\ndifferent content types.\n", - "items": { - "$ref": "#/components/schemas/InputItem" - } - } - ] - }, - "Invite": { + "CreateEvalCompletionsRunDataSource": { "type": "object", - "description": "Represents an individual `invite` to the organization.", + "title": "CompletionsRunDataSource", + "description": "A CompletionsRunDataSource object describing a model sampling configuration.\n", "properties": { - "object": { - "type": "string", - "enum": [ - "organization.invite" - ], - "description": "The object type, which is always `organization.invite`", - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "email": { - "type": "string", - "description": "The email address of the individual to whom the invite was sent" - }, - "role": { - "type": "string", - "enum": [ - "owner", - "reader" - ], - "description": "`owner` or `reader`" - }, - "status": { + "type": { "type": "string", "enum": [ - "accepted", - "expired", - "pending" + "completions" ], - "description": "`accepted`,`expired`, or `pending`" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the invite was sent." + "default": "completions", + "description": "The type of run data source. Always `completions`." }, - "expires_at": { - "anyOf": [ + "input_messages": { + "description": "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace.", + "oneOf": [ { - "type": "integer", - "format": "unixtime" + "type": "object", + "title": "TemplateInputMessages", + "properties": { + "type": { + "type": "string", + "enum": [ + "template" + ], + "description": "The type of input messages. Always `template`." + }, + "template": { + "type": "array", + "description": "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/EasyInputMessage" + }, + { + "$ref": "#/components/schemas/EvalItem" + } + ] + } + } + }, + "required": [ + "type", + "template" + ] }, { - "type": "null" + "type": "object", + "title": "ItemReferenceInputMessages", + "properties": { + "type": { + "type": "string", + "enum": [ + "item_reference" + ], + "description": "The type of input messages. Always `item_reference`." + }, + "item_reference": { + "type": "string", + "description": "A reference to a variable in the `item` namespace. Ie, \"item.input_trajectory\"" + } + }, + "required": [ + "type", + "item_reference" + ] } - ], - "description": "The Unix timestamp (in seconds) of when the invite expires." + ] }, - "accepted_at": { - "anyOf": [ - { + "sampling_params": { + "type": "object", + "properties": { + "reasoning_effort": { + "$ref": "#/components/schemas/ReasoningEffort" + }, + "temperature": { + "type": "number", + "description": "A higher temperature increases randomness in the outputs.", + "default": 1 + }, + "max_completion_tokens": { "type": "integer", - "format": "unixtime" + "description": "The maximum number of tokens in the generated output." }, - { - "type": "null" + "top_p": { + "type": "number", + "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.", + "default": 1 + }, + "seed": { + "type": "integer", + "description": "A seed value to initialize the randomness, during sampling.", + "default": 42 + }, + "response_format": { + "description": "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](https://developers.openai.com/api/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ResponseFormatText" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonSchema" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonObject" + } + ] + }, + "tools": { + "type": "array", + "description": "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n", + "items": { + "$ref": "#/components/schemas/ChatCompletionTool" + } } - ], - "description": "The Unix timestamp (in seconds) of when the invite was accepted." + } }, - "projects": { - "type": "array", - "description": "The projects that were granted membership upon acceptance of the invite.", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Project's public ID" - }, - "role": { - "type": "string", - "enum": [ - "member", - "owner" - ], - "description": "Project membership role" - } + "model": { + "type": "string", + "description": "The name of the model to use for generating completions (e.g. \"o3-mini\")." + }, + "source": { + "description": "Determines what populates the `item` namespace in this run's data source.", + "oneOf": [ + { + "$ref": "#/components/schemas/EvalJsonlFileContentSource" }, - "required": [ - "id", - "role" - ] - } + { + "$ref": "#/components/schemas/EvalJsonlFileIdSource" + }, + { + "$ref": "#/components/schemas/EvalStoredCompletionsSource" + } + ] } }, "required": [ - "object", - "id", - "email", - "role", - "status", - "created_at", - "projects" + "type", + "source" ], "x-oaiMeta": { - "name": "The invite object", - "example": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"created_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533,\n \"projects\": [\n {\n \"id\": \"project-xyz\",\n \"role\": \"member\"\n }\n ]\n}\n" + "name": "The completions data source object used to configure an individual run", + "group": "eval runs", + "example": "{\n \"type\": \"completions\",\n \"input_messages\": {\n \"type\": \"item_reference\",\n \"item_reference\": \"item.input\"\n },\n \"model\": \"gpt-6-astra\",\n \"source\": {\n \"type\": \"stored_completions\",\n \"model\": \"gpt-6-astra\"\n }\n}\n" } }, - "InviteDeleteResponse": { + "CreateEvalCustomDataSourceConfig": { "type": "object", + "title": "CustomDataSourceConfig", + "description": "A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs.\nThis schema is used to define the shape of the data that will be:\n- Used to define your testing criteria and\n- What data is required when creating a run\n", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "organization.invite.deleted" + "custom" ], - "description": "The object type, which is always `organization.invite.deleted`", + "default": "custom", + "description": "The type of data source. Always `custom`.", "x-stainless-const": true }, - "id": { - "type": "string" + "item_schema": { + "type": "object", + "description": "The json schema for each row in the data source.", + "additionalProperties": true, + "example": "{\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"integer\"}\n },\n \"required\": [\"name\", \"age\"]\n}\n" }, - "deleted": { - "type": "boolean" + "include_sample_schema": { + "type": "boolean", + "default": false, + "description": "Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source)" } }, "required": [ - "object", - "id", - "deleted" - ] + "item_schema", + "type" + ], + "x-oaiMeta": { + "name": "The eval file data source config object", + "group": "evals", + "example": "{\n \"type\": \"custom\",\n \"item_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"integer\"}\n },\n \"required\": [\"name\", \"age\"]\n },\n \"include_sample_schema\": true\n}\n" + } }, - "InviteListResponse": { + "CreateEvalItem": { + "title": "CreateEvalItem", + "description": "A chat message that makes up the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}.", + "type": "object", + "oneOf": [ + { + "type": "object", + "title": "SimpleInputMessage", + "properties": { + "role": { + "type": "string", + "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")." + }, + "content": { + "type": "string", + "description": "The content of the message." + } + }, + "required": [ + "role", + "content" + ] + }, + { + "$ref": "#/components/schemas/EvalItem" + } + ], + "x-oaiMeta": { + "name": "The chat message object used to configure an individual run" + } + }, + "CreateEvalJsonlRunDataSource": { "type": "object", + "title": "JsonlRunDataSource", + "description": "A JsonlRunDataSource object with that specifies a JSONL file that matches the eval \n", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "jsonl" ], - "description": "The object type, which is always `list`", + "default": "jsonl", + "description": "The type of data source. Always `jsonl`.", "x-stainless-const": true }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Invite" - } - }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "The first `invite_id` in the retrieved `list`" - }, - "last_id": { - "anyOf": [ + "source": { + "description": "Determines what populates the `item` namespace in the data source.", + "oneOf": [ { - "type": "string" + "$ref": "#/components/schemas/EvalJsonlFileContentSource" }, { - "type": "null" + "$ref": "#/components/schemas/EvalJsonlFileIdSource" } - ], - "description": "The last `invite_id` in the retrieved `list`" - }, - "has_more": { - "type": "boolean", - "description": "The `has_more` property is used for pagination to indicate there are additional results." + ] } }, "required": [ - "object", - "data", - "has_more" - ] + "type", + "source" + ], + "x-oaiMeta": { + "name": "The file data source object for the eval run configuration", + "group": "evals", + "example": "{\n \"type\": \"jsonl\",\n \"source\": {\n \"type\": \"file_id\",\n \"id\": \"file-9GYS6xbkWgWhmE7VoLUWFg\"\n }\n}\n" + } }, - "InviteProjectGroupBody": { + "CreateEvalLabelModelGrader": { "type": "object", - "description": "Request payload for granting a group access to a project.", + "title": "LabelModelGrader", + "description": "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n", "properties": { - "group_id": { + "type": { + "description": "The object type, which is always `label_model`.", "type": "string", - "description": "Identifier of the group to add to the project." + "enum": [ + "label_model" + ], + "x-stainless-const": true }, - "role": { + "name": { "type": "string", - "description": "Identifier of the project role to grant to the group." + "description": "The name of the grader." + }, + "model": { + "type": "string", + "description": "The model to use for the evaluation. Must support structured outputs." + }, + "input": { + "type": "array", + "description": "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}.", + "items": { + "$ref": "#/components/schemas/CreateEvalItem" + } + }, + "labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The labels to classify to each item in the evaluation." + }, + "passing_labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The labels that indicate a passing result. Must be a subset of labels." } }, "required": [ - "group_id", - "role" + "type", + "model", + "input", + "passing_labels", + "labels", + "name" ], "x-oaiMeta": { - "example": "{\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"role\": \"role_01J1F8PROJ\"\n}\n" + "name": "The eval label model grader object", + "group": "evals", + "example": "{\n \"type\": \"label_model\",\n \"model\": \"gpt-4o-2024-08-06\",\n \"input\": [\n {\n \"role\": \"system\",\n \"content\": \"Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Statement: {{item.response}}\"\n }\n ],\n \"passing_labels\": [\"positive\"],\n \"labels\": [\"positive\", \"neutral\", \"negative\"],\n \"name\": \"Sentiment label grader\"\n}\n" } }, - "InviteRequest": { + "CreateEvalLogsDataSourceConfig": { "type": "object", + "title": "LogsDataSourceConfig", + "description": "A data source config which specifies the metadata property of your logs query.\nThis is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc.\n", "properties": { - "email": { - "type": "string", - "description": "Send an email to this address" - }, - "role": { + "type": { "type": "string", "enum": [ - "reader", - "owner" + "logs" ], - "description": "`owner` or `reader`" + "default": "logs", + "description": "The type of data source. Always `logs`.", + "x-stainless-const": true }, - "projects": { - "type": "array", - "description": "An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Project's public ID" - }, - "role": { - "type": "string", - "enum": [ - "member", - "owner" - ], - "description": "Project membership role" - } - }, - "required": [ - "id", - "role" - ] - } + "metadata": { + "type": "object", + "description": "Metadata filters for the logs data source.", + "additionalProperties": true, + "example": "{\n \"use_case\": \"customer_support_agent\"\n}\n" } }, "required": [ - "email", - "role" - ] + "type" + ], + "x-oaiMeta": { + "name": "The logs data source object for evals", + "group": "evals", + "example": "{\n \"type\": \"logs\",\n \"metadata\": {\n \"use_case\": \"customer_support_agent\"\n }\n}\n" + } }, - "Item": { + "CreateEvalRequest": { "type": "object", - "description": "Content item used to generate a response.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/InputMessage" - }, - { - "$ref": "#/components/schemas/OutputMessage" - }, - { - "$ref": "#/components/schemas/FileSearchToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCall" - }, - { - "$ref": "#/components/schemas/ComputerCallOutputItemParam" - }, - { - "$ref": "#/components/schemas/WebSearchToolCall" - }, - { - "$ref": "#/components/schemas/FunctionToolCall" - }, - { - "$ref": "#/components/schemas/FunctionCallOutputItemParam" - }, - { - "$ref": "#/components/schemas/ToolSearchCallItemParam" - }, - { - "$ref": "#/components/schemas/ToolSearchOutputItemParam" - }, - { - "$ref": "#/components/schemas/AdditionalToolsItemParam" - }, - { - "$ref": "#/components/schemas/ResponseConfigurationUpdateItemParam" - }, - { - "$ref": "#/components/schemas/ReasoningItem" - }, - { - "$ref": "#/components/schemas/CompactionSummaryItemParam" - }, - { - "$ref": "#/components/schemas/ImageGenToolCall" - }, - { - "$ref": "#/components/schemas/CodeInterpreterToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCallOutput" - }, - { - "$ref": "#/components/schemas/FunctionShellCallItemParam" - }, - { - "$ref": "#/components/schemas/FunctionShellCallOutputItemParam" - }, - { - "$ref": "#/components/schemas/ApplyPatchToolCallItemParam" - }, - { - "$ref": "#/components/schemas/ApplyPatchToolCallOutputItemParam" - }, - { - "$ref": "#/components/schemas/MCPListTools" - }, - { - "$ref": "#/components/schemas/MCPApprovalRequest" - }, - { - "$ref": "#/components/schemas/MCPApprovalResponse" - }, - { - "$ref": "#/components/schemas/MCPToolCall" - }, - { - "$ref": "#/components/schemas/CustomToolCallOutput" - }, - { - "$ref": "#/components/schemas/CustomToolCall" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "ItemResource": { - "description": "Content item used to generate a response.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/InputMessageResource" - }, - { - "$ref": "#/components/schemas/OutputMessage" - }, - { - "$ref": "#/components/schemas/FileSearchToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCallOutputResource" - }, - { - "$ref": "#/components/schemas/WebSearchToolCall" - }, - { - "$ref": "#/components/schemas/FunctionToolCallResource" - }, - { - "$ref": "#/components/schemas/FunctionToolCallOutputResource" - }, - { - "$ref": "#/components/schemas/ToolSearchCall" - }, - { - "$ref": "#/components/schemas/ToolSearchOutput" - }, - { - "$ref": "#/components/schemas/AdditionalTools" - }, - { - "$ref": "#/components/schemas/ResponseConfigurationUpdate" - }, - { - "$ref": "#/components/schemas/ReasoningItem" - }, - { - "$ref": "#/components/schemas/Program" - }, - { - "$ref": "#/components/schemas/ProgramOutput" - }, - { - "$ref": "#/components/schemas/CompactionBody" - }, - { - "$ref": "#/components/schemas/ImageGenToolCall" - }, - { - "$ref": "#/components/schemas/CodeInterpreterToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCallOutput" - }, - { - "$ref": "#/components/schemas/FunctionShellCall" - }, - { - "$ref": "#/components/schemas/FunctionShellCallOutput" - }, - { - "$ref": "#/components/schemas/ApplyPatchToolCall" - }, - { - "$ref": "#/components/schemas/ApplyPatchToolCallOutput" - }, - { - "$ref": "#/components/schemas/MCPListTools" - }, - { - "$ref": "#/components/schemas/MCPApprovalRequest" - }, - { - "$ref": "#/components/schemas/MCPApprovalResponseResource" + "title": "CreateEvalRequest", + "properties": { + "name": { + "type": "string", + "description": "The name of the evaluation." }, - { - "$ref": "#/components/schemas/MCPToolCall" + "metadata": { + "$ref": "#/components/schemas/Metadata" }, - { - "$ref": "#/components/schemas/CustomToolCallResource" + "data_source_config": { + "type": "object", + "description": "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation.", + "oneOf": [ + { + "$ref": "#/components/schemas/CreateEvalCustomDataSourceConfig" + }, + { + "$ref": "#/components/schemas/CreateEvalLogsDataSourceConfig" + }, + { + "$ref": "#/components/schemas/CreateEvalStoredCompletionsDataSourceConfig" + } + ] }, - { - "$ref": "#/components/schemas/CustomToolCallOutputResource" + "testing_criteria": { + "type": "array", + "description": "A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like `{{item.variable_name}}`. To reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`).", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateEvalLabelModelGrader" + }, + { + "$ref": "#/components/schemas/EvalGraderStringCheck" + }, + { + "$ref": "#/components/schemas/EvalGraderTextSimilarity" + }, + { + "$ref": "#/components/schemas/EvalGraderPython" + }, + { + "$ref": "#/components/schemas/EvalGraderScoreModel" + } + ] + } } - ], - "discriminator": { - "propertyName": "type" - } + }, + "required": [ + "data_source_config", + "testing_criteria" + ] }, - "ListAssistantsResponse": { + "CreateEvalResponsesRunDataSource": { "type": "object", + "title": "ResponsesRunDataSource", + "description": "A ResponsesRunDataSource object describing a model sampling configuration.\n", "properties": { - "object": { + "type": { "type": "string", - "example": "list" + "enum": [ + "responses" + ], + "default": "responses", + "description": "The type of run data source. Always `responses`." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AssistantObject" - } + "input_messages": { + "description": "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace.", + "oneOf": [ + { + "type": "object", + "title": "InputMessagesTemplate", + "properties": { + "type": { + "type": "string", + "enum": [ + "template" + ], + "description": "The type of input messages. Always `template`." + }, + "template": { + "type": "array", + "description": "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}.", + "items": { + "oneOf": [ + { + "type": "object", + "title": "ChatMessage", + "properties": { + "role": { + "type": "string", + "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")." + }, + "content": { + "type": "string", + "description": "The content of the message." + } + }, + "required": [ + "role", + "content" + ] + }, + { + "$ref": "#/components/schemas/EvalItem" + } + ] + } + } + }, + "required": [ + "type", + "template" + ] + }, + { + "type": "object", + "title": "InputMessagesItemReference", + "properties": { + "type": { + "type": "string", + "enum": [ + "item_reference" + ], + "description": "The type of input messages. Always `item_reference`." + }, + "item_reference": { + "type": "string", + "description": "A reference to a variable in the `item` namespace. Ie, \"item.name\"" + } + }, + "required": [ + "type", + "item_reference" + ] + } + ] }, - "first_id": { - "type": "string", - "example": "asst_abc123" + "sampling_params": { + "type": "object", + "properties": { + "reasoning_effort": { + "$ref": "#/components/schemas/ReasoningEffort" + }, + "temperature": { + "type": "number", + "description": "A higher temperature increases randomness in the outputs.", + "default": 1 + }, + "max_completion_tokens": { + "type": "integer", + "description": "The maximum number of tokens in the generated output." + }, + "top_p": { + "type": "number", + "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.", + "default": 1 + }, + "seed": { + "type": "integer", + "description": "A seed value to initialize the randomness, during sampling.", + "default": 42 + }, + "tools": { + "type": "array", + "description": "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nThe two categories of tools you can provide the model are:\n\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](https://developers.openai.com/api/docs/guides/tools-web-search)\n or [file search](https://developers.openai.com/api/docs/guides/tools-file-search). Learn more about\n [built-in tools](https://developers.openai.com/api/docs/guides/tools).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code. Learn more about\n [function calling](https://developers.openai.com/api/docs/guides/function-calling).\n", + "items": { + "$ref": "#/components/schemas/Tool" + } + }, + "text": { + "type": "object", + "description": "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text)\n- [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs)\n", + "properties": { + "format": { + "$ref": "#/components/schemas/TextResponseFormatConfiguration" + } + } + } + } }, - "last_id": { + "model": { "type": "string", - "example": "asst_abc456" + "description": "The name of the model to use for generating completions (e.g. \"o3-mini\")." }, - "has_more": { - "type": "boolean", - "example": false + "source": { + "description": "Determines what populates the `item` namespace in this run's data source.", + "oneOf": [ + { + "$ref": "#/components/schemas/EvalJsonlFileContentSource" + }, + { + "$ref": "#/components/schemas/EvalJsonlFileIdSource" + }, + { + "$ref": "#/components/schemas/EvalResponsesSource" + } + ] } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type", + "source" ], "x-oaiMeta": { - "name": "List assistants response object", - "group": "chat", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698982736,\n \"name\": \"Coding Tutor\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc456\",\n \"object\": \"assistant\",\n \"created_at\": 1698982718,\n \"name\": \"My Assistant\",\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc789\",\n \"object\": \"assistant\",\n \"created_at\": 1698982643,\n \"name\": null,\n \"description\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n }\n ],\n \"first_id\": \"asst_abc123\",\n \"last_id\": \"asst_abc789\",\n \"has_more\": false\n}\n" + "name": "The completions data source object used to configure an individual run", + "group": "eval runs", + "example": "{\n \"type\": \"responses\",\n \"input_messages\": {\n \"type\": \"item_reference\",\n \"item_reference\": \"item.input\"\n },\n \"model\": \"gpt-6-astra\",\n \"source\": {\n \"type\": \"responses\",\n \"model\": \"gpt-6-astra\"\n }\n}\n" } }, - "ListAuditLogsResponse": { + "CreateEvalRunRequest": { "type": "object", + "title": "CreateEvalRunRequest", "properties": { - "object": { + "name": { "type": "string", - "enum": [ - "list" - ], - "x-stainless-const": true + "description": "The name of the run." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AuditLog" - } + "metadata": { + "$ref": "#/components/schemas/Metadata" }, - "first_id": { - "anyOf": [ + "data_source": { + "type": "object", + "description": "Details about the run's data source.", + "oneOf": [ { - "type": "string" + "$ref": "#/components/schemas/CreateEvalJsonlRunDataSource" }, { - "type": "null" - } - ], - "example": "audit_log-defb456h8dks" - }, - "last_id": { - "anyOf": [ - { - "type": "string" + "$ref": "#/components/schemas/CreateEvalCompletionsRunDataSource" }, { - "type": "null" + "$ref": "#/components/schemas/CreateEvalResponsesRunDataSource" } - ], - "example": "audit_log-hnbkd8s93s" - }, - "has_more": { - "type": "boolean" + ] } }, "required": [ - "object", - "data", - "has_more" + "data_source" ] }, - "ListBatchesResponse": { + "CreateEvalStoredCompletionsDataSourceConfig": { "type": "object", + "title": "StoredCompletionsDataSourceConfig", + "description": "Deprecated in favor of LogsDataSourceConfig.\n", "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Batch" - } - }, - "first_id": { + "type": { "type": "string", - "example": "batch_abc123" + "enum": [ + "stored_completions" + ], + "default": "stored_completions", + "description": "The type of data source. Always `stored_completions`.", + "x-stainless-const": true }, - "last_id": { + "metadata": { + "type": "object", + "description": "Metadata filters for the stored completions data source.", + "additionalProperties": true, + "example": "{\n \"use_case\": \"customer_support_agent\"\n}\n" + } + }, + "required": [ + "type" + ], + "deprecated": true, + "x-oaiMeta": { + "name": "The stored completions data source object for evals", + "group": "evals", + "example": "{\n \"type\": \"stored_completions\",\n \"metadata\": {\n \"use_case\": \"customer_support_agent\"\n }\n}\n" + } + }, + "CreateFileRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "description": "The File object (not file name) to be uploaded.\n", "type": "string", - "example": "batch_abc456" - }, - "has_more": { - "type": "boolean" + "format": "binary" }, - "object": { + "purpose": { + "description": "The intended purpose of the uploaded file. One of:\n- `assistants`: Used in the Assistants API\n- `batch`: Used in the Batch API\n- `fine-tune`: Used for fine-tuning\n- `vision`: Images used for vision fine-tuning\n- `user_data`: Flexible file type for any purpose\n- `evals`: Used for eval data sets\n", "type": "string", "enum": [ - "list" - ], - "x-stainless-const": true + "assistants", + "batch", + "fine-tune", + "vision", + "user_data", + "evals" + ] + }, + "expires_after": { + "$ref": "#/components/schemas/FileExpirationAfter" } }, "required": [ - "object", - "data", - "has_more" + "file", + "purpose" ] }, - "ListCertificatesResponse": { + "CreateFineTuningCheckpointPermissionRequest": { "type": "object", + "additionalProperties": false, "properties": { - "data": { + "project_ids": { "type": "array", + "description": "The project identifiers to grant access to.", "items": { - "$ref": "#/components/schemas/OrganizationCertificate" + "type": "string" } - }, - "first_id": { + } + }, + "required": [ + "project_ids" + ] + }, + "CreateFineTuningJobRequest": { + "type": "object", + "properties": { + "model": { + "description": "The name of the model to fine-tune. You can select one of the\n[supported models](https://developers.openai.com/api/docs/guides/model-optimization#fine-tuning-methods).\n", + "example": "gpt-4o-mini", "anyOf": [ { "type": "string" }, { - "type": "null" + "type": "string", + "enum": [ + "babbage-002", + "davinci-002", + "gpt-3.5-turbo", + "gpt-4o-mini" + ] } ], - "example": "cert_abc" + "x-oaiTypeLabel": "string" }, - "last_id": { - "anyOf": [ - { - "type": "string" + "training_file": { + "description": "The ID of an uploaded file that contains training data.\n\nSee [upload file](https://developers.openai.com/api/reference/resources/files/methods/create) for how to upload a file.\n\nYour dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`.\n\nThe contents of the file should differ depending on if the model uses the [chat](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data), [completions](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) format, or if the fine-tuning method uses the [preference](https://developers.openai.com/api/docs/guides/direct-preference-optimization) format.\n\nSee the [fine-tuning guide](https://developers.openai.com/api/docs/guides/model-optimization) for more details.\n", + "type": "string", + "example": "file-abc123" + }, + "hyperparameters": { + "type": "object", + "description": "The hyperparameters used for the fine-tuning job.\nThis value is now deprecated in favor of `method`, and should be passed in under the `method` parameter.\n", + "properties": { + "batch_size": { + "description": "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 256 + } + ], + "default": "auto" }, - { - "type": "null" + "learning_rate_multiplier": { + "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "number", + "exclusiveMinimum": 0 + } + ], + "default": "auto" + }, + "n_epochs": { + "description": "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + ], + "default": "auto" } + }, + "deprecated": true + }, + "suffix": { + "description": "A string of up to 64 characters that will be added to your fine-tuned model name.\n\nFor example, a `suffix` of \"custom-model-name\" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.\n", + "type": [ + "string", + "null" ], - "example": "cert_abc" + "minLength": 1, + "maxLength": 64, + "default": null }, - "has_more": { - "type": "boolean" + "validation_file": { + "description": "The ID of an uploaded file that contains validation data.\n\nIf you provide this file, the data is used to generate validation\nmetrics periodically during fine-tuning. These metrics can be viewed in\nthe fine-tuning results file.\nThe same data should not be present in both train and validation files.\n\nYour dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`.\n\nSee the [fine-tuning guide](https://developers.openai.com/api/docs/guides/model-optimization) for more details.\n", + "type": [ + "string", + "null" + ], + "example": "file-abc123" }, - "object": { - "type": "string", - "enum": [ - "list" + "integrations": { + "type": [ + "array", + "null" ], - "x-stainless-const": true + "description": "A list of integrations to enable for your fine-tuning job.", + "items": { + "type": "object", + "required": [ + "type", + "wandb" + ], + "properties": { + "type": { + "description": "The type of integration to enable. Currently, only \"wandb\" (Weights and Biases) is supported.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "wandb" + ], + "x-stainless-const": true + } + ] + }, + "wandb": { + "type": "object", + "description": "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n", + "required": [ + "project" + ], + "properties": { + "project": { + "description": "The name of the project that the new run will be created under.\n", + "type": "string", + "example": "my-wandb-project" + }, + "name": { + "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n", + "type": [ + "string", + "null" + ] + }, + "entity": { + "description": "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n", + "type": [ + "string", + "null" + ] + }, + "tags": { + "description": "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n", + "type": "array", + "items": { + "type": "string", + "example": "custom-tag" + } + } + } + } + } + } + }, + "seed": { + "description": "The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases.\nIf a seed is not specified, one will be generated for you.\n", + "type": [ + "integer", + "null" + ], + "minimum": 0, + "maximum": 2147483647, + "example": 42 + }, + "method": { + "$ref": "#/components/schemas/FineTuneMethod" + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" } }, "required": [ - "object", - "data", - "has_more", - "first_id", - "last_id" + "model", + "training_file" ] }, - "ListFilesResponse": { + "CreateGroupBody": { "type": "object", + "description": "Request payload for creating a new group in the organization.", "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIFile" - } - }, - "first_id": { + "name": { "type": "string", - "example": "file-abc123" - }, - "last_id": { + "description": "Human readable name for the group.", + "minLength": 1, + "maxLength": 255 + } + }, + "required": [ + "name" + ], + "x-oaiMeta": { + "example": "{\n \"name\": \"Support Team\"\n}\n" + } + }, + "CreateGroupUserBody": { + "type": "object", + "description": "Request payload for adding a user to a group.", + "properties": { + "user_id": { "type": "string", - "example": "file-abc456" - }, - "has_more": { - "type": "boolean", - "example": false + "description": "Identifier of the user to add to the group." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] + "user_id" + ], + "x-oaiMeta": { + "example": "{\n \"user_id\": \"user_abc123\"\n}\n" + } }, - "ListFineTuningCheckpointPermissionResponse": { + "CreateImageEditRequest": { "type": "object", "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FineTuningCheckpointPermission" - } + "image": { + "anyOf": [ + { + "type": "string", + "format": "binary" + }, + { + "type": "array", + "maxItems": 16, + "items": { + "type": "string", + "format": "binary" + } + } + ], + "description": "The image(s) to edit. Must be a supported image file or an array of images.\n\nFor the GPT image models (`gpt-image-1-mini`, `gpt-image-1.5`,\n`gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and\n`gpt-image-2.5-flare-2026-09-08`), each image should be a `png`, `webp`, or `jpg`\nfile less than 50MB. You can provide up to 16 images. `chatgpt-image-latest`\nfollows the same input constraints as GPT image models.\n" }, - "object": { + "prompt": { + "description": "A text description of the desired image(s). The maximum length is 32000 characters for the GPT image models.", "type": "string", - "enum": [ - "list" + "example": "A cute baby sea otter wearing a beret" + }, + "mask": { + "description": "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.", + "type": "string", + "format": "binary" + }, + "markup": { + "$ref": "#/components/schemas/markup", + "description": "A transparent PNG overlaid on the first image to guide the edit. Must match that image's dimensions after orientation and contain transparent pixels. Supports GPT Image 2.5. Cannot be combined with mask." + }, + "background": { + "anyOf": [ + { + "type": "string", + "enum": [ + "transparent", + "opaque", + "auto" + ] + }, + { + "type": "null" + } ], - "x-stainless-const": true + "default": "auto", + "example": "transparent", + "description": "Set the background of the generated image(s). This parameter is only supported for\nthe GPT image models. Must be one of `transparent`, `opaque`, or `auto` (default\nvalue). When `auto` is used, the model will automatically determine the best\nbackground for the image.\n\n`gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`\nsnapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds\nare available for supported GPT Image models. For `gpt-image-2` and\n`gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,\nset the output format to `png` or `webp`.\n" }, - "first_id": { + "model": { "anyOf": [ { "type": "string" }, { - "type": "null" + "type": "string", + "enum": [ + "gpt-image-1.5", + "gpt-image-2", + "gpt-image-2-2026-04-21", + "gpt-image-2.5-sunburst", + "gpt-image-2.5-sunburst-2026-09-08", + "gpt-image-2.5-flare", + "gpt-image-2.5-flare-2026-09-08", + "gpt-image-1", + "gpt-image-1-mini", + "chatgpt-image-latest", + "dall-e-2" + ], + "x-openai-enum-deprecations": { + "gpt-image-1": { + "message": "GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead." + }, + "dall-e-2": { + "message": "This model was retired on May 12, 2026. Use a GPT image model instead." + } + }, + "x-stainless-const": true } - ] + ], + "x-oaiTypeLabel": "string", + "example": "gpt-image-1.5", + "description": "The GPT image model to use for image editing\n(`gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,\n`gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,\n`gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`).\n\n`gpt-image-1` was shut down on October 23, 2026. Use\n`gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.\n" }, - "last_id": { + "n": { + "type": [ + "integer", + "null" + ], + "minimum": 1, + "maximum": 10, + "default": 1, + "example": 1, + "description": "The number of images to generate. Must be between 1 and 10." + }, + "size": { "anyOf": [ { "type": "string" }, + { + "type": "string", + "enum": [ + "1024x1024", + "1536x1024", + "1024x1536", + "auto", + "256x256", + "512x512" + ], + "x-openai-enum-deprecations": { + "256x256": { + "message": "This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes." + }, + "512x512": { + "message": "This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes." + } + } + }, { "type": "null" } - ] - }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "has_more" - ] - }, - "ListFineTuningJobCheckpointsResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FineTuningJobCheckpoint" - } + ], + "default": "auto", + "example": "1024x1024", + "description": "The size of the generated images. Defaults to `auto`. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing." }, - "object": { - "type": "string", + "response_format": { + "type": [ + "string", + "null" + ], "enum": [ - "list" + "url", + "b64_json", + null ], - "x-stainless-const": true + "deprecated": true, + "description": "Legacy response format parameter for retired image models. Unsupported for GPT image models, which always return base64-encoded images." }, - "first_id": { + "output_format": { "anyOf": [ { - "type": "string" + "type": "string", + "enum": [ + "png", + "jpeg", + "webp" + ] }, { "type": "null" } - ] + ], + "default": "png", + "example": "png", + "description": "The format in which the generated images are returned. This parameter is\nonly supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.\nThe default value is `png`.\n" }, - "last_id": { + "output_compression": { + "type": [ + "integer", + "null" + ], + "default": 100, + "example": 100, + "description": "The compression level (0-100%) for the generated images. This parameter\nis only supported for the GPT image models with the `webp` or `jpeg` output\nformats, and defaults to 100.\n" + }, + "safety_identifier": { + "type": [ + "string", + "null" + ], + "maxLength": 128, + "example": "user-1234", + "description": "A stable identifier for an end user in your organization, used for safety monitoring and abuse detection. Hash a username or email address to avoid sending identifying information. A non-empty value takes precedence over the deprecated `user` parameter. If omitted, null, or empty, the API uses `user` when available. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers)." + }, + "user": { + "type": "string", + "example": "user-1234", + "deprecated": true, + "description": "Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers)." + }, + "input_fidelity": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/InputFidelity" }, { "type": "null" } ] }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "has_more" - ] - }, - "ListFineTuningJobEventsResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FineTuningJobEvent" - } - }, - "object": { - "type": "string", - "enum": [ - "list" + "stream": { + "type": [ + "boolean", + "null" ], - "x-stainless-const": true + "default": false, + "example": false, + "description": "Edit the image in streaming mode. Defaults to `false`. See the\n[Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information.\n" }, - "has_more": { - "type": "boolean" + "partial_images": { + "$ref": "#/components/schemas/PartialImages" + }, + "quality": { + "anyOf": [ + { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto", + "standard" + ], + "x-openai-enum-deprecations": { + "standard": { + "message": "This quality was only supported by retired DALL·E models. Use a GPT image quality instead." + } + } + }, + { + "type": "null" + } + ], + "default": "auto", + "example": "high", + "description": "The quality of the image that will be generated for GPT image models. The GPT image models support `low`, `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`.\n" } }, "required": [ - "object", - "data", - "has_more" + "model", + "prompt", + "image" ] }, - "ListMessagesResponse": { + "CreateImageRequest": { + "type": "object", "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "first_id": { + "prompt": { + "description": "A text description of the desired image(s). The maximum length is 32000 characters.", "type": "string", - "example": "msg_abc123" + "example": "A cute baby sea otter" }, - "last_id": { - "type": "string", - "example": "msg_abc123" + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-image-1.5", + "gpt-image-2", + "gpt-image-2-2026-04-21", + "gpt-image-2.5-sunburst", + "gpt-image-2.5-sunburst-2026-09-08", + "gpt-image-2.5-flare", + "gpt-image-2.5-flare-2026-09-08", + "gpt-image-1", + "gpt-image-1-mini", + "chatgpt-image-latest", + "dall-e-2", + "dall-e-3" + ], + "x-openai-enum-deprecations": { + "gpt-image-1": { + "message": "GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead." + }, + "dall-e-2": { + "message": "This model was retired on May 12, 2026. Use a GPT image model instead." + }, + "dall-e-3": { + "message": "This model was retired on May 12, 2026. Use a GPT image model instead." + } + } + } + ], + "x-oaiTypeLabel": "string", + "example": "gpt-image-2.5-flare", + "description": "The GPT image model to use for image generation. Specify a model explicitly.\nSupported models include `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,\n`gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,\n`gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.\n\n`gpt-image-1` was shut down on October 23, 2026. Use\n`gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.\n" }, - "has_more": { - "type": "boolean", - "example": false - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "ListModelsResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", + "n": { + "type": [ + "integer", + "null" + ], + "minimum": 1, + "maximum": 10, + "default": 1, + "example": 1, + "description": "The number of images to generate. Must be between 1 and 10." + }, + "quality": { + "anyOf": [ + { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto", + "standard", + "hd" + ], + "x-openai-enum-deprecations": { + "standard": { + "message": "This quality was only supported by retired DALL·E models. Use a GPT image quality instead." + }, + "hd": { + "message": "This quality was only supported by retired DALL·E models. Use a GPT image quality instead." + } + } + }, + { + "type": "null" + } + ], + "default": "auto", + "example": "medium", + "description": "The quality of the image that will be generated.\n\n- `auto` (default value) will automatically select the best quality for the given\n model.\n- `high`, `medium` and `low` are supported for the GPT image models.\n- `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`\n snapshots, also support `xhigh` and `max`.\n" + }, + "response_format": { + "type": [ + "string", + "null" + ], "enum": [ - "list" + "url", + "b64_json", + null ], - "x-stainless-const": true + "deprecated": true, + "description": "Legacy response format parameter for retired image models. Unsupported for GPT image models, which always return base64-encoded images." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Model" - } - } - }, - "required": [ - "object", - "data" - ] - }, - "ListPaginatedFineTuningJobsResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FineTuningJob" - } + "output_format": { + "anyOf": [ + { + "type": "string", + "enum": [ + "png", + "jpeg", + "webp" + ] + }, + { + "type": "null" + } + ], + "default": "png", + "example": "png", + "description": "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`." }, - "has_more": { - "type": "boolean" + "output_compression": { + "type": [ + "integer", + "null" + ], + "default": 100, + "example": 100, + "description": "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." }, - "object": { - "type": "string", - "enum": [ - "list" + "stream": { + "type": [ + "boolean", + "null" ], - "x-stainless-const": true - } - }, - "required": [ - "object", - "data", - "has_more" - ] - }, - "ListProjectCertificatesResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OrganizationProjectCertificate" - } + "default": false, + "example": false, + "description": "Generate the image in streaming mode. Defaults to `false`. See the\n[Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information.\nThis parameter is only supported for the GPT image models.\n" }, - "first_id": { + "partial_images": { + "$ref": "#/components/schemas/PartialImages" + }, + "size": { "anyOf": [ { "type": "string" }, + { + "type": "string", + "enum": [ + "auto", + "1024x1024", + "1536x1024", + "1024x1536", + "256x256", + "512x512", + "1792x1024", + "1024x1792" + ], + "x-openai-enum-deprecations": { + "256x256": { + "message": "This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes." + }, + "512x512": { + "message": "This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes." + }, + "1792x1024": { + "message": "This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes." + }, + "1024x1792": { + "message": "This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes." + } + } + }, { "type": "null" } ], - "example": "cert_abc" + "default": "auto", + "example": "1024x1024", + "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing." }, - "last_id": { + "moderation": { "anyOf": [ { - "type": "string" + "type": "string", + "enum": [ + "low", + "auto" + ] }, { "type": "null" } ], - "example": "cert_abc" + "default": "auto", + "example": "low", + "description": "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)." }, - "has_more": { - "type": "boolean" + "background": { + "anyOf": [ + { + "type": "string", + "enum": [ + "transparent", + "opaque", + "auto" + ] + }, + { + "type": "null" + } + ], + "default": "auto", + "example": "transparent", + "description": "Set the background of the generated image(s). This parameter is only supported for\nthe GPT image models. Must be one of `transparent`, `opaque`, or `auto` (default\nvalue). When `auto` is used, the model will automatically determine the best\nbackground for the image.\n\n`gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`\nsnapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds\nare available for supported GPT Image models. For `gpt-image-2` and\n`gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,\nset the output format to `png` or `webp`.\n" }, - "object": { - "type": "string", + "style": { + "type": [ + "string", + "null" + ], "enum": [ - "list" + "vivid", + "natural", + null ], - "x-stainless-const": true - } - }, - "required": [ - "object", - "data", - "has_more", - "first_id", - "last_id" - ] - }, - "ListRunStepsResponse": { - "properties": { - "object": { - "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RunStepObject" - } + "example": "vivid", + "deprecated": true, + "description": "Legacy style parameter for retired image models. Unsupported for GPT image models; describe the desired style in the prompt instead." }, - "first_id": { - "type": "string", - "example": "step_abc123" + "safety_identifier": { + "type": [ + "string", + "null" + ], + "maxLength": 128, + "example": "user-1234", + "description": "A stable identifier for an end user in your organization, used for safety monitoring and abuse detection. Hash a username or email address to avoid sending identifying information. A non-empty value takes precedence over the deprecated `user` parameter. If omitted, null, or empty, the API uses `user` when available. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers)." }, - "last_id": { + "user": { "type": "string", - "example": "step_abc456" - }, - "has_more": { - "type": "boolean", - "example": false + "example": "user-1234", + "deprecated": true, + "description": "Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers)." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "model", + "prompt" ] }, - "ListRunsResponse": { + "CreateImageVariationRequest": { "type": "object", + "deprecated": true, + "description": "Legacy request for the retired image variations endpoint.", "properties": { - "object": { + "image": { + "description": "The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.", "type": "string", - "example": "list" + "format": "binary" }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RunObject" - } + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "dall-e-2" + ], + "x-stainless-const": true + }, + { + "type": "null" + } + ], + "x-oaiTypeLabel": "string", + "default": "dall-e-2", + "example": "dall-e-2", + "description": "The legacy model used by the retired image variations endpoint. This endpoint no longer accepts requests." }, - "first_id": { - "type": "string", - "example": "run_abc123" + "n": { + "type": [ + "integer", + "null" + ], + "minimum": 1, + "maximum": 10, + "default": 1, + "example": 1, + "description": "The number of images to generate. Must be between 1 and 10." }, - "last_id": { - "type": "string", - "example": "run_abc456" + "response_format": { + "type": [ + "string", + "null" + ], + "enum": [ + "url", + "b64_json", + null + ], + "default": "url", + "example": "url", + "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated." }, - "has_more": { - "type": "boolean", - "example": false + "size": { + "type": [ + "string", + "null" + ], + "enum": [ + "256x256", + "512x512", + "1024x1024", + null + ], + "default": "1024x1024", + "example": "1024x1024", + "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`." + }, + "user": { + "type": "string", + "example": "user-1234", + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "image" ] }, - "ListVectorStoreFilesResponse": { + "CreateMessageRequest": { + "type": "object", + "additionalProperties": false, + "required": [ + "role", + "content" + ], "properties": { - "object": { + "role": { "type": "string", - "example": "list" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VectorStoreFileObject" - } + "enum": [ + "user", + "assistant" + ], + "description": "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n" }, - "first_id": { - "type": "string", - "example": "file-abc123" + "content": { + "oneOf": [ + { + "type": "string", + "description": "The text contents of the message.", + "title": "Text content" + }, + { + "type": "array", + "description": "An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](https://developers.openai.com/api/docs/models).", + "title": "Array of content parts", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageContentImageFileObject" + }, + { + "$ref": "#/components/schemas/MessageContentImageUrlObject" + }, + { + "$ref": "#/components/schemas/MessageRequestContentTextObject" + } + ] + }, + "minItems": 1 + } + ] }, - "last_id": { - "type": "string", - "example": "file-abc456" + "attachments": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "object", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file to attach to the message." + }, + "tools": { + "description": "The tools to add this file to.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearchTypeOnly" + } + ] + } + } + } + }, + "description": "A list of files attached to the message, and the tools they should be added to.", + "required": [ + "file_id", + "tools" + ] + }, + { + "type": "null" + } + ] }, - "has_more": { - "type": "boolean", - "example": false + "metadata": { + "$ref": "#/components/schemas/Metadata" } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] + } }, - "ListVectorStoresResponse": { - "properties": { - "object": { - "type": "string", - "example": "list" + "CreateModelResponseProperties": { + "allOf": [ + { + "$ref": "#/components/schemas/ModelResponseProperties" }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VectorStoreObject" + { + "type": "object", + "properties": { + "prompt_cache_options": { + "$ref": "#/components/schemas/PromptCacheOptionsParam" + }, + "top_logprobs": { + "description": "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n", + "type": "integer", + "minimum": 0, + "maximum": 20 + } } - }, - "first_id": { - "type": "string", - "example": "vs_abc123" - }, - "last_id": { - "type": "string", - "example": "vs_abc456" - }, - "has_more": { - "type": "boolean", - "example": false } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" ] }, - "LiveCallAcceptRequest": { - "type": "object", - "description": "Accept an incoming SIP call with Live startup configuration.", - "properties": { - "session": { - "$ref": "#/components/schemas/LiveCallAcceptSession", - "description": "Model and startup configuration for the Live session that answers the incoming SIP call." - } - }, - "required": [ - "session" - ], - "additionalProperties": false - }, - "LiveCallAcceptSession": { + "CreateModerationRequest": { "type": "object", - "description": "Startup configuration for accepting an incoming Live SIP call. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend and backend instructions.", "properties": { - "model": { - "$ref": "#/components/schemas/ModelIdsLive", - "description": "The Live model to use for the accepted call.", - "minLength": 1 - }, - "instructions": { - "$ref": "#/components/schemas/instructions" - }, - "audio": { - "$ref": "#/components/schemas/LiveMediaSessionAudioParam", - "description": "Startup audio output configuration. SIP negotiates the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup." - }, - "delegation": { - "$ref": "#/components/schemas/delegation" - }, - "store": { - "$ref": "#/components/schemas/store" - }, "input": { - "$ref": "#/components/schemas/input" - }, - "type": { - "type": "string", - "enum": [ - "live" - ], - "default": "live", - "x-stainless-const": true, - "description": "The session type. Always `live`." - } - }, - "required": [ - "model", - "type" - ], - "additionalProperties": false - }, - "LiveCallReferRequest": { - "type": "object", - "description": "Parameters used to transfer a Live SIP call to another destination.", - "properties": { - "target_uri": { - "$ref": "#/components/schemas/target_uri", - "minLength": 1, - "pattern": "\\S", - "description": "Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or sip:agent@example.com." - } - }, - "required": [ - "target_uri" - ], - "additionalProperties": false - }, - "LiveCallRejectRequest": { - "type": "object", - "description": "Parameters used to reject an incoming Live SIP call.", - "properties": { - "status_code": { - "type": "integer", - "minimum": 300, - "maximum": 699, - "description": "SIP rejection status sent to the caller. This field is required.", - "example": 486 - } - }, - "required": [ - "status_code" - ], - "additionalProperties": false - }, - "LiveClientEvent": { - "description": "Client events for Live. Initialize a primary WebSocket with session.start and wait for session.started. WebRTC creation already starts the session. Audio append is primary WebSocket-only. See the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before writing frontend instructions and delegation policies.", - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveSessionStartEvent" - }, - { - "$ref": "#/components/schemas/LiveSessionUpdateParam" - }, - { - "$ref": "#/components/schemas/LiveInputAudioAppendEvent" - }, - { - "$ref": "#/components/schemas/LiveInputAudioMuteParam" - }, - { - "$ref": "#/components/schemas/LiveInputAudioUnmuteParam" - }, - { - "$ref": "#/components/schemas/LiveInstructionsAppendParam" - }, - { - "$ref": "#/components/schemas/LiveThinkingAppendParam" - }, - { - "$ref": "#/components/schemas/LiveCommentaryAppendParam" - }, - { - "$ref": "#/components/schemas/LiveResponseItemCreateParam" - }, - { - "$ref": "#/components/schemas/LiveResponseCreateParam" - }, - { - "$ref": "#/components/schemas/LiveSessionCloseParam" - } - ] - }, - "LiveConnectParams": { - "type": "object", - "x-stainless-empty-object": true, - "description": "Primary Live WebSocket connections accept no query parameters. Supply the model and startup configuration in the first session.start event.", - "properties": {}, - "additionalProperties": false - }, - "LiveCreateRequest": { - "type": "object", - "description": "Create a Live WebRTC session with JSON session configuration and an SDP offer. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before choosing frontend and backend instructions. The request starts the session; do not send session.start on the data channel.", - "properties": { - "session": { - "$ref": "#/components/schemas/LiveMediaSessionCreateParams", - "description": "Startup configuration for the Live session." - }, - "transport": { - "$ref": "#/components/schemas/LiveWebRTCTransport", - "description": "WebRTC transport with the browser's SDP offer." - } - }, - "required": [ - "session", - "transport" - ], - "additionalProperties": false - }, - "LiveCreateResponse": { - "type": "object", - "description": "The created Live session identifier and WebRTC answer. Apply transport.sdp as the peer's remote answer and wait for session.started on the data channel before sending commands.", - "properties": { - "session": { - "type": "object", - "description": "The newly created Live session. Use its ID for session controls and sideband connections.", - "properties": { - "id": { + "description": "Input (or inputs) to classify. Can be a single string, an array of strings, or\nan array of multi-modal input objects similar to other models.\n", + "oneOf": [ + { "type": "string", - "description": "Opaque session identifier. Preserve the returned value unchanged, including its prefix." + "description": "A string of text to classify for moderation.", + "default": "", + "example": "...text to classify goes here..." + }, + { + "type": "array", + "description": "An array of strings to classify for moderation.", + "items": { + "type": "string", + "default": "", + "example": "...text to classify goes here..." + } + }, + { + "type": "array", + "description": "An array of multi-modal inputs to the moderation model.", + "items": { + "oneOf": [ + { + "type": "object", + "description": "An object describing an image to classify.", + "properties": { + "type": { + "description": "Always `image_url`.", + "type": "string", + "enum": [ + "image_url" + ], + "x-stainless-const": true + }, + "image_url": { + "type": "object", + "description": "Contains either an image URL or a data URL for a base64 encoded image.", + "properties": { + "url": { + "type": "string", + "description": "Either a URL of the image or the base64 encoded image data.", + "format": "uri", + "example": "https://example.com/image.jpg" + } + }, + "required": [ + "url" + ] + } + }, + "required": [ + "type", + "image_url" + ] + }, + { + "type": "object", + "description": "An object describing text to classify.", + "properties": { + "type": { + "description": "Always `text`.", + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + }, + "text": { + "description": "A string of text to classify.", + "type": "string", + "example": "...text to classify goes here..." + } + }, + "required": [ + "type", + "text" + ] + } + ] + } } - }, - "required": [ - "id" ] }, - "transport": { - "$ref": "#/components/schemas/LiveWebRTCTransport", - "description": "WebRTC transport with the SDP answer." + "model": { + "description": "The content moderation model you would like to use. Learn more in\n[the moderation guide](https://developers.openai.com/api/docs/guides/moderation), and learn about\navailable models [here](https://developers.openai.com/api/docs/guides/moderation).\n", + "default": "omni-moderation-latest", + "example": "omni-moderation-2024-09-26", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "omni-moderation-latest", + "omni-moderation-2024-09-26", + "text-moderation-latest", + "text-moderation-stable" + ] + } + ], + "x-oaiTypeLabel": "string" } }, "required": [ - "session", - "transport" - ] - }, - "LiveForkClientEvent": { - "description": "Client events for a Live fork WebSocket. First send session.start with an overrides object (which may be empty), then wait for session.started before sending other commands. The model and conversation are inherited from the stored session.", - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveForkSessionStartEvent" - }, - { - "$ref": "#/components/schemas/LiveSessionUpdateParam" - }, - { - "$ref": "#/components/schemas/LiveInputAudioAppendEvent" - }, - { - "$ref": "#/components/schemas/LiveInputAudioMuteParam" - }, - { - "$ref": "#/components/schemas/LiveInputAudioUnmuteParam" - }, - { - "$ref": "#/components/schemas/LiveInstructionsAppendParam" - }, - { - "$ref": "#/components/schemas/LiveThinkingAppendParam" - }, - { - "$ref": "#/components/schemas/LiveCommentaryAppendParam" - }, - { - "$ref": "#/components/schemas/LiveResponseItemCreateParam" - }, - { - "$ref": "#/components/schemas/LiveResponseCreateParam" - }, - { - "$ref": "#/components/schemas/LiveSessionCloseParam" - } + "input" ] }, - "LiveForkPathParams": { + "CreateModerationResponse": { "type": "object", - "description": "Identifies the stored Live session whose conversation and configuration are used to create a fork.", - "required": [ - "session_id" - ], + "description": "Represents if a given text input is potentially harmful.", "properties": { - "session_id": { + "id": { "type": "string", - "description": "The ID of the stored Live session to fork." - } - } - }, - "LiveForkRequest": { - "type": "object", - "description": "Fork a stored Live session onto a new WebRTC connection. Omit session or send an empty object to inherit its configuration.", - "properties": { - "session": { - "$ref": "#/components/schemas/LiveMediaSessionForkParams", - "description": "Optional configuration overrides for the new Live session. Omit this object or send an empty object to inherit the stored session's settings." + "description": "The unique identifier for the moderation request." }, - "transport": { - "$ref": "#/components/schemas/LiveWebRTCTransport", - "description": "WebRTC transport with an SDP offer for the new connection to the forked session." - } - }, - "required": [ - "transport" - ], - "additionalProperties": false - }, - "LiveForkServerEvent": { - "$ref": "#/components/schemas/LiveServerEvent" - }, - "LiveMediaSessionAudioParam": { - "type": "object", - "description": "Startup audio output configuration. WebRTC and SIP negotiate the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup.", - "properties": { - "output": { - "$ref": "#/components/schemas/LiveInitialSessionAudioOutputParam" - } - }, - "additionalProperties": false - }, - "LiveMediaSessionCreateParams": { - "type": "object", - "description": "Startup configuration for a Live media session. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend instructions and the backend prompt under delegation.responses.instructions.", - "properties": { "model": { - "$ref": "#/components/schemas/ModelIdsLive" - }, - "instructions": { - "$ref": "#/components/schemas/instructions" - }, - "audio": { - "$ref": "#/components/schemas/LiveMediaSessionAudioParam", - "description": "Startup audio configuration. WebRTC and SIP negotiate their audio format on the media transport." - }, - "delegation": { - "$ref": "#/components/schemas/delegation" - }, - "store": { - "$ref": "#/components/schemas/store" - }, - "input": { - "$ref": "#/components/schemas/input" - }, - "client": { - "$ref": "#/components/schemas/LiveClientConfigParam" - } - }, - "required": [ - "model" - ], - "additionalProperties": false - }, - "LiveMediaSessionForkParams": { - "type": "object", - "description": "Optional overrides for a stored Live session. Omitted settings are inherited. The model, voice, frontend instructions, and prior conversation come from the stored session. WebRTC negotiates its audio format; audio.format is only supported on WebSocket forks.", - "properties": { - "store": { - "$ref": "#/components/schemas/properties-store" - }, - "delegation": { - "$ref": "#/components/schemas/LiveResponsesDelegationUpdateParam" - }, - "client": { - "$ref": "#/components/schemas/LiveClientConfigParam" - } - }, - "additionalProperties": false - }, - "LiveServerEvent": { - "description": "Server events for Live. Response lifecycle events are wrapped inside response.event; dispatch the nested event by its full type and tolerate new response event types. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when designing the conversation and delegation policy.", - "discriminator": { - "propertyName": "type" - }, - "allOf": [ - { - "$ref": "#/components/schemas/LiveServerEvent-2" - } - ] - }, - "LiveSidebandClientEvent": { - "description": "Client events accepted by an attached Live sideband WebSocket. The session is already started; send audio over the primary connection.", - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveSessionUpdateParam" - }, - { - "$ref": "#/components/schemas/LiveInputAudioMuteParam" - }, - { - "$ref": "#/components/schemas/LiveInputAudioUnmuteParam" - }, - { - "$ref": "#/components/schemas/LiveInstructionsAppendParam" - }, - { - "$ref": "#/components/schemas/LiveThinkingAppendParam" - }, - { - "$ref": "#/components/schemas/LiveCommentaryAppendParam" - }, - { - "$ref": "#/components/schemas/LiveResponseItemCreateParam" - }, - { - "$ref": "#/components/schemas/LiveResponseCreateParam" - }, - { - "$ref": "#/components/schemas/LiveSessionCloseParam" - } - ] - }, - "LiveSidebandConnectParams": { - "type": "object", - "description": "Connection options for a sideband WebSocket attached to an existing Live session.", - "properties": { - "graceful_close": { - "type": "boolean", - "description": "Opt in to the graceful WebSocket closing handshake when the session ends. The server may also enable this behavior by default." - } - }, - "additionalProperties": false - }, - "LiveSidebandPathParams": { - "type": "object", - "description": "Identifies the Live session to observe and control through a sideband WebSocket.", - "required": [ - "session_id" - ], - "properties": { - "session_id": { "type": "string", - "description": "The ID of the existing Live session to attach to." - } - } - }, - "LiveSidebandServerEvent": { - "description": "Server events received by an attached Live sideband WebSocket. Audio deltas are delivered over the primary connection.", - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveSessionStarted" - }, - { - "$ref": "#/components/schemas/LiveSessionUpdated" - }, - { - "$ref": "#/components/schemas/LiveInputAudioMuted" - }, - { - "$ref": "#/components/schemas/LiveInputAudioUnmuted" - }, - { - "$ref": "#/components/schemas/LiveInstructionsAppended" - }, - { - "$ref": "#/components/schemas/LiveThinkingAppended" - }, - { - "$ref": "#/components/schemas/LiveCommentaryAppended" - }, - { - "$ref": "#/components/schemas/LiveInputTranscriptDelta" - }, - { - "$ref": "#/components/schemas/LiveOutputTranscriptDelta" - }, - { - "$ref": "#/components/schemas/LiveDelegationCreated" - }, - { - "$ref": "#/components/schemas/LiveResponseEvent" + "description": "The model used to generate the moderation results." }, + "results": { + "type": "array", + "description": "A list of moderation objects.", + "items": { + "type": "object", + "properties": { + "flagged": { + "type": "boolean", + "description": "Whether any of the below categories are flagged." + }, + "categories": { + "type": "object", + "description": "A list of the categories, and whether they are flagged or not.", + "properties": { + "hate": { + "type": "boolean", + "description": "Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment." + }, + "hate/threatening": { + "type": "boolean", + "description": "Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste." + }, + "harassment": { + "type": "boolean", + "description": "Content that expresses, incites, or promotes harassing language towards any target." + }, + "harassment/threatening": { + "type": "boolean", + "description": "Harassment content that also includes violence or serious harm towards any target." + }, + "illicit": { + "anyOf": [ + { + "type": "boolean", + "description": "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, \"how to shoplift\" would fit this category." + }, + { + "type": "null" + } + ] + }, + "illicit/violent": { + "anyOf": [ + { + "type": "boolean", + "description": "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon." + }, + { + "type": "null" + } + ] + }, + "self-harm": { + "type": "boolean", + "description": "Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders." + }, + "self-harm/intent": { + "type": "boolean", + "description": "Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders." + }, + "self-harm/instructions": { + "type": "boolean", + "description": "Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts." + }, + "sexual": { + "type": "boolean", + "description": "Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness)." + }, + "sexual/minors": { + "type": "boolean", + "description": "Sexual content that includes an individual who is under 18 years old." + }, + "violence": { + "type": "boolean", + "description": "Content that depicts death, violence, or physical injury." + }, + "violence/graphic": { + "type": "boolean", + "description": "Content that depicts death, violence, or physical injury in graphic detail." + } + }, + "required": [ + "hate", + "hate/threatening", + "harassment", + "harassment/threatening", + "illicit", + "illicit/violent", + "self-harm", + "self-harm/intent", + "self-harm/instructions", + "sexual", + "sexual/minors", + "violence", + "violence/graphic" + ] + }, + "category_scores": { + "type": "object", + "description": "A list of the categories along with their scores as predicted by model.", + "properties": { + "hate": { + "type": "number", + "description": "The score for the category 'hate'." + }, + "hate/threatening": { + "type": "number", + "description": "The score for the category 'hate/threatening'." + }, + "harassment": { + "type": "number", + "description": "The score for the category 'harassment'." + }, + "harassment/threatening": { + "type": "number", + "description": "The score for the category 'harassment/threatening'." + }, + "illicit": { + "type": "number", + "description": "The score for the category 'illicit'." + }, + "illicit/violent": { + "type": "number", + "description": "The score for the category 'illicit/violent'." + }, + "self-harm": { + "type": "number", + "description": "The score for the category 'self-harm'." + }, + "self-harm/intent": { + "type": "number", + "description": "The score for the category 'self-harm/intent'." + }, + "self-harm/instructions": { + "type": "number", + "description": "The score for the category 'self-harm/instructions'." + }, + "sexual": { + "type": "number", + "description": "The score for the category 'sexual'." + }, + "sexual/minors": { + "type": "number", + "description": "The score for the category 'sexual/minors'." + }, + "violence": { + "type": "number", + "description": "The score for the category 'violence'." + }, + "violence/graphic": { + "type": "number", + "description": "The score for the category 'violence/graphic'." + } + }, + "required": [ + "hate", + "hate/threatening", + "harassment", + "harassment/threatening", + "illicit", + "illicit/violent", + "self-harm", + "self-harm/intent", + "self-harm/instructions", + "sexual", + "sexual/minors", + "violence", + "violence/graphic" + ] + }, + "category_applied_input_types": { + "type": "object", + "description": "A list of the categories along with the input type(s) that the score applies to.", + "properties": { + "hate": { + "type": "array", + "description": "The applied input type(s) for the category 'hate'.", + "items": { + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + } + }, + "hate/threatening": { + "type": "array", + "description": "The applied input type(s) for the category 'hate/threatening'.", + "items": { + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + } + }, + "harassment": { + "type": "array", + "description": "The applied input type(s) for the category 'harassment'.", + "items": { + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + } + }, + "harassment/threatening": { + "type": "array", + "description": "The applied input type(s) for the category 'harassment/threatening'.", + "items": { + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + } + }, + "illicit": { + "type": "array", + "description": "The applied input type(s) for the category 'illicit'.", + "items": { + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + } + }, + "illicit/violent": { + "type": "array", + "description": "The applied input type(s) for the category 'illicit/violent'.", + "items": { + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + } + }, + "self-harm": { + "type": "array", + "description": "The applied input type(s) for the category 'self-harm'.", + "items": { + "type": "string", + "enum": [ + "text", + "image" + ] + } + }, + "self-harm/intent": { + "type": "array", + "description": "The applied input type(s) for the category 'self-harm/intent'.", + "items": { + "type": "string", + "enum": [ + "text", + "image" + ] + } + }, + "self-harm/instructions": { + "type": "array", + "description": "The applied input type(s) for the category 'self-harm/instructions'.", + "items": { + "type": "string", + "enum": [ + "text", + "image" + ] + } + }, + "sexual": { + "type": "array", + "description": "The applied input type(s) for the category 'sexual'.", + "items": { + "type": "string", + "enum": [ + "text", + "image" + ] + } + }, + "sexual/minors": { + "type": "array", + "description": "The applied input type(s) for the category 'sexual/minors'.", + "items": { + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + } + }, + "violence": { + "type": "array", + "description": "The applied input type(s) for the category 'violence'.", + "items": { + "type": "string", + "enum": [ + "text", + "image" + ] + } + }, + "violence/graphic": { + "type": "array", + "description": "The applied input type(s) for the category 'violence/graphic'.", + "items": { + "type": "string", + "enum": [ + "text", + "image" + ] + } + } + }, + "required": [ + "hate", + "hate/threatening", + "harassment", + "harassment/threatening", + "illicit", + "illicit/violent", + "self-harm", + "self-harm/intent", + "self-harm/instructions", + "sexual", + "sexual/minors", + "violence", + "violence/graphic" + ] + } + }, + "required": [ + "flagged", + "categories", + "category_scores", + "category_applied_input_types" + ] + } + } + }, + "required": [ + "id", + "model", + "results" + ], + "x-oaiMeta": { + "name": "The moderation object", + "example": "{\n \"id\": \"modr-0d9740456c391e43c445bf0f010940c7\",\n \"model\": \"omni-moderation-latest\",\n \"results\": [\n {\n \"flagged\": true,\n \"categories\": {\n \"harassment\": true,\n \"harassment/threatening\": true,\n \"sexual\": false,\n \"hate\": false,\n \"hate/threatening\": false,\n \"illicit\": false,\n \"illicit/violent\": false,\n \"self-harm/intent\": false,\n \"self-harm/instructions\": false,\n \"self-harm\": false,\n \"sexual/minors\": false,\n \"violence\": true,\n \"violence/graphic\": true\n },\n \"category_scores\": {\n \"harassment\": 0.8189693396524255,\n \"harassment/threatening\": 0.804985420696006,\n \"sexual\": 1.573112165348997e-6,\n \"hate\": 0.007562942636942845,\n \"hate/threatening\": 0.004208854591835476,\n \"illicit\": 0.030535955153511665,\n \"illicit/violent\": 0.008925306722380033,\n \"self-harm/intent\": 0.00023023930975076432,\n \"self-harm/instructions\": 0.0002293869201073356,\n \"self-harm\": 0.012598046106750154,\n \"sexual/minors\": 2.212566909570261e-8,\n \"violence\": 0.9999992735124786,\n \"violence/graphic\": 0.843064871157054\n },\n \"category_applied_input_types\": {\n \"harassment\": [\n \"text\"\n ],\n \"harassment/threatening\": [\n \"text\"\n ],\n \"sexual\": [\n \"text\",\n \"image\"\n ],\n \"hate\": [\n \"text\"\n ],\n \"hate/threatening\": [\n \"text\"\n ],\n \"illicit\": [\n \"text\"\n ],\n \"illicit/violent\": [\n \"text\"\n ],\n \"self-harm/intent\": [\n \"text\",\n \"image\"\n ],\n \"self-harm/instructions\": [\n \"text\",\n \"image\"\n ],\n \"self-harm\": [\n \"text\",\n \"image\"\n ],\n \"sexual/minors\": [\n \"text\"\n ],\n \"violence\": [\n \"text\",\n \"image\"\n ],\n \"violence/graphic\": [\n \"text\",\n \"image\"\n ]\n }\n }\n ]\n}\n" + } + }, + "CreateResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/CreateModelResponseProperties" + }, + { + "$ref": "#/components/schemas/ResponseProperties" + }, + { + "type": "object", + "properties": { + "access_programs": { + "$ref": "#/components/schemas/AccessProgramsParam" + }, + "image": { + "$ref": "#/components/schemas/ImageOptionsParam" + }, + "prompt_cache_options": { + "$ref": "#/components/schemas/ResponsePromptCacheOptionsParam" + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTierResponses" + }, + "truncation": { + "deprecated": true, + "anyOf": [ + { + "type": "string", + "description": "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n", + "enum": [ + "auto", + "disabled" + ], + "default": "disabled" + }, + { + "type": "null" + } + ] + }, + "reasoning": { + "anyOf": [ + { + "$ref": "#/components/schemas/Reasoning" + }, + { + "type": "null" + } + ] + }, + "input": { + "$ref": "#/components/schemas/InputParam" + }, + "include": { + "anyOf": [ + { + "type": "array", + "description": "Specify additional output data to include in the model response. Currently supported values are:\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program).", + "items": { + "$ref": "#/components/schemas/IncludeEnum" + } + }, + { + "type": "null" + } + ] + }, + "parallel_tool_calls": { + "anyOf": [ + { + "type": "boolean", + "description": "Whether to allow the model to run tool calls in parallel.\n", + "default": true + }, + { + "type": "null" + } + ] + }, + "store": { + "anyOf": [ + { + "type": "boolean", + "description": "Whether to store the generated model response for later retrieval via\nAPI.\nDefaults to true when omitted.\nIf set to true, response data will be stored for at least 30 days, subject to the [data retention exceptions](https://developers.openai.com/api/docs/guides/your-data#v1responses).\n", + "default": true + }, + { + "type": "null" + } + ] + }, + "instructions": { + "anyOf": [ + { + "type": "string", + "description": "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" + }, + { + "type": "null" + } + ] + }, + "moderation": { + "anyOf": [ + { + "$ref": "#/components/schemas/ModerationParam", + "description": "Configuration for running moderation on the input and output of this response.\n" + }, + { + "type": "null" + } + ] + }, + "stream": { + "anyOf": [ + { + "description": "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](https://developers.openai.com/api/reference/resources/responses/streaming-events)\nfor more information.\n", + "type": "boolean", + "default": false + }, + { + "type": "null" + } + ] + }, + "stream_options": { + "$ref": "#/components/schemas/ResponseStreamOptions" + }, + "conversation": { + "anyOf": [ + { + "$ref": "#/components/schemas/ConversationParam" + }, + { + "type": "null" + } + ] + }, + "context_management": { + "anyOf": [ + { + "type": "array", + "example": [ + { + "type": "compaction", + "compact_threshold": 1000 + } + ], + "description": "Context management configuration for this request.\n", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/ContextManagementParam" + } + }, + { + "type": "null" + } + ] + }, + "max_output_tokens": { + "anyOf": [ + { + "description": "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning).\n", + "type": "integer", + "minimum": 16 + }, + { + "type": "null" + } + ] + } + } + } + ] + }, + "CreateRunRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "assistant_id": { + "description": "The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run.", + "type": "string" + }, + "model": { + "description": "The ID of the [Model](https://developers.openai.com/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.", + "example": "gpt-4.1", + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/AssistantSupportedModels" + }, + { + "type": "null" + } + ], + "x-oaiTypeLabel": "string" + }, + "reasoning_effort": { + "$ref": "#/components/schemas/ReasoningEffort" + }, + "instructions": { + "description": "Overrides the [instructions](https://developers.openai.com/api/docs/assistants/migration) of the assistant. This is useful for modifying the behavior on a per-run basis.", + "type": [ + "string", + "null" + ] + }, + "additional_instructions": { + "description": "Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.", + "type": [ + "string", + "null" + ] + }, + "additional_messages": { + "description": "Adds additional messages to the thread before creating the run.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/CreateMessageRequest" + } + }, + "tools": { + "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", + "type": [ + "array", + "null" + ], + "maxItems": 20, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ] + } + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "temperature": { + "type": [ + "number", + "null" + ], + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n" + }, + "top_p": { + "type": [ + "number", + "null" + ], + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + "stream": { + "type": [ + "boolean", + "null" + ], + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" + }, + "max_prompt_tokens": { + "type": [ + "integer", + "null" + ], + "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", + "minimum": 256 + }, + "max_completion_tokens": { + "type": [ + "integer", + "null" + ], + "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", + "minimum": 256 + }, + "truncation_strategy": { + "allOf": [ + { + "$ref": "#/components/schemas/TruncationObject" + }, + { + "nullable": true + } + ] + }, + "tool_choice": { + "allOf": [ + { + "$ref": "#/components/schemas/AssistantsApiToolChoiceOption" + }, + { + "nullable": true + } + ] + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "response_format": { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", + "nullable": true + } + }, + "required": [ + "assistant_id" + ] + }, + "CreateSpeechRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "model": { + "description": "One of the available [TTS models](https://developers.openai.com/api/docs/guides/text-to-speech): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.\n", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "tts-1", + "tts-1-hd", + "gpt-4o-mini-tts", + "gpt-4o-mini-tts-2025-12-15" + ], + "x-openai-enum-deprecations": { + "gpt-4o-mini-tts": { + "message": "Announced shutdown date: 2027-01-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "tts-1": { + "message": "Announced shutdown date: 2027-01-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "tts-1-hd": { + "message": "Announced shutdown date: 2027-01-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-tts-2025-12-15": { + "message": "Announced shutdown date: 2027-01-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } + } + ], + "x-oaiTypeLabel": "string" + }, + "input": { + "type": "string", + "description": "The text to generate audio for. The maximum length is 4096 characters.", + "maxLength": 4096 + }, + "instructions": { + "type": "string", + "description": "Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.", + "maxLength": 4096 + }, + "voice": { + "description": "The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ \"id\": \"voice_1234\" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options). Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.", + "title": "Voice", + "anyOf": [ + { + "anyOf": [ + { + "$ref": "#/components/schemas/VoiceIdsShared" + }, + { + "type": "string", + "enum": [ + "fable", + "onyx", + "nova" + ] + } + ] + }, + { + "type": "object", + "description": "Custom voice reference.", + "additionalProperties": false, + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The custom voice ID, e.g. `voice_1234`.", + "example": "voice_1234" + } + } + } + ] + }, + "response_format": { + "description": "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.", + "default": "mp3", + "type": "string", + "enum": [ + "mp3", + "opus", + "aac", + "flac", + "wav", + "pcm" + ] + }, + "speed": { + "description": "The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.", + "type": "number", + "default": 1, + "minimum": 0.25, + "maximum": 4 + }, + "stream_format": { + "description": "The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`.", + "type": "string", + "default": "audio", + "enum": [ + "sse", + "audio" + ] + } + }, + "required": [ + "model", + "input", + "voice" + ] + }, + "CreateSpeechResponseStreamEvent": { + "anyOf": [ + { + "$ref": "#/components/schemas/SpeechAudioDeltaEvent" + }, + { + "$ref": "#/components/schemas/SpeechAudioDoneEvent" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "CreateSpendAlertBody": { + "type": "object", + "description": "Parameters for creating or updating a spend alert.", + "properties": { + "threshold_amount": { + "type": "integer", + "minimum": 0, + "description": "The alert threshold amount, in cents." + }, + "currency": { + "type": "string", + "enum": [ + "USD" + ], + "description": "The currency for the threshold amount." + }, + "interval": { + "type": "string", + "enum": [ + "month" + ], + "description": "The time interval for evaluating spend against the threshold." + }, + "notification_channel": { + "$ref": "#/components/schemas/SpendAlertNotificationChannel" + } + }, + "required": [ + "threshold_amount", + "currency", + "interval", + "notification_channel" + ] + }, + "CreateThreadAndRunRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "assistant_id": { + "description": "The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run.", + "type": "string" + }, + "thread": { + "$ref": "#/components/schemas/CreateThreadRequest" + }, + "model": { + "description": "The ID of the [Model](https://developers.openai.com/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.", + "example": "gpt-4.1", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-5", + "gpt-5-mini", + "gpt-5-nano", + "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", + "gpt-5-nano-2025-08-07", + "gpt-4.1", + "gpt-4.1-mini", + "gpt-4.1-nano", + "gpt-4.1-2025-04-14", + "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", + "gpt-4o", + "gpt-4o-2024-11-20", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4.5-preview", + "gpt-4.5-preview-2025-02-27", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613" + ], + "x-openai-enum-deprecations": { + "gpt-5": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-mini": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-nano": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-mini-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-nano-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } + }, + { + "type": "null" + } + ], + "x-oaiTypeLabel": "string" + }, + "instructions": { + "description": "Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.", + "type": [ + "string", + "null" + ] + }, + "tools": { + "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", + "type": [ + "array", + "null" + ], + "maxItems": 20, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ] + } + }, + "tool_resources": { + "type": [ + "object", + "null" + ], + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + } + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "temperature": { + "type": [ + "number", + "null" + ], + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n" + }, + "top_p": { + "type": [ + "number", + "null" + ], + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + "stream": { + "type": [ + "boolean", + "null" + ], + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" + }, + "max_prompt_tokens": { + "type": [ + "integer", + "null" + ], + "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", + "minimum": 256 + }, + "max_completion_tokens": { + "type": [ + "integer", + "null" + ], + "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n", + "minimum": 256 + }, + "truncation_strategy": { + "allOf": [ + { + "$ref": "#/components/schemas/TruncationObject" + }, + { + "nullable": true + } + ] + }, + "tool_choice": { + "allOf": [ + { + "$ref": "#/components/schemas/AssistantsApiToolChoiceOption" + }, + { + "nullable": true + } + ] + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "response_format": { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", + "nullable": true + } + }, + "required": [ + "assistant_id" + ] + }, + "CreateThreadRequest": { + "type": "object", + "description": "Options to create a new thread. If no thread is provided when running a\nrequest, an empty thread will be created.\n", + "additionalProperties": false, + "properties": { + "messages": { + "description": "A list of [messages](https://developers.openai.com/api/docs/assistants/migration) to start the thread with.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CreateMessageRequest" + } + }, + "tool_resources": { + "anyOf": [ + { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", + "maxItems": 1, + "items": { + "type": "string" + } + }, + "vector_stores": { + "type": "array", + "description": "A helper to create a [vector store](https://developers.openai.com/api/reference/resources/vector_stores) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n", + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.\n", + "maxItems": 100000000, + "items": { + "type": "string" + } + }, + "chunking_strategy": { + "type": "object", + "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.", + "oneOf": [ + { + "type": "object", + "title": "Auto Chunking Strategy", + "description": "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `auto`.", + "enum": [ + "auto" + ], + "x-stainless-const": true + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "title": "Static Chunking Strategy", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `static`.", + "enum": [ + "static" + ], + "x-stainless-const": true + }, + "static": { + "type": "object", + "additionalProperties": false, + "properties": { + "max_chunk_size_tokens": { + "type": "integer", + "minimum": 100, + "maximum": 4096, + "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." + }, + "chunk_overlap_tokens": { + "type": "integer", + "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" + } + }, + "required": [ + "max_chunk_size_tokens", + "chunk_overlap_tokens" + ] + } + }, + "required": [ + "type", + "static" + ] + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + } + } + } + }, + "oneOf": [ + { + "required": [ + "vector_store_ids" + ] + }, + { + "required": [ + "vector_stores" + ] + } + ] + } + } + }, + { + "type": "null" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + } + }, + "CreateTranscriptionRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "description": "The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\nThe request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type.\n", + "type": "string", + "x-oaiTypeLabel": "file", + "format": "binary" + }, + "model": { + "description": "ID of the model to use. The options are `gpt-transcribe`, `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`.\n", + "example": "gpt-4o-transcribe", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "whisper-1", + "gpt-transcribe", + "gpt-4o-transcribe", + "gpt-4o-mini-transcribe", + "gpt-4o-mini-transcribe-2025-12-15", + "gpt-4o-transcribe-diarize" + ], + "x-openai-enum-deprecations": { + "gpt-4o-mini-transcribe-2025-12-15": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "whisper-1": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-transcribe": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-transcribe": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-transcribe-diarize": { + "message": "Announced shutdown date: 2027-02-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + }, + "x-stainless-const": true + } + ], + "x-oaiTypeLabel": "string" + }, + "language": { + "description": "The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.\n", + "type": "string" + }, + "languages": { + "description": "Possible languages of the input audio, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. Supported by `gpt-transcribe`.\n", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "keywords": { + "description": "Words or phrases to guide transcription of the input audio. Supported by `gpt-transcribe`.\n", + "type": "array", + "items": { + "type": "string" + } + }, + "prompt": { + "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`.\n", + "type": "string" + }, + "response_format": { + "$ref": "#/components/schemas/AudioResponseFormat" + }, + "temperature": { + "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", + "type": "number", + "default": 0 + }, + "include": { + "description": "Additional information to include in the transcription response.\n`logprobs` will return the log probabilities of the tokens in the\nresponse to understand the model's confidence in the transcription.\n`logprobs` only works with response_format set to `json` and only with\nthe models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`.\n", + "type": "array", + "items": { + "$ref": "#/components/schemas/TranscriptionInclude" + } + }, + "timestamp_granularities": { + "description": "The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.\nThis option is not available for `gpt-4o-transcribe-diarize`.\n", + "type": "array", + "items": { + "type": "string", + "enum": [ + "word", + "segment" + ] + }, + "default": [ + "segment" + ] + }, + "stream": { + "anyOf": [ + { + "description": "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming)\nfor more information.\n\nNote: Streaming is not supported for the `whisper-1` model and will be ignored.\n", + "type": "boolean", + "default": false + }, + { + "type": "null" + } + ] + }, + "chunking_strategy": { + "anyOf": [ + { + "description": "Controls how the audio is cut into chunks. When set to `\"auto\"`, the server first normalizes loudness and then uses voice activity detection (VAD) to choose boundaries. `server_vad` object can be provided to tweak VAD detection parameters manually. If unset, the audio is transcribed as a single block. Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30 seconds. ", + "anyOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "default": "auto", + "description": "Automatically set chunking parameters based on the audio. Must be set to `\"auto\"`.\n", + "x-stainless-const": true + }, + { + "$ref": "#/components/schemas/VadConfig" + } + ], + "x-oaiTypeLabel": "string" + }, + { + "type": "null" + } + ] + }, + "known_speaker_names": { + "description": "Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported.\n", + "type": "array", + "maxItems": 4, + "items": { + "type": "string" + } + }, + "known_speaker_references": { + "description": "Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`.\n", + "type": "array", + "maxItems": 4, + "items": { + "type": "string" + } + } + }, + "required": [ + "file", + "model" + ] + }, + "CreateTranscriptionResponseDiarizedJson": { + "type": "object", + "description": "Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.\n", + "properties": { + "task": { + "type": "string", + "description": "The type of task that was run. Always `transcribe`.", + "enum": [ + "transcribe" + ], + "x-stainless-const": true + }, + "duration": { + "type": "number", + "format": "double", + "description": "Duration of the input audio in seconds." + }, + "text": { + "type": "string", + "description": "The concatenated transcript text for the entire audio input." + }, + "segments": { + "type": "array", + "description": "Segments of the transcript annotated with timestamps and speaker labels.", + "items": { + "$ref": "#/components/schemas/TranscriptionDiarizedSegment" + } + }, + "usage": { + "type": "object", + "description": "Token or duration usage statistics for the request.", + "oneOf": [ + { + "$ref": "#/components/schemas/TranscriptTextUsageTokens", + "title": "Token Usage" + }, + { + "$ref": "#/components/schemas/TranscriptTextUsageDuration", + "title": "Duration Usage" + } + ], + "discriminator": { + "propertyName": "type" + } + } + }, + "required": [ + "task", + "duration", + "text", + "segments" + ], + "x-oaiMeta": { + "name": "The transcription object (Diarized JSON)", + "group": "audio", + "example": "{\n \"task\": \"transcribe\",\n \"duration\": 42.7,\n \"text\": \"Agent: Thanks for calling OpenAI support.\\nCustomer: Hi, I need help with diarization.\",\n \"segments\": [\n {\n \"type\": \"transcript.text.segment\",\n \"id\": \"seg_001\",\n \"start\": 0.0,\n \"end\": 5.2,\n \"text\": \"Thanks for calling OpenAI support.\",\n \"speaker\": \"agent\"\n },\n {\n \"type\": \"transcript.text.segment\",\n \"id\": \"seg_002\",\n \"start\": 5.2,\n \"end\": 12.8,\n \"text\": \"Hi, I need help with diarization.\",\n \"speaker\": \"A\"\n }\n ],\n \"usage\": {\n \"type\": \"duration\",\n \"seconds\": 43\n }\n}\n" + } + }, + "CreateTranscriptionResponseJson": { + "type": "object", + "description": "Represents a transcription response returned by model, based on the provided input.", + "properties": { + "text": { + "type": "string", + "description": "The transcribed text." + }, + "languages": { + "type": "array", + "description": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n", + "items": { + "$ref": "#/components/schemas/TranscriptionLanguage" + } + }, + "logprobs": { + "type": "array", + "optional": true, + "description": "The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array.\n", + "items": { + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "The token in the transcription." + }, + "logprob": { + "type": "number", + "description": "The log probability of the token." + }, + "bytes": { + "type": "array", + "items": { + "type": "number" + }, + "description": "The bytes of the token." + } + } + } + }, + "usage": { + "type": "object", + "description": "Token usage statistics for the request.", + "oneOf": [ + { + "$ref": "#/components/schemas/TranscriptTextUsageTokens", + "title": "Token Usage" + }, + { + "$ref": "#/components/schemas/TranscriptTextUsageDuration", + "title": "Duration Usage" + } + ] + } + }, + "required": [ + "text" + ], + "x-oaiMeta": { + "name": "The transcription object (JSON)", + "group": "audio", + "example": "{\n \"text\": \"Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.\",\n \"usage\": {\n \"type\": \"tokens\",\n \"input_tokens\": 14,\n \"input_token_details\": {\n \"text_tokens\": 10,\n \"audio_tokens\": 4\n },\n \"output_tokens\": 101,\n \"total_tokens\": 115\n }\n}\n" + } + }, + "CreateTranscriptionResponseStreamEvent": { + "anyOf": [ + { + "$ref": "#/components/schemas/TranscriptTextSegmentEvent" + }, + { + "$ref": "#/components/schemas/TranscriptTextDeltaEvent" + }, + { + "$ref": "#/components/schemas/TranscriptTextDoneEvent" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "CreateTranscriptionResponseVerboseJson": { + "type": "object", + "description": "Represents a verbose json transcription response returned by model, based on the provided input.", + "properties": { + "language": { + "type": "string", + "description": "The language of the input audio." + }, + "duration": { + "type": "number", + "format": "double", + "description": "The duration of the input audio." + }, + "text": { + "type": "string", + "description": "The transcribed text." + }, + "words": { + "type": "array", + "description": "Extracted words and their corresponding timestamps.", + "items": { + "$ref": "#/components/schemas/TranscriptionWord" + } + }, + "segments": { + "type": "array", + "description": "Segments of the transcribed text and their corresponding details.", + "items": { + "$ref": "#/components/schemas/TranscriptionSegment" + } + }, + "usage": { + "$ref": "#/components/schemas/TranscriptTextUsageDuration" + } + }, + "required": [ + "language", + "duration", + "text" + ], + "x-oaiMeta": { + "name": "The transcription object (Verbose JSON)", + "group": "audio", + "example": "{\n \"task\": \"transcribe\",\n \"language\": \"english\",\n \"duration\": 3.32,\n \"text\": \"The beach was a popular spot on a hot summer day.\",\n \"segments\": [\n {\n \"id\": 0,\n \"seek\": 0,\n \"start\": 0.0,\n \"end\": 3.319999933242798,\n \"text\": \" The beach was a popular spot on a hot summer day.\",\n \"tokens\": [\n 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530\n ],\n \"temperature\": 0.0,\n \"avg_logprob\": -0.2860786020755768,\n \"compression_ratio\": 1.2363636493682861,\n \"no_speech_prob\": 0.00985979475080967\n }\n ],\n \"usage\": {\n \"type\": \"duration\",\n \"seconds\": 4\n }\n}\n" + } + }, + "CreateTranslationRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "description": "The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type.\n", + "type": "string", + "x-oaiTypeLabel": "file", + "format": "binary" + }, + "model": { + "description": "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n", + "example": "whisper-1", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "whisper-1" + ], + "x-stainless-const": true + } + ], + "x-oaiTypeLabel": "string" + }, + "prompt": { + "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting) should be in English.\n", + "type": "string" + }, + "response_format": { + "description": "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.\n", + "type": "string", + "enum": [ + "json", + "text", + "srt", + "verbose_json", + "vtt" + ], + "default": "json" + }, + "temperature": { + "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", + "type": "number", + "default": 0 + } + }, + "required": [ + "file", + "model" + ] + }, + "CreateTranslationResponseJson": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "required": [ + "text" + ] + }, + "CreateTranslationResponseVerboseJson": { + "type": "object", + "properties": { + "language": { + "type": "string", + "description": "The language of the output translation (always `english`)." + }, + "duration": { + "type": "number", + "format": "double", + "description": "The duration of the input audio." + }, + "text": { + "type": "string", + "description": "The translated text." + }, + "segments": { + "type": "array", + "description": "Segments of the translated text and their corresponding details.", + "items": { + "$ref": "#/components/schemas/TranscriptionSegment" + } + } + }, + "required": [ + "language", + "duration", + "text" + ] + }, + "CreateUploadRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "filename": { + "description": "The name of the file to upload.\n", + "type": "string" + }, + "purpose": { + "description": "The intended purpose of the uploaded file.\n\nSee the [documentation on File\npurposes](https://developers.openai.com/api/reference/resources/files/methods/create#%28resource%29%20files%20%3E%20%28method%29%20create%20%3E%20%28params%29%200%20%3E%20%28param%29%20purpose%20%3E%20%28schema%29).\n", + "type": "string", + "enum": [ + "assistants", + "batch", + "fine-tune", + "vision" + ] + }, + "bytes": { + "description": "The number of bytes in the file you are uploading.\n", + "type": "integer" + }, + "mime_type": { + "description": "The MIME type of the file.\n\n\nThis must fall within the supported MIME types for your file purpose. See\nthe supported MIME types for assistants and vision.\n", + "type": "string" + }, + "expires_after": { + "$ref": "#/components/schemas/FileExpirationAfter" + } + }, + "required": [ + "filename", + "purpose", + "bytes", + "mime_type" + ] + }, + "CreateVectorStoreFileBatchRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file_ids": { + "description": "A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`.", + "type": "array", + "minItems": 1, + "maxItems": 2000, + "items": { + "type": "string" + } + }, + "files": { + "description": "A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`.", + "type": "array", + "minItems": 1, + "maxItems": 2000, + "items": { + "$ref": "#/components/schemas/CreateVectorStoreFileRequest" + } + }, + "chunking_strategy": { + "$ref": "#/components/schemas/ChunkingStrategyRequestParam" + }, + "attributes": { + "$ref": "#/components/schemas/VectorStoreFileAttributes" + } + }, + "anyOf": [ + { + "required": [ + "file_ids" + ] + }, + { + "required": [ + "files" + ] + } + ] + }, + "CreateVectorStoreFileRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file_id": { + "description": "A [File](https://developers.openai.com/api/reference/resources/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](https://developers.openai.com/api/reference/resources/vector_stores/subresources/file_batches/methods/create) to minimize per-vector-store write requests.", + "type": "string" + }, + "chunking_strategy": { + "$ref": "#/components/schemas/ChunkingStrategyRequestParam" + }, + "attributes": { + "$ref": "#/components/schemas/VectorStoreFileAttributes" + } + }, + "required": [ + "file_id" + ] + }, + "CreateVectorStoreRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "file_ids": { + "description": "A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files.", + "type": "array", + "maxItems": 500, + "items": { + "type": "string" + } + }, + "name": { + "description": "The name of the vector store.", + "type": "string" + }, + "description": { + "description": "A description for the vector store. Can be used to describe the vector store's purpose.", + "type": "string" + }, + "expires_after": { + "$ref": "#/components/schemas/VectorStoreExpirationAfter" + }, + "chunking_strategy": { + "type": "object", + "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.", + "oneOf": [ + { + "$ref": "#/components/schemas/AutoChunkingStrategyRequestParam" + }, + { + "$ref": "#/components/schemas/StaticChunkingStrategyRequestParam" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + } + }, + "CreateVoiceConsentRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The label to use for this consent recording." + }, + "recording": { + "type": "string", + "format": "binary", + "x-oaiTypeLabel": "file", + "description": "The consent audio recording file. Maximum size is 10 MiB.\n\nSupported MIME types:\n`audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.\n" + }, + "language": { + "type": "string", + "description": "The BCP 47 language tag for the consent phrase (for example, `en-US`)." + } + }, + "required": [ + "name", + "recording", + "language" + ] + }, + "CreateVoiceFromConsentRequest": { + "type": "object", + "title": "Consent", + "description": "Creates a voice from a consent recording and an audio sample. Requires multipart/form-data.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "audio_sample" + ], + "default": "audio_sample", + "description": "The voice creation method. Defaults to `audio_sample` when omitted." + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "description": "The name of the new voice." + }, + "audio_sample": { + "type": "string", + "format": "binary", + "x-oaiTypeLabel": "file", + "description": "The sample audio recording file. Maximum size is 10 MiB.\n\nSupported MIME types:\n`audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.\n" + }, + "consent": { + "type": "string", + "description": "The consent recording ID (for example, `cons_1234`)." + } + }, + "required": [ + "name", + "audio_sample", + "consent" + ] + }, + "CreateVoicePromptRequest": { + "type": "object", + "title": "Prompt", + "description": "Creates a synthetic voice from a text description. Supports application/json or multipart/form-data.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "prompt" + ], + "description": "Set to `prompt` to create a voice from a text description." + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "description": "The name of the new voice." + }, + "prompt": { + "type": "string", + "minLength": 1, + "maxLength": 2000, + "description": "A description of the desired voice. Must not contain only whitespace." + }, + "script_hint": { + "type": "string", + "minLength": 1, + "maxLength": 2000, + "description": "Optional text for the voice to speak during creation. If omitted, a script is generated from the prompt. Must not be blank after trimming whitespace; scripts that are too short are rejected." + }, + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "auto", + "2026-10-08" + ] + } + ], + "default": "auto", + "description": "The voice creation model to use. Defaults to `auto`." + } + }, + "required": [ + "type", + "name", + "prompt" + ] + }, + "CreateVoiceRequest": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateVoiceFromConsentRequest" + }, + { + "$ref": "#/components/schemas/CreateVoicePromptRequest" + } + ], + "x-oai-default-discriminator-value": "audio_sample", + "discriminator": { + "propertyName": "type", + "mapping": { + "audio_sample": "#/components/schemas/CreateVoiceFromConsentRequest", + "prompt": "#/components/schemas/CreateVoicePromptRequest" + } + } + }, + "CustomToolCall": { + "type": "object", + "title": "Custom tool call", + "description": "A call to a custom tool created by the model.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "custom_tool_call" + ], + "x-stainless-const": true, + "description": "The type of the custom tool call. Always `custom_tool_call`.\n" + }, + "id": { + "type": "string", + "description": "The unique ID of the custom tool call in the OpenAI platform.\n" + }, + "call_id": { + "type": "string", + "description": "An identifier used to map this custom tool call to a tool call output.\n" + }, + "caller": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToolCallCaller" + }, + { + "type": "null" + } + ] + }, + "namespace": { + "type": "string", + "description": "The namespace of the custom tool being called.\n" + }, + "name": { + "type": "string", + "description": "The name of the custom tool being called.\n" + }, + "input": { + "type": "string", + "description": "The input for the custom tool call generated by the model.\n" + }, + "async": { + "type": "boolean", + "description": "Whether the custom tool call runs asynchronously.\n" + } + }, + "required": [ + "type", + "call_id", + "name", + "input" + ] + }, + "CustomToolCallOutput": { + "type": "object", + "title": "Custom tool call output", + "description": "The output of a custom tool call from your code, being sent back to the model.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "custom_tool_call_output" + ], + "x-stainless-const": true, + "description": "The type of the custom tool call output. Always `custom_tool_call_output`.\n" + }, + "id": { + "type": "string", + "description": "The unique ID of the custom tool call output in the OpenAI platform.\n" + }, + "call_id": { + "type": "string", + "description": "The call ID, used to map this custom tool call output to a custom tool call.\n" + }, + "caller": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToolCallCallerParam" + }, + { + "type": "null" + } + ] + }, + "output": { + "description": "The output from the custom tool call generated by your code.\nCan be a string or an list of output content.\n", + "oneOf": [ + { + "type": "string", + "description": "A string of the output of the custom tool call.\n", + "title": "string output" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/FunctionAndCustomToolCallOutput" + }, + "title": "output content list", + "description": "Text, image, or file output of the custom tool call.\n" + } + ] + } + }, + "required": [ + "type", + "call_id", + "output" + ] + }, + "CustomToolCallOutputResource": { + "title": "ResponseCustomToolCallOutputItem", + "allOf": [ + { + "$ref": "#/components/schemas/CustomToolCallOutput" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the custom tool call output item.\n" + }, + "status": { + "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "$ref": "#/components/schemas/FunctionCallOutputStatusEnum" + }, + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item.\n" + } + }, + "required": [ + "id", + "status" + ] + } + ] + }, + "CustomToolCallResource": { + "title": "ResponseCustomToolCallItem", + "allOf": [ + { + "$ref": "#/components/schemas/CustomToolCall" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the custom tool call item.\n" + }, + "status": { + "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "$ref": "#/components/schemas/FunctionCallStatus" + }, + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item.\n" + } + }, + "required": [ + "id", + "status" + ] + } + ] + }, + "CustomToolChatCompletions": { + "type": "object", + "title": "Custom tool", + "description": "A custom tool that processes input using a specified format.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "custom" + ], + "description": "The type of the custom tool. Always `custom`.", + "x-stainless-const": true + }, + "custom": { + "type": "object", + "title": "Custom tool properties", + "description": "Properties of the custom tool.\n", + "properties": { + "name": { + "type": "string", + "description": "The name of the custom tool, used to identify it in tool calls." + }, + "description": { + "type": "string", + "description": "Optional description of the custom tool, used to provide more context.\n" + }, + "format": { + "description": "The input format for the custom tool. Default is unconstrained text.\n", + "oneOf": [ + { + "type": "object", + "title": "Text format", + "description": "Unconstrained free-form text.", + "properties": { + "type": { + "type": "string", + "enum": [ + "text" + ], + "description": "Unconstrained text format. Always `text`.", + "x-stainless-const": true + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "title": "Grammar format", + "description": "A grammar defined by the user.", + "properties": { + "type": { + "type": "string", + "enum": [ + "grammar" + ], + "description": "Grammar format. Always `grammar`.", + "x-stainless-const": true + }, + "grammar": { + "type": "object", + "title": "Grammar format", + "description": "Your chosen grammar.", + "properties": { + "definition": { + "type": "string", + "description": "The grammar definition." + }, + "syntax": { + "type": "string", + "description": "The syntax of the grammar definition. One of `lark` or `regex`.", + "enum": [ + "lark", + "regex" + ] + } + }, + "required": [ + "definition", + "syntax" + ] + } + }, + "required": [ + "type", + "grammar" + ], + "additionalProperties": false + } + ] + } + }, + "required": [ + "name" + ] + } + }, + "required": [ + "type", + "custom" + ] + }, + "DeleteAssistantResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "assistant.deleted" + ], + "x-stainless-const": true + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "DeleteCertificateResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "description": "The object type, must be `certificate.deleted`.", + "enum": [ + "certificate.deleted" + ], + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The ID of the certificate that was deleted." + } + }, + "required": [ + "object", + "id" + ] + }, + "DeleteFileResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "object": { + "type": "string", + "enum": [ + "file" + ], + "x-stainless-const": true + }, + "deleted": { + "type": "boolean" + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "DeleteFineTuningCheckpointPermissionResponse": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the fine-tuned model checkpoint permission that was deleted." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"checkpoint.permission\".", + "enum": [ + "checkpoint.permission" + ], + "x-stainless-const": true + }, + "deleted": { + "type": "boolean", + "description": "Whether the fine-tuned model checkpoint permission was successfully deleted." + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "DeleteMessageResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "thread.message.deleted" + ], + "x-stainless-const": true + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "DeleteModelResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string" + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "DeleteThreadResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "thread.deleted" + ], + "x-stainless-const": true + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "DeleteVectorStoreFileResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "vector_store.file.deleted" + ], + "x-stainless-const": true + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "DeleteVectorStoreResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "vector_store.deleted" + ], + "x-stainless-const": true + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "DeletedConversation": { + "title": "The deleted conversation object", + "allOf": [ + { + "$ref": "#/components/schemas/DeletedConversationResource" + } + ], + "x-oaiMeta": { + "name": "The deleted conversation object", + "group": "conversations" + } + }, + "DeletedRoleAssignmentResource": { + "type": "object", + "description": "Confirmation payload returned after unassigning a role.", + "properties": { + "object": { + "type": "string", + "description": "Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`." + }, + "deleted": { + "type": "boolean", + "description": "Whether the assignment was removed." + } + }, + "required": [ + "object", + "deleted" + ], + "x-oaiMeta": { + "name": "Role assignment deletion confirmation", + "example": "{\n \"object\": \"group.role.deleted\",\n \"deleted\": true\n}\n" + } + }, + "DoneEvent": { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "done" + ], + "x-stainless-const": true + }, + "data": { + "type": "string", + "enum": [ + "[DONE]" + ], + "x-stainless-const": true + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a stream ends.", + "x-oaiMeta": { + "dataDescription": "`data` is `[DONE]`" + } + }, + "EasyInputMessage": { + "type": "object", + "title": "Input message", + "description": "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role. Messages with the\n`assistant` role are presumed to have been generated by the model in previous\ninteractions.\n", + "properties": { + "role": { + "type": "string", + "description": "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n", + "enum": [ + "user", + "assistant", + "system", + "developer" + ] + }, + "content": { + "description": "Text, image, or audio input to the model, used to generate a response.\nCan also contain previous assistant responses.\n", + "oneOf": [ + { + "type": "string", + "title": "Text input", + "description": "A text input to the model.\n" + }, + { + "$ref": "#/components/schemas/InputMessageContentList" + } + ] + }, + "phase": { + "anyOf": [ + { + "$ref": "#/components/schemas/MessagePhase" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string", + "description": "The type of the message input. Always `message`.\n", + "enum": [ + "message" + ], + "x-stainless-const": true + } + }, + "required": [ + "role", + "content" + ] + }, + "EditImageBodyJsonParam": { + "type": "object", + "description": "JSON request body for image edits.\n\nUse `images` (array of `ImageRefParam`) instead of multipart `image` uploads.\nYou can reference images via external URLs, data URLs, or uploaded file IDs.\nJSON edits support GPT image models.\n", + "properties": { + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-image-1.5", + "gpt-image-2", + "gpt-image-2-2026-04-21", + "gpt-image-2.5-sunburst", + "gpt-image-2.5-sunburst-2026-09-08", + "gpt-image-2.5-flare", + "gpt-image-2.5-flare-2026-09-08", + "gpt-image-1", + "gpt-image-1-mini", + "chatgpt-image-latest" + ], + "x-openai-enum-deprecations": { + "gpt-image-1": { + "message": "GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead." + } + } + }, + { + "type": "null" + } + ], + "x-oaiTypeLabel": "string", + "default": "gpt-image-2.5-sunburst", + "example": "gpt-image-2.5-sunburst", + "description": "The GPT image model to use for image editing, including `gpt-image-2`, its dated\nsnapshot `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and\n`gpt-image-2.5-flare-2026-09-08`. Defaults to `gpt-image-2.5-sunburst`.\n\n`gpt-image-1` was shut down on October 23, 2026. Use\n`gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.\n" + }, + "images": { + "type": "array", + "minItems": 1, + "maxItems": 16, + "description": "Input image references to edit.\nFor GPT image models, you can provide up to 16 images.\n", + "items": { + "$ref": "#/components/schemas/ImageRefParam" + } + }, + "mask": { + "$ref": "#/components/schemas/ImageRefParam" + }, + "markup": { + "$ref": "#/components/schemas/ImageRefParam", + "description": "A transparent PNG overlaid on the first image, referenced by file ID, HTTPS URL, or base64 data URL. Must match that image's dimensions after orientation and contain transparent pixels. Supports GPT Image 2.5. Cannot be combined with mask." + }, + "prompt": { + "type": "string", + "minLength": 1, + "maxLength": 32000, + "example": "Add a watercolor effect and keep the subject centered", + "description": "A text description of the desired image edit." + }, + "n": { + "anyOf": [ + { + "type": "integer", + "minimum": 1, + "maximum": 10 + }, + { + "type": "null" + } + ], + "default": 1, + "example": 1, + "description": "The number of edited images to generate." + }, + "quality": { + "anyOf": [ + { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto" + ] + }, + { + "type": "null" + } + ], + "default": "auto", + "example": "high", + "description": "Output quality for GPT image models. The GPT image models support `low`, `medium`,\nand `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their\n`2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`.\n" + }, + "input_fidelity": { + "anyOf": [ + { + "type": "string", + "enum": [ + "high", + "low" + ] + }, + { + "type": "null" + } + ], + "description": "Control how much effort the model will exert to match the style and features, especially facial features, of input images. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models." + }, + "size": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "auto", + "1024x1024", + "1536x1024", + "1024x1536" + ] + }, + { + "type": "null" + } + ], + "default": "auto", + "example": "1024x1024", + "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing." + }, + "safety_identifier": { + "type": [ + "string", + "null" + ], + "maxLength": 128, + "example": "user-1234", + "description": "A stable identifier for an end user in your organization, used for safety monitoring and abuse detection. Hash a username or email address to avoid sending identifying information. A non-empty value takes precedence over the deprecated `user` parameter. If omitted, null, or empty, the API uses `user` when available. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers)." + }, + "user": { + "type": "string", + "example": "user-1234", + "deprecated": true, + "description": "Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers)." + }, + "output_format": { + "anyOf": [ + { + "type": "string", + "enum": [ + "png", + "jpeg", + "webp" + ] + }, + { + "type": "null" + } + ], + "default": "png", + "example": "png", + "description": "Output image format. Supported for GPT image models." + }, + "output_compression": { + "anyOf": [ + { + "type": "integer", + "minimum": 0, + "maximum": 100 + }, + { + "type": "null" + } + ], + "example": 100, + "description": "Compression level for `jpeg` or `webp` output." + }, + "moderation": { + "anyOf": [ + { + "type": "string", + "enum": [ + "low", + "auto" + ] + }, + { + "type": "null" + } + ], + "default": "auto", + "example": "auto", + "description": "Moderation level for GPT image models." + }, + "background": { + "anyOf": [ + { + "type": "string", + "enum": [ + "transparent", + "opaque", + "auto" + ] + }, + { + "type": "null" + } + ], + "default": "auto", + "example": "transparent", + "description": "Set the background of the generated image output. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds are available for supported GPT Image models. For `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`, set the output format to `png` or `webp`." + }, + "stream": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": false, + "example": false, + "description": "Stream partial image results as events." + }, + "partial_images": { + "$ref": "#/components/schemas/PartialImages" + } + }, + "required": [ + "images", + "prompt" + ] + }, + "Embedding": { + "type": "object", + "description": "Represents an embedding vector returned by embedding endpoint.\n", + "properties": { + "index": { + "type": "integer", + "description": "The index of the embedding in the list of embeddings." + }, + "embedding": { + "description": "The embedding vector, returned as a list of floats when `encoding_format` is `float` (the default), or as a base64-encoded string when `encoding_format` is `base64`. The length of the vector depends on the model as listed in the [embedding guide](https://developers.openai.com/api/docs/guides/embeddings).\n", + "anyOf": [ + { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] + }, + "object": { + "type": "string", + "description": "The object type, which is always \"embedding\".", + "enum": [ + "embedding" + ], + "x-stainless-const": true + } + }, + "required": [ + "index", + "object", + "embedding" + ], + "x-oaiMeta": { + "name": "The embedding object", + "example": "{\n \"object\": \"embedding\",\n \"embedding\": [\n 0.26726124,\n 0.53452248,\n 0.80178373\n ],\n \"index\": 0\n}\n" + } + }, + "Error": { + "type": "object", + "properties": { + "code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "message": { + "type": "string" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "misalignment": { + "$ref": "#/components/schemas/MisalignmentErrorDetailsResource" + } + }, + "required": [ + "type", + "message", + "param", + "code" + ] + }, + "ErrorEvent": { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "error" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/Error" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when an [error](https://developers.openai.com/api/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout.", + "x-oaiMeta": { + "dataDescription": "`data` is an [error](https://developers.openai.com/api/docs/guides/error-codes#api-errors)" + } + }, + "ErrorResponse": { + "type": "object", + "properties": { + "error": { + "$ref": "#/components/schemas/Error" + } + }, + "required": [ + "error" + ] + }, + "Eval": { + "type": "object", + "title": "Eval", + "description": "An Eval object with a data source config and testing criteria.\nAn Eval represents a task to be done for your LLM integration.\nLike:\n - Improve the quality of my chatbot\n - See how well my chatbot handles customer support\n - Check if o4-mini is better at my usecase than gpt-6-astra\n", + "properties": { + "object": { + "type": "string", + "enum": [ + "eval" + ], + "default": "eval", + "description": "The object type.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "Unique identifier for the evaluation." + }, + "name": { + "type": "string", + "description": "The name of the evaluation.", + "example": "Chatbot effectiveness Evaluation" + }, + "data_source_config": { + "type": "object", + "description": "Configuration of data sources used in runs of the evaluation.", + "oneOf": [ + { + "$ref": "#/components/schemas/EvalCustomDataSourceConfig" + }, + { + "$ref": "#/components/schemas/EvalLogsDataSourceConfig" + }, + { + "$ref": "#/components/schemas/EvalStoredCompletionsDataSourceConfig" + } + ] + }, + "testing_criteria": { + "description": "A list of testing criteria.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/EvalGraderLabelModel" + }, + { + "$ref": "#/components/schemas/EvalGraderStringCheck" + }, + { + "$ref": "#/components/schemas/EvalGraderTextSimilarity" + }, + { + "$ref": "#/components/schemas/EvalGraderPython" + }, + { + "$ref": "#/components/schemas/EvalGraderScoreModel" + } + ] + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the eval was created." + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + }, + "required": [ + "id", + "data_source_config", + "object", + "testing_criteria", + "name", + "created_at", + "metadata" + ], + "x-oaiMeta": { + "name": "The eval object", + "group": "evals", + "example": "{\n \"object\": \"eval\",\n \"id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"data_source_config\": {\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\"type\": \"object\", \"properties\": {\"label\": {\"type\": \"string\"}}, \"required\": [\"label\"]},\n \"sample\": {\n \"type\": \"object\",\n \"properties\": {\n \"model\": {\"type\": \"string\"},\n \"choices\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"message\": {\n \"type\": \"object\",\n \"properties\": {\n \"role\": {\"type\": \"string\", \"enum\": [\"assistant\"]},\n \"content\": {\"type\": [\"string\", \"array\", \"null\"]},\n \"refusal\": {\"type\": [\"boolean\", \"null\"]},\n \"tool_calls\": {\n \"type\": [\"array\", \"null\"],\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\"type\": \"string\", \"enum\": [\"function\"]},\n \"function\": {\n \"type\": \"object\",\n \"properties\": {\"name\": {\"type\": \"string\"}, \"arguments\": {\"type\": \"string\"}},\n \"required\": [\"name\", \"arguments\"]\n },\n \"id\": {\"type\": \"string\"}\n },\n \"required\": [\"type\", \"function\", \"id\"]\n }\n },\n \"function_call\": {\n \"type\": [\"object\", \"null\"],\n \"properties\": {\"name\": {\"type\": \"string\"}, \"arguments\": {\"type\": \"string\"}},\n \"required\": [\"name\", \"arguments\"]\n }\n },\n \"required\": [\"role\"]\n },\n \"finish_reason\": {\"type\": \"string\"}\n },\n \"required\": [\"index\", \"message\", \"finish_reason\"]\n }\n },\n \"output_text\": {\"type\": \"string\"},\n \"output_json\": {\"type\": \"object\"},\n \"output_tools\": {\"type\": \"array\", \"items\": {\"type\": \"object\"}},\n \"output_reasoning_summary\": {\"type\": [\"string\", \"null\"]},\n \"output_audio\": {\"type\": [\"object\", \"null\"]},\n \"input_tools\": {\"type\": \"array\", \"items\": {\"type\": \"object\"}}\n },\n \"required\": [\"model\", \"choices\"]\n }\n },\n \"required\": [\"item\", \"sample\"]\n }\n },\n \"testing_criteria\": [\n {\n \"name\": \"My string check grader\",\n \"type\": \"string_check\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"operation\": \"eq\"\n }\n ],\n \"name\": \"External Data Eval\",\n \"created_at\": 1739314509,\n \"metadata\": {\n \"test\": \"synthetics\"\n }\n}\n" + } + }, + "EvalApiError": { + "type": "object", + "title": "EvalApiError", + "description": "An object representing an error response from the Eval API.\n", + "properties": { + "code": { + "type": "string", + "description": "The error code." + }, + "message": { + "type": "string", + "description": "The error message." + } + }, + "required": [ + "code", + "message" + ], + "x-oaiMeta": { + "name": "The API error object", + "group": "evals", + "example": "{\n \"code\": \"internal_error\",\n \"message\": \"The eval run failed due to an internal error.\"\n}\n" + } + }, + "EvalCustomDataSourceConfig": { + "type": "object", + "title": "CustomDataSourceConfig", + "description": "A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces.\nThe response schema defines the shape of the data that will be:\n- Used to define your testing criteria and\n- What data is required when creating a run\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "custom" + ], + "default": "custom", + "description": "The type of data source. Always `custom`.", + "x-stainless-const": true + }, + "schema": { + "type": "object", + "description": "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n", + "additionalProperties": true, + "example": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": { + "type": "string" + } + }, + "required": [ + "label" + ] + } + }, + "required": [ + "item" + ] + } + } + }, + "required": [ + "type", + "schema" + ], + "x-oaiMeta": { + "name": "The eval custom data source config object", + "group": "evals", + "example": "{\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"label\": {\"type\": \"string\"}\n },\n \"required\": [\"label\"]\n }\n },\n \"required\": [\"item\"]\n }\n}\n" + } + }, + "EvalGraderLabelModel": { + "type": "object", + "title": "LabelModelGrader", + "allOf": [ + { + "$ref": "#/components/schemas/GraderLabelModel" + } + ] + }, + "EvalGraderPython": { + "type": "object", + "title": "PythonGrader", + "allOf": [ + { + "$ref": "#/components/schemas/GraderPython" + }, + { + "type": "object", + "properties": { + "pass_threshold": { + "type": "number", + "description": "The threshold for the score." + } + }, + "x-oaiMeta": { + "name": "Eval Python Grader", + "group": "graders", + "example": "{\n \"type\": \"python\",\n \"name\": \"Example python grader\",\n \"image_tag\": \"2025-05-08\",\n \"source\": \"\\ndef grade(sample: dict, item: dict) -> float:\\n \\\"\\\"\\\"\\n Returns 1.0 if `output_text` equals `label`, otherwise 0.0.\\n \\\"\\\"\\\"\\n output = sample.get(\\\"output_text\\\")\\n label = item.get(\\\"label\\\")\\n return 1.0 if output == label else 0.0\\n\",\n \"pass_threshold\": 0.8\n}\n" + } + } + ] + }, + "EvalGraderScoreModel": { + "type": "object", + "title": "ScoreModelGrader", + "allOf": [ + { + "$ref": "#/components/schemas/GraderScoreModel" + }, + { + "type": "object", + "properties": { + "pass_threshold": { + "type": "number", + "description": "The threshold for the score." + } + } + } + ] + }, + "EvalGraderStringCheck": { + "type": "object", + "title": "StringCheckGrader", + "allOf": [ + { + "$ref": "#/components/schemas/GraderStringCheck" + } + ] + }, + "EvalGraderTextSimilarity": { + "type": "object", + "title": "TextSimilarityGrader", + "allOf": [ + { + "$ref": "#/components/schemas/GraderTextSimilarity" + }, + { + "type": "object", + "properties": { + "pass_threshold": { + "type": "number", + "description": "The threshold for the score." + } + }, + "required": [ + "pass_threshold" + ], + "x-oaiMeta": { + "name": "Text Similarity Grader", + "group": "graders", + "example": "{\n \"type\": \"text_similarity\",\n \"name\": \"Example text similarity grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"pass_threshold\": 0.8,\n \"evaluation_metric\": \"fuzzy_match\"\n}\n" + } + } + ] + }, + "EvalItem": { + "type": "object", + "title": "Eval message object", + "description": "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role. Messages with the\n`assistant` role are presumed to have been generated by the model in previous\ninteractions.\n", + "properties": { + "role": { + "type": "string", + "description": "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n", + "enum": [ + "user", + "assistant", + "system", + "developer" + ] + }, + "content": { + "$ref": "#/components/schemas/EvalItemContent" + }, + "type": { + "type": "string", + "description": "The type of the message input. Always `message`.\n", + "enum": [ + "message" + ], + "x-stainless-const": true + } + }, + "required": [ + "role", + "content" + ] + }, + "EvalItemContent": { + "title": "Eval content", + "description": "Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/EvalItemContentItem" + }, + { + "$ref": "#/components/schemas/EvalItemContentArray" + } + ] + }, + "EvalItemContentArray": { + "type": "array", + "title": "An array of Input text, Output text, Input image, and Input audio", + "description": "A list of inputs, each of which may be either an input text, output text, input\nimage, or input audio object.\n", + "items": { + "$ref": "#/components/schemas/EvalItemContentItem" + } + }, + "EvalItemContentItem": { + "title": "Eval content item", + "description": "A single content item: input text, output text, input image, or input audio.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/EvalItemContentText" + }, + { + "$ref": "#/components/schemas/InputTextContent" + }, + { + "$ref": "#/components/schemas/EvalItemContentOutputText" + }, + { + "$ref": "#/components/schemas/EvalItemInputImage" + }, + { + "$ref": "#/components/schemas/InputAudio" + } + ] + }, + "EvalItemContentOutputText": { + "type": "object", + "title": "Output text", + "description": "A text output from the model.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the output text. Always `output_text`.\n", + "enum": [ + "output_text" + ], + "x-stainless-const": true + }, + "text": { + "type": "string", + "description": "The text output from the model.\n" + } + }, + "required": [ + "type", + "text" + ] + }, + "EvalItemContentText": { + "type": "string", + "title": "Text input", + "description": "A text input to the model.\n" + }, + "EvalItemInputImage": { + "title": "Input image", + "description": "An image input block used within EvalItem content arrays.", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of the image input. Always `input_image`.\n", + "enum": [ + "input_image" + ], + "x-stainless-const": true + }, + "image_url": { + "type": "string", + "format": "uri", + "description": "The URL of the image input.\n" + }, + "detail": { + "type": "string", + "description": "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n" + } + }, + "required": [ + "type", + "image_url" + ] + }, + "EvalJsonlFileContentSource": { + "type": "object", + "title": "EvalJsonlFileContentSource", + "properties": { + "type": { + "type": "string", + "enum": [ + "file_content" + ], + "default": "file_content", + "description": "The type of jsonl source. Always `file_content`.", + "x-stainless-const": true + }, + "content": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "object", + "additionalProperties": true + }, + "sample": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "item" + ] + }, + "description": "The content of the jsonl file." + } + }, + "required": [ + "type", + "content" + ] + }, + "EvalJsonlFileIdSource": { + "type": "object", + "title": "EvalJsonlFileIdSource", + "properties": { + "type": { + "type": "string", + "enum": [ + "file_id" + ], + "default": "file_id", + "description": "The type of jsonl source. Always `file_id`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The identifier of the file." + } + }, + "required": [ + "type", + "id" + ] + }, + "EvalList": { + "type": "object", + "title": "EvalList", + "description": "An object representing a list of evals.\n", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "description": "The type of this object. It is always set to \"list\".\n", + "x-stainless-const": true + }, + "data": { + "type": "array", + "description": "An array of eval objects.\n", + "items": { + "$ref": "#/components/schemas/Eval" + } + }, + "first_id": { + "type": "string", + "description": "The identifier of the first eval in the data array." + }, + "last_id": { + "type": "string", + "description": "The identifier of the last eval in the data array." + }, + "has_more": { + "type": "boolean", + "description": "Indicates whether there are more evals available." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "x-oaiMeta": { + "name": "The eval list object", + "group": "evals", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"eval\",\n \"id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"data_source_config\": {\n \"type\": \"custom\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\",\n \"properties\": {\n \"input\": {\n \"type\": \"string\"\n },\n \"ground_truth\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"input\",\n \"ground_truth\"\n ]\n }\n },\n \"required\": [\n \"item\"\n ]\n }\n },\n \"testing_criteria\": [\n {\n \"name\": \"String check\",\n \"id\": \"String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2\",\n \"type\": \"string_check\",\n \"input\": \"{{item.input}}\",\n \"reference\": \"{{item.ground_truth}}\",\n \"operation\": \"eq\"\n }\n ],\n \"name\": \"External Data Eval\",\n \"created_at\": 1739314509,\n \"metadata\": {}\n }\n ],\n \"first_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"last_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"has_more\": true\n}\n" + } + }, + "EvalLogsDataSourceConfig": { + "type": "object", + "title": "LogsDataSourceConfig", + "description": "A LogsDataSourceConfig which specifies the metadata property of your logs query.\nThis is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc.\nThe schema returned by this data source config is used to defined what variables are available in your evals.\n`item` and `sample` are both defined when using this data source config.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "logs" + ], + "default": "logs", + "description": "The type of data source. Always `logs`.", + "x-stainless-const": true + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "schema": { + "type": "object", + "description": "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n", + "additionalProperties": true + } + }, + "required": [ + "type", + "schema" + ], + "x-oaiMeta": { + "name": "The logs data source object for evals", + "group": "evals", + "example": "{\n \"type\": \"logs\",\n \"metadata\": {\n \"language\": \"english\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\"\n },\n \"sample\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"item\",\n \"sample\"\n ]\n }\n}\n" + } + }, + "EvalResponsesSource": { + "type": "object", + "title": "EvalResponsesSource", + "description": "A EvalResponsesSource object describing a run data source configuration.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "responses" + ], + "description": "The type of run data source. Always `responses`." + }, + "metadata": { + "anyOf": [ + { + "type": "object", + "description": "Metadata filter for the responses. This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "model": { + "anyOf": [ + { + "type": "string", + "description": "The name of the model to find responses for. This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "instructions_search": { + "anyOf": [ + { + "type": "string", + "description": "Optional string to search the 'instructions' field. This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "created_after": { + "anyOf": [ + { + "type": "integer", + "minimum": 0, + "description": "Only include items created after this timestamp (inclusive). This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "created_before": { + "anyOf": [ + { + "type": "integer", + "minimum": 0, + "description": "Only include items created before this timestamp (inclusive). This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "reasoning_effort": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningEffort", + "description": "Optional reasoning effort parameter. This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "temperature": { + "anyOf": [ + { + "type": "number", + "description": "Sampling temperature. This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "top_p": { + "anyOf": [ + { + "type": "number", + "description": "Nucleus sampling parameter. This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "users": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of user identifiers. This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + }, + "tools": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of tool names. This is a query parameter used to select responses." + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "The run data source object used to configure an individual run", + "group": "eval runs", + "example": "{\n \"type\": \"responses\",\n \"model\": \"gpt-6-astra\",\n \"users\": [\"user1\", \"user2\"],\n \"tools\": [\"tool1\", \"tool2\"],\n \"instructions_search\": \"You are a coding assistant\"\n}\n" + } + }, + "EvalRun": { + "type": "object", + "title": "EvalRun", + "description": "A schema representing an evaluation run.\n", + "properties": { + "object": { + "type": "string", + "enum": [ + "eval.run" + ], + "default": "eval.run", + "description": "The type of the object. Always \"eval.run\".", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "Unique identifier for the evaluation run." + }, + "eval_id": { + "type": "string", + "description": "The identifier of the associated evaluation." + }, + "status": { + "type": "string", + "description": "The status of the evaluation run." + }, + "model": { + "type": [ + "string", + "null" + ], + "description": "The model that is evaluated, if applicable." + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "The name of the evaluation run." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the evaluation run was created." + }, + "report_url": { + "type": "string", + "format": "uri", + "description": "The URL to the rendered evaluation run report on the UI dashboard." + }, + "result_counts": { + "type": "object", + "description": "Counters summarizing the outcomes of the evaluation run.", + "properties": { + "total": { + "type": "integer", + "description": "Total number of executed output items." + }, + "errored": { + "type": "integer", + "description": "Number of output items that resulted in an error." + }, + "failed": { + "type": "integer", + "description": "Number of output items that failed to pass the evaluation." + }, + "passed": { + "type": "integer", + "description": "Number of output items that passed the evaluation." + } + }, + "required": [ + "total", + "errored", + "failed", + "passed" + ] + }, + "per_model_usage": { + "type": [ + "array", + "null" + ], + "description": "Usage statistics for each model during the evaluation run.", + "items": { + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model." + }, + "invocation_count": { + "type": "integer", + "description": "The number of invocations." + }, + "prompt_tokens": { + "type": "integer", + "description": "The number of prompt tokens used." + }, + "completion_tokens": { + "type": "integer", + "description": "The number of completion tokens generated." + }, + "total_tokens": { + "type": "integer", + "description": "The total number of tokens used." + }, + "cached_tokens": { + "type": "integer", + "description": "The number of tokens retrieved from cache." + } + }, + "required": [ + "model_name", + "invocation_count", + "prompt_tokens", + "completion_tokens", + "total_tokens", + "cached_tokens" + ] + } + }, + "per_testing_criteria_results": { + "type": [ + "array", + "null" + ], + "description": "Results per testing criteria applied during the evaluation run.", + "items": { + "type": "object", + "properties": { + "testing_criteria": { + "type": "string", + "description": "A description of the testing criteria." + }, + "passed": { + "type": "integer", + "description": "Number of tests passed for this criteria." + }, + "failed": { + "type": "integer", + "description": "Number of tests failed for this criteria." + } + }, + "required": [ + "testing_criteria", + "passed", + "failed" + ] + } + }, + "data_source": { + "type": "object", + "description": "Information about the run's data source.", + "oneOf": [ + { + "$ref": "#/components/schemas/CreateEvalJsonlRunDataSource" + }, + { + "$ref": "#/components/schemas/CreateEvalCompletionsRunDataSource" + }, + { + "$ref": "#/components/schemas/CreateEvalResponsesRunDataSource" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "error": { + "anyOf": [ + { + "$ref": "#/components/schemas/EvalApiError" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "object", + "id", + "eval_id", + "status", + "model", + "name", + "created_at", + "report_url", + "result_counts", + "per_model_usage", + "per_testing_criteria_results", + "data_source", + "metadata", + "error" + ], + "x-oaiMeta": { + "name": "The eval run object", + "group": "evals", + "example": "{\n \"object\": \"eval.run\",\n \"id\": \"evalrun_67e57965b480819094274e3a32235e4c\",\n \"eval_id\": \"eval_67e579652b548190aaa83ada4b125f47\",\n \"report_url\": \"https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c\",\n \"status\": \"queued\",\n \"model\": \"gpt-6-astra\",\n \"name\": \"gpt-6-astra\",\n \"created_at\": 1743092069,\n \"result_counts\": {\n \"total\": 0,\n \"errored\": 0,\n \"failed\": 0,\n \"passed\": 0\n },\n \"per_model_usage\": null,\n \"per_testing_criteria_results\": null,\n \"data_source\": {\n \"type\": \"completions\",\n \"source\": {\n \"type\": \"file_content\",\n \"content\": [\n {\n \"item\": {\n \"input\": \"Tech Company Launches Advanced Artificial Intelligence Platform\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"Central Bank Increases Interest Rates Amid Inflation Concerns\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"International Summit Addresses Climate Change Strategies\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Major Retailer Reports Record-Breaking Holiday Sales\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"National Team Qualifies for World Championship Finals\",\n \"ground_truth\": \"Sports\"\n }\n },\n {\n \"item\": {\n \"input\": \"Stock Markets Rally After Positive Economic Data Released\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"Global Manufacturer Announces Merger with Competitor\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"Breakthrough in Renewable Energy Technology Unveiled\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"World Leaders Sign Historic Climate Agreement\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Professional Athlete Sets New Record in Championship Event\",\n \"ground_truth\": \"Sports\"\n }\n },\n {\n \"item\": {\n \"input\": \"Financial Institutions Adapt to New Regulatory Requirements\",\n \"ground_truth\": \"Business\"\n }\n },\n {\n \"item\": {\n \"input\": \"Tech Conference Showcases Advances in Artificial Intelligence\",\n \"ground_truth\": \"Technology\"\n }\n },\n {\n \"item\": {\n \"input\": \"Global Markets Respond to Oil Price Fluctuations\",\n \"ground_truth\": \"Markets\"\n }\n },\n {\n \"item\": {\n \"input\": \"International Cooperation Strengthened Through New Treaty\",\n \"ground_truth\": \"World\"\n }\n },\n {\n \"item\": {\n \"input\": \"Sports League Announces Revised Schedule for Upcoming Season\",\n \"ground_truth\": \"Sports\"\n }\n }\n ]\n },\n \"input_messages\": {\n \"type\": \"template\",\n \"template\": [\n {\n \"type\": \"message\",\n \"role\": \"developer\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\\n\\n# Steps\\n\\n1. Analyze the content of the news headline to understand its primary focus.\\n2. Extract the subject matter, identifying any key indicators or keywords.\\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\\n4. Ensure only one category is selected per headline.\\n\\n# Output Format\\n\\nRespond with the chosen category as a single word. For instance: \\\"Technology\\\", \\\"Markets\\\", \\\"World\\\", \\\"Business\\\", or \\\"Sports\\\".\\n\\n# Examples\\n\\n**Input**: \\\"Apple Unveils New iPhone Model, Featuring Advanced AI Features\\\" \\n**Output**: \\\"Technology\\\"\\n\\n**Input**: \\\"Global Stocks Mixed as Investors Await Central Bank Decisions\\\" \\n**Output**: \\\"Markets\\\"\\n\\n**Input**: \\\"War in Ukraine: Latest Updates on Negotiation Status\\\" \\n**Output**: \\\"World\\\"\\n\\n**Input**: \\\"Microsoft in Talks to Acquire Gaming Company for $2 Billion\\\" \\n**Output**: \\\"Business\\\"\\n\\n**Input**: \\\"Manchester United Secures Win in Premier League Football Match\\\" \\n**Output**: \\\"Sports\\\" \\n\\n# Notes\\n\\n- If the headline appears to fit into more than one category, choose the most dominant theme.\\n- Keywords or phrases such as \\\"stocks\\\", \\\"company acquisition\\\", \\\"match\\\", or technological brands can be good indicators for classification.\\n\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"{{item.input}}\"\n }\n }\n ]\n },\n \"model\": \"gpt-6-astra\",\n \"sampling_params\": {\n \"max_completions_tokens\": 2048\n }\n },\n \"error\": null,\n \"metadata\": {}\n}\n" + } + }, + "EvalRunList": { + "type": "object", + "title": "EvalRunList", + "description": "An object representing a list of runs for an evaluation.\n", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "description": "The type of this object. It is always set to \"list\".\n", + "x-stainless-const": true + }, + "data": { + "type": "array", + "description": "An array of eval run objects.\n", + "items": { + "$ref": "#/components/schemas/EvalRun" + } + }, + "first_id": { + "type": "string", + "description": "The identifier of the first eval run in the data array." + }, + "last_id": { + "type": "string", + "description": "The identifier of the last eval run in the data array." + }, + "has_more": { + "type": "boolean", + "description": "Indicates whether there are more evals available." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "x-oaiMeta": { + "name": "The eval run list object", + "group": "evals", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"eval.run\",\n \"id\": \"evalrun_67b7fbdad46c819092f6fe7a14189620\",\n \"eval_id\": \"eval_67b7fa9a81a88190ab4aa417e397ea21\",\n \"report_url\": \"https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620\",\n \"status\": \"completed\",\n \"model\": \"o3-mini\",\n \"name\": \"Academic Assistant\",\n \"created_at\": 1740110812,\n \"result_counts\": {\n \"total\": 171,\n \"errored\": 0,\n \"failed\": 80,\n \"passed\": 91\n },\n \"per_model_usage\": [],\n \"per_testing_criteria_results\": [\n {\n \"testing_criteria\": \"String check grader\",\n \"passed\": 91,\n \"failed\": 80\n }\n ],\n \"error\": null,\n \"metadata\": {\n \"test\": \"synthetics\"\n },\n \"data_source\": {\n \"type\": \"completions\",\n \"source\": {\n \"type\": \"file_id\",\n \"id\": \"file-abc123\"\n },\n \"input_messages\": {\n \"type\": \"template\",\n \"template\": [\n {\n \"type\": \"message\",\n \"role\": \"system\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"You are a helpful assistant.\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Hello, can you help me with my homework?\"\n }\n }\n ]\n },\n \"model\": \"o3-mini\"\n }\n }\n ],\n \"first_id\": \"evalrun_67b7fbdad46c819092f6fe7a14189620\",\n \"last_id\": \"evalrun_67b7fbdad46c819092f6fe7a14189620\",\n \"has_more\": false\n}\n" + } + }, + "EvalRunOutputItem": { + "type": "object", + "title": "EvalRunOutputItem", + "description": "A schema representing an evaluation run output item.\n", + "properties": { + "object": { + "type": "string", + "enum": [ + "eval.run.output_item" + ], + "default": "eval.run.output_item", + "description": "The type of the object. Always \"eval.run.output_item\".", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "Unique identifier for the evaluation run output item." + }, + "run_id": { + "type": "string", + "description": "The identifier of the evaluation run associated with this output item." + }, + "eval_id": { + "type": "string", + "description": "The identifier of the evaluation group." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the evaluation run was created." + }, + "status": { + "type": "string", + "description": "The status of the evaluation run." + }, + "datasource_item_id": { + "type": "integer", + "description": "The identifier for the data source item." + }, + "datasource_item": { + "type": "object", + "description": "Details of the input data source item.", + "additionalProperties": true + }, + "results": { + "type": "array", + "description": "A list of grader results for this output item.", + "items": { + "$ref": "#/components/schemas/EvalRunOutputItemResult" + } + }, + "sample": { + "type": "object", + "description": "A sample containing the input and output of the evaluation run.", + "properties": { + "input": { + "type": "array", + "description": "An array of input messages.", + "items": { + "type": "object", + "description": "An input message.", + "properties": { + "role": { + "type": "string", + "description": "The role of the message sender (e.g., system, user, developer)." + }, + "content": { + "type": "string", + "description": "The content of the message." + } + }, + "required": [ + "role", + "content" + ] + } + }, + "output": { + "type": "array", + "description": "An array of output messages.", + "items": { + "type": "object", + "properties": { + "role": { + "type": "string", + "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")." + }, + "content": { + "type": "string", + "description": "The content of the message." + } + } + } + }, + "finish_reason": { + "type": "string", + "description": "The reason why the sample generation was finished." + }, + "model": { + "type": "string", + "description": "The model used for generating the sample." + }, + "usage": { + "type": "object", + "description": "Token usage details for the sample.", + "properties": { + "total_tokens": { + "type": "integer", + "description": "The total number of tokens used." + }, + "completion_tokens": { + "type": "integer", + "description": "The number of completion tokens generated." + }, + "prompt_tokens": { + "type": "integer", + "description": "The number of prompt tokens used." + }, + "cached_tokens": { + "type": "integer", + "description": "The number of tokens retrieved from cache." + } + }, + "required": [ + "total_tokens", + "completion_tokens", + "prompt_tokens", + "cached_tokens" + ] + }, + "error": { + "anyOf": [ + { + "$ref": "#/components/schemas/EvalApiError" + }, + { + "type": "null" + } + ] + }, + "temperature": { + "type": "number", + "description": "The sampling temperature used." + }, + "max_completion_tokens": { + "type": "integer", + "description": "The maximum number of tokens allowed for completion." + }, + "top_p": { + "type": "number", + "description": "The top_p value used for sampling." + }, + "seed": { + "type": "integer", + "description": "The seed used for generating the sample." + } + }, + "required": [ + "input", + "output", + "finish_reason", + "model", + "usage", + "error", + "temperature", + "max_completion_tokens", + "top_p", + "seed" + ] + } + }, + "required": [ + "object", + "id", + "run_id", + "eval_id", + "created_at", + "status", + "datasource_item_id", + "datasource_item", + "results", + "sample" + ], + "x-oaiMeta": { + "name": "The eval run output item object", + "group": "evals", + "example": "{\n \"object\": \"eval.run.output_item\",\n \"id\": \"outputitem_67abd55eb6548190bb580745d5644a33\",\n \"run_id\": \"evalrun_67abd54d60ec8190832b46859da808f7\",\n \"eval_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"created_at\": 1739314509,\n \"status\": \"pass\",\n \"datasource_item_id\": 137,\n \"datasource_item\": {\n \"teacher\": \"To grade essays, I only check for style, content, and grammar.\",\n \"student\": \"I am a student who is trying to write the best essay.\"\n },\n \"results\": [\n {\n \"name\": \"String Check Grader\",\n \"type\": \"string-check-grader\",\n \"score\": 1.0,\n \"passed\": true\n }\n ],\n \"sample\": {\n \"input\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an evaluator bot...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"You are assessing...\"\n }\n ],\n \"output\": [\n {\n \"role\": \"assistant\",\n \"content\": \"The rubric is not clear nor concise.\"\n }\n ],\n \"finish_reason\": \"stop\",\n \"model\": \"gpt-6-astra\",\n \"usage\": {\n \"total_tokens\": 521,\n \"completion_tokens\": 2,\n \"prompt_tokens\": 519,\n \"cached_tokens\": 0\n },\n \"error\": null,\n \"temperature\": 1.0,\n \"max_completion_tokens\": 2048,\n \"top_p\": 1.0,\n \"seed\": 42\n }\n}\n" + } + }, + "EvalRunOutputItemList": { + "type": "object", + "title": "EvalRunOutputItemList", + "description": "An object representing a list of output items for an evaluation run.\n", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "description": "The type of this object. It is always set to \"list\".\n", + "x-stainless-const": true + }, + "data": { + "type": "array", + "description": "An array of eval run output item objects.\n", + "items": { + "$ref": "#/components/schemas/EvalRunOutputItem" + } + }, + "first_id": { + "type": "string", + "description": "The identifier of the first eval run output item in the data array." + }, + "last_id": { + "type": "string", + "description": "The identifier of the last eval run output item in the data array." + }, + "has_more": { + "type": "boolean", + "description": "Indicates whether there are more eval run output items available." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "x-oaiMeta": { + "name": "The eval run output item list object", + "group": "evals", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"eval.run.output_item\",\n \"id\": \"outputitem_67abd55eb6548190bb580745d5644a33\",\n \"run_id\": \"evalrun_67abd54d60ec8190832b46859da808f7\",\n \"eval_id\": \"eval_67abd54d9b0081909a86353f6fb9317a\",\n \"created_at\": 1739314509,\n \"status\": \"pass\",\n \"datasource_item_id\": 137,\n \"datasource_item\": {\n \"teacher\": \"To grade essays, I only check for style, content, and grammar.\",\n \"student\": \"I am a student who is trying to write the best essay.\"\n },\n \"results\": [\n {\n \"name\": \"String Check Grader\",\n \"type\": \"string-check-grader\",\n \"score\": 1.0,\n \"passed\": true\n }\n ],\n \"sample\": {\n \"input\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an evaluator bot...\"\n },\n {\n \"role\": \"user\",\n \"content\": \"You are assessing...\"\n }\n ],\n \"output\": [\n {\n \"role\": \"assistant\",\n \"content\": \"The rubric is not clear nor concise.\"\n }\n ],\n \"finish_reason\": \"stop\",\n \"model\": \"gpt-6-astra\",\n \"usage\": {\n \"total_tokens\": 521,\n \"completion_tokens\": 2,\n \"prompt_tokens\": 519,\n \"cached_tokens\": 0\n },\n \"error\": null,\n \"temperature\": 1.0,\n \"max_completion_tokens\": 2048,\n \"top_p\": 1.0,\n \"seed\": 42\n }\n }\n ],\n \"first_id\": \"outputitem_67abd55eb6548190bb580745d5644a33\",\n \"last_id\": \"outputitem_67abd55eb6548190bb580745d5644a33\",\n \"has_more\": false\n}\n" + } + }, + "EvalRunOutputItemResult": { + "type": "object", + "title": "EvalRunOutputItemResult", + "description": "A single grader result for an evaluation run output item.\n", + "properties": { + "name": { + "type": "string", + "description": "The name of the grader." + }, + "type": { + "type": "string", + "description": "The grader type (for example, \"string-check-grader\")." + }, + "score": { + "type": "number", + "description": "The numeric score produced by the grader." + }, + "passed": { + "type": "boolean", + "description": "Whether the grader considered the output a pass." + }, + "sample": { + "anyOf": [ + { + "type": "object", + "additionalProperties": true + }, + { + "type": "null" + } + ], + "description": "Optional sample or intermediate data produced by the grader." + } + }, + "additionalProperties": true, + "required": [ + "name", + "score", + "passed" + ] + }, + "EvalStoredCompletionsDataSourceConfig": { + "type": "object", + "title": "StoredCompletionsDataSourceConfig", + "description": "Deprecated in favor of LogsDataSourceConfig.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "stored_completions" + ], + "default": "stored_completions", + "description": "The type of data source. Always `stored_completions`.", + "x-stainless-const": true + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "schema": { + "type": "object", + "description": "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n", + "additionalProperties": true + } + }, + "required": [ + "type", + "schema" + ], + "deprecated": true, + "x-oaiMeta": { + "name": "The stored completions data source object for evals", + "group": "evals", + "example": "{\n \"type\": \"stored_completions\",\n \"metadata\": {\n \"language\": \"english\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"type\": \"object\"\n },\n \"sample\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"item\",\n \"sample\"\n ]\n }\n}\n" + } + }, + "EvalStoredCompletionsSource": { + "type": "object", + "title": "StoredCompletionsRunDataSource", + "description": "A StoredCompletionsRunDataSource configuration describing a set of filters\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "stored_completions" + ], + "default": "stored_completions", + "description": "The type of source. Always `stored_completions`.", + "x-stainless-const": true + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "model": { + "anyOf": [ + { + "type": "string", + "description": "An optional model to filter by (e.g., 'gpt-6-astra')." + }, + { + "type": "null" + } + ] + }, + "created_after": { + "anyOf": [ + { + "type": "integer", + "description": "An optional Unix timestamp to filter items created after this time." + }, + { + "type": "null" + } + ] + }, + "created_before": { + "anyOf": [ + { + "type": "integer", + "description": "An optional Unix timestamp to filter items created before this time." + }, + { + "type": "null" + } + ] + }, + "limit": { + "anyOf": [ + { + "type": "integer", + "description": "An optional maximum number of items to return." + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "The stored completions data source object used to configure an individual run", + "group": "eval runs", + "example": "{\n \"type\": \"stored_completions\",\n \"model\": \"gpt-6-astra\",\n \"created_after\": 1668124800,\n \"created_before\": 1668124900,\n \"limit\": 100,\n \"metadata\": {}\n}\n" + } + }, + "FileExpirationAfter": { + "type": "object", + "title": "File expiration policy", + "description": "The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted.", + "properties": { + "anchor": { + "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`.", + "type": "string", + "enum": [ + "created_at" + ], + "x-stainless-const": true + }, + "seconds": { + "description": "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).", + "type": "integer", + "format": "int64", + "minimum": 3600, + "maximum": 2592000 + } + }, + "required": [ + "anchor", + "seconds" + ] + }, + "FilePath": { + "type": "object", + "title": "File path", + "description": "A path to a file.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the file path. Always `file_path`.\n", + "enum": [ + "file_path" + ], + "x-stainless-const": true + }, + "file_id": { + "type": "string", + "description": "The ID of the file.\n" + }, + "index": { + "type": "integer", + "description": "The index of the file in the list of files.\n" + } + }, + "required": [ + "type", + "file_id", + "index" + ] + }, + "FileSearchRanker": { + "type": "string", + "description": "The ranker to use for the file search. If not specified will use the `auto` ranker.", + "enum": [ + "auto", + "default_2024_08_21" + ] + }, + "FileSearchRankingOptions": { + "title": "File search tool call ranking options", + "type": "object", + "description": "The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.\n\nSee the [file search tool documentation](https://developers.openai.com/api/docs/guides/tools-file-search#retrieval-customization) for more information.\n", + "properties": { + "ranker": { + "$ref": "#/components/schemas/FileSearchRanker" + }, + "score_threshold": { + "type": "number", + "description": "The score threshold for the file search. All values must be a floating point number between 0 and 1.", + "minimum": 0, + "maximum": 1 + } + }, + "required": [ + "score_threshold" + ] + }, + "FileSearchToolCall": { + "type": "object", + "title": "File search tool call", + "description": "The results of a file search tool call. See the\n[file search guide](https://developers.openai.com/api/docs/guides/tools-file-search) for more information.\n", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the file search tool call.\n" + }, + "type": { + "type": "string", + "enum": [ + "file_search_call" + ], + "description": "The type of the file search tool call. Always `file_search_call`.\n", + "x-stainless-const": true + }, + "status": { + "type": "string", + "description": "The status of the file search tool call. One of `in_progress`,\n`searching`, `incomplete` or `failed`,\n", + "enum": [ + "in_progress", + "searching", + "completed", + "incomplete", + "failed" + ] + }, + "queries": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The queries used to search for files.\n" + }, + "results": { + "anyOf": [ + { + "type": "array", + "description": "The results of the file search tool call.\n", + "items": { + "type": "object", + "properties": { + "file_id": { + "type": "string", + "description": "The unique ID of the file.\n" + }, + "text": { + "type": "string", + "description": "The text that was retrieved from the file.\n" + }, + "filename": { + "type": "string", + "description": "The name of the file.\n" + }, + "attributes": { + "$ref": "#/components/schemas/VectorStoreFileAttributes" + }, + "score": { + "type": "number", + "format": "float", + "description": "The relevance score of the file - a value between 0 and 1.\n" + } + } + } + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "type", + "status", + "queries" + ] + }, + "FineTuneChatCompletionRequestAssistantMessage": { + "allOf": [ + { + "type": "object", + "title": "Assistant message", + "deprecated": false, + "properties": { + "weight": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "description": "Controls whether the assistant message is trained against (0 or 1)" + } + } + }, + { + "$ref": "#/components/schemas/ChatCompletionRequestAssistantMessage" + } + ], + "required": [ + "role" + ] + }, + "FineTuneDPOHyperparameters": { + "type": "object", + "description": "The hyperparameters used for the DPO fine-tuning job.", + "properties": { + "beta": { + "description": "The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "number", + "maximum": 2, + "exclusiveMinimum": 0 + } + ], + "default": "auto" + }, + "batch_size": { + "description": "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 256 + } + ], + "default": "auto" + }, + "learning_rate_multiplier": { + "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "number", + "exclusiveMinimum": 0 + } + ], + "default": "auto" + }, + "n_epochs": { + "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + ], + "default": "auto" + } + } + }, + "FineTuneDPOMethod": { + "type": "object", + "description": "Configuration for the DPO fine-tuning method.", + "properties": { + "hyperparameters": { + "$ref": "#/components/schemas/FineTuneDPOHyperparameters" + } + } + }, + "FineTuneMethod": { + "type": "object", + "description": "The method used for fine-tuning.", + "properties": { + "type": { + "type": "string", + "description": "The type of method. Is either `supervised`, `dpo`, or `reinforcement`.", + "enum": [ + "supervised", + "dpo", + "reinforcement" + ] + }, + "supervised": { + "$ref": "#/components/schemas/FineTuneSupervisedMethod" + }, + "dpo": { + "$ref": "#/components/schemas/FineTuneDPOMethod" + }, + "reinforcement": { + "$ref": "#/components/schemas/FineTuneReinforcementMethod" + } + }, + "required": [ + "type" + ] + }, + "FineTuneReinforcementHyperparameters": { + "type": "object", + "description": "The hyperparameters used for the reinforcement fine-tuning job.", + "properties": { + "batch_size": { + "description": "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 256 + } + ], + "default": "auto" + }, + "learning_rate_multiplier": { + "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "number", + "exclusiveMinimum": 0 + } + ], + "default": "auto" + }, + "n_epochs": { + "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + ], + "default": "auto" + }, + "reasoning_effort": { + "description": "Level of reasoning effort.\n", + "type": "string", + "enum": [ + "default", + "low", + "medium", + "high" + ], + "default": "default" + }, + "compute_multiplier": { + "description": "Multiplier on amount of compute used for exploring search space during training.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "number", + "maximum": 10, + "exclusiveMinimum": 0.00001 + } + ], + "default": "auto" + }, + "eval_interval": { + "description": "The number of training steps between evaluation runs.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1 + } + ], + "default": "auto" + }, + "eval_samples": { + "description": "Number of evaluation samples to generate per training step.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1 + } + ], + "default": "auto" + } + } + }, + "FineTuneReinforcementMethod": { + "type": "object", + "description": "Configuration for the reinforcement fine-tuning method.", + "properties": { + "grader": { + "type": "object", + "description": "The grader used for the fine-tuning job.", + "oneOf": [ + { + "$ref": "#/components/schemas/GraderStringCheck" + }, + { + "$ref": "#/components/schemas/GraderTextSimilarity" + }, + { + "$ref": "#/components/schemas/GraderPython" + }, + { + "$ref": "#/components/schemas/GraderScoreModel" + }, + { + "$ref": "#/components/schemas/GraderMulti" + } + ] + }, + "hyperparameters": { + "$ref": "#/components/schemas/FineTuneReinforcementHyperparameters" + } + }, + "required": [ + "grader" + ] + }, + "FineTuneSupervisedHyperparameters": { + "type": "object", + "description": "The hyperparameters used for the fine-tuning job.", + "properties": { + "batch_size": { + "description": "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 256 + } + ], + "default": "auto" + }, + "learning_rate_multiplier": { + "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "number", + "exclusiveMinimum": 0 + } + ], + "default": "auto" + }, + "n_epochs": { + "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + ], + "default": "auto" + } + } + }, + "FineTuneSupervisedMethod": { + "type": "object", + "description": "Configuration for the supervised fine-tuning method.", + "properties": { + "hyperparameters": { + "$ref": "#/components/schemas/FineTuneSupervisedHyperparameters" + } + } + }, + "FineTuningCheckpointPermission": { + "type": "object", + "title": "FineTuningCheckpointPermission", + "description": "The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.\n", + "properties": { + "id": { + "type": "string", + "description": "The permission identifier, which can be referenced in the API endpoints." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the permission was created." + }, + "project_id": { + "type": "string", + "description": "The project identifier that the permission is for." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"checkpoint.permission\".", + "enum": [ + "checkpoint.permission" + ], + "x-stainless-const": true + } + }, + "required": [ + "created_at", + "id", + "object", + "project_id" + ], + "x-oaiMeta": { + "name": "The fine-tuned model checkpoint permission object", + "example": "{\n \"object\": \"checkpoint.permission\",\n \"id\": \"cp_zc4Q7MP6XxulcVzj4MZdwsAB\",\n \"created_at\": 1712211699,\n \"project_id\": \"proj_abGMw1llN8IrBb6SvvY5A1iH\"\n}\n" + } + }, + "FineTuningIntegration": { + "type": "object", + "title": "Fine-Tuning Job Integration", + "required": [ + "type", + "wandb" + ], + "properties": { + "type": { + "type": "string", + "description": "The type of the integration being enabled for the fine-tuning job", + "enum": [ + "wandb" + ], + "x-stainless-const": true + }, + "wandb": { + "type": "object", + "description": "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n", + "required": [ + "project" + ], + "properties": { + "project": { + "description": "The name of the project that the new run will be created under.\n", + "type": "string", + "example": "my-wandb-project" + }, + "name": { + "anyOf": [ + { + "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "entity": { + "anyOf": [ + { + "description": "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "tags": { + "description": "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n", + "type": "array", + "items": { + "type": "string", + "example": "custom-tag" + } + } + } + } + } + }, + "FineTuningJob": { + "type": "object", + "title": "FineTuningJob", + "description": "The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.\n", + "properties": { + "id": { + "type": "string", + "description": "The object identifier, which can be referenced in the API endpoints." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the fine-tuning job was created." + }, + "error": { + "anyOf": [ + { + "type": "object", + "description": "For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.", + "properties": { + "code": { + "type": "string", + "description": "A machine-readable error code." + }, + "message": { + "type": "string", + "description": "A human-readable error message." + }, + "param": { + "anyOf": [ + { + "type": "string", + "description": "The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific." + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "code", + "message", + "param" + ] + }, + { + "type": "null" + }, + { + "type": "object", + "maxProperties": 0 + } + ] + }, + "fine_tuned_model": { + "anyOf": [ + { + "type": "string", + "description": "The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running." + }, + { + "type": "null" + } + ] + }, + "finished_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running." + }, + { + "type": "null" + } + ] + }, + "hyperparameters": { + "type": [ + "object", + "null" + ], + "description": "The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs.", + "properties": { + "batch_size": { + "anyOf": [ + { + "description": "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 256 + } + ], + "default": "auto" + }, + { + "type": "null" + } + ] + }, + "learning_rate_multiplier": { + "description": "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "number", + "exclusiveMinimum": 0 + } + ], + "default": "auto" + }, + "n_epochs": { + "description": "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n", + "oneOf": [ + { + "type": "string", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + ], + "default": "auto" + } + } + }, + "model": { + "type": "string", + "description": "The base model that is being fine-tuned." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"fine_tuning.job\".", + "enum": [ + "fine_tuning.job" + ], + "x-stainless-const": true + }, + "organization_id": { + "type": "string", + "description": "The organization that owns the fine-tuning job." + }, + "result_files": { + "type": "array", + "description": "The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content).", + "items": { + "type": "string", + "example": "file-abc123" + } + }, + "status": { + "type": "string", + "description": "The current status of the fine-tuning job, which can be `validating_files`, `queued`, `running`, `pausing`, `paused`, `succeeded`, `failed`, or `cancelled`.", + "enum": [ + "validating_files", + "queued", + "running", + "succeeded", + "failed", + "cancelled", + "pausing", + "paused" + ] + }, + "trained_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running." + }, + { + "type": "null" + } + ] + }, + "training_file": { + "type": "string", + "description": "The file ID used for training. You can retrieve the training data with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content)." + }, + "validation_file": { + "anyOf": [ + { + "type": "string", + "description": "The file ID used for validation. You can retrieve the validation results with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content)." + }, + { + "type": "null" + } + ] + }, + "integrations": { + "anyOf": [ + { + "type": "array", + "description": "A list of integrations to enable for this fine-tuning job.", + "maxItems": 5, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/FineTuningIntegration" + } + ] + } + }, + { + "type": "null" + } + ] + }, + "seed": { + "type": [ + "integer", + "null" + ], + "description": "The seed used for the fine-tuning job." + }, + "estimated_finish": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running." + }, + { + "type": "null" + } + ] + }, + "method": { + "anyOf": [ + { + "$ref": "#/components/schemas/FineTuneMethod" + }, + { + "type": "null" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + }, + "required": [ + "created_at", + "error", + "finished_at", + "fine_tuned_model", + "id", + "model", + "object", + "organization_id", + "result_files", + "status", + "trained_tokens", + "training_file", + "validation_file", + "seed" + ], + "if": { + "properties": { + "method": { + "type": "object", + "properties": { + "type": { + "enum": [ + "dpo", + "reinforcement" + ] + } + }, + "required": [ + "type" + ] + } + }, + "required": [ + "method" + ] + }, + "else": { + "required": [ + "hyperparameters" + ] + }, + "x-oaiMeta": { + "name": "The fine-tuning job object", + "example": "{\n \"object\": \"fine_tuning.job\",\n \"id\": \"ftjob-abc123\",\n \"model\": \"davinci-002\",\n \"created_at\": 1692661014,\n \"finished_at\": 1692661190,\n \"fine_tuned_model\": \"ft:davinci-002:my-org:custom_suffix:7q8mpxmy\",\n \"organization_id\": \"org-123\",\n \"result_files\": [\n \"file-abc123\"\n ],\n \"status\": \"succeeded\",\n \"validation_file\": null,\n \"training_file\": \"file-abc123\",\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n },\n \"trained_tokens\": 5768,\n \"integrations\": [],\n \"seed\": 0,\n \"estimated_finish\": 0,\n \"method\": {\n \"type\": \"supervised\",\n \"supervised\": {\n \"hyperparameters\": {\n \"n_epochs\": 4,\n \"batch_size\": 1,\n \"learning_rate_multiplier\": 1.0\n }\n }\n },\n \"metadata\": {\n \"key\": \"value\"\n },\n \"error\": {}\n}\n" + } + }, + "FineTuningJobCheckpoint": { + "type": "object", + "title": "FineTuningJobCheckpoint", + "description": "The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.\n", + "properties": { + "id": { + "type": "string", + "description": "The checkpoint identifier, which can be referenced in the API endpoints." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the checkpoint was created." + }, + "fine_tuned_model_checkpoint": { + "type": "string", + "description": "The name of the fine-tuned checkpoint model that is created." + }, + "step_number": { + "type": "integer", + "description": "The step number that the checkpoint was created at." + }, + "metrics": { + "type": "object", + "description": "Metrics at the step number during the fine-tuning job.", + "properties": { + "step": { + "type": "number" + }, + "train_loss": { + "type": "number" + }, + "train_mean_token_accuracy": { + "type": "number" + }, + "valid_loss": { + "type": "number" + }, + "valid_mean_token_accuracy": { + "type": "number" + }, + "full_valid_loss": { + "type": "number" + }, + "full_valid_mean_token_accuracy": { + "type": "number" + } + } + }, + "fine_tuning_job_id": { + "type": "string", + "description": "The name of the fine-tuning job that this checkpoint was created from." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"fine_tuning.job.checkpoint\".", + "enum": [ + "fine_tuning.job.checkpoint" + ], + "x-stainless-const": true + } + }, + "required": [ + "created_at", + "fine_tuning_job_id", + "fine_tuned_model_checkpoint", + "id", + "metrics", + "object", + "step_number" + ], + "x-oaiMeta": { + "name": "The fine-tuning job checkpoint object", + "example": "{\n \"object\": \"fine_tuning.job.checkpoint\",\n \"id\": \"ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P\",\n \"created_at\": 1712211699,\n \"fine_tuned_model_checkpoint\": \"ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88\",\n \"fine_tuning_job_id\": \"ftjob-fpbNQ3H1GrMehXRf8cO97xTN\",\n \"metrics\": {\n \"step\": 88,\n \"train_loss\": 0.478,\n \"train_mean_token_accuracy\": 0.924,\n \"valid_loss\": 10.112,\n \"valid_mean_token_accuracy\": 0.145,\n \"full_valid_loss\": 0.567,\n \"full_valid_mean_token_accuracy\": 0.944\n },\n \"step_number\": 88\n}\n" + } + }, + "FineTuningJobEvent": { + "type": "object", + "description": "Fine-tuning job event object", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always \"fine_tuning.job.event\".", + "enum": [ + "fine_tuning.job.event" + ], + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The object identifier." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the fine-tuning job was created." + }, + "level": { + "type": "string", + "description": "The log level of the event.", + "enum": [ + "info", + "warn", + "error" + ] + }, + "message": { + "type": "string", + "description": "The message of the event." + }, + "type": { + "type": "string", + "description": "The type of event.", + "enum": [ + "message", + "metrics" + ] + }, + "data": { + "type": [ + "object", + "null" + ], + "description": "The data associated with the event." + } + }, + "required": [ + "id", + "object", + "created_at", + "level", + "message" + ], + "x-oaiMeta": { + "name": "The fine-tuning job event object", + "example": "{\n \"object\": \"fine_tuning.job.event\",\n \"id\": \"ftevent-abc123\",\n \"created_at\": 1677610602,\n \"level\": \"info\",\n \"message\": \"Created fine-tuning job\",\n \"data\": {},\n \"type\": \"message\"\n}\n" + } + }, + "FunctionAndCustomToolCallOutput": { + "oneOf": [ + { + "$ref": "#/components/schemas/InputTextContent" + }, + { + "$ref": "#/components/schemas/InputImageContent" + }, + { + "$ref": "#/components/schemas/InputFileContent" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "FunctionObject": { + "x-openai-structured-output": "function", + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "A description of what the function does, used by the model to choose when and how to call the function." + }, + "name": { + "type": "string", + "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." + }, + "parameters": { + "$ref": "#/components/schemas/FunctionParameters" + }, + "strict": { + "anyOf": [ + { + "type": "boolean", + "default": false, + "description": "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://developers.openai.com/api/docs/guides/function-calling)." + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "name" + ] + }, + "FunctionParameters": { + "type": "object", + "description": "The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://developers.openai.com/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.\n\nOmitting `parameters` defines a function with an empty parameter list.", + "additionalProperties": true + }, + "FunctionToolCall": { + "type": "object", + "title": "Function tool call", + "description": "A tool call to run a function. See the\n[function calling guide](https://developers.openai.com/api/docs/guides/function-calling) for more information.\n", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the function tool call.\n" + }, + "type": { + "type": "string", + "enum": [ + "function_call" + ], + "description": "The type of the function tool call. Always `function_call`.\n", + "x-stainless-const": true + }, + "call_id": { + "type": "string", + "description": "The unique ID of the function tool call generated by the model.\n" + }, + "caller": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToolCallCaller" + }, + { + "type": "null" + } + ] + }, + "namespace": { + "type": "string", + "description": "The namespace of the function to run.\n" + }, + "name": { + "type": "string", + "description": "The name of the function to run.\n" + }, + "arguments": { + "type": "string", + "description": "A JSON string of the arguments to pass to the function.\n" + }, + "status": { + "type": "string", + "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + }, + "async": { + "type": "boolean", + "description": "Whether the function tool call runs asynchronously.\n" + } + }, + "required": [ + "type", + "call_id", + "name", + "arguments" + ] + }, + "FunctionToolCallOutput": { + "type": "object", + "title": "Function tool call output", + "description": "The output of a function tool call.\n", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the function tool call output. Populated when this item\nis returned via API.\n" + }, + "type": { + "type": "string", + "enum": [ + "function_call_output" + ], + "description": "The type of the function tool call output. Always `function_call_output`.\n", + "x-stainless-const": true + }, + "call_id": { + "type": "string", + "description": "The unique ID of the function tool call generated by the model.\n" + }, + "name": { + "type": "string", + "description": "The name of the tool that produced the output.\n" + }, + "namespace": { + "type": "string", + "description": "The namespace of the tool that produced the output.\n" + }, + "caller": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToolCallCallerParam" + }, + { + "type": "null" + } + ] + }, + "output": { + "description": "The output from the function call generated by your code.\nCan be a string or an list of output content.\n", + "oneOf": [ + { + "type": "string", + "description": "A string of the output of the function call.\n", + "title": "string output" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/FunctionAndCustomToolCallOutput" + }, + "title": "output content list", + "description": "Text, image, or file output of the function call.\n" + } + ] + }, + "status": { + "type": "string", + "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + } + }, + "required": [ + "type", + "output" + ] + }, + "FunctionToolCallOutputResource": { + "allOf": [ + { + "$ref": "#/components/schemas/FunctionToolCallOutput" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the function call tool output.\n" + }, + "status": { + "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "$ref": "#/components/schemas/FunctionCallOutputStatusEnum" + }, + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item.\n" + } + }, + "required": [ + "id", + "status" + ] + } + ] + }, + "FunctionToolCallResource": { + "allOf": [ + { + "$ref": "#/components/schemas/FunctionToolCall" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the function tool call.\n" + }, + "status": { + "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "$ref": "#/components/schemas/FunctionCallStatus" + }, + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item.\n" + } + }, + "required": [ + "id", + "status" + ] + } + ] + }, + "GraderLabelModel": { + "type": "object", + "title": "LabelModelGrader", + "description": "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n", + "properties": { + "type": { + "description": "The object type, which is always `label_model`.", + "type": "string", + "enum": [ + "label_model" + ], + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the grader." + }, + "model": { + "type": "string", + "description": "The model to use for the evaluation. Must support structured outputs." + }, + "input": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EvalItem" + } + }, + "labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The labels to assign to each item in the evaluation." + }, + "passing_labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The labels that indicate a passing result. Must be a subset of labels." + } + }, + "required": [ + "type", + "model", + "input", + "passing_labels", + "labels", + "name" + ], + "x-oaiMeta": { + "name": "Label Model Grader", + "group": "graders", + "example": "{\n \"name\": \"First label grader\",\n \"type\": \"label_model\",\n \"model\": \"gpt-4o-2024-08-06\",\n \"input\": [\n {\n \"type\": \"message\",\n \"role\": \"system\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Classify the sentiment of the following statement as one of positive, neutral, or negative\"\n }\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": {\n \"type\": \"input_text\",\n \"text\": \"Statement: {{item.response}}\"\n }\n }\n ],\n \"passing_labels\": [\n \"positive\"\n ],\n \"labels\": [\n \"positive\",\n \"neutral\",\n \"negative\"\n ]\n}\n" + } + }, + "GraderMulti": { + "type": "object", + "title": "MultiGrader", + "description": "A MultiGrader object combines the output of multiple graders to produce a single score.", + "properties": { + "type": { + "type": "string", + "enum": [ + "multi" + ], + "default": "multi", + "description": "The object type, which is always `multi`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the grader." + }, + "graders": { + "type": "object", + "minProperties": 1, + "additionalProperties": { + "discriminator": { + "propertyName": "type", + "mapping": { + "string_check": "#/components/schemas/GraderStringCheck", + "text_similarity": "#/components/schemas/GraderTextSimilarity", + "python": "#/components/schemas/GraderPython", + "score_model": "#/components/schemas/GraderScoreModel", + "label_model": "#/components/schemas/GraderLabelModel" + } + }, + "oneOf": [ + { + "$ref": "#/components/schemas/GraderStringCheck" + }, + { + "$ref": "#/components/schemas/GraderTextSimilarity" + }, + { + "$ref": "#/components/schemas/GraderPython" + }, + { + "$ref": "#/components/schemas/GraderScoreModel" + }, + { + "$ref": "#/components/schemas/GraderLabelModel" + } + ] + } + }, + "calculate_output": { + "type": "string", + "description": "A formula to calculate the output based on grader results." + } + }, + "required": [ + "name", + "type", + "graders", + "calculate_output" + ], + "x-oaiMeta": { + "name": "Multi Grader", + "group": "graders", + "example": "{\n \"type\": \"multi\",\n \"name\": \"example multi grader\",\n \"graders\": {\n \"text_similarity_score\": {\n \"type\": \"text_similarity\",\n \"name\": \"example text similarity grader\",\n \"input\": \"The graded text\",\n \"reference\": \"The reference text\",\n \"evaluation_metric\": \"fuzzy_match\"\n },\n \"string_check_score\": {\n \"type\": \"string_check\",\n \"name\": \"Example string check grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"operation\": \"eq\"\n }\n },\n \"calculate_output\": \"0.5 * text_similarity_score + 0.5 * string_check_score\"\n}\n" + } + }, + "GraderPython": { + "type": "object", + "title": "PythonGrader", + "description": "A PythonGrader object that runs a python script on the input.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "python" + ], + "description": "The object type, which is always `python`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the grader." + }, + "source": { + "type": "string", + "description": "The source code of the python script." + }, + "image_tag": { + "type": "string", + "description": "The image tag to use for the python script." + } + }, + "required": [ + "type", + "name", + "source" + ], + "x-oaiMeta": { + "name": "Python Grader", + "group": "graders", + "example": "{\n \"type\": \"python\",\n \"name\": \"Example python grader\",\n \"image_tag\": \"2025-05-08\",\n \"source\": \"\\ndef grade(sample: dict, item: dict) -> float:\\n \\\"\\\"\\\"\\n Returns 1.0 if `output_text` equals `label`, otherwise 0.0.\\n \\\"\\\"\\\"\\n output = sample.get(\\\"output_text\\\")\\n label = item.get(\\\"label\\\")\\n return 1.0 if output == label else 0.0\\n\"\n}\n" + } + }, + "GraderScoreModel": { + "type": "object", + "title": "ScoreModelGrader", + "description": "A ScoreModelGrader object that uses a model to assign a score to the input.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "score_model" + ], + "description": "The object type, which is always `score_model`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the grader." + }, + "model": { + "type": "string", + "description": "The model to use for the evaluation." + }, + "sampling_params": { + "type": "object", + "description": "The sampling parameters for the model.", + "properties": { + "seed": { + "anyOf": [ + { + "type": "integer", + "description": "A seed value to initialize the randomness, during sampling.\n" + }, + { + "type": "null" + } + ] + }, + "top_p": { + "anyOf": [ + { + "type": "number", + "default": 1, + "example": 1, + "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.\n" + }, + { + "type": "null" + } + ] + }, + "temperature": { + "anyOf": [ + { + "type": "number", + "description": "A higher temperature increases randomness in the outputs.\n" + }, + { + "type": "null" + } + ] + }, + "max_completions_tokens": { + "anyOf": [ + { + "type": "integer", + "minimum": 1, + "description": "The maximum number of tokens the grader model may generate in its response.\n" + }, + { + "type": "null" + } + ] + }, + "reasoning_effort": { + "$ref": "#/components/schemas/ReasoningEffort" + } + } + }, + "input": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EvalItem" + }, + "description": "The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.\n" + }, + "range": { + "type": "array", + "items": { + "type": "number" + }, + "description": "The service requires two numbers for the score range. Defaults to `[0, 1]`.\n" + } + }, + "required": [ + "type", + "name", + "input", + "model" + ], + "x-oaiMeta": { + "name": "Score Model Grader", + "group": "graders", + "example": "{\n \"type\": \"score_model\",\n \"name\": \"Example score model grader\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Score how close the reference answer is to the model answer. Score 1.0 if they are the same and 0.0 if they are different. Return just a floating point score\\n\\n Reference answer: {{item.label}}\\n\\n Model answer: {{sample.output_text}}\"\n },\n {\n \"type\": \"input_image\",\n \"image_url\": \"https://example.com/reference.png\",\n \"file_id\": null,\n \"detail\": \"auto\"\n }\n ]\n }\n ],\n \"model\": \"gpt-5-mini\",\n \"sampling_params\": {\n \"temperature\": 1,\n \"top_p\": 1,\n \"seed\": 42,\n \"max_completions_tokens\": 32768,\n \"reasoning_effort\": \"medium\"\n }\n}\n" + } + }, + "GraderStringCheck": { + "type": "object", + "title": "StringCheckGrader", + "description": "A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "string_check" + ], + "description": "The object type, which is always `string_check`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the grader." + }, + "input": { + "type": "string", + "description": "The input text. This may include template strings." + }, + "reference": { + "type": "string", + "description": "The reference text. This may include template strings." + }, + "operation": { + "type": "string", + "enum": [ + "eq", + "ne", + "like", + "ilike" + ], + "description": "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`." + } + }, + "required": [ + "type", + "name", + "input", + "reference", + "operation" + ], + "x-oaiMeta": { + "name": "String Check Grader", + "group": "graders", + "example": "{\n \"type\": \"string_check\",\n \"name\": \"Example string check grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"operation\": \"eq\"\n}\n" + } + }, + "GraderTextSimilarity": { + "type": "object", + "title": "TextSimilarityGrader", + "description": "A TextSimilarityGrader object which grades text based on similarity metrics.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "text_similarity" + ], + "default": "text_similarity", + "description": "The type of grader.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the grader." + }, + "input": { + "type": "string", + "description": "The text being graded." + }, + "reference": { + "type": "string", + "description": "The text being graded against." + }, + "evaluation_metric": { + "type": "string", + "enum": [ + "cosine", + "fuzzy_match", + "bleu", + "gleu", + "meteor", + "rouge_1", + "rouge_2", + "rouge_3", + "rouge_4", + "rouge_5", + "rouge_l" + ], + "description": "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n" + } + }, + "required": [ + "type", + "name", + "input", + "reference", + "evaluation_metric" + ], + "x-oaiMeta": { + "name": "Text Similarity Grader", + "group": "graders", + "example": "{\n \"type\": \"text_similarity\",\n \"name\": \"Example text similarity grader\",\n \"input\": \"{{sample.output_text}}\",\n \"reference\": \"{{item.label}}\",\n \"evaluation_metric\": \"fuzzy_match\"\n}\n" + } + }, + "Group": { + "type": "object", + "description": "Summary information about a group returned in role assignment responses.", + "properties": { + "object": { + "type": "string", + "enum": [ + "group" + ], + "description": "Always `group`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "Identifier for the group." + }, + "name": { + "type": "string", + "description": "Display name of the group." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the group was created." + }, + "scim_managed": { + "type": "boolean", + "description": "Whether the group is managed through SCIM." + } + }, + "required": [ + "object", + "id", + "name", + "created_at", + "scim_managed" + ], + "x-oaiMeta": { + "name": "The group object", + "example": "{\n \"object\": \"group\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"scim_managed\": false\n}\n" + } + }, + "GroupDeletedResource": { + "type": "object", + "description": "Confirmation payload returned after deleting a group.", + "properties": { + "object": { + "type": "string", + "enum": [ + "group.deleted" + ], + "description": "Always `group.deleted`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "Identifier of the deleted group." + }, + "deleted": { + "type": "boolean", + "description": "Whether the group was deleted." + } + }, + "required": [ + "object", + "id", + "deleted" + ], + "x-oaiMeta": { + "example": "{\n \"object\": \"group.deleted\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"deleted\": true\n}\n" + } + }, + "GroupListResource": { + "type": "object", + "description": "Paginated list of organization groups.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "Always `list`.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "description": "Groups returned in the current page.", + "items": { + "$ref": "#/components/schemas/GroupResponse" + } + }, + "has_more": { + "type": "boolean", + "description": "Whether additional groups are available when paginating." + }, + "next": { + "description": "Cursor to fetch the next page of results, or `null` if there are no more results.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "object", + "data", + "has_more", + "next" + ], + "x-oaiMeta": { + "name": "Group list", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"group_type\": \"group\",\n \"is_scim_managed\": false\n },\n {\n \"id\": \"group_01J1F8PQRMNO\",\n \"name\": \"Sales\",\n \"created_at\": 1711472599,\n \"group_type\": \"group\",\n \"is_scim_managed\": true\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + } + }, + "GroupMemberUser": { + "type": "object", + "description": "Details about a user returned from an organization group membership lookup.", + "properties": { + "id": { + "type": "string", + "description": "Identifier for the user." + }, + "name": { + "type": "string", + "description": "Display name of the user." + }, + "email": { + "description": "Email address of the user, or `null` for users without an email.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "picture": { + "description": "URL of the user's profile picture, if available.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "is_service_account": { + "description": "Whether the user is a service account.", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "user_type": { + "type": "string", + "enum": [ + "user", + "tenant_user" + ], + "description": "The type of user." + } + }, + "required": [ + "id", + "name", + "email", + "picture", + "is_service_account", + "user_type" + ], + "x-oaiMeta": { + "name": "The group member user object", + "example": "{\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\",\n \"picture\": null,\n \"is_service_account\": false,\n \"user_type\": \"user\"\n}\n" + } + }, + "GroupResourceWithSuccess": { + "type": "object", + "description": "Response returned after updating a group.", + "properties": { + "id": { + "type": "string", + "description": "Identifier for the group." + }, + "name": { + "type": "string", + "description": "Updated display name for the group." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the group was created." + }, + "is_scim_managed": { + "type": "boolean", + "description": "Whether the group is managed through SCIM and controlled by your identity provider." + } + }, + "required": [ + "id", + "name", + "created_at", + "is_scim_managed" + ], + "x-oaiMeta": { + "example": "{\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Escalations\",\n \"created_at\": 1711471533,\n \"is_scim_managed\": false\n}\n" + } + }, + "GroupResponse": { + "type": "object", + "description": "Details about an organization group.", + "properties": { + "id": { + "type": "string", + "description": "Identifier for the group." + }, + "name": { + "type": "string", + "description": "Display name of the group." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the group was created." + }, + "is_scim_managed": { + "type": "boolean", + "description": "Whether the group is managed through SCIM and controlled by your identity provider." + }, + "group_type": { + "type": "string", + "enum": [ + "group", + "tenant_group" + ], + "description": "The type of the group." + } + }, + "required": [ + "id", + "name", + "created_at", + "is_scim_managed", + "group_type" + ], + "x-oaiMeta": { + "name": "Group", + "example": "{\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"is_scim_managed\": false,\n \"group_type\": \"group\"\n}\n" + } + }, + "GroupRoleAssignment": { + "type": "object", + "description": "Role assignment linking a group to a role.", + "properties": { + "object": { + "type": "string", + "enum": [ + "group.role" + ], + "description": "Always `group.role`.", + "x-stainless-const": true + }, + "group": { + "$ref": "#/components/schemas/Group" + }, + "role": { + "$ref": "#/components/schemas/Role" + } + }, + "required": [ + "object", + "group", + "role" + ], + "x-oaiMeta": { + "name": "The group role object", + "example": "{\n \"object\": \"group.role\",\n \"group\": {\n \"object\": \"group\",\n \"id\": \"group_01J1F8ABCDXYZ\",\n \"name\": \"Support Team\",\n \"created_at\": 1711471533,\n \"scim_managed\": false\n },\n \"role\": {\n \"object\": \"role\",\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"description\": \"Allows managing organization groups\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false\n }\n}\n" + } + }, + "GroupUser": { + "type": "object", + "description": "Represents an individual user returned when inspecting group membership.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "type": "string", + "description": "The name of the user." + }, + "email": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The email address of the user." + } + }, + "required": [ + "id", + "name", + "email" + ] + }, + "GroupUserAssignment": { + "type": "object", + "description": "Confirmation payload returned after adding a user to a group.", + "properties": { + "object": { + "type": "string", + "enum": [ + "group.user" + ], + "description": "Always `group.user`.", + "x-stainless-const": true + }, + "user_id": { + "type": "string", + "description": "Identifier of the user that was added." + }, + "group_id": { + "type": "string", + "description": "Identifier of the group the user was added to." + } + }, + "required": [ + "object", + "user_id", + "group_id" + ], + "x-oaiMeta": { + "name": "The group user object", + "example": "{\n \"object\": \"group.user\",\n \"user_id\": \"user_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\"\n}\n" + } + }, + "GroupUserDeletedResource": { + "type": "object", + "description": "Confirmation payload returned after removing a user from a group.", + "properties": { + "object": { + "type": "string", + "enum": [ + "group.user.deleted" + ], + "description": "Always `group.user.deleted`.", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean", + "description": "Whether the group membership was removed." + } + }, + "required": [ + "object", + "deleted" + ], + "x-oaiMeta": { + "name": "Group user deletion confirmation", + "example": "{\n \"object\": \"group.user.deleted\",\n \"deleted\": true\n}\n" + } + }, + "HostedToolPermission": { + "type": "object", + "description": "Permission state for a single hosted tool on a project.", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether the hosted tool is enabled for the project." + } + }, + "required": [ + "enabled" + ] + }, + "HostedToolPermissionUpdate": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether to enable the hosted tool for the project." + } + }, + "required": [ + "enabled" + ] + }, + "Image": { + "type": "object", + "description": "Represents the content or the URL of an image generated by the OpenAI API.", + "properties": { + "b64_json": { + "type": "string", + "description": "The base64-encoded JSON of the generated image. Returned by default for GPT image models, or when `response_format` is set to `b64_json` for models that support that parameter." + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL of the generated image when `response_format` is set to `url` for models that support that parameter. Unsupported for GPT image models." + }, + "revised_prompt": { + "type": "string", + "description": "The revised prompt used to generate the image, for models that support prompt revision. Not returned by GPT image models." + } + } + }, + "ImageEditCompletedEvent": { + "type": "object", + "description": "Emitted when image editing has completed and the final image is available.\n", + "properties": { + "safety_identifier": { + "type": [ + "string", + "null" + ], + "description": "The effective safety identifier used for safety monitoring and abuse detection. This is the non-empty `safety_identifier` from the request, or the deprecated `user` value when `safety_identifier` is omitted, null, or empty." + }, + "type": { + "type": "string", + "description": "The type of the event. Always `image_edit.completed`.\n", + "enum": [ + "image_edit.completed" + ], + "x-stainless-const": true + }, + "b64_json": { + "type": "string", + "description": "Base64-encoded final edited image data, suitable for rendering as an image.\n" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp when the event was created.\n" + }, + "size": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "1024x1024", + "1024x1536", + "1536x1024", + "auto" + ] + } + ], + "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + }, + "quality": { + "type": "string", + "description": "The quality setting for the edited image.\n", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto" + ] + }, + "background": { + "type": "string", + "description": "The background setting for the edited image.\n", + "enum": [ + "transparent", + "opaque", + "auto" + ] + }, + "output_format": { + "type": "string", + "description": "The output format for the edited image.\n", + "enum": [ + "png", + "webp", + "jpeg" + ] + }, + "usage": { + "$ref": "#/components/schemas/ImagesUsage" + } + }, + "required": [ + "type", + "b64_json", + "created_at", + "size", + "quality", + "background", + "output_format", + "usage" + ], + "x-oaiMeta": { + "name": "image_edit.completed", + "group": "images", + "example": "{\n \"type\": \"image_edit.completed\",\n \"b64_json\": \"...\",\n \"created_at\": 1620000000,\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"usage\": {\n \"total_tokens\": 100,\n \"input_tokens\": 50,\n \"output_tokens\": 50,\n \"input_tokens_details\": {\n \"text_tokens\": 10,\n \"image_tokens\": 40\n }\n }\n}\n" + } + }, + "ImageEditPartialImageEvent": { + "type": "object", + "description": "Emitted when a partial image is available during image editing streaming.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the event. Always `image_edit.partial_image`.\n", + "enum": [ + "image_edit.partial_image" + ], + "x-stainless-const": true + }, + "b64_json": { + "type": "string", + "description": "Base64-encoded partial image data, suitable for rendering as an image.\n" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp when the event was created.\n" + }, + "size": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "1024x1024", + "1024x1536", + "1536x1024", + "auto" + ] + } + ], + "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + }, + "quality": { + "type": "string", + "description": "The quality setting for the requested edited image.\n", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto" + ] + }, + "background": { + "type": "string", + "description": "The background setting for the requested edited image.\n", + "enum": [ + "transparent", + "opaque", + "auto" + ] + }, + "output_format": { + "type": "string", + "description": "The output format for the requested edited image.\n", + "enum": [ + "png", + "webp", + "jpeg" + ] + }, + "partial_image_index": { + "type": "integer", + "description": "0-based index for the partial image (streaming).\n" + } + }, + "required": [ + "type", + "b64_json", + "created_at", + "size", + "quality", + "background", + "output_format", + "partial_image_index" + ], + "x-oaiMeta": { + "name": "image_edit.partial_image", + "group": "images", + "example": "{\n \"type\": \"image_edit.partial_image\",\n \"b64_json\": \"...\",\n \"created_at\": 1620000000,\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"partial_image_index\": 0\n}\n" + } + }, + "ImageEditStreamEvent": { + "anyOf": [ + { + "$ref": "#/components/schemas/ImageEditPartialImageEvent" + }, + { + "$ref": "#/components/schemas/ImageEditCompletedEvent" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "ImageGenCompletedEvent": { + "type": "object", + "description": "Emitted when image generation has completed and the final image is available.\n", + "properties": { + "safety_identifier": { + "type": [ + "string", + "null" + ], + "description": "The effective safety identifier used for safety monitoring and abuse detection. This is the non-empty `safety_identifier` from the request, or the deprecated `user` value when `safety_identifier` is omitted, null, or empty." + }, + "type": { + "type": "string", + "description": "The type of the event. Always `image_generation.completed`.\n", + "enum": [ + "image_generation.completed" + ], + "x-stainless-const": true + }, + "b64_json": { + "type": "string", + "description": "Base64-encoded image data, suitable for rendering as an image.\n" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp when the event was created.\n" + }, + "size": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "1024x1024", + "1024x1536", + "1536x1024", + "auto" + ] + } + ], + "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + }, + "quality": { + "type": "string", + "description": "The quality setting for the generated image.\n", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto" + ] + }, + "background": { + "type": "string", + "description": "The background setting for the generated image.\n", + "enum": [ + "transparent", + "opaque", + "auto" + ] + }, + "output_format": { + "type": "string", + "description": "The output format for the generated image.\n", + "enum": [ + "png", + "webp", + "jpeg" + ] + }, + "usage": { + "$ref": "#/components/schemas/ImagesUsage" + } + }, + "required": [ + "type", + "b64_json", + "created_at", + "size", + "quality", + "background", + "output_format", + "usage" + ], + "x-oaiMeta": { + "name": "image_generation.completed", + "group": "images", + "example": "{\n \"type\": \"image_generation.completed\",\n \"b64_json\": \"...\",\n \"created_at\": 1620000000,\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"usage\": {\n \"total_tokens\": 100,\n \"input_tokens\": 50,\n \"output_tokens\": 50,\n \"input_tokens_details\": {\n \"text_tokens\": 10,\n \"image_tokens\": 40\n }\n }\n}\n" + } + }, + "ImageGenPartialImageEvent": { + "type": "object", + "description": "Emitted when a partial image is available during image generation streaming.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the event. Always `image_generation.partial_image`.\n", + "enum": [ + "image_generation.partial_image" + ], + "x-stainless-const": true + }, + "b64_json": { + "type": "string", + "description": "Base64-encoded partial image data, suitable for rendering as an image.\n" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp when the event was created.\n" + }, + "size": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "1024x1024", + "1024x1536", + "1536x1024", + "auto" + ] + } + ], + "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + }, + "quality": { + "type": "string", + "description": "The quality setting for the requested image.\n", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto" + ] + }, + "background": { + "type": "string", + "description": "The background setting for the requested image.\n", + "enum": [ + "transparent", + "opaque", + "auto" + ] + }, + "output_format": { + "type": "string", + "description": "The output format for the requested image.\n", + "enum": [ + "png", + "webp", + "jpeg" + ] + }, + "partial_image_index": { + "type": "integer", + "description": "0-based index for the partial image (streaming).\n" + } + }, + "required": [ + "type", + "b64_json", + "created_at", + "size", + "quality", + "background", + "output_format", + "partial_image_index" + ], + "x-oaiMeta": { + "name": "image_generation.partial_image", + "group": "images", + "example": "{\n \"type\": \"image_generation.partial_image\",\n \"b64_json\": \"...\",\n \"created_at\": 1620000000,\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"partial_image_index\": 0\n}\n" + } + }, + "ImageGenStreamEvent": { + "anyOf": [ + { + "$ref": "#/components/schemas/ImageGenPartialImageEvent" + }, + { + "$ref": "#/components/schemas/ImageGenCompletedEvent" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "ImageGenTool": { + "type": "object", + "title": "Image generation tool", + "description": "A tool that generates images using the GPT image models.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "image_generation" + ], + "description": "The type of the image generation tool. Always `image_generation`.\n", + "x-stainless-const": true + }, + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-image-1", + "gpt-image-1-mini", + "gpt-image-1.5", + "gpt-image-2", + "gpt-image-2-2026-04-21", + "gpt-image-2.5-sunburst", + "gpt-image-2.5-sunburst-2026-09-08", + "gpt-image-2.5-flare", + "gpt-image-2.5-flare-2026-09-08" + ], + "x-openai-enum-deprecations": { + "gpt-image-1": { + "message": "GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead." + } + }, + "description": "The image generation model to use. One of `gpt-image-1-mini`,\n`gpt-image-1.5`, `gpt-image-2`,\n`gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,\n`gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`. Default:\n`gpt-image-2`.\n\n`gpt-image-1` was shut down on October 23, 2026. Use\n`gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.\n", + "default": "gpt-image-2" + } + ] + }, + "quality": { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto" + ], + "description": "The quality of the generated image. The GPT image models support `low`,\n`medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,\nincluding their `2026-09-08` snapshots, also support `xhigh` and `max`.\nDefault: `auto`.\n", + "default": "auto" + }, + "size": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "1024x1024", + "1024x1536", + "1536x1024", + "auto" + ] + } + ], + "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing.", + "default": "auto" + }, + "output_format": { + "type": "string", + "enum": [ + "png", + "webp", + "jpeg" + ], + "description": "The output format of the generated image. One of `png`, `webp`, or\n`jpeg`. Default: `png`.\n", + "default": "png" + }, + "output_compression": { + "type": "integer", + "minimum": 0, + "maximum": 100, + "description": "Compression level for the output image. Default: 100.\n", + "default": 100 + }, + "moderation": { + "type": "string", + "enum": [ + "auto", + "low" + ], + "description": "Moderation level for the generated image. Default: `auto`.\n", + "default": "auto" + }, + "background": { + "type": "string", + "enum": [ + "transparent", + "opaque", + "auto" + ], + "description": "Set the background of the generated image. One of `transparent`, `opaque`,\nor `auto`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including\ntheir `2026-09-08` snapshots, support `opaque` and `transparent`\nbackgrounds. Transparent backgrounds are available for supported GPT Image\nmodels. For `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in\npreview. When using `transparent`, set the output format to `png` or `webp`.\nDefault: `auto`.\n", + "default": "auto" + }, + "input_fidelity": { + "anyOf": [ + { + "$ref": "#/components/schemas/InputFidelity" + }, + { + "type": "null" + } + ] + }, + "input_image_mask": { + "type": "object", + "description": "Optional mask for inpainting. Contains `image_url`\n(string, optional) and `file_id` (string, optional).\n", + "properties": { + "image_url": { + "type": "string", + "description": "Base64-encoded mask image.\n" + }, + "file_id": { + "type": "string", + "description": "File ID for the mask image.\n" + } + }, + "required": [], + "additionalProperties": false + }, + "partial_images": { + "type": "integer", + "minimum": 0, + "maximum": 3, + "description": "Number of partial images to generate in streaming mode, from 0 (default value) to 3.\n", + "default": 0 + }, + "action": { + "description": "Whether to generate a new image or edit an existing image. Default: `auto`.\n", + "$ref": "#/components/schemas/ImageGenActionEnum" + } + }, + "required": [ + "type" + ] + }, + "ImageRefParam": { + "type": "object", + "description": "Reference an input image by either URL or uploaded file ID.\nProvide exactly one of `image_url` or `file_id`.\n", + "properties": { + "image_url": { + "type": "string", + "format": "uri", + "maxLength": 20971520, + "description": "A fully qualified URL or base64-encoded data URL.", + "example": "https://example.com/source-image.png" + }, + "file_id": { + "type": "string", + "description": "The File API ID of an uploaded image to use as input.", + "example": "file-abc123" + } + }, + "anyOf": [ + { + "required": [ + "image_url" + ] + }, + { + "required": [ + "file_id" + ] + } + ], + "not": { + "required": [ + "image_url", + "file_id" + ] + }, + "additionalProperties": false + }, + "ImagesResponse": { + "type": "object", + "title": "Image generation response", + "description": "The response from the image generation endpoint.", + "properties": { + "safety_identifier": { + "type": [ + "string", + "null" + ], + "description": "The effective safety identifier used for safety monitoring and abuse detection. This is the non-empty `safety_identifier` from the request, or the deprecated `user` value when `safety_identifier` is omitted, null, or empty." + }, + "created": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the image was created." + }, + "data": { + "type": "array", + "description": "The list of generated images.", + "items": { + "$ref": "#/components/schemas/Image" + } + }, + "background": { + "type": "string", + "description": "The background parameter used for the image generation. Either `transparent` or `opaque`.", + "enum": [ + "transparent", + "opaque" + ] + }, + "output_format": { + "type": "string", + "description": "The output format of the image generation. Either `png`, `webp`, or `jpeg`.", + "enum": [ + "png", + "webp", + "jpeg" + ] + }, + "size": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "1024x1024", + "1024x1536", + "1536x1024" + ] + } + ], + "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + }, + "quality": { + "type": "string", + "description": "The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or `max`.", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + }, + "usage": { + "$ref": "#/components/schemas/ImageGenUsage" + } + }, + "required": [ + "created" + ], + "x-oaiMeta": { + "name": "The image generation response", + "group": "images", + "example": "{\n \"created\": 1713833628,\n \"data\": [\n {\n \"b64_json\": \"...\"\n }\n ],\n \"background\": \"transparent\",\n \"output_format\": \"png\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"usage\": {\n \"total_tokens\": 100,\n \"input_tokens\": 50,\n \"output_tokens\": 50,\n \"input_tokens_details\": {\n \"text_tokens\": 10,\n \"image_tokens\": 40\n }\n }\n}\n" + } + }, + "ImagesUsage": { + "type": "object", + "description": "For the GPT image models only, the token usage information for the image generation.\n", + "required": [ + "total_tokens", + "input_tokens", + "output_tokens", + "input_tokens_details" + ], + "properties": { + "total_tokens": { + "type": "integer", + "description": "The total number of tokens (images and text) used for the image generation.\n" + }, + "input_tokens": { + "type": "integer", + "description": "The number of tokens (images and text) in the input prompt." + }, + "output_tokens": { + "type": "integer", + "description": "The number of image tokens in the output image." + }, + "input_tokens_details": { + "type": "object", + "description": "The input tokens detailed information for the image generation.", + "required": [ + "text_tokens", + "image_tokens" + ], + "properties": { + "text_tokens": { + "type": "integer", + "description": "The number of text tokens in the input prompt." + }, + "image_tokens": { + "type": "integer", + "description": "The number of image tokens in the input prompt." + } + } + } + } + }, + "InputAudio": { + "type": "object", + "title": "Input audio", + "description": "An audio input to the model.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the input item. Always `input_audio`.\n", + "enum": [ + "input_audio" + ], + "x-stainless-const": true + }, + "input_audio": { + "type": "object", + "properties": { + "data": { + "type": "string", + "description": "Base64-encoded audio data.\n" + }, + "format": { + "type": "string", + "description": "The format of the audio data. Currently supported formats are `mp3` and\n`wav`.\n", + "enum": [ + "mp3", + "wav" + ] + } + }, + "required": [ + "data", + "format" + ] + } + }, + "required": [ + "type", + "input_audio" + ] + }, + "InputContent": { + "oneOf": [ + { + "$ref": "#/components/schemas/InputTextContent" + }, + { + "$ref": "#/components/schemas/InputImageContent" + }, + { + "$ref": "#/components/schemas/InputFileContent" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "InputItem": { + "oneOf": [ + { + "$ref": "#/components/schemas/EasyInputMessage" + }, + { + "type": "object", + "title": "Item", + "description": "An item representing part of the context for the response to be\ngenerated by the model. Can contain text, images, and audio inputs,\nas well as previous assistant responses and tool call outputs.\n", + "$ref": "#/components/schemas/Item" + }, + { + "$ref": "#/components/schemas/CompactionTriggerItemParam" + }, + { + "$ref": "#/components/schemas/ItemReferenceParam" + }, + { + "$ref": "#/components/schemas/ProgramItemParam" + }, + { + "$ref": "#/components/schemas/ProgramOutputItemParam" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "InputMessage": { + "type": "object", + "title": "Input message", + "description": "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the message input. Always set to `message`.\n", + "enum": [ + "message" + ], + "x-stainless-const": true + }, + "role": { + "type": "string", + "description": "The role of the message input. One of `user`, `system`, or `developer`.\n", + "enum": [ + "user", + "system", + "developer" + ] + }, + "status": { + "type": "string", + "description": "The status of item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + }, + "content": { + "$ref": "#/components/schemas/InputMessageContentList" + } + }, + "required": [ + "role", + "content" + ] + }, + "InputMessageContentList": { + "type": "array", + "title": "Input item content list", + "description": "A list of one or many input items to the model, containing different content \ntypes.\n", + "items": { + "$ref": "#/components/schemas/InputContent" + } + }, + "InputMessageResource": { + "allOf": [ + { + "$ref": "#/components/schemas/InputMessage" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the message input.\n" + } + }, + "required": [ + "id", + "type" + ] + } + ] + }, + "InputParam": { + "description": "Text, image, or file inputs to the model, used to generate a response.\n\nLearn more:\n- [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text)\n- [Image inputs](https://developers.openai.com/api/docs/guides/images-vision)\n- [File inputs](https://developers.openai.com/api/docs/guides/file-inputs)\n- [Conversation state](https://developers.openai.com/api/docs/guides/conversation-state)\n- [Function calling](https://developers.openai.com/api/docs/guides/function-calling)\n", + "oneOf": [ + { + "type": "string", + "title": "Text input", + "description": "A text input to the model, equivalent to a text input with the\n`user` role.\n" + }, + { + "type": "array", + "title": "Input item list", + "description": "A list of one or many input items to the model, containing\ndifferent content types.\n", + "items": { + "$ref": "#/components/schemas/InputItem" + } + } + ] + }, + "Invite": { + "type": "object", + "description": "Represents an individual `invite` to the organization.", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.invite" + ], + "description": "The object type, which is always `organization.invite`", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "email": { + "type": "string", + "description": "The email address of the individual to whom the invite was sent" + }, + "role": { + "type": "string", + "enum": [ + "owner", + "reader" + ], + "description": "`owner` or `reader`" + }, + "status": { + "type": "string", + "enum": [ + "accepted", + "expired", + "pending" + ], + "description": "`accepted`,`expired`, or `pending`" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the invite was sent." + }, + "expires_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ], + "description": "The Unix timestamp (in seconds) of when the invite expires." + }, + "accepted_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ], + "description": "The Unix timestamp (in seconds) of when the invite was accepted." + }, + "projects": { + "type": "array", + "description": "The projects that were granted membership upon acceptance of the invite.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Project's public ID" + }, + "role": { + "type": "string", + "enum": [ + "member", + "owner" + ], + "description": "Project membership role" + } + }, + "required": [ + "id", + "role" + ] + } + } + }, + "required": [ + "object", + "id", + "email", + "role", + "status", + "created_at", + "projects" + ], + "x-oaiMeta": { + "name": "The invite object", + "example": "{\n \"object\": \"organization.invite\",\n \"id\": \"invite-abc\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"status\": \"accepted\",\n \"created_at\": 1711471533,\n \"expires_at\": 1711471533,\n \"accepted_at\": 1711471533,\n \"projects\": [\n {\n \"id\": \"project-xyz\",\n \"role\": \"member\"\n }\n ]\n}\n" + } + }, + "InviteDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.invite.deleted" + ], + "description": "The object type, which is always `organization.invite.deleted`", + "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": [ + "object", + "id", + "deleted" + ] + }, + "InviteListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The object type, which is always `list`", + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Invite" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The first `invite_id` in the retrieved `list`" + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The last `invite_id` in the retrieved `list`" + }, + "has_more": { + "type": "boolean", + "description": "The `has_more` property is used for pagination to indicate there are additional results." + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "InviteProjectGroupBody": { + "type": "object", + "description": "Request payload for granting a group access to a project.", + "properties": { + "group_id": { + "type": "string", + "description": "Identifier of the group to add to the project." + }, + "role": { + "type": "string", + "description": "Identifier of the project role to grant to the group." + } + }, + "required": [ + "group_id", + "role" + ], + "x-oaiMeta": { + "example": "{\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"role\": \"role_01J1F8PROJ\"\n}\n" + } + }, + "InviteRequest": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Send an email to this address" + }, + "role": { + "type": "string", + "enum": [ + "reader", + "owner" + ], + "description": "`owner` or `reader`" + }, + "projects": { + "type": "array", + "description": "An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Project's public ID" + }, + "role": { + "type": "string", + "enum": [ + "member", + "owner" + ], + "description": "Project membership role" + } + }, + "required": [ + "id", + "role" + ] + } + } + }, + "required": [ + "email", + "role" + ] + }, + "Item": { + "type": "object", + "description": "Content item used to generate a response.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/InputMessage" + }, + { + "$ref": "#/components/schemas/OutputMessage" + }, + { + "$ref": "#/components/schemas/FileSearchToolCall" + }, + { + "$ref": "#/components/schemas/ComputerToolCall" + }, + { + "$ref": "#/components/schemas/ComputerCallOutputItemParam" + }, + { + "$ref": "#/components/schemas/WebSearchToolCall" + }, + { + "$ref": "#/components/schemas/FunctionToolCall" + }, + { + "$ref": "#/components/schemas/FunctionCallOutputItemParam" + }, + { + "$ref": "#/components/schemas/ToolSearchCallItemParam" + }, + { + "$ref": "#/components/schemas/ToolSearchOutputItemParam" + }, + { + "$ref": "#/components/schemas/AdditionalToolsItemParam" + }, + { + "$ref": "#/components/schemas/ResponseConfigurationUpdateItemParam" + }, + { + "$ref": "#/components/schemas/ReasoningItem" + }, + { + "$ref": "#/components/schemas/CompactionSummaryItemParam" + }, + { + "$ref": "#/components/schemas/ImageGenToolCall" + }, + { + "$ref": "#/components/schemas/CodeInterpreterToolCall" + }, + { + "$ref": "#/components/schemas/LocalShellToolCall" + }, + { + "$ref": "#/components/schemas/LocalShellToolCallOutput" + }, + { + "$ref": "#/components/schemas/FunctionShellCallItemParam" + }, + { + "$ref": "#/components/schemas/FunctionShellCallOutputItemParam" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolCallItemParam" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolCallOutputItemParam" + }, + { + "$ref": "#/components/schemas/MCPListTools" + }, + { + "$ref": "#/components/schemas/MCPApprovalRequest" + }, + { + "$ref": "#/components/schemas/MCPApprovalResponse" + }, + { + "$ref": "#/components/schemas/MCPToolCall" + }, + { + "$ref": "#/components/schemas/CustomToolCallOutput" + }, + { + "$ref": "#/components/schemas/CustomToolCall" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "ItemResource": { + "description": "Content item used to generate a response.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/InputMessageResource" + }, + { + "$ref": "#/components/schemas/OutputMessage" + }, + { + "$ref": "#/components/schemas/FileSearchToolCall" + }, + { + "$ref": "#/components/schemas/ComputerToolCall" + }, + { + "$ref": "#/components/schemas/ComputerToolCallOutputResource" + }, + { + "$ref": "#/components/schemas/WebSearchToolCall" + }, + { + "$ref": "#/components/schemas/FunctionToolCallResource" + }, + { + "$ref": "#/components/schemas/FunctionToolCallOutputResource" + }, + { + "$ref": "#/components/schemas/ToolSearchCall" + }, + { + "$ref": "#/components/schemas/ToolSearchOutput" + }, + { + "$ref": "#/components/schemas/AdditionalTools" + }, + { + "$ref": "#/components/schemas/ResponseConfigurationUpdate" + }, + { + "$ref": "#/components/schemas/ReasoningItem" + }, + { + "$ref": "#/components/schemas/Program" + }, + { + "$ref": "#/components/schemas/ProgramOutput" + }, + { + "$ref": "#/components/schemas/CompactionBody" + }, + { + "$ref": "#/components/schemas/ImageGenToolCall" + }, + { + "$ref": "#/components/schemas/CodeInterpreterToolCall" + }, + { + "$ref": "#/components/schemas/LocalShellToolCall" + }, + { + "$ref": "#/components/schemas/LocalShellToolCallOutput" + }, + { + "$ref": "#/components/schemas/FunctionShellCall" + }, + { + "$ref": "#/components/schemas/FunctionShellCallOutput" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolCall" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolCallOutput" + }, + { + "$ref": "#/components/schemas/MCPListTools" + }, + { + "$ref": "#/components/schemas/MCPApprovalRequest" + }, + { + "$ref": "#/components/schemas/MCPApprovalResponseResource" + }, + { + "$ref": "#/components/schemas/MCPToolCall" + }, + { + "$ref": "#/components/schemas/CustomToolCallResource" + }, + { + "$ref": "#/components/schemas/CustomToolCallOutputResource" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "ListAssistantsResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AssistantObject" + } + }, + "first_id": { + "type": "string", + "example": "asst_abc123" + }, + "last_id": { + "type": "string", + "example": "asst_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "x-oaiMeta": { + "name": "List assistants response object", + "group": "chat", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"asst_abc123\",\n \"object\": \"assistant\",\n \"created_at\": 1698982736,\n \"name\": \"Coding Tutor\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc456\",\n \"object\": \"assistant\",\n \"created_at\": 1698982718,\n \"name\": \"My Assistant\",\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant designed to make me better at coding!\",\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n },\n {\n \"id\": \"asst_abc789\",\n \"object\": \"assistant\",\n \"created_at\": 1698982643,\n \"name\": null,\n \"description\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": null,\n \"tools\": [],\n \"tool_resources\": {},\n \"metadata\": {},\n \"top_p\": 1.0,\n \"temperature\": 1.0,\n \"response_format\": \"auto\"\n }\n ],\n \"first_id\": \"asst_abc123\",\n \"last_id\": \"asst_abc789\",\n \"has_more\": false\n}\n" + } + }, + "ListAuditLogsResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AuditLog" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "example": "audit_log-defb456h8dks" + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "example": "audit_log-hnbkd8s93s" + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ListBatchesResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Batch" + } + }, + "first_id": { + "type": "string", + "example": "batch_abc123" + }, + "last_id": { + "type": "string", + "example": "batch_abc456" + }, + "has_more": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ListCertificatesResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrganizationCertificate" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "example": "cert_abc" + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "example": "cert_abc" + }, + "has_more": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + } + }, + "required": [ + "object", + "data", + "has_more", + "first_id", + "last_id" + ] + }, + "ListFilesResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIFile" + } + }, + "first_id": { + "type": "string", + "example": "file-abc123" + }, + "last_id": { + "type": "string", + "example": "file-abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "ListFineTuningCheckpointPermissionResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FineTuningCheckpointPermission" + } + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ListFineTuningJobCheckpointsResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FineTuningJobCheckpoint" + } + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ListFineTuningJobEventsResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FineTuningJobEvent" + } + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ListMessagesResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "first_id": { + "type": "string", + "example": "msg_abc123" + }, + "last_id": { + "type": "string", + "example": "msg_abc123" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "ListModelsResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Model" + } + } + }, + "required": [ + "object", + "data" + ] + }, + "ListPaginatedFineTuningJobsResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FineTuningJob" + } + }, + "has_more": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ListProjectCertificatesResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrganizationProjectCertificate" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "example": "cert_abc" + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "example": "cert_abc" + }, + "has_more": { + "type": "boolean" + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + } + }, + "required": [ + "object", + "data", + "has_more", + "first_id", + "last_id" + ] + }, + "ListRunStepsResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "first_id": { + "type": "string", + "example": "step_abc123" + }, + "last_id": { + "type": "string", + "example": "step_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "ListRunsResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RunObject" + } + }, + "first_id": { + "type": "string", + "example": "run_abc123" + }, + "last_id": { + "type": "string", + "example": "run_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "ListVectorStoreFilesResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VectorStoreFileObject" + } + }, + "first_id": { + "type": "string", + "example": "file-abc123" + }, + "last_id": { + "type": "string", + "example": "file-abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "ListVectorStoresResponse": { + "properties": { + "object": { + "type": "string", + "example": "list" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VectorStoreObject" + } + }, + "first_id": { + "type": "string", + "example": "vs_abc123" + }, + "last_id": { + "type": "string", + "example": "vs_abc456" + }, + "has_more": { + "type": "boolean", + "example": false + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "LiveCallAcceptRequest": { + "type": "object", + "description": "Accept an incoming SIP call with Live startup configuration.", + "properties": { + "session": { + "$ref": "#/components/schemas/LiveCallAcceptSession", + "description": "Model and startup configuration for the Live session that answers the incoming SIP call." + } + }, + "required": [ + "session" + ], + "additionalProperties": false + }, + "LiveCallAcceptSession": { + "type": "object", + "description": "Startup configuration for accepting an incoming Live SIP call. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend and backend instructions.", + "properties": { + "model": { + "$ref": "#/components/schemas/ModelIdsLive", + "description": "The Live model to use for the accepted call.", + "minLength": 1 + }, + "instructions": { + "$ref": "#/components/schemas/instructions" + }, + "audio": { + "$ref": "#/components/schemas/LiveMediaSessionAudioParam", + "description": "Startup audio output configuration. SIP negotiates the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup." + }, + "delegation": { + "$ref": "#/components/schemas/delegation" + }, + "triggers": { + "$ref": "#/components/schemas/triggers" + }, + "store": { + "$ref": "#/components/schemas/store" + }, + "input": { + "$ref": "#/components/schemas/input" + }, + "type": { + "type": "string", + "enum": [ + "live" + ], + "default": "live", + "x-stainless-const": true, + "description": "The session type. Always `live`." + } + }, + "required": [ + "model", + "type" + ], + "additionalProperties": false + }, + "LiveCallReferRequest": { + "type": "object", + "description": "Parameters used to transfer a Live SIP call to another destination.", + "properties": { + "target_uri": { + "$ref": "#/components/schemas/target_uri", + "minLength": 1, + "pattern": "\\S", + "description": "Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or sip:agent@example.com." + } + }, + "required": [ + "target_uri" + ], + "additionalProperties": false + }, + "LiveCallRejectRequest": { + "type": "object", + "description": "Parameters used to reject an incoming Live SIP call.", + "properties": { + "status_code": { + "type": "integer", + "minimum": 300, + "maximum": 699, + "description": "SIP rejection status sent to the caller. This field is required.", + "example": 486 + } + }, + "required": [ + "status_code" + ], + "additionalProperties": false + }, + "LiveClientEvent": { + "description": "Client events for Live. Initialize a primary WebSocket with session.start and wait for session.started. WebRTC creation already starts the session. Audio append is primary WebSocket-only. See the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before writing frontend instructions and delegation policies.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveSessionStartEvent" + }, + { + "$ref": "#/components/schemas/LiveSessionUpdateParam" + }, + { + "$ref": "#/components/schemas/LiveInputAudioAppendEvent" + }, + { + "$ref": "#/components/schemas/LiveInputAudioMuteParam" + }, + { + "$ref": "#/components/schemas/LiveInputAudioUnmuteParam" + }, + { + "$ref": "#/components/schemas/LiveOutputAudioFixturePlayParam" + }, + { + "$ref": "#/components/schemas/LiveInstructionsAppendParam" + }, + { + "$ref": "#/components/schemas/LiveThinkingAppendParam" + }, + { + "$ref": "#/components/schemas/LiveCommentaryAppendParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionCreateParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemCreateParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemDeleteParam" + }, + { + "$ref": "#/components/schemas/LiveResponseItemCreateParam" + }, + { + "$ref": "#/components/schemas/LiveResponseCreateParam" + }, + { + "$ref": "#/components/schemas/LiveSessionCloseParam" + } + ] + }, + "LiveConnectParams": { + "type": "object", + "x-stainless-empty-object": true, + "description": "Primary Live WebSocket connections accept no query parameters. Supply the model and startup configuration in the first session.start event.", + "properties": {}, + "additionalProperties": false + }, + "LiveCreateRequest": { + "type": "object", + "description": "Create a Live WebRTC session with JSON session configuration and an SDP offer. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before choosing frontend and backend instructions. The request starts the session; do not send session.start on the data channel.", + "properties": { + "session": { + "$ref": "#/components/schemas/LiveMediaSessionCreateParams", + "description": "Startup configuration for the Live session." + }, + "transport": { + "$ref": "#/components/schemas/LiveWebRTCTransport", + "description": "WebRTC transport with the browser's SDP offer." + } + }, + "required": [ + "session", + "transport" + ], + "additionalProperties": false + }, + "LiveCreateResponse": { + "type": "object", + "description": "The created Live session identifier and WebRTC answer. Apply transport.sdp as the peer's remote answer and wait for session.started on the data channel before sending commands.", + "properties": { + "session": { + "type": "object", + "description": "The newly created Live session. Use its ID for session controls and sideband connections.", + "properties": { + "id": { + "type": "string", + "description": "Opaque session identifier. Preserve the returned value unchanged, including its prefix." + } + }, + "required": [ + "id" + ] + }, + "transport": { + "$ref": "#/components/schemas/LiveWebRTCTransport", + "description": "WebRTC transport with the SDP answer." + } + }, + "required": [ + "session", + "transport" + ] + }, + "LiveForkClientEvent": { + "description": "Client events for a Live fork WebSocket. First send session.start with an overrides object (which may be empty), then wait for session.started before sending other commands. The model and conversation are inherited from the stored session.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveForkSessionStartEvent" + }, + { + "$ref": "#/components/schemas/LiveSessionUpdateParam" + }, + { + "$ref": "#/components/schemas/LiveInputAudioAppendEvent" + }, + { + "$ref": "#/components/schemas/LiveInputAudioMuteParam" + }, + { + "$ref": "#/components/schemas/LiveInputAudioUnmuteParam" + }, + { + "$ref": "#/components/schemas/LiveOutputAudioFixturePlayParam" + }, + { + "$ref": "#/components/schemas/LiveInstructionsAppendParam" + }, + { + "$ref": "#/components/schemas/LiveThinkingAppendParam" + }, + { + "$ref": "#/components/schemas/LiveCommentaryAppendParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionCreateParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemCreateParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemDeleteParam" + }, + { + "$ref": "#/components/schemas/LiveResponseItemCreateParam" + }, + { + "$ref": "#/components/schemas/LiveResponseCreateParam" + }, + { + "$ref": "#/components/schemas/LiveSessionCloseParam" + } + ] + }, + "LiveForkPathParams": { + "type": "object", + "description": "Identifies the stored Live session whose conversation and configuration are used to create a fork.", + "required": [ + "session_id" + ], + "properties": { + "session_id": { + "type": "string", + "description": "The ID of the stored Live session to fork." + } + } + }, + "LiveForkRequest": { + "type": "object", + "description": "Fork a stored Live session onto a new WebRTC connection. Omit session or send an empty object to inherit its configuration.", + "properties": { + "session": { + "$ref": "#/components/schemas/LiveMediaSessionForkParams", + "description": "Optional configuration overrides for the new Live session. Omit this object or send an empty object to inherit the stored session's settings." + }, + "transport": { + "$ref": "#/components/schemas/LiveWebRTCTransport", + "description": "WebRTC transport with an SDP offer for the new connection to the forked session." + } + }, + "required": [ + "transport" + ], + "additionalProperties": false + }, + "LiveForkServerEvent": { + "$ref": "#/components/schemas/LiveServerEvent" + }, + "LiveMediaSessionAudioParam": { + "type": "object", + "description": "Startup audio output configuration. WebRTC and SIP negotiate the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup.", + "properties": { + "output": { + "$ref": "#/components/schemas/LiveInitialSessionAudioOutputParam" + } + }, + "additionalProperties": false + }, + "LiveMediaSessionCreateParams": { + "type": "object", + "description": "Startup configuration for a Live media session. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend instructions and the backend prompt under delegation.responses.instructions.", + "properties": { + "model": { + "$ref": "#/components/schemas/ModelIdsLive" + }, + "instructions": { + "$ref": "#/components/schemas/instructions" + }, + "audio": { + "$ref": "#/components/schemas/LiveMediaSessionAudioParam", + "description": "Startup audio configuration. WebRTC and SIP negotiate their audio format on the media transport." + }, + "delegation": { + "$ref": "#/components/schemas/delegation" + }, + "triggers": { + "$ref": "#/components/schemas/triggers" + }, + "store": { + "$ref": "#/components/schemas/store" + }, + "input": { + "$ref": "#/components/schemas/input" + }, + "client": { + "$ref": "#/components/schemas/LiveClientConfigParam" + } + }, + "required": [ + "model" + ], + "additionalProperties": false + }, + "LiveMediaSessionForkParams": { + "type": "object", + "description": "Optional overrides for a stored Live session. Omitted settings are inherited. The model, voice, frontend instructions, and prior conversation come from the stored session. WebRTC negotiates its audio format; audio.format is only supported on WebSocket forks.", + "properties": { + "store": { + "$ref": "#/components/schemas/properties-store" + }, + "delegation": { + "$ref": "#/components/schemas/LiveResponsesDelegationUpdateParam" + }, + "client": { + "$ref": "#/components/schemas/LiveClientConfigParam" + } + }, + "additionalProperties": false + }, + "LiveSIPTransport": { + "type": "object", + "description": "Place an outbound SIP call using your provider's trunk. The trunk must support TLS signaling, Opus audio, and SDES-SRTP media. See [Telephony and SIP](https://developers.openai.com/api/docs/guides/voice-sip?api=live#place-an-outbound-call).", + "properties": { + "type": { + "type": "string", + "description": "The transport used for the Live session. Always `sip`.", + "enum": [ + "sip" + ], + "x-stainless-const": true + }, + "destination": { + "type": "string", + "description": "Phone number to call in E.164 format. SIP URI destinations are not supported.", + "pattern": "^\\+[1-9][0-9]{1,14}$", + "example": "+14155550123" + }, + "trunk": { + "$ref": "#/components/schemas/LiveSIPTrunk" + } + }, + "required": [ + "type", + "destination", + "trunk" + ], + "additionalProperties": false + }, + "LiveSIPTrunk": { + "type": "object", + "description": "SIP trunk configuration supplied for this call. Keep trunk credentials on your server. The creation response does not return this configuration.", + "properties": { + "provider_url": { + "type": "string", + "description": "Provider endpoint in the form `sips:host[:port][;transport=tcp]`. The default port is 5061. IPv6 addresses must be bracketed. TLS signaling is required; plaintext SIP is not supported. Do not include userinfo, a path, URI headers, or other URI parameters. Local hostnames and literal private, loopback, link-local, unspecified, multicast, and broadcast IP addresses are rejected.", + "example": "sips:sip.example.com:5061" + }, + "auth": { + "$ref": "#/components/schemas/LiveSIPTrunkAuth" + }, + "caller_number": { + "type": "string", + "description": "Caller phone number in E.164 format to use in the SIP From header.", + "pattern": "^\\+[1-9][0-9]{1,14}$", + "example": "+14155550100" + } + }, + "required": [ + "provider_url", + "auth", + "caller_number" + ], + "additionalProperties": false + }, + "LiveSIPTrunkAuth": { + "type": "object", + "description": "Credentials for SIP Digest authentication with your trunk provider.", + "properties": { + "type": { + "type": "string", + "description": "Use `digest` for SIP Digest authentication. Handles 401 and 407 challenges.", + "enum": [ + "digest" + ] + }, + "username": { + "type": "string", + "minLength": 1, + "description": "Provider username. Must contain a non-whitespace character, be at most 256 bytes, and contain no CR, LF, or NUL." + }, + "password": { + "type": "string", + "minLength": 1, + "writeOnly": true, + "description": "Provider password. Must be at most 4096 bytes and contain no CR, LF, or NUL." + } + }, + "required": [ + "type", + "username", + "password" + ], + "additionalProperties": false + }, + "LiveServerEvent": { + "description": "Server events for Live. Response lifecycle events are wrapped inside response.event; dispatch the nested event by its full type and tolerate new response event types. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when designing the conversation and delegation policy.", + "discriminator": { + "propertyName": "type" + }, + "allOf": [ + { + "$ref": "#/components/schemas/LiveServerEvent-2" + } + ] + }, + "LiveSessionCreateRequest": { + "type": "object", + "description": "Create a Live session with a WebRTC SDP offer or place an outbound SIP call. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before choosing frontend and backend instructions. The request starts the session; do not send session.start again on the data channel or sideband.", + "properties": { + "session": { + "$ref": "#/components/schemas/LiveMediaSessionCreateParams", + "description": "Startup configuration for the Live session." + }, + "transport": { + "description": "WebRTC transport with an SDP offer, or SIP transport with a destination and per-call trunk credentials.", + "oneOf": [ + { + "$ref": "#/components/schemas/LiveWebRTCTransport" + }, + { + "$ref": "#/components/schemas/LiveSIPTransport" + } + ], + "discriminator": { + "propertyName": "type" + } + } + }, + "required": [ + "session", + "transport" + ], + "additionalProperties": false + }, + "LiveSessionCreateResponse": { + "type": "object", + "description": "The created Live session and its transport. WebRTC creation returns 201 Created with an SDP answer. Outbound SIP creation returns 201 Created after initialization, before the callee necessarily answers, without SDP or trunk credentials.", + "properties": { + "session": { + "$ref": "#/components/schemas/session" + }, + "transport": { + "description": "WebRTC transport with an SDP answer, or SIP transport without SDP or trunk credentials. For SIP, attach a sideband using session.id to receive transport.ringing, transport.answered, and transport.failed notifications.", + "oneOf": [ + { + "$ref": "#/components/schemas/LiveWebRTCTransport" + }, + { + "type": "object", + "description": "The SIP transport. Trunk credentials and SDP are not returned.", + "properties": { + "type": { + "type": "string", + "description": "The transport used for the Live session. Always `sip`.", + "enum": [ + "sip" + ], + "x-stainless-const": true + } + }, + "required": [ + "type" + ] + } + ], + "discriminator": { + "propertyName": "type" + } + } + }, + "required": [ + "session", + "transport" + ] + }, + "LiveSidebandClientEvent": { + "description": "Client events accepted by an attached Live sideband WebSocket. The session has already started. Send input audio over the primary connection.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveSessionUpdateParam" + }, + { + "$ref": "#/components/schemas/LiveInputAudioMuteParam" + }, + { + "$ref": "#/components/schemas/LiveInputAudioUnmuteParam" + }, + { + "$ref": "#/components/schemas/LiveOutputAudioFixturePlayParam" + }, + { + "$ref": "#/components/schemas/LiveTransportDTMFSendParam" + }, + { + "$ref": "#/components/schemas/LiveInstructionsAppendParam" + }, + { + "$ref": "#/components/schemas/LiveThinkingAppendParam" + }, + { + "$ref": "#/components/schemas/LiveCommentaryAppendParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionCreateParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemCreateParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemDeleteParam" + }, + { + "$ref": "#/components/schemas/LiveResponseItemCreateParam" + }, + { + "$ref": "#/components/schemas/LiveResponseCreateParam" + }, + { + "$ref": "#/components/schemas/LiveSessionCloseParam" + } + ] + }, + "LiveSidebandConnectParams": { + "type": "object", + "description": "Connection options for a sideband WebSocket attached to an existing Live session.", + "properties": { + "graceful_close": { + "type": "boolean", + "description": "Opt in to the graceful WebSocket closing handshake when the session ends. The server may also enable this behavior by default." + } + }, + "additionalProperties": false + }, + "LiveSidebandPathParams": { + "type": "object", + "description": "Identifies the Live session to observe and control through a sideband WebSocket.", + "required": [ + "session_id" + ], + "properties": { + "session_id": { + "type": "string", + "description": "The ID of the existing Live session to attach to." + } + } + }, + "LiveSidebandServerEvent": { + "description": "Server events received by an attached Live sideband WebSocket. Audio deltas are delivered over the primary connection.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveTransportRinging" + }, + { + "$ref": "#/components/schemas/LiveTransportAnswered" + }, + { + "$ref": "#/components/schemas/LiveTransportFailed" + }, + { + "$ref": "#/components/schemas/LiveTransportDTMFReceived" + }, + { + "$ref": "#/components/schemas/LiveTransportDTMFSent" + }, + { + "$ref": "#/components/schemas/LiveSessionStarted" + }, + { + "$ref": "#/components/schemas/LiveSessionUpdated" + }, + { + "$ref": "#/components/schemas/LiveInputAudioMuted" + }, + { + "$ref": "#/components/schemas/LiveInputAudioUnmuted" + }, + { + "$ref": "#/components/schemas/LiveOutputAudioFixturePlaying" + }, + { + "$ref": "#/components/schemas/LiveOutputAudioFixturePlayed" + }, + { + "$ref": "#/components/schemas/LiveInstructionsAppended" + }, + { + "$ref": "#/components/schemas/LiveThinkingAppended" + }, + { + "$ref": "#/components/schemas/LiveCommentaryAppended" + }, + { + "$ref": "#/components/schemas/LiveInputTranscriptDelta" + }, + { + "$ref": "#/components/schemas/LiveOutputTranscriptDelta" + }, + { + "$ref": "#/components/schemas/LiveDelegationCreated" + }, + { + "$ref": "#/components/schemas/LiveDecisionEvent" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemCreated" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemDeleted" + }, + { + "$ref": "#/components/schemas/LiveResponseEvent" + }, + { + "$ref": "#/components/schemas/LiveSessionUsageUpdated" + }, + { + "$ref": "#/components/schemas/LiveSessionClosed" + }, + { + "$ref": "#/components/schemas/LiveErrorEvent" + }, + { + "$ref": "#/components/schemas/LiveInfoEvent" + } + ] + }, + "LiveWebRTCTransport": { + "type": "object", + "description": "WebRTC transport carrying the offer SDP in a creation request or answer SDP in its response.", + "properties": { + "type": { + "type": "string", + "description": "The transport used for the Live session. Always `webrtc`.", + "enum": [ + "webrtc" + ], + "x-stainless-const": true + }, + "sdp": { + "type": "string", + "minLength": 1, + "description": "Session Description Protocol message for the WebRTC connection." + } + }, + "required": [ + "type", + "sdp" + ], + "additionalProperties": false + }, + "LocalShellToolCall": { + "type": "object", + "title": "Local shell call", + "description": "A tool call to run a command on the local shell.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "local_shell_call" + ], + "description": "The type of the local shell call. Always `local_shell_call`.\n", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the local shell call.\n" + }, + "call_id": { + "type": "string", + "description": "The unique ID of the local shell tool call generated by the model.\n" + }, + "action": { + "$ref": "#/components/schemas/LocalShellExecAction" + }, + "status": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ], + "description": "The status of the local shell call.\n" + } + }, + "required": [ + "type", + "id", + "call_id", + "action", + "status" + ] + }, + "LocalShellToolCallOutput": { + "type": "object", + "title": "Local shell call output", + "description": "The output of a local shell tool call.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "local_shell_call_output" + ], + "description": "The type of the local shell tool call output. Always `local_shell_call_output`.\n", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the local shell tool call generated by the model.\n" + }, + "output": { + "type": "string", + "description": "A JSON string of the output of the local shell tool call.\n" + }, + "status": { + "anyOf": [ + { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ], + "description": "The status of the item. One of `in_progress`, `completed`, or `incomplete`.\n" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "type", + "call_id", + "output" + ] + }, + "LogProbProperties": { + "type": "object", + "description": "A log probability object.\n", + "properties": { + "token": { + "type": "string", + "description": "The token that was used to generate the log probability.\n" + }, + "logprob": { + "type": "number", + "description": "The log probability of the token.\n" + }, + "bytes": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "The bytes that were used to generate the log probability.\n" + } + }, + "required": [ + "token", + "logprob", + "bytes" + ] + }, + "MCPApprovalRequest": { + "type": "object", + "title": "MCP approval request", + "description": "A request for human approval of a tool invocation.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_approval_request" + ], + "description": "The type of the item. Always `mcp_approval_request`.\n", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the approval request.\n" + }, + "server_label": { + "type": "string", + "description": "The label of the MCP server making the request.\n" + }, + "name": { + "type": "string", + "description": "The name of the tool to run.\n" + }, + "arguments": { + "type": "string", + "description": "A JSON string of arguments for the tool.\n" + } + }, + "required": [ + "type", + "id", + "server_label", + "name", + "arguments" + ] + }, + "MCPApprovalResponse": { + "type": "object", + "title": "MCP approval response", + "description": "A response to an MCP approval request.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_approval_response" + ], + "description": "The type of the item. Always `mcp_approval_response`.\n", + "x-stainless-const": true + }, + "id": { + "anyOf": [ + { + "type": "string", + "description": "The unique ID of the approval response\n" + }, + { + "type": "null" + } + ] + }, + "approval_request_id": { + "type": "string", + "description": "The ID of the approval request being answered.\n" + }, + "approve": { + "type": "boolean", + "description": "Whether the request was approved.\n" + }, + "reason": { + "anyOf": [ + { + "type": "string", + "description": "Optional reason for the decision.\n" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "request_id", + "approve", + "approval_request_id" + ] + }, + "MCPApprovalResponseResource": { + "type": "object", + "title": "MCP approval response", + "description": "A response to an MCP approval request.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_approval_response" + ], + "description": "The type of the item. Always `mcp_approval_response`.\n", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the approval response\n" + }, + "approval_request_id": { + "type": "string", + "description": "The ID of the approval request being answered.\n" + }, + "approve": { + "type": "boolean", + "description": "Whether the request was approved.\n" + }, + "reason": { + "anyOf": [ + { + "type": "string", + "description": "Optional reason for the decision.\n" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "id", + "request_id", + "approve", + "approval_request_id" + ] + }, + "MCPListTools": { + "type": "object", + "title": "MCP list tools", + "description": "A list of tools available on an MCP server.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_list_tools" + ], + "description": "The type of the item. Always `mcp_list_tools`.\n", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the list.\n" + }, + "server_label": { + "type": "string", + "description": "The label of the MCP server.\n" + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MCPListToolsTool" + }, + "description": "The tools available on the server.\n" + }, + "error": { + "anyOf": [ + { + "type": "string", + "description": "Error message if the server could not list tools.\n" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "id", + "server_label", + "tools" + ] + }, + "MCPListToolsTool": { + "type": "object", + "title": "MCP list tools tool", + "description": "A tool available on an MCP server.\n", + "properties": { + "name": { + "type": "string", + "description": "The name of the tool.\n" + }, + "description": { + "anyOf": [ + { + "type": "string", + "description": "The description of the tool.\n" + }, + { + "type": "null" + } + ] + }, + "input_schema": { + "type": "object", + "description": "The JSON schema describing the tool's input.\n" + }, + "annotations": { + "anyOf": [ + { + "type": "object", + "description": "Additional annotations about the tool.\n" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "name", + "input_schema" + ] + }, + "MCPTool": { + "type": "object", + "title": "MCP tool", + "description": "Give the model access to additional tools via remote Model Context Protocol\n(MCP) servers. [Learn more about MCP](https://developers.openai.com/api/docs/guides/tools-connectors-mcp).\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp" + ], + "description": "The type of the MCP tool. Always `mcp`.", + "x-stainless-const": true + }, + "server_label": { + "type": "string", + "description": "A label for this MCP server, used to identify it in tool calls.\n" + }, + "server_url": { + "type": "string", + "format": "uri", + "description": "The URL for the MCP server. One of `server_url`, `connector_id`, or\n`tunnel_id` must be provided.\n" + }, + "connector_id": { + "type": "string", + "deprecated": true, + "enum": [ + "connector_dropbox", + "connector_gmail", + "connector_googlecalendar", + "connector_googledrive", + "connector_microsoftteams", + "connector_outlookcalendar", + "connector_outlookemail", + "connector_sharepoint" + ], + "description": "Identifier for service connectors, like those available in ChatGPT. One of\n`server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more\nabout service connectors [here](https://developers.openai.com/api/docs/guides/tools-connectors-mcp#connectors).\n\nThis field is deprecated for models released after September 1, 2026.\nUse `server_url` to connect to a remote MCP server, or `tunnel_id` to\nconnect through a Secure MCP Tunnel.\n\nCurrently supported `connector_id` values are:\n\n- Dropbox: `connector_dropbox`\n- Gmail: `connector_gmail`\n- Google Calendar: `connector_googlecalendar`\n- Google Drive: `connector_googledrive`\n- Microsoft Teams: `connector_microsoftteams`\n- Outlook Calendar: `connector_outlookcalendar`\n- Outlook Email: `connector_outlookemail`\n- SharePoint: `connector_sharepoint`\n" + }, + "tunnel_id": { + "type": "string", + "pattern": "^tunnel_[a-z0-9]{32}$", + "description": "The Secure MCP Tunnel ID to use instead of a direct server URL. One of\n`server_url`, `connector_id`, or `tunnel_id` must be provided.\n" + }, + "authorization": { + "type": "string", + "description": "An OAuth access token that can be used with a remote MCP server, either\nwith a custom MCP server URL or a service connector. Your application\nmust handle the OAuth authorization flow and provide the token here.\n" + }, + "server_description": { + "type": "string", + "description": "Optional description of the MCP server, used to provide more context.\n" + }, + "headers": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Optional HTTP headers to send to the MCP server. Use for authentication\nor other purposes.\n" + }, + { + "type": "null" + } + ] + }, + "allowed_tools": { + "anyOf": [ + { + "description": "List of allowed tool names or a filter object.\n", + "oneOf": [ + { + "type": "array", + "title": "MCP allowed tools", + "description": "A string array of allowed tool names", + "items": { + "type": "string" + } + }, + { + "$ref": "#/components/schemas/MCPToolFilter" + } + ] + }, + { + "type": "null" + } + ] + }, + "allowed_callers": { + "anyOf": [ + { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/CallableToolAllowedCaller" + }, + "description": "The tool invocation context(s)." + }, + { + "type": "null" + } + ] + }, + "require_approval": { + "anyOf": [ + { + "description": "Specify which of the MCP server's tools require approval.", + "oneOf": [ + { + "type": "object", + "title": "MCP tool approval filter", + "description": "Specify which of the MCP server's tools require approval. Can be\n`always`, `never`, or a filter object associated with tools\nthat require approval.\n", + "properties": { + "always": { + "$ref": "#/components/schemas/MCPToolFilter" + }, + "never": { + "$ref": "#/components/schemas/MCPToolFilter" + } + }, + "additionalProperties": false + }, + { + "type": "string", + "title": "MCP tool approval setting", + "description": "Specify a single approval policy for all tools. One of `always` or\n`never`. When set to `always`, all tools will require approval. When\nset to `never`, all tools will not require approval.\n", + "enum": [ + "always", + "never" + ] + } + ], + "default": "always" + }, + { + "type": "null" + } + ] + }, + "defer_loading": { + "type": "boolean", + "description": "Whether this MCP tool is deferred and discovered via tool search.\n" + } + }, + "required": [ + "type", + "server_label" + ] + }, + "MCPToolCall": { + "type": "object", + "title": "MCP tool call", + "description": "An invocation of a tool on an MCP server.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_call" + ], + "description": "The type of the item. Always `mcp_call`.\n", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the tool call.\n" + }, + "server_label": { + "type": "string", + "description": "The label of the MCP server running the tool.\n" + }, + "name": { + "type": "string", + "description": "The name of the tool that was run.\n" + }, + "arguments": { + "type": "string", + "description": "A JSON string of the arguments passed to the tool.\n" + }, + "output": { + "anyOf": [ + { + "type": "string", + "description": "The output from the tool call.\n" + }, + { + "type": "null" + } + ] + }, + "error": { + "description": "The error from the tool call, if any.", + "anyOf": [ + { + "$ref": "#/components/schemas/MCPToolCallError" + }, + { + "type": "null" + } + ] + }, + "status": { + "$ref": "#/components/schemas/MCPToolCallStatus", + "description": "The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\n" + }, + "approval_request_id": { + "anyOf": [ + { + "type": "string", + "description": "Unique identifier for the MCP tool call approval request.\nInclude this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.\n" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "id", + "server_label", + "name", + "arguments" + ] + }, + "MCPToolCallError": { + "oneOf": [ + { + "$ref": "#/components/schemas/MCPProtocolError" + }, + { + "$ref": "#/components/schemas/MCPToolExecutionError" + }, + { + "$ref": "#/components/schemas/HTTPError" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "MCPToolFilter": { + "type": "object", + "title": "MCP tool filter", + "description": "A filter object to specify which tools are allowed.\n", + "properties": { + "tool_names": { + "type": "array", + "title": "MCP allowed tools", + "items": { + "type": "string" + }, + "description": "List of allowed tool names." + }, + "read_only": { + "type": "boolean", + "description": "Indicates whether or not a tool modifies data or is read-only. If an\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\nit will match this filter.\n" + } + }, + "required": [], + "additionalProperties": false + }, + "MessageContentImageFileObject": { + "title": "Image file", + "type": "object", + "description": "References an image [File](https://developers.openai.com/api/reference/resources/files) in the content of a message.", + "properties": { + "type": { + "description": "Always `image_file`.", + "type": "string", + "enum": [ + "image_file" + ], + "x-stainless-const": true + }, + "image_file": { + "type": "object", + "properties": { + "file_id": { + "description": "The [File](https://developers.openai.com/api/reference/resources/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content.", + "type": "string" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.", + "enum": [ + "auto", + "low", + "high" + ], + "default": "auto" + } + }, + "required": [ + "file_id" + ] + } + }, + "required": [ + "type", + "image_file" + ] + }, + "MessageContentImageUrlObject": { + "title": "Image URL", + "type": "object", + "description": "References an image URL in the content of a message.", + "properties": { + "type": { + "type": "string", + "enum": [ + "image_url" + ], + "description": "The type of the content part.", + "x-stainless-const": true + }, + "image_url": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.", + "format": "uri" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`", + "enum": [ + "auto", + "low", + "high" + ], + "default": "auto" + } + }, + "required": [ + "url" + ] + } + }, + "required": [ + "type", + "image_url" + ] + }, + "MessageContentRefusalObject": { + "title": "Refusal", + "type": "object", + "description": "The refusal content generated by the assistant.", + "properties": { + "type": { + "description": "Always `refusal`.", + "type": "string", + "enum": [ + "refusal" + ], + "x-stainless-const": true + }, + "refusal": { + "type": "string" + } + }, + "required": [ + "type", + "refusal" + ] + }, + "MessageContentTextAnnotationsFileCitationObject": { + "title": "File citation", + "type": "object", + "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files.", + "properties": { + "type": { + "description": "Always `file_citation`.", + "type": "string", + "enum": [ + "file_citation" + ], + "x-stainless-const": true + }, + "text": { + "description": "The text in the message content that needs to be replaced.", + "type": "string" + }, + "file_citation": { + "type": "object", + "properties": { + "file_id": { + "description": "The ID of the specific File the citation is from.", + "type": "string" + } + }, + "required": [ + "file_id" + ] + }, + "start_index": { + "type": "integer", + "minimum": 0 + }, + "end_index": { + "type": "integer", + "minimum": 0 + } + }, + "required": [ + "type", + "text", + "file_citation", + "start_index", + "end_index" + ] + }, + "MessageContentTextAnnotationsFilePathObject": { + "title": "File path", + "type": "object", + "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.", + "properties": { + "type": { + "description": "Always `file_path`.", + "type": "string", + "enum": [ + "file_path" + ], + "x-stainless-const": true + }, + "text": { + "description": "The text in the message content that needs to be replaced.", + "type": "string" + }, + "file_path": { + "type": "object", + "properties": { + "file_id": { + "description": "The ID of the file that was generated.", + "type": "string" + } + }, + "required": [ + "file_id" + ] + }, + "start_index": { + "type": "integer", + "minimum": 0 + }, + "end_index": { + "type": "integer", + "minimum": 0 + } + }, + "required": [ + "type", + "text", + "file_path", + "start_index", + "end_index" + ] + }, + "MessageContentTextObject": { + "title": "Text", + "type": "object", + "description": "The text content that is part of a message.", + "properties": { + "type": { + "description": "Always `text`.", + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + }, + "text": { + "type": "object", + "properties": { + "value": { + "description": "The data that makes up the text.", + "type": "string" + }, + "annotations": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageContentTextAnnotationsFileCitationObject" + }, + { + "$ref": "#/components/schemas/MessageContentTextAnnotationsFilePathObject" + } + ] + } + } + }, + "required": [ + "value", + "annotations" + ] + } + }, + "required": [ + "type", + "text" + ] + }, + "MessageDeltaContentImageFileObject": { + "title": "Image file", + "type": "object", + "description": "References an image [File](https://developers.openai.com/api/reference/resources/files) in the content of a message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the content part in the message." + }, + "type": { + "description": "Always `image_file`.", + "type": "string", + "enum": [ + "image_file" + ], + "x-stainless-const": true + }, + "image_file": { + "type": "object", + "properties": { + "file_id": { + "description": "The [File](https://developers.openai.com/api/reference/resources/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content.", + "type": "string" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.", + "enum": [ + "auto", + "low", + "high" + ], + "default": "auto" + } + } + } + }, + "required": [ + "index", + "type" + ] + }, + "MessageDeltaContentImageUrlObject": { + "title": "Image URL", + "type": "object", + "description": "References an image URL in the content of a message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the content part in the message." + }, + "type": { + "description": "Always `image_url`.", + "type": "string", + "enum": [ + "image_url" + ], + "x-stainless-const": true + }, + "image_url": { + "type": "object", + "properties": { + "url": { + "description": "The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.", + "type": "string", + "format": "uri" + }, + "detail": { + "type": "string", + "description": "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`.", + "enum": [ + "auto", + "low", + "high" + ], + "default": "auto" + } + } + } + }, + "required": [ + "index", + "type" + ] + }, + "MessageDeltaContentRefusalObject": { + "title": "Refusal", + "type": "object", + "description": "The refusal content that is part of a message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the refusal part in the message." + }, + "type": { + "description": "Always `refusal`.", + "type": "string", + "enum": [ + "refusal" + ], + "x-stainless-const": true + }, + "refusal": { + "type": "string" + } + }, + "required": [ + "index", + "type" + ] + }, + "MessageDeltaContentTextAnnotationsFileCitationObject": { + "title": "File citation", + "type": "object", + "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the annotation in the text content part." + }, + "type": { + "description": "Always `file_citation`.", + "type": "string", + "enum": [ + "file_citation" + ], + "x-stainless-const": true + }, + "text": { + "description": "The text in the message content that needs to be replaced.", + "type": "string" + }, + "file_citation": { + "type": "object", + "properties": { + "file_id": { + "description": "The ID of the specific File the citation is from.", + "type": "string" + }, + "quote": { + "description": "The specific quote in the file.", + "type": "string" + } + } + }, + "start_index": { + "type": "integer", + "minimum": 0 + }, + "end_index": { + "type": "integer", + "minimum": 0 + } + }, + "required": [ + "index", + "type" + ] + }, + "MessageDeltaContentTextAnnotationsFilePathObject": { + "title": "File path", + "type": "object", + "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the annotation in the text content part." + }, + "type": { + "description": "Always `file_path`.", + "type": "string", + "enum": [ + "file_path" + ], + "x-stainless-const": true + }, + "text": { + "description": "The text in the message content that needs to be replaced.", + "type": "string" + }, + "file_path": { + "type": "object", + "properties": { + "file_id": { + "description": "The ID of the file that was generated.", + "type": "string" + } + } + }, + "start_index": { + "type": "integer", + "minimum": 0 + }, + "end_index": { + "type": "integer", + "minimum": 0 + } + }, + "required": [ + "index", + "type" + ] + }, + "MessageDeltaContentTextObject": { + "title": "Text", + "type": "object", + "description": "The text content that is part of a message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the content part in the message." + }, + "type": { + "description": "Always `text`.", + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + }, + "text": { + "type": "object", + "properties": { + "value": { + "description": "The data that makes up the text.", + "type": "string" + }, + "annotations": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject" + }, + { + "$ref": "#/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject" + } + ] + } + } + } + } + }, + "required": [ + "index", + "type" + ] + }, + "MessageDeltaObject": { + "type": "object", + "title": "Message delta object", + "description": "Represents a message delta i.e. any changed fields on a message during streaming.\n", + "properties": { + "id": { + "description": "The identifier of the message, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `thread.message.delta`.", + "type": "string", + "enum": [ + "thread.message.delta" + ], + "x-stainless-const": true + }, + "delta": { + "description": "The delta containing the fields that have changed on the Message.", + "type": "object", + "properties": { + "role": { + "description": "The entity that produced the message. One of `user` or `assistant`.", + "type": "string", + "enum": [ + "user", + "assistant" + ] + }, + "content": { + "description": "The content of the message in array of text and/or images.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageDeltaContentImageFileObject" + }, + { + "$ref": "#/components/schemas/MessageDeltaContentTextObject" + }, + { + "$ref": "#/components/schemas/MessageDeltaContentRefusalObject" + }, + { + "$ref": "#/components/schemas/MessageDeltaContentImageUrlObject" + } + ] + } + } + } + } + }, + "required": [ + "id", + "object", + "delta" + ], + "x-oaiMeta": { + "name": "The message delta object", + "beta": true, + "example": "{\n \"id\": \"msg_123\",\n \"object\": \"thread.message.delta\",\n \"delta\": {\n \"content\": [\n {\n \"index\": 0,\n \"type\": \"text\",\n \"text\": { \"value\": \"Hello\", \"annotations\": [] }\n }\n ]\n }\n}\n" + } + }, + "MessageObject": { + "type": "object", + "title": "The message object", + "description": "Represents a message within a [thread](https://developers.openai.com/api/docs/assistants/migration).", + "properties": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `thread.message`.", + "type": "string", + "enum": [ + "thread.message" + ], + "x-stainless-const": true + }, + "created_at": { + "description": "The Unix timestamp (in seconds) for when the message was created.", + "type": "integer", + "format": "unixtime" + }, + "thread_id": { + "description": "The [thread](https://developers.openai.com/api/docs/assistants/migration) ID that this message belongs to.", + "type": "string" + }, + "status": { + "description": "The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.", + "type": "string", + "enum": [ + "in_progress", + "incomplete", + "completed" + ] + }, + "incomplete_details": { + "anyOf": [ + { + "description": "On an incomplete message, details about why the message is incomplete.", + "type": "object", + "properties": { + "reason": { + "type": "string", + "description": "The reason the message is incomplete.", + "enum": [ + "content_filter", + "max_tokens", + "run_cancelled", + "run_expired", + "run_failed" + ] + } + }, + "required": [ + "reason" + ] + }, + { + "type": "null" + } + ] + }, + "completed_at": { + "anyOf": [ + { + "description": "The Unix timestamp (in seconds) for when the message was completed.", + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ] + }, + "incomplete_at": { + "anyOf": [ + { + "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ] + }, + "role": { + "description": "The entity that produced the message. One of `user` or `assistant`.", + "type": "string", + "enum": [ + "user", + "assistant" + ] + }, + "content": { + "description": "The content of the message in array of text and/or images.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageContentImageFileObject" + }, + { + "$ref": "#/components/schemas/MessageContentImageUrlObject" + }, + { + "$ref": "#/components/schemas/MessageContentTextObject" + }, + { + "$ref": "#/components/schemas/MessageContentRefusalObject" + } + ] + } + }, + "assistant_id": { + "anyOf": [ + { + "description": "If applicable, the ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) that authored this message.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "run_id": { + "anyOf": [ + { + "description": "The ID of the [run](https://developers.openai.com/api/docs/assistants/migration) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "attachments": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "object", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file to attach to the message." + }, + "tools": { + "description": "The tools to add this file to.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearchTypeOnly" + } + ] + } + } + } + }, + "description": "A list of files attached to the message, and the tools they were added to." + }, + { + "type": "null" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + }, + "required": [ + "id", + "object", + "created_at", + "thread_id", + "status", + "incomplete_details", + "completed_at", + "incomplete_at", + "role", + "content", + "assistant_id", + "run_id", + "attachments", + "metadata" + ], + "x-oaiMeta": { + "name": "The message object", + "beta": true, + "example": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1698983503,\n \"thread_id\": \"thread_abc123\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"Hi! How can I help you today?\",\n \"annotations\": []\n }\n }\n ],\n \"assistant_id\": \"asst_abc123\",\n \"run_id\": \"run_abc123\",\n \"attachments\": [],\n \"metadata\": {},\n \"status\": \"completed\",\n \"completed_at\": 1698983503,\n \"incomplete_at\": null,\n \"incomplete_details\": null\n}\n" + } + }, + "MessagePhase": { + "type": "string", + "description": "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`).\nFor models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend\nphase on all assistant messages — dropping it can degrade performance. Not used for user messages.\n", + "enum": [ + "commentary", + "final_answer" + ] + }, + "MessageRequestContentTextObject": { + "title": "Text", + "type": "object", + "description": "The text content that is part of a message.", + "properties": { + "type": { + "description": "Always `text`.", + "type": "string", + "enum": [ + "text" + ], + "x-stainless-const": true + }, + "text": { + "type": "string", + "description": "Text content to be sent to the model" + } + }, + "required": [ + "type", + "text" + ] + }, + "MessageStreamEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.message.created" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) is created.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.message.in_progress" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` state.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.message.delta" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/MessageDeltaObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when parts of a [Message](https://developers.openai.com/api/docs/assistants/migration) are being streamed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message delta](https://developers.openai.com/api/docs/assistants/migration)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.message.completed" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) is completed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.message.incomplete" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/MessageObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) ends before it is completed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)" + } + } + ] + }, + "Metadata": { + "anyOf": [ + { + "type": "object", + "description": "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n", + "additionalProperties": { + "type": "string" + }, + "x-oaiTypeLabel": "map" + }, + { + "type": "null" + } + ] + }, + "Model": { + "title": "Model", + "description": "Describes an OpenAI model offering that can be used with the API.", + "properties": { + "id": { + "type": "string", + "description": "The model identifier, which can be referenced in the API endpoints." + }, + "created": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) when the model was created." + }, + "object": { + "type": "string", + "description": "The object type, which is always \"model\".", + "enum": [ + "model" + ], + "x-stainless-const": true + }, + "owned_by": { + "type": "string", + "description": "The organization that owns the model." + }, + "shutdown_date": { + "anyOf": [ + { + "type": "string", + "format": "date" + }, + { + "type": "null" + } + ], + "description": "The date when the model will shut down, or null if not announced." + } + }, + "required": [ + "id", + "object", + "created", + "owned_by" + ], + "x-oaiMeta": { + "name": "The model object", + "example": "{\n \"id\": \"gpt-6-astra\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\",\n \"shutdown_date\": \"2026-10-23\"\n}\n" + } + }, + "ModelIds": { + "anyOf": [ + { + "$ref": "#/components/schemas/ModelIdsShared" + }, + { + "$ref": "#/components/schemas/ModelIdsResponses" + } + ] + }, + "ModelIdsCompaction": { + "anyOf": [ + { + "$ref": "#/components/schemas/ModelIdsResponses" + }, + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models." + }, + "ModelIdsLive": { + "description": "The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter.", + "example": "gpt-live-1", + "anyOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "type": "string", + "enum": [ + "gpt-live-1" + ] + } + ] + }, + "ModelIdsResponses": { + "example": "gpt-6-astra", + "anyOf": [ + { + "$ref": "#/components/schemas/ModelIdsShared" + }, + { + "type": "string", + "title": "ResponsesOnlyModel", + "enum": [ + "o1-pro", + "o1-pro-2025-03-19", + "o3-pro", + "o3-pro-2025-06-10", + "o3-deep-research", + "o3-deep-research-2025-06-26", + "o4-mini-deep-research", + "o4-mini-deep-research-2025-06-26", + "computer-use-preview", + "computer-use-preview-2025-03-11", + "gpt-5.5-pro", + "gpt-5.5-pro-2026-04-23", + "gpt-5-codex", + "gpt-5-pro", + "gpt-5-pro-2025-10-06", + "gpt-5.1-codex-max", + "gpt-daybreak-blue-latest", + "gpt-daybreak-red-latest", + "gpt-5.6-cyber", + "gpt-rosalind-research" + ], + "x-openai-enum-deprecations": { + "o1-pro": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-pro-2025-03-19": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-pro-2025-06-10": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-deep-research": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-deep-research-2025-06-26": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o4-mini-deep-research": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o4-mini-deep-research-2025-06-26": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "computer-use-preview": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "computer-use-preview-2025-03-11": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-codex": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-pro-2025-10-06": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-codex-max": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-pro": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-pro": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } + } + ] + }, + "ModelIdsShared": { + "example": "gpt-6-astra", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-6-astra", + "gpt-6.1-sol", + "gpt-6.1-terra", + "gpt-6-sol", + "gpt-6-luna", + "gpt-5.6-sol", + "gpt-5.6-terra", + "gpt-5.6-luna", + "gpt-5.5", + "gpt-5.5-2026-04-23", + "gpt-5.4", + "gpt-5.4-mini", + "gpt-5.4-nano", + "gpt-5.4-mini-2026-03-17", + "gpt-5.4-nano-2026-03-17", + "gpt-5.3-chat-latest", + "gpt-5.2", + "gpt-5.2-2025-12-11", + "gpt-5.2-chat-latest", + "gpt-5.2-pro", + "gpt-5.2-pro-2025-12-11", + "gpt-5.1", + "gpt-5.1-2025-11-13", + "gpt-5.1-codex", + "gpt-5.1-mini", + "gpt-5.1-chat-latest", + "gpt-5", + "gpt-5-mini", + "gpt-5-nano", + "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", + "gpt-5-nano-2025-08-07", + "gpt-5-chat-latest", + "gpt-4.1", + "gpt-4.1-mini", + "gpt-4.1-nano", + "gpt-4.1-2025-04-14", + "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", + "o4-mini", + "o4-mini-2025-04-16", + "o3", + "o3-2025-04-16", + "o3-mini", + "o3-mini-2025-01-31", + "o1", + "o1-2024-12-17", + "o1-preview", + "o1-preview-2024-09-12", + "o1-mini", + "o1-mini-2024-09-12", + "gpt-4o", + "gpt-4o-2024-11-20", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-audio-mini", + "gpt-audio-mini-2025-12-15", + "gpt-4o-audio-preview", + "gpt-4o-audio-preview-2024-10-01", + "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", + "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", + "gpt-4o-search-preview", + "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", + "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", + "codex-mini-latest", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613" + ], + "x-openai-enum-deprecations": { + "gpt-5.4-nano": { + "message": "Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1": { + "message": "Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-2025-11-13": { + "message": "Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.4-nano-2026-03-17": { + "message": "Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-2025-04-14": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-mini": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-mini-2025-04-14": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-2024-08-06": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-2024-11-20": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-2024-07-18": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.3-chat-latest": { + "message": "Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.2-chat-latest": { + "message": "Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-codex": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-chat-latest": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-mini-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-nano-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-chat-latest": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-nano": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-nano-2025-04-14": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o4-mini": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o4-mini-2025-04-16": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-2025-04-16": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-mini": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-mini-2025-01-31": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-2024-12-17": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-2024-05-13": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-search-preview-2025-03-11": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-search-preview-2025-03-11": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-turbo": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-turbo-2024-04-09": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-0125-preview": { + "message": "Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-turbo-preview": { + "message": "Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-1106-preview": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-0314": { + "message": "Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-0613": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-1106": { + "message": "Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-0125": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-0301": { + "message": "Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-0613": { + "message": "Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-16k": { + "message": "Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-16k-0613": { + "message": "Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-vision-preview": { + "message": "Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-32k": { + "message": "Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-32k-0314": { + "message": "Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-32k-0613": { + "message": "Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-preview": { + "message": "Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-preview-2024-09-12": { + "message": "Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-audio-preview-2024-10-01": { + "message": "Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-mini": { + "message": "Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-mini-2024-09-12": { + "message": "Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "codex-mini-latest": { + "message": "Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "chatgpt-4o-latest": { + "message": "Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-audio-preview": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-audio-preview": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-audio-preview-2024-12-17": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-audio-preview-2025-06-03": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-audio-preview-2024-12-17": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-search-preview": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-search-preview": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-mini": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-nano": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini-2025-12-15": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-mini": { + "message": "Not a supported model ID. Retained for SDK compatibility." + } + } + } + ] + }, + "ModelResponseProperties": { + "type": "object", + "properties": { + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "top_logprobs": { + "anyOf": [ + { + "description": "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n", + "type": "integer", + "minimum": 0, + "maximum": 20 + }, + { + "type": "null" + } + ] + }, + "temperature": { + "anyOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n" + }, + { + "type": "null" + } + ] + }, + "top_p": { + "anyOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" + }, + { + "type": "null" + } + ] + }, + "user": { + "type": [ + "string", + "null" + ], + "example": "user-1234", + "deprecated": true, + "description": "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" + }, + "safety_identifier": { + "anyOf": [ + { + "type": "string", + "maxLength": 128, + "example": "safety-identifier-1234", + "description": "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" + }, + { + "type": "null" + } + ] + }, + "prompt_cache_key": { + "anyOf": [ + { + "type": "string", + "example": "prompt-cache-key-1234", + "description": "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching).\n" + }, + { + "type": "null" + } + ] + }, + "prompt_cache_retention": { + "deprecated": true, + "anyOf": [ + { + "type": "string", + "enum": [ + "in_memory", + "24h" + ], + "description": "Deprecated. Use `prompt_cache_options.ttl` instead.\n\nThe retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention).\nThis field expresses a maximum retention policy, while\n`prompt_cache_options.ttl` expresses a minimum cache lifetime. The two\nfields are independent and do not interact.\nFor `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.\n\nFor older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:\n - Organizations without ZDR enabled default to `24h`.\n - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.\n" + }, + { + "type": "null" + } + ] + } + } + }, + "ModifyAssistantRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "model": { + "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/AssistantSupportedModels" + } + ] + }, + "reasoning_effort": { + "$ref": "#/components/schemas/ReasoningEffort" + }, + "name": { + "anyOf": [ + { + "description": "The name of the assistant. The maximum length is 256 characters.\n", + "type": "string", + "maxLength": 256 + }, + { + "type": "null" + } + ] + }, + "description": { + "anyOf": [ + { + "description": "The description of the assistant. The maximum length is 512 characters.\n", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, + "instructions": { + "anyOf": [ + { + "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", + "type": "string", + "maxLength": 256000 + }, + { + "type": "null" + } + ] + }, + "tools": { + "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", + "default": [], + "type": "array", + "maxItems": 128, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ] + } + }, + "tool_resources": { + "anyOf": [ + { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "Overrides the list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "Overrides the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + } + }, + { + "type": "null" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "temperature": { + "anyOf": [ + { + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1 + }, + { + "type": "null" + } + ] + }, + "top_p": { + "anyOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + }, + { + "type": "null" + } + ] + }, + "response_format": { + "anyOf": [ + { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption" + }, + { + "type": "null" + } + ] + } + } + }, + "ModifyCertificateRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The updated name for the certificate" + } + } + }, + "ModifyMessageRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + } + }, + "ModifyRunRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + } + }, + "ModifyThreadRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "tool_resources": { + "anyOf": [ + { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + } + }, + { + "type": "null" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + } + }, + "NoiseReductionType": { + "type": "string", + "enum": [ + "near_field", + "far_field" + ], + "description": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n" + }, + "OpenAIFile": { + "title": "OpenAIFile", + "description": "The `File` object represents a document that has been uploaded to OpenAI.", + "properties": { + "id": { + "type": "string", + "description": "The file identifier, which can be referenced in the API endpoints." + }, + "bytes": { + "type": [ + "integer", + "null" + ], + "description": "The size of the file, in bytes. In a completed file upload response, this can\nbe null when the file size is not yet available.\n" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the file was created." + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the file will expire. In a\ncompleted file upload response, this can be null when no expiry is set.\n" + }, + "filename": { + "type": "string", + "description": "The name of the file." + }, + "object": { + "type": "string", + "description": "The object type, which is always `file`.", + "enum": [ + "file" + ], + "x-stainless-const": true + }, + "purpose": { + "type": "string", + "description": "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.", + "enum": [ + "assistants", + "assistants_output", + "batch", + "batch_output", + "fine-tune", + "fine-tune-results", + "vision", + "user_data" + ] + }, + "status": { + "type": "string", + "deprecated": true, + "description": "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.", + "enum": [ + "uploaded", + "processed", + "error" + ] + }, + "status_details": { + "type": "string", + "deprecated": true, + "description": "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. Completed file upload responses can return null when these details are unset." + } + }, + "required": [ + "id", + "object", + "bytes", + "created_at", + "filename", + "purpose", + "status" + ], + "x-oaiMeta": { + "name": "The file object", + "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1680202602,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n \"status\": \"processed\"\n}\n" + } + }, + "OrganizationCertificate": { + "type": "object", + "description": "Represents an individual certificate configured at the organization level.", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.certificate" + ], + "description": "The object type, which is always `organization.certificate`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The name of the certificate." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the certificate was uploaded." + }, + "certificate_details": { + "type": "object", + "properties": { + "valid_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the certificate becomes valid." + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the certificate expires." + } + } + }, + "active": { + "type": "boolean", + "description": "Whether the certificate is currently active at the organization level." + } + }, + "required": [ + "object", + "id", + "name", + "created_at", + "certificate_details", + "active" + ] + }, + "OrganizationCertificateActivationResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.certificate.activation" + ], + "description": "The organization certificate activation result type.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrganizationCertificate" + } + } + }, + "required": [ + "object", + "data" + ] + }, + "OrganizationCertificateDeactivationResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.certificate.deactivation" + ], + "description": "The organization certificate deactivation result type.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrganizationCertificate" + } + } + }, + "required": [ + "object", + "data" + ] + }, + "OrganizationDataRetention": { + "type": "object", + "description": "Represents the organization's data retention control setting.", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.data_retention" + ], + "description": "The object type, which is always `organization.data_retention`.", + "x-stainless-const": true + }, + "type": { + "type": "string", + "enum": [ + "zero_data_retention", + "modified_abuse_monitoring", + "enhanced_zero_data_retention", + "enhanced_modified_abuse_monitoring" + ], + "description": "The configured organization data retention type." + } + }, + "required": [ + "object", + "type" + ], + "x-oaiMeta": { + "name": "The organization data retention object", + "example": "{\n \"object\": \"organization.data_retention\",\n \"type\": \"modified_abuse_monitoring\"\n}\n" + } + }, + "OrganizationProjectCertificate": { + "type": "object", + "description": "Represents an individual certificate configured at the project level.", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.certificate" + ], + "description": "The object type, which is always `organization.project.certificate`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The name of the certificate." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the certificate was uploaded." + }, + "certificate_details": { + "type": "object", + "properties": { + "valid_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the certificate becomes valid." + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the certificate expires." + } + } + }, + "active": { + "type": "boolean", + "description": "Whether the certificate is currently active at the project level." + } + }, + "required": [ + "object", + "id", + "name", + "created_at", + "certificate_details", + "active" + ] + }, + "OrganizationProjectCertificateActivationResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.certificate.activation" + ], + "description": "The project certificate activation result type.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrganizationProjectCertificate" + } + } + }, + "required": [ + "object", + "data" + ] + }, + "OrganizationProjectCertificateDeactivationResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.certificate.deactivation" + ], + "description": "The project certificate deactivation result type.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrganizationProjectCertificate" + } + } + }, + "required": [ + "object", + "data" + ] + }, + "OrganizationSpendAlert": { + "type": "object", + "description": "Represents a spend alert configured at the organization level.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "enum": [ + "organization.spend_alert" + ], + "description": "The object type, which is always `organization.spend_alert`.", + "x-stainless-const": true + }, + "threshold_amount": { + "type": "integer", + "description": "The alert threshold amount, in cents." + }, + "currency": { + "type": "string", + "enum": [ + "USD" + ], + "description": "The currency for the threshold amount." + }, + "interval": { + "type": "string", + "enum": [ + "month" + ], + "description": "The time interval for evaluating spend against the threshold." + }, + "notification_channel": { + "$ref": "#/components/schemas/SpendAlertNotificationChannel" + } + }, + "required": [ + "id", + "object", + "threshold_amount", + "currency", + "interval", + "notification_channel" + ], + "x-oaiMeta": { + "name": "The organization spend alert object", + "example": "{\n \"id\": \"alert_abc123\",\n \"object\": \"organization.spend_alert\",\n \"threshold_amount\": 100000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"notification_channel\": {\n \"type\": \"email\",\n \"recipients\": [\"finance@example.com\"],\n \"subject_prefix\": \"OpenAI spend alert\"\n }\n}\n" + } + }, + "OrganizationSpendAlertDeletedResource": { + "type": "object", + "description": "Confirmation payload returned after deleting an organization spend alert.", + "properties": { + "id": { + "type": "string", + "description": "The deleted spend alert ID." + }, + "object": { + "type": "string", + "enum": [ + "organization.spend_alert.deleted" + ], + "description": "Always `organization.spend_alert.deleted`.", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean", + "description": "Whether the spend alert was deleted." + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "OrganizationSpendAlertListResource": { + "type": "object", + "description": "Paginated list of organization spend alerts.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "Always `list`.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "description": "Spend alerts returned in the current page.", + "items": { + "$ref": "#/components/schemas/OrganizationSpendAlert" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The ID of the first spend alert in this page." + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The ID of the last spend alert in this page." + }, + "has_more": { + "type": "boolean", + "description": "Whether more spend alerts are available when paginating." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "OtherChunkingStrategyResponseParam": { + "type": "object", + "title": "Other Chunking Strategy", + "description": "This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `other`.", + "enum": [ + "other" + ], + "x-stainless-const": true + } + }, + "required": [ + "type" + ] + }, + "OutputAudio": { + "type": "object", + "title": "Output audio", + "description": "An audio output from the model.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the output audio. Always `output_audio`.\n", + "enum": [ + "output_audio" + ], + "x-stainless-const": true + }, + "data": { + "type": "string", + "description": "Base64-encoded audio data from the model.\n" + }, + "transcript": { + "type": "string", + "description": "The transcript of the audio data from the model.\n" + } + }, + "required": [ + "type", + "data", + "transcript" + ] + }, + "OutputContent": { + "oneOf": [ + { + "$ref": "#/components/schemas/OutputTextContent" + }, + { + "$ref": "#/components/schemas/RefusalContent" + }, + { + "$ref": "#/components/schemas/ReasoningTextContent" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "OutputItem": { + "oneOf": [ + { + "$ref": "#/components/schemas/OutputMessage" + }, + { + "$ref": "#/components/schemas/FileSearchToolCall" + }, + { + "$ref": "#/components/schemas/FunctionToolCall" + }, + { + "$ref": "#/components/schemas/FunctionToolCallOutputResource" + }, + { + "$ref": "#/components/schemas/WebSearchToolCall" + }, + { + "$ref": "#/components/schemas/ComputerToolCall" + }, + { + "$ref": "#/components/schemas/ComputerToolCallOutputResource" + }, + { + "$ref": "#/components/schemas/ReasoningItem" + }, + { + "$ref": "#/components/schemas/Program" + }, + { + "$ref": "#/components/schemas/ProgramOutput" + }, + { + "$ref": "#/components/schemas/ToolSearchCall" + }, + { + "$ref": "#/components/schemas/ToolSearchOutput" + }, + { + "$ref": "#/components/schemas/AdditionalTools" + }, + { + "$ref": "#/components/schemas/CompactionBody" + }, + { + "$ref": "#/components/schemas/ImageGenToolCall" + }, + { + "$ref": "#/components/schemas/CodeInterpreterToolCall" + }, + { + "$ref": "#/components/schemas/LocalShellToolCall" + }, + { + "$ref": "#/components/schemas/LocalShellToolCallOutput" + }, + { + "$ref": "#/components/schemas/FunctionShellCall" + }, + { + "$ref": "#/components/schemas/FunctionShellCallOutput" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolCall" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolCallOutput" + }, + { + "$ref": "#/components/schemas/MCPToolCall" + }, + { + "$ref": "#/components/schemas/MCPListTools" + }, + { + "$ref": "#/components/schemas/MCPApprovalRequest" + }, + { + "$ref": "#/components/schemas/MCPApprovalResponseResource" + }, + { + "$ref": "#/components/schemas/CustomToolCall" + }, + { + "$ref": "#/components/schemas/CustomToolCallOutputResource" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "OutputMessage": { + "type": "object", + "title": "Output message", + "description": "An output message from the model.\n", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the output message.\n" + }, + "type": { + "type": "string", + "description": "The type of the output message. Always `message`.\n", + "enum": [ + "message" + ], + "x-stainless-const": true + }, + "role": { + "type": "string", + "description": "The role of the output message. Always `assistant`.\n", + "enum": [ + "assistant" + ], + "x-stainless-const": true + }, + "content": { + "type": "array", + "description": "The content of the output message.\n", + "items": { + "$ref": "#/components/schemas/OutputMessageContent" + } + }, + "phase": { + "anyOf": [ + { + "$ref": "#/components/schemas/MessagePhase" + }, + { + "type": "null" + } + ] + }, + "status": { + "type": "string", + "description": "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + } + }, + "required": [ + "id", + "type", + "role", + "content", + "status" + ] + }, + "OutputMessageContent": { + "oneOf": [ + { + "$ref": "#/components/schemas/OutputTextContent" + }, + { + "$ref": "#/components/schemas/RefusalContent" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "ParallelToolCalls": { + "description": "Whether to enable [parallel function calling](https://developers.openai.com/api/docs/guides/function-calling#parallel-function-calling) during tool use.", + "type": "boolean", + "default": true + }, + "PartialImages": { + "anyOf": [ + { + "type": "integer", + "maximum": 3, + "minimum": 0, + "default": 0, + "example": 1, + "description": "The number of partial images to generate. This parameter is used for\nstreaming responses that return partial images. Value must be between 0 and 3.\nWhen set to 0, the response will be a single image sent in one streaming event.\n\nNote that the final image may be sent before the full number of partial images\nare generated if the full image is generated more quickly.\n" + }, + { + "type": "null" + } + ] + }, + "PermissionErrorResponse": { + "type": "object", + "properties": { + "error": { + "description": "Details about the permission error.", + "anyOf": [ + { + "$ref": "#/components/schemas/Error" + }, + { + "type": "string", + "description": "An explanation of the missing API permissions." + } + ] + } + }, + "required": [ + "error" + ] + }, + "PredictionContent": { + "type": "object", + "title": "Static Content", + "description": "Static predicted output content, such as the content of a text file that is\nbeing regenerated.\n", + "required": [ + "type", + "content" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "content" + ], + "description": "The type of the predicted content you want to provide. This type is\ncurrently always `content`.\n", + "x-stainless-const": true + }, + "content": { + "description": "The content that should be matched when generating a model response.\nIf generated tokens would match this content, the entire model response\ncan be returned much more quickly.\n", + "oneOf": [ + { + "type": "string", + "title": "Text content", + "description": "The content used for a Predicted Output. This is often the\ntext of a file you are regenerating with minor changes.\n" + }, + { + "type": "array", + "description": "An array of content parts with a defined type. Supported options differ based on the [model](https://developers.openai.com/api/docs/models) being used to generate the response. Can contain text inputs.", + "title": "Array of content parts", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" + }, + "minItems": 1 + } + ] + } + } + }, + "Project": { + "type": "object", + "description": "Represents an individual project.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "object": { + "type": "string", + "enum": [ + "organization.project" + ], + "description": "The object type, which is always `organization.project`", + "x-stainless-const": true + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The name of the project. This appears in reporting." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the project was created." + }, + "archived_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the project was archived or `null`." + }, + { + "type": "null" + } + ] + }, + "status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "`active` or `archived`" + }, + "external_key_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The external key associated with the project." + }, + "residency": { + "$ref": "#/components/schemas/PublicProjectResidency", + "description": "The residency configuration for the project." + } + }, + "required": [ + "id", + "object", + "created_at" + ], + "x-oaiMeta": { + "name": "The project object", + "example": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project example\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\",\n \"external_key_id\": null\n}\n" + } + }, + "ProjectApiKey": { + "type": "object", + "description": "Represents an individual API key in a project.", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.api_key" + ], + "description": "The object type, which is always `organization.project.api_key`", + "x-stainless-const": true + }, + "redacted_value": { + "type": "string", + "description": "The redacted value of the API key" + }, + "name": { + "type": "string", + "description": "The name of the API key" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the API key was created" + }, + "expires_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ], + "description": "The Unix timestamp (in seconds) when the API key expires, or null if it does not expire." + }, + "last_used_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ], + "description": "The Unix timestamp (in seconds) of when the API key was last used." + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "owner_project_access": { + "type": "string", + "enum": [ + "active", + "inactive" + ], + "description": "Whether the API key's owner currently has effective access to the project." + }, + "owner": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "user", + "service_account" + ], + "description": "`user` or `service_account`" + }, + "user": { + "$ref": "#/components/schemas/ProjectApiKeyOwnerUser" + }, + "service_account": { + "$ref": "#/components/schemas/ProjectApiKeyOwnerServiceAccount" + } + } + } + }, + "required": [ + "object", + "redacted_value", + "name", + "created_at", + "last_used_at", + "id", + "owner_project_access", + "owner" + ], + "x-oaiMeta": { + "name": "The project API key object", + "example": "{\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"expires_at\": 1714063533,\n \"last_used_at\": 1711471534,\n \"id\": \"key_abc\",\n \"owner_project_access\": \"active\",\n \"owner\": {\n \"type\": \"user\",\n \"user\": {\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n }\n }\n}\n" + } + }, + "ProjectApiKeyDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.api_key.deleted" + ], + "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": [ + "object", + "id", + "deleted" + ] + }, + "ProjectApiKeyListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProjectApiKey" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ProjectApiKeyOwnerServiceAccount": { + "type": "object", + "description": "The service account that owns a project API key.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "type": "string", + "description": "The name of the service account." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the service account was created." + }, + "role": { + "type": "string", + "description": "The service account's project role." + } + }, + "required": [ + "id", + "name", + "created_at", + "role" + ] + }, + "ProjectApiKeyOwnerUser": { + "type": "object", + "description": "The user that owns a project API key.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "email": { + "type": "string", + "description": "The email address of the user." + }, + "name": { + "type": "string", + "description": "The name of the user." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the user was created." + }, + "role": { + "type": "string", + "description": "The user's project role." + } + }, + "required": [ + "id", + "email", + "name", + "created_at", + "role" + ] + }, + "ProjectCreateRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The friendly name of the project, this name appears in reports." + }, + "geography": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "deprecated": true, + "description": "Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field.\nDeprecated: use `residency` instead. Do not provide both `geography` and `residency`." + }, + "residency": { + "anyOf": [ + { + "$ref": "#/components/schemas/PublicProjectResidency" + }, + { + "type": "null" + } + ], + "description": "Create the project with the specified residency configuration. Your organization must have access to the requested residency configuration in order to use it. See [data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field." + }, + "external_key_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "External key ID to associate with the project." + } + }, + "required": [ + "name" + ] + }, + "ProjectDataRetention": { + "type": "object", + "description": "Represents a project's data retention control setting.", + "properties": { + "object": { + "type": "string", + "enum": [ + "project.data_retention" + ], + "description": "The object type, which is always `project.data_retention`.", + "x-stainless-const": true + }, + "type": { + "type": "string", + "enum": [ + "organization_default", + "none", + "zero_data_retention", + "modified_abuse_monitoring", + "enhanced_zero_data_retention", + "enhanced_modified_abuse_monitoring" + ], + "description": "The configured project data retention type." + } + }, + "required": [ + "object", + "type" + ], + "x-oaiMeta": { + "name": "The project data retention object", + "example": "{\n \"object\": \"project.data_retention\",\n \"type\": \"organization_default\"\n}\n" + } + }, + "ProjectGroup": { + "type": "object", + "description": "Details about a group's membership in a project.", + "properties": { + "object": { + "type": "string", + "enum": [ + "project.group" + ], + "description": "Always `project.group`.", + "x-stainless-const": true + }, + "project_id": { + "type": "string", + "description": "Identifier of the project." + }, + "group_id": { + "type": "string", + "description": "Identifier of the group that has access to the project." + }, + "group_name": { + "type": "string", + "description": "Display name of the group." + }, + "group_type": { + "type": "string", + "enum": [ + "group", + "tenant_group" + ], + "description": "The type of the group." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the group was granted project access." + } + }, + "required": [ + "object", + "project_id", + "group_id", + "group_name", + "group_type", + "created_at" + ], + "x-oaiMeta": { + "name": "The project group object", + "example": "{\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"group_type\": \"group\",\n \"created_at\": 1711471533\n}\n" + } + }, + "ProjectGroupDeletedResource": { + "type": "object", + "description": "Confirmation payload returned after removing a group from a project.", + "properties": { + "object": { + "type": "string", + "enum": [ + "project.group.deleted" + ], + "description": "Always `project.group.deleted`.", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean", + "description": "Whether the group membership in the project was removed." + } + }, + "required": [ + "object", + "deleted" + ], + "x-oaiMeta": { + "name": "Project group deletion confirmation", + "example": "{\n \"object\": \"project.group.deleted\",\n \"deleted\": true\n}\n" + } + }, + "ProjectGroupListResource": { + "type": "object", + "description": "Paginated list of groups that have access to a project.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "Always `list`.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "description": "Project group memberships returned in the current page.", + "items": { + "$ref": "#/components/schemas/ProjectGroup" + } + }, + "has_more": { + "type": "boolean", + "description": "Whether additional project group memberships are available." + }, + "next": { + "description": "Cursor to fetch the next page of results, or `null` when there are no more results.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "object", + "data", + "has_more", + "next" + ], + "x-oaiMeta": { + "name": "Project group list", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"group_type\": \"group\",\n \"created_at\": 1711471533\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + } + }, + "ProjectHostedToolPermissions": { + "type": "object", + "description": "Represents hosted tool permissions for a project.", + "properties": { + "file_search": { + "$ref": "#/components/schemas/HostedToolPermission" + }, + "web_search": { + "$ref": "#/components/schemas/HostedToolPermission" + }, + "image_generation": { + "$ref": "#/components/schemas/HostedToolPermission" + }, + "mcp": { + "$ref": "#/components/schemas/HostedToolPermission" + }, + "code_interpreter": { + "$ref": "#/components/schemas/HostedToolPermission" + } + }, + "required": [ + "file_search", + "web_search", + "image_generation", + "mcp", + "code_interpreter" + ], + "x-oaiMeta": { + "name": "The project hosted tool permissions object", + "example": "{\n \"file_search\": {\n \"enabled\": true\n },\n \"web_search\": {\n \"enabled\": true\n },\n \"image_generation\": {\n \"enabled\": true\n },\n \"mcp\": {\n \"enabled\": true\n },\n \"code_interpreter\": {\n \"enabled\": true\n }\n}\n" + } + }, + "ProjectHostedToolPermissionsUpdateRequest": { + "type": "object", + "properties": { + "file_search": { + "anyOf": [ + { + "$ref": "#/components/schemas/HostedToolPermissionUpdate" + }, + { + "type": "null" + } + ], + "description": "The file search permission update." + }, + "web_search": { + "anyOf": [ + { + "$ref": "#/components/schemas/HostedToolPermissionUpdate" + }, + { + "type": "null" + } + ], + "description": "The web search permission update." + }, + "image_generation": { + "anyOf": [ + { + "$ref": "#/components/schemas/HostedToolPermissionUpdate" + }, + { + "type": "null" + } + ], + "description": "The image generation permission update." + }, + "mcp": { + "anyOf": [ + { + "$ref": "#/components/schemas/HostedToolPermissionUpdate" + }, + { + "type": "null" + } + ], + "description": "The MCP permission update." + }, + "code_interpreter": { + "anyOf": [ + { + "$ref": "#/components/schemas/HostedToolPermissionUpdate" + }, + { + "type": "null" + } + ], + "description": "The code interpreter permission update." + } + } + }, + "ProjectListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Project" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ProjectModelPermissions": { + "type": "object", + "description": "Represents the model allowlist or denylist policy for a project.", + "properties": { + "object": { + "type": "string", + "enum": [ + "project.model_permissions" + ], + "description": "The object type, which is always `project.model_permissions`.", + "x-stainless-const": true + }, + "mode": { + "type": "string", + "enum": [ + "allow_list", + "deny_list" + ], + "description": "Whether the project uses an allowlist or a denylist." + }, + "model_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The model IDs included in the model permissions policy." + } + }, + "required": [ + "object", + "mode", + "model_ids" + ], + "x-oaiMeta": { + "name": "The project model permissions object", + "example": "{\n \"object\": \"project.model_permissions\",\n \"mode\": \"allow_list\",\n \"model_ids\": [\n \"gpt-6-astra\",\n \"o3\"\n ]\n}\n" + } + }, + "ProjectModelPermissionsDeleteResponse": { + "type": "object", + "description": "Confirmation payload returned after deleting project model permissions.", + "properties": { + "object": { + "type": "string", + "enum": [ + "project.model_permissions.deleted" + ], + "description": "The object type, which is always `project.model_permissions.deleted`.", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean", + "description": "Whether the project model permissions were deleted." + } + }, + "required": [ + "object", + "deleted" + ], + "x-oaiMeta": { + "name": "Project model permissions deletion confirmation", + "example": "{\n \"object\": \"project.model_permissions.deleted\",\n \"deleted\": true\n}\n" + } + }, + "ProjectModelPermissionsUpdateRequest": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "allow_list", + "deny_list" + ], + "description": "The model permissions mode to apply." + }, + "model_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The model IDs included in this permissions policy." + } + }, + "required": [ + "mode", + "model_ids" + ] + }, + "ProjectRateLimit": { + "type": "object", + "description": "Represents a project rate limit config.", + "properties": { + "object": { + "type": "string", + "enum": [ + "project.rate_limit" + ], + "description": "The object type, which is always `project.rate_limit`", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "model": { + "type": "string", + "description": "The model this rate limit applies to." + }, + "max_requests_per_1_minute": { + "type": "integer", + "description": "The maximum requests per minute." + }, + "max_tokens_per_1_minute": { + "type": "integer", + "description": "The maximum tokens per minute." + }, + "max_images_per_1_minute": { + "type": "integer", + "description": "The maximum images per minute. Only present for relevant models." + }, + "max_audio_megabytes_per_1_minute": { + "type": "integer", + "description": "The maximum audio megabytes per minute. Only present for relevant models." + }, + "max_requests_per_1_day": { + "type": "integer", + "description": "The maximum requests per day. Only present for relevant models." + }, + "batch_1_day_max_input_tokens": { + "type": "integer", + "description": "The maximum batch input tokens per day. Only present for relevant models." + } + }, + "required": [ + "object", + "id", + "model", + "max_requests_per_1_minute", + "max_tokens_per_1_minute" + ], + "x-oaiMeta": { + "name": "The project rate limit object", + "example": "{\n \"object\": \"project.rate_limit\",\n \"id\": \"rl_ada\",\n \"model\": \"ada\",\n \"max_requests_per_1_minute\": 600,\n \"max_tokens_per_1_minute\": 150000,\n \"max_images_per_1_minute\": 10\n}\n" + } + }, + "ProjectRateLimitListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProjectRateLimit" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ProjectRateLimitUpdateRequest": { + "type": "object", + "properties": { + "max_requests_per_1_minute": { + "type": "integer", + "description": "The maximum requests per minute." + }, + "max_tokens_per_1_minute": { + "type": "integer", + "description": "The maximum tokens per minute." + }, + "max_images_per_1_minute": { + "type": "integer", + "description": "The maximum images per minute. Only relevant for certain models." + }, + "max_audio_megabytes_per_1_minute": { + "type": "integer", + "description": "The maximum audio megabytes per minute. Only relevant for certain models." + }, + "max_requests_per_1_day": { + "type": "integer", + "description": "The maximum requests per day. Only relevant for certain models." + }, + "batch_1_day_max_input_tokens": { + "type": "integer", + "description": "The maximum batch input tokens per day. Only relevant for certain models." + } + } + }, + "ProjectServiceAccount": { + "type": "object", + "description": "Represents an individual service account in a project.", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.service_account" + ], + "description": "The object type, which is always `organization.project.service_account`", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "type": "string", + "description": "The name of the service account" + }, + "role": { + "type": "string", + "enum": [ + "owner", + "member", + "none" + ], + "description": "`owner`, `member`, or `none`" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the service account was created" + } + }, + "required": [ + "object", + "id", + "name", + "role", + "created_at" + ], + "x-oaiMeta": { + "name": "The project service account object", + "example": "{\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n}\n" + } + }, + "ProjectServiceAccountApiKey": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.service_account.api_key" + ], + "description": "The object type, which is always `organization.project.service_account.api_key`", + "x-stainless-const": true + }, + "value": { + "type": "string" + }, + "name": { + "type": "string" + }, + "created_at": { + "type": "integer", + "format": "unixtime" + }, + "expires_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ], + "description": "The Unix timestamp (in seconds) when the API key expires, or null if it does not expire." + }, + "id": { + "type": "string" + } + }, + "required": [ + "object", + "value", + "name", + "created_at", + "id" + ] + }, + "ProjectServiceAccountCreateRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the service account being created." + }, + "create_service_account_only": { + "anyOf": [ + { + "type": "boolean", + "description": "Create the service account without default roles or an API key." + }, + { + "type": "null" + } + ] + }, + "expires_in_seconds": { + "anyOf": [ + { + "type": "integer", + "minimum": 1, + "maximum": 31536000 + }, + { + "type": "null" + } + ], + "description": "Number of seconds until the initial API key expires. If omitted or null, the key does not expire unless the effective organization or project policy requires an expiration. When a policy sets a maximum lifetime, this value must be provided and must not exceed that limit. A non-null value cannot be used when `create_service_account_only` is true." + } + }, + "required": [ + "name" + ] + }, + "ProjectServiceAccountCreateResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.service_account" + ], + "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "member", + "none" + ], + "description": "Service accounts created with default project membership have role `member`. Accounts created with `create_service_account_only` have role `none`.\n" + }, + "created_at": { + "type": "integer", + "format": "unixtime" + }, + "api_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ProjectServiceAccountApiKey" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "object", + "id", + "name", + "role", + "created_at", + "api_key" + ] + }, + "ProjectServiceAccountDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.service_account.deleted" + ], + "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": [ + "object", + "id", + "deleted" + ] + }, + "ProjectServiceAccountListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProjectServiceAccount" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ProjectSpendAlert": { + "type": "object", + "description": "Represents a spend alert configured at the project level.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "enum": [ + "project.spend_alert" + ], + "description": "The object type, which is always `project.spend_alert`.", + "x-stainless-const": true + }, + "threshold_amount": { + "type": "integer", + "description": "The alert threshold amount, in cents." + }, + "currency": { + "type": "string", + "enum": [ + "USD" + ], + "description": "The currency for the threshold amount." + }, + "interval": { + "type": "string", + "enum": [ + "month" + ], + "description": "The time interval for evaluating spend against the threshold." + }, + "notification_channel": { + "$ref": "#/components/schemas/SpendAlertNotificationChannel" + } + }, + "required": [ + "id", + "object", + "threshold_amount", + "currency", + "interval", + "notification_channel" + ], + "x-oaiMeta": { + "name": "The project spend alert object", + "example": "{\n \"id\": \"alert_abc123\",\n \"object\": \"project.spend_alert\",\n \"threshold_amount\": 100000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"notification_channel\": {\n \"type\": \"email\",\n \"recipients\": [\"finance@example.com\"],\n \"subject_prefix\": \"OpenAI spend alert\"\n }\n}\n" + } + }, + "ProjectSpendAlertDeletedResource": { + "type": "object", + "description": "Confirmation payload returned after deleting a project spend alert.", + "properties": { + "id": { + "type": "string", + "description": "The deleted spend alert ID." + }, + "object": { + "type": "string", + "enum": [ + "project.spend_alert.deleted" + ], + "description": "Always `project.spend_alert.deleted`.", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean", + "description": "Whether the spend alert was deleted." + } + }, + "required": [ + "id", + "object", + "deleted" + ] + }, + "ProjectSpendAlertListResource": { + "type": "object", + "description": "Paginated list of project spend alerts.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "Always `list`.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "description": "Spend alerts returned in the current page.", + "items": { + "$ref": "#/components/schemas/ProjectSpendAlert" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The ID of the first spend alert in this page." + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The ID of the last spend alert in this page." + }, + "has_more": { + "type": "boolean", + "description": "Whether more spend alerts are available when paginating." + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "ProjectUpdateRequest": { + "type": "object", + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The updated name of the project, this name appears in reports." + }, + "external_key_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "External key ID to associate with the project." + }, + "geography": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "deprecated": true, + "description": "Geography for the project.\nDeprecated: use `residency` when creating a project to configure data residency. This field is retained for backward compatibility." + } + } + }, + "ProjectUser": { + "type": "object", + "description": "Represents an individual user in a project.", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.user" + ], + "description": "The object type, which is always `organization.project.user`", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The name of the user" + }, + "email": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The email address of the user" + }, + "role": { + "type": "string", + "description": "`owner` or `member`" + }, + "added_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the project was added." + } + }, + "required": [ + "object", + "id", + "role", + "added_at" + ], + "x-oaiMeta": { + "name": "The project user object", + "example": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + } + }, + "ProjectUserCreateRequest": { + "type": "object", + "properties": { + "user_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The ID of the user." + }, + "email": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Email of the user to add." + }, + "role": { + "type": "string", + "description": "`owner` or `member`" + } + }, + "required": [ + "role" + ] + }, + "ProjectUserDeleteResponse": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.project.user.deleted" + ], + "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" + } + }, + "required": [ + "object", + "id", + "deleted" + ] + }, + "ProjectUserListResponse": { + "type": "object", + "properties": { + "object": { + "type": "string" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProjectUser" + } + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" + } + }, + "required": [ + "object", + "data", + "has_more" + ] + }, + "ProjectUserUpdateRequest": { + "type": "object", + "properties": { + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "`owner` or `member`" + } + } + }, + "Prompt": { + "anyOf": [ + { + "type": "object", + "description": "Reference to a prompt template and its variables.\n[Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code).\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique identifier of the prompt template to use." + }, + "version": { + "anyOf": [ + { + "type": "string", + "description": "Optional version of the prompt template." + }, + { + "type": "null" + } + ] + }, + "variables": { + "$ref": "#/components/schemas/ResponsePromptVariables" + } + } + }, + { + "type": "null" + } + ] + }, + "PublicAssignOrganizationGroupRoleBody": { + "type": "object", + "description": "Request payload for assigning a role to a group or user.", + "properties": { + "role_id": { + "type": "string", + "description": "Identifier of the role to assign." + } + }, + "required": [ + "role_id" + ], + "x-oaiMeta": { + "example": "{\n \"role_id\": \"role_01J1F8ROLE01\"\n}\n" + } + }, + "PublicCreateOrganizationRoleBody": { + "type": "object", + "description": "Request payload for creating a custom role.", + "properties": { + "role_name": { + "type": "string", + "description": "Unique name for the role." + }, + "permissions": { + "type": "array", + "description": "Permissions to grant to the role.", + "items": { + "type": "string" + } + }, + "description": { + "description": "Optional description of the role.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "role_name", + "permissions" + ], + "x-oaiMeta": { + "example": "{\n \"role_name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"description\": \"Allows managing organization groups\"\n}\n" + } + }, + "PublicRoleListResource": { + "type": "object", + "description": "Paginated list of roles available on an organization or project.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "Always `list`.", + "x-stainless-const": true + }, + "data": { + "type": "array", + "description": "Roles returned in the current page.", + "items": { + "$ref": "#/components/schemas/Role" + } + }, + "has_more": { + "type": "boolean", + "description": "Whether more roles are available when paginating." + }, + "next": { + "description": "Cursor to fetch the next page of results, or `null` when there are no additional roles.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "object", + "data", + "has_more", + "next" + ], + "x-oaiMeta": { + "name": "Role list", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"role\",\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"description\": \"Allows managing organization groups\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" + } + }, + "PublicUpdateOrganizationRoleBody": { + "type": "object", + "description": "Request payload for updating an existing role.", + "properties": { + "permissions": { + "description": "Updated set of permissions for the role.", + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "null" + } + ] + }, + "description": { + "description": "New description for the role.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "role_name": { + "description": "New name for the role.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "x-oaiMeta": { + "example": "{\n \"role_name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"description\": \"Allows managing organization groups\"\n}\n" + } + }, + "RealtimeAudioFormats": { + "anyOf": [ + { + "type": "object", + "title": "PCM audio format", + "description": "The PCM audio format. Only a 24kHz sample rate is supported.", + "properties": { + "type": { + "type": "string", + "description": "The audio format. Always `audio/pcm`.", + "enum": [ + "audio/pcm" + ] + }, + "rate": { + "type": "integer", + "description": "The sample rate of the audio. Always `24000`.", + "enum": [ + 24000 + ] + } + } + }, + { + "type": "object", + "title": "PCMU audio format", + "description": "The G.711 μ-law format.", + "properties": { + "type": { + "type": "string", + "description": "The audio format. Always `audio/pcmu`.", + "enum": [ + "audio/pcmu" + ] + } + } + }, + { + "type": "object", + "title": "PCMA audio format", + "description": "The G.711 A-law format.", + "properties": { + "type": { + "type": "string", + "description": "The audio format. Always `audio/pcma`.", + "enum": [ + "audio/pcma" + ] + } + } + } + ] + }, + "RealtimeBetaClientEventConversationItemCreate": { + "type": "object", + "description": "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.create" + ], + "description": "The event type, must be `conversation.item.create`.", + "x-stainless-const": true + }, + "previous_item_id": { + "type": "string", + "description": "The ID of the preceding item after which the new item will be inserted. \nIf not set, the new item will be appended to the end of the conversation.\nIf set to `root`, the new item will be added to the beginning of the conversation.\nIf set to an existing ID, it allows an item to be inserted mid-conversation. If the\nID cannot be found, an error will be returned and the item will not be added.\n" + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + }, + "required": [ + "type", + "item" + ], + "x-oaiMeta": { + "name": "conversation.item.create", + "group": "realtime", + "example": "{\n \"type\": \"conversation.item.create\",\n \"item\": {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"hi\"\n }\n ]\n },\n \"event_id\": \"b904fba0-0ec4-40af-8bbb-f908a9b26793\",\n}\n" + } + }, + "RealtimeBetaClientEventConversationItemDelete": { + "type": "object", + "description": "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.delete" + ], + "description": "The event type, must be `conversation.item.delete`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the item to delete." + } + }, + "required": [ + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "conversation.item.delete", + "group": "realtime", + "example": "{\n \"event_id\": \"event_901\",\n \"type\": \"conversation.item.delete\",\n \"item_id\": \"msg_003\"\n}\n" + } + }, + "RealtimeBetaClientEventConversationItemRetrieve": { + "type": "object", + "description": "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.retrieve" + ], + "description": "The event type, must be `conversation.item.retrieve`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the item to retrieve." + } + }, + "required": [ + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "conversation.item.retrieve", + "group": "realtime", + "example": "{\n \"event_id\": \"event_901\",\n \"type\": \"conversation.item.retrieve\",\n \"item_id\": \"msg_003\"\n}\n" + } + }, + "RealtimeBetaClientEventConversationItemTruncate": { + "type": "object", + "description": "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.truncate" + ], + "description": "The event type, must be `conversation.item.truncate`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n" + }, + "content_index": { + "type": "integer", + "description": "The index of the content part to truncate. Set this to 0." + }, + "audio_end_ms": { + "type": "integer", + "description": "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n" + } + }, + "required": [ + "type", + "item_id", + "content_index", + "audio_end_ms" + ], + "x-oaiMeta": { + "name": "conversation.item.truncate", + "group": "realtime", + "example": "{\n \"event_id\": \"event_678\",\n \"type\": \"conversation.item.truncate\",\n \"item_id\": \"msg_002\",\n \"content_index\": 0,\n \"audio_end_ms\": 1500\n}\n" + } + }, + "RealtimeBetaClientEventInputAudioBufferAppend": { + "type": "object", + "description": "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. In Server VAD \nmode, the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike made other client events, the server will \nnot send a confirmation response to this event.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.append" + ], + "description": "The event type, must be `input_audio_buffer.append`.", + "x-stainless-const": true + }, + "audio": { + "type": "string", + "description": "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n" + } + }, + "required": [ + "type", + "audio" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.append", + "group": "realtime", + "example": "{\n \"event_id\": \"event_456\",\n \"type\": \"input_audio_buffer.append\",\n \"audio\": \"Base64EncodedAudioData\"\n}\n" + } + }, + "RealtimeBetaClientEventInputAudioBufferClear": { + "type": "object", + "description": "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.clear" + ], + "description": "The event type, must be `input_audio_buffer.clear`.", + "x-stainless-const": true + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.clear", + "group": "realtime", + "example": "{\n \"event_id\": \"event_012\",\n \"type\": \"input_audio_buffer.clear\"\n}\n" + } + }, + "RealtimeBetaClientEventInputAudioBufferCommit": { + "type": "object", + "description": "Send this event to commit the user input audio buffer, which will create a \nnew user message item in the conversation. This event will produce an error \nif the input audio buffer is empty. When in Server VAD mode, the client does \nnot need to send this event, the server will commit the audio buffer \nautomatically.\n\nCommitting the input audio buffer will trigger input audio transcription \n(if enabled in session configuration), but it will not create a response \nfrom the model. The server will respond with an `input_audio_buffer.committed` \nevent.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.commit" + ], + "description": "The event type, must be `input_audio_buffer.commit`.", + "x-stainless-const": true + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.commit", + "group": "realtime", + "example": "{\n \"event_id\": \"event_789\",\n \"type\": \"input_audio_buffer.commit\"\n}\n" + } + }, + "RealtimeBetaClientEventOutputAudioBufferClear": { + "type": "object", + "description": "**WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to\nstop generating audio and emit a `output_audio_buffer.cleared` event. This\nevent should be preceded by a `response.cancel` client event to stop the\ngeneration of the current response.\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the client event used for error handling." + }, + "type": { + "type": "string", + "enum": [ + "output_audio_buffer.clear" + ], + "description": "The event type, must be `output_audio_buffer.clear`.", + "x-stainless-const": true + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "output_audio_buffer.clear", + "group": "realtime", + "example": "{\n \"event_id\": \"optional_client_event_id\",\n \"type\": \"output_audio_buffer.clear\"\n}\n" + } + }, + "RealtimeBetaClientEventResponseCancel": { + "type": "object", + "description": "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "response.cancel" + ], + "description": "The event type, must be `response.cancel`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n" + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "response.cancel", + "group": "realtime", + "example": "{\n \"event_id\": \"event_567\",\n \"type\": \"response.cancel\"\n}\n" + } + }, + "RealtimeBetaClientEventResponseCreate": { + "type": "object", + "description": "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event can optionally include inference configuration like \n`instructions`, and `temperature`. These fields will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "response.create" + ], + "description": "The event type, must be `response.create`.", + "x-stainless-const": true + }, + "response": { + "$ref": "#/components/schemas/RealtimeBetaResponseCreateParams" + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "response.create", + "group": "realtime", + "example": "// Trigger a response with the default Conversation and no special parameters\n{\n \"type\": \"response.create\",\n}\n\n// Trigger an out-of-band response that does not write to the default Conversation\n{\n \"type\": \"response.create\",\n \"response\": {\n \"instructions\": \"Provide a concise answer.\",\n \"tools\": [], // clear any session tools\n \"conversation\": \"none\",\n \"output_modalities\": [\"text\"],\n \"input\": [\n {\n \"type\": \"item_reference\",\n \"id\": \"item_12345\",\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Summarize the above message in one sentence.\"\n }\n ]\n }\n ],\n }\n}\n" + } + }, + "RealtimeBetaClientEventSessionUpdate": { + "type": "object", + "description": "Send this event to update the session’s default configuration.\nThe client may send this event at any time to update any field,\nexcept for `voice`. However, note that once a session has been\ninitialized with a particular `model`, it can’t be changed to\nanother model using `session.update`.\n\nWhen the server receives a `session.update`, it will respond\nwith a `session.updated` event showing the full, effective configuration.\nOnly the fields that are present are updated. To clear a field like\n`instructions`, pass an empty string.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "session.update" + ], + "description": "The event type, must be `session.update`.", + "x-stainless-const": true + }, + "session": { + "$ref": "#/components/schemas/RealtimeSessionCreateRequest" + } + }, + "required": [ + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.update", + "group": "realtime", + "example": "{\n \"type\": \"session.update\",\n \"session\": {\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"display_color_palette\",\n \"description\": \"Call this function when a user asks for a color palette.\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"theme\": {\n \"type\": \"string\",\n \"description\": \"Description of the theme for the color scheme.\"\n },\n \"colors\": {\n \"type\": \"array\",\n \"description\": \"Array of five hex color codes based on the theme.\",\n \"items\": {\n \"type\": \"string\",\n \"description\": \"Hex color code\"\n }\n }\n },\n \"required\": [\n \"theme\",\n \"colors\"\n ]\n }\n }\n ],\n \"tool_choice\": \"auto\"\n }\n}\n" + } + }, + "RealtimeBetaClientEventTranscriptionSessionUpdate": { + "type": "object", + "description": "Send this event to update a transcription session.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "transcription_session.update" + ], + "description": "The event type, must be `transcription_session.update`.", + "x-stainless-const": true + }, + "session": { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateRequest" + } + }, + "required": [ + "type", + "session" + ], + "x-oaiMeta": { + "name": "transcription_session.update", + "group": "realtime", + "example": "{\n \"type\": \"transcription_session.update\",\n \"session\": {\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500,\n \"create_response\": true,\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\",\n ]\n }\n}\n" + } + }, + "RealtimeBetaResponse": { + "type": "object", + "description": "The response resource.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the response." + }, + "object": { + "type": "string", + "enum": [ + "realtime.response" + ], + "description": "The object type, must be `realtime.response`.", + "x-stainless-const": true + }, + "status": { + "type": "string", + "enum": [ + "completed", + "cancelled", + "failed", + "incomplete", + "in_progress" + ], + "description": "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n" + }, + "status_details": { + "type": "object", + "description": "Additional details about the status.", + "properties": { + "type": { + "type": "string", + "enum": [ + "completed", + "cancelled", + "failed", + "incomplete" + ], + "description": "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n" + }, + "reason": { + "type": "string", + "enum": [ + "turn_detected", + "client_cancelled", + "max_output_tokens", + "content_filter" + ], + "description": "The reason the Response did not complete. For a `cancelled` Response, \none of `turn_detected` (the server VAD detected a new start of speech) \nor `client_cancelled` (the client sent a cancel event). For an \n`incomplete` Response, one of `max_output_tokens` or `content_filter` \n(the server-side safety filter activated and cut off the response).\n" + }, + "error": { + "type": "object", + "description": "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of error." + }, + "code": { + "type": "string", + "description": "Error code, if any." + }, + "message": { + "type": "string", + "description": "A human-readable error message." + } + } + } + } + }, + "output": { + "type": "array", + "description": "The list of output items generated by the response.", + "items": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "usage": { + "type": "object", + "description": "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n", + "properties": { + "total_tokens": { + "type": "integer", + "description": "The total number of tokens in the Response including input and output \ntext and audio tokens.\n" + }, + "input_tokens": { + "type": "integer", + "description": "The number of input tokens used in the Response, including text and \naudio tokens.\n" + }, + "output_tokens": { + "type": "integer", + "description": "The number of output tokens sent in the Response, including text and \naudio tokens.\n" + }, + "input_token_details": { + "type": "object", + "description": "Details about the input tokens used in the Response.", + "properties": { + "cached_tokens": { + "type": "integer", + "description": "The number of cached tokens used as input for the Response." + }, + "text_tokens": { + "type": "integer", + "description": "The number of text tokens used as input for the Response." + }, + "image_tokens": { + "type": "integer", + "description": "The number of image tokens used as input for the Response." + }, + "audio_tokens": { + "type": "integer", + "description": "The number of audio tokens used as input for the Response." + }, + "cached_tokens_details": { + "type": "object", + "description": "Details about the cached tokens used as input for the Response.", + "properties": { + "text_tokens": { + "type": "integer", + "description": "The number of cached text tokens used as input for the Response." + }, + "image_tokens": { + "type": "integer", + "description": "The number of cached image tokens used as input for the Response." + }, + "audio_tokens": { + "type": "integer", + "description": "The number of cached audio tokens used as input for the Response." + } + } + } + } + }, + "output_token_details": { + "type": "object", + "description": "Details about the output tokens used in the Response.", + "properties": { + "text_tokens": { + "type": "integer", + "description": "The number of text tokens used in the Response." + }, + "audio_tokens": { + "type": "integer", + "description": "The number of audio tokens used in the Response." + } + } + } + } + }, + "conversation_id": { + "description": "Which conversation the response is added to, determined by the `conversation`\nfield in the `response.create` event. If `auto`, the response will be added to\nthe default conversation and the value of `conversation_id` will be an id like\n`conv_1234`. If `none`, the response will not be added to any conversation and\nthe value of `conversation_id` will be `null`. If responses are being triggered\nby server VAD, the response will be added to the default conversation, thus\nthe `conversation_id` will be an id like `conv_1234`.\n", + "type": "string" + }, + "voice": { + "$ref": "#/components/schemas/VoiceIdsShared", + "description": "The voice the model used to respond.\nCurrent voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n" + }, + "modalities": { + "type": "array", + "description": "The set of modalities the model used to respond. If there are multiple modalities,\nthe model will pick one, for example if `modalities` is `[\"text\", \"audio\"]`, the model\ncould be responding in either text or audio.\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } + }, + "output_audio_format": { + "type": "string", + "enum": [ + "pcm16", + "g711_ulaw", + "g711_alaw" + ], + "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" + }, + "temperature": { + "type": "number", + "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n" + }, + "max_output_tokens": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string", + "enum": [ + "inf" + ], + "x-stainless-const": true + } + ], + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls, that was used in this response.\n" + } + } + }, + "RealtimeBetaResponseCreateParams": { + "type": "object", + "description": "Create a new Realtime response with these parameters", + "properties": { + "modalities": { + "type": "array", + "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } + }, + "instructions": { + "type": "string", + "description": "The default system instructions (i.e. system message) prepended to model \ncalls. This field allows the client to guide the model on desired \nresponses. The model can be instructed on response content and format, \n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good \nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion \ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed \nto be followed by the model, but they provide guidance to the model on the \ndesired behavior.\n\nNote that the server sets default instructions which will be used if this \nfield is not set and are visible in the `session.created` event at the \nstart of the session.\n" + }, + "voice": { + "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", + "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with an\n`id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed during\nthe session once the model has responded with audio at least once.\nCustom voices must be created from audio samples. Voices created from text prompts are supported only in Live.\n" + }, + "output_audio_format": { + "type": "string", + "enum": [ + "pcm16", + "g711_ulaw", + "g711_alaw" + ], + "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" + }, + "tools": { + "type": "array", + "description": "Tools (functions) available to the model.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ], + "description": "The type of the tool, i.e. `function`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the function." + }, + "description": { + "type": "string", + "description": "The description of the function, including guidance on when and how \nto call it, and guidance about what to tell the user when calling \n(if anything).\n" + }, + "parameters": { + "type": "object", + "description": "Parameters of the function in JSON Schema." + } + } + } + }, + "tool_choice": { + "description": "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ToolChoiceOptions" + }, + { + "$ref": "#/components/schemas/ToolChoiceFunction" + }, + { + "$ref": "#/components/schemas/ToolChoiceMCP" + } + ], + "default": "auto" + }, + "temperature": { + "type": "number", + "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n" + }, + "max_output_tokens": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string", + "enum": [ + "inf" + ], + "x-stainless-const": true + } + ], + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" + }, + "conversation": { + "description": "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which \nwill not add items to default conversation.\n", + "oneOf": [ + { + "type": "string" + }, + { + "type": "string", + "default": "auto", + "enum": [ + "auto", + "none" + ] + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "prompt": { + "$ref": "#/components/schemas/Prompt" + }, + "input": { + "type": "array", + "description": "Input items to include in the prompt for the model. Using this field\ncreates a new context for this Response instead of using the default\nconversation. An empty array `[]` will clear the context for this Response.\nNote that this can include references to items from the default conversation.\n", + "items": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + } + } + }, + "RealtimeBetaServerEventConversationItemCreated": { + "type": "object", + "description": "Returned when a conversation item is created. There are several scenarios that produce this event:\n - The server is generating a Response, which if successful will produce\n either one or two Items, which will be of type `message`\n (role `assistant`) or type `function_call`.\n - The input audio buffer has been committed, either by the client or the\n server (in `server_vad` mode). The server will take the content of the\n input audio buffer and add it to a new user message Item.\n - The client has sent a `conversation.item.create` event to add a new Item\n to the Conversation.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.created" + ], + "description": "The event type, must be `conversation.item.created`.", + "x-stainless-const": true + }, + "previous_item_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the preceding item in the Conversation context, allows the\nclient to understand the order of the conversation. Can be `null` if the\nitem has no predecessor.\n" + }, + { + "type": "null" + } + ] + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + }, + "required": [ + "event_id", + "type", + "item" + ], + "x-oaiMeta": { + "name": "conversation.item.created", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1920\",\n \"type\": \"conversation.item.created\",\n \"previous_item_id\": \"msg_002\",\n \"item\": {\n \"id\": \"msg_003\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"user\",\n \"content\": []\n }\n}\n" + } + }, + "RealtimeBetaServerEventConversationItemDeleted": { + "type": "object", + "description": "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.deleted" + ], + "description": "The event type, must be `conversation.item.deleted`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the item that was deleted." + } + }, + "required": [ + "event_id", + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "conversation.item.deleted", + "group": "realtime", + "example": "{\n \"event_id\": \"event_2728\",\n \"type\": \"conversation.item.deleted\",\n \"item_id\": \"msg_005\"\n}\n" + } + }, + "RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted": { + "type": "object", + "description": "This event is the output of audio transcription for user audio written to the\nuser audio buffer. Transcription begins when the input audio buffer is\ncommitted by the client or server (in `server_vad` mode). Transcription runs\nasynchronously with Response creation, so this event may come before or after\nthe Response events.\n\nRealtime API models accept audio natively, and thus input transcription is a\nseparate process run on a separate ASR (Automatic Speech Recognition) model.\nThe transcript may diverge somewhat from the model's interpretation, and\nshould be treated as a rough guide.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.input_audio_transcription.completed" + ], + "description": "The event type, must be\n`conversation.item.input_audio_transcription.completed`.\n", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the user message item containing the audio." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part containing the audio." + }, + "transcript": { + "type": "string", + "description": "The transcribed text." + }, + "languages": { + "type": "array", + "description": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n", + "items": { + "$ref": "#/components/schemas/TranscriptionLanguage" + } + }, + "logprobs": { + "anyOf": [ + { + "type": "array", + "description": "The log probabilities of the transcription.", + "items": { + "$ref": "#/components/schemas/LogProbProperties" + } + }, + { + "type": "null" + } + ] + }, + "usage": { + "type": "object", + "description": "Usage statistics for the transcription.", + "oneOf": [ + { + "$ref": "#/components/schemas/TranscriptTextUsageTokens", + "title": "Token Usage" + }, + { + "$ref": "#/components/schemas/TranscriptTextUsageDuration", + "title": "Duration Usage" + } + ] + } + }, + "required": [ + "event_id", + "type", + "item_id", + "content_index", + "transcript", + "usage" + ], + "x-oaiMeta": { + "name": "conversation.item.input_audio_transcription.completed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_2122\",\n \"type\": \"conversation.item.input_audio_transcription.completed\",\n \"item_id\": \"msg_003\",\n \"content_index\": 0,\n \"transcript\": \"Hello, how are you?\",\n \"usage\": {\n \"type\": \"tokens\",\n \"total_tokens\": 48,\n \"input_tokens\": 38,\n \"input_token_details\": {\n \"text_tokens\": 10,\n \"audio_tokens\": 28,\n },\n \"output_tokens\": 10,\n }\n}\n" + } + }, + "RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta": { + "type": "object", + "description": "Returned when the text value of an input audio transcription content part is updated.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.input_audio_transcription.delta" + ], + "description": "The event type, must be `conversation.item.input_audio_transcription.delta`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "delta": { + "type": "string", + "description": "The text delta." + }, + "logprobs": { + "anyOf": [ + { + "type": "array", + "description": "The log probabilities of the transcription.", + "items": { + "$ref": "#/components/schemas/LogProbProperties" + } + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event_id", + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "conversation.item.input_audio_transcription.delta", + "group": "realtime", + "example": "{\n \"type\": \"conversation.item.input_audio_transcription.delta\",\n \"event_id\": \"event_001\",\n \"item_id\": \"item_001\",\n \"content_index\": 0,\n \"delta\": \"Hello\"\n}\n" + } + }, + "RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed": { + "type": "object", + "description": "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.input_audio_transcription.failed" + ], + "description": "The event type, must be\n`conversation.item.input_audio_transcription.failed`.\n", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the user message item." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part containing the audio." + }, + "error": { + "type": "object", + "description": "Details of the transcription error.", + "properties": { + "type": { + "type": "string", + "description": "The type of error." + }, + "code": { + "type": "string", + "description": "Error code, if any." + }, + "message": { + "type": "string", + "description": "A human-readable error message." + }, + "param": { + "type": "string", + "description": "Parameter related to the error, if any." + } + } + } + }, + "required": [ + "event_id", + "type", + "item_id", + "content_index", + "error" + ], + "x-oaiMeta": { + "name": "conversation.item.input_audio_transcription.failed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_2324\",\n \"type\": \"conversation.item.input_audio_transcription.failed\",\n \"item_id\": \"msg_003\",\n \"content_index\": 0,\n \"error\": {\n \"type\": \"transcription_error\",\n \"code\": \"audio_unintelligible\",\n \"message\": \"The audio could not be transcribed.\",\n \"param\": null\n }\n}\n" + } + }, + "RealtimeBetaServerEventConversationItemInputAudioTranscriptionSegment": { + "type": "object", + "description": "Returned when an input audio transcription segment is identified for an item.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.input_audio_transcription.segment" + ], + "description": "The event type, must be `conversation.item.input_audio_transcription.segment`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the item containing the input audio content." + }, + "content_index": { + "type": "integer", + "description": "The index of the input audio content part within the item." + }, + "text": { + "type": "string", + "description": "The text for this segment." + }, + "id": { + "type": "string", + "description": "The segment identifier." + }, + "speaker": { + "type": "string", + "description": "The detected speaker label for this segment." + }, + "start": { + "type": "number", + "format": "double", + "description": "Start time of the segment in seconds." + }, + "end": { + "type": "number", + "format": "double", + "description": "End time of the segment in seconds." + } + }, + "required": [ + "event_id", + "type", + "item_id", + "content_index", + "text", + "id", + "speaker", + "start", + "end" + ], + "x-oaiMeta": { + "name": "conversation.item.input_audio_transcription.segment", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6501\",\n \"type\": \"conversation.item.input_audio_transcription.segment\",\n \"item_id\": \"msg_011\",\n \"content_index\": 0,\n \"text\": \"hello\",\n \"id\": \"seg_0001\",\n \"speaker\": \"spk_1\",\n \"start\": 0.0,\n \"end\": 0.4\n}\n" + } + }, + "RealtimeBetaServerEventConversationItemRetrieved": { + "type": "object", + "description": "Returned when a conversation item is retrieved with `conversation.item.retrieve`.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.retrieved" + ], + "description": "The event type, must be `conversation.item.retrieved`.", + "x-stainless-const": true + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + }, + "required": [ + "event_id", + "type", + "item" + ], + "x-oaiMeta": { + "name": "conversation.item.retrieved", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1920\",\n \"type\": \"conversation.item.created\",\n \"previous_item_id\": \"msg_002\",\n \"item\": {\n \"id\": \"msg_003\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_audio\",\n \"transcript\": \"hello how are you\",\n \"audio\": \"base64encodedaudio==\"\n }\n ]\n }\n}\n" + } + }, + "RealtimeBetaServerEventConversationItemTruncated": { + "type": "object", + "description": "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.truncated" + ], + "description": "The event type, must be `conversation.item.truncated`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the assistant message item that was truncated." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part that was truncated." + }, + "audio_end_ms": { + "type": "integer", + "description": "The duration up to which the audio was truncated, in milliseconds.\n" + } + }, + "required": [ + "event_id", + "type", + "item_id", + "content_index", + "audio_end_ms" + ], + "x-oaiMeta": { + "name": "conversation.item.truncated", + "group": "realtime", + "example": "{\n \"event_id\": \"event_2526\",\n \"type\": \"conversation.item.truncated\",\n \"item_id\": \"msg_004\",\n \"content_index\": 0,\n \"audio_end_ms\": 1500\n}\n" + } + }, + "RealtimeBetaServerEventError": { + "type": "object", + "description": "Returned when an error occurs, which could be a client problem or a server\nproblem. Most errors are recoverable and the session will stay open, we\nrecommend to implementors to monitor and log error messages by default.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "error" + ], + "description": "The event type, must be `error`.", + "x-stainless-const": true + }, + "error": { + "type": "object", + "description": "Details of the error.", + "required": [ + "type", + "message" + ], + "properties": { + "type": { + "type": "string", + "description": "The type of error (e.g., \"invalid_request_error\", \"server_error\").\n" + }, + "code": { + "anyOf": [ + { + "type": "string", + "description": "Error code, if any." + }, + { + "type": "null" + } + ] + }, + "message": { + "type": "string", + "description": "A human-readable error message." + }, + "param": { + "anyOf": [ + { + "type": "string", + "description": "Parameter related to the error, if any." + }, + { + "type": "null" + } + ] + }, + "event_id": { + "anyOf": [ + { + "type": "string", + "description": "The event_id of the client event that caused the error, if applicable.\n" + }, + { + "type": "null" + } + ] + } + } + } + }, + "required": [ + "event_id", + "type", + "error" + ], + "x-oaiMeta": { + "name": "error", + "group": "realtime", + "example": "{\n \"event_id\": \"event_890\",\n \"type\": \"error\",\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"code\": \"invalid_event\",\n \"message\": \"The 'type' field is missing.\",\n \"param\": null,\n \"event_id\": \"event_567\"\n }\n}\n" + } + }, + "RealtimeBetaServerEventInputAudioBufferCleared": { + "type": "object", + "description": "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.cleared" + ], + "description": "The event type, must be `input_audio_buffer.cleared`.", + "x-stainless-const": true + } + }, + "required": [ + "event_id", + "type" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.cleared", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1314\",\n \"type\": \"input_audio_buffer.cleared\"\n}\n" + } + }, + "RealtimeBetaServerEventInputAudioBufferCommitted": { + "type": "object", + "description": "Returned when an input audio buffer is committed, either by the client or\nautomatically in server VAD mode. The `item_id` property is the ID of the user\nmessage item that will be created, thus a `conversation.item.created` event\nwill also be sent to the client.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.committed" + ], + "description": "The event type, must be `input_audio_buffer.committed`.", + "x-stainless-const": true + }, + "previous_item_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the preceding item after which the new item will be inserted.\nCan be `null` if the item has no predecessor.\n" + }, + { + "type": "null" + } + ] + }, + "item_id": { + "type": "string", + "description": "The ID of the user message item that will be created." + } + }, + "required": [ + "event_id", + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.committed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1121\",\n \"type\": \"input_audio_buffer.committed\",\n \"previous_item_id\": \"msg_001\",\n \"item_id\": \"msg_002\"\n}\n" + } + }, + "RealtimeBetaServerEventInputAudioBufferSpeechStarted": { + "type": "object", + "description": "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.speech_started" + ], + "description": "The event type, must be `input_audio_buffer.speech_started`.", + "x-stainless-const": true + }, + "audio_start_ms": { + "type": "integer", + "description": "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n" + }, + "item_id": { + "type": "string", + "description": "The ID of the user message item that will be created when speech stops.\n" + } + }, + "required": [ + "event_id", + "type", + "audio_start_ms", + "item_id" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.speech_started", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1516\",\n \"type\": \"input_audio_buffer.speech_started\",\n \"audio_start_ms\": 1000,\n \"item_id\": \"msg_003\"\n}\n" + } + }, + "RealtimeBetaServerEventInputAudioBufferSpeechStopped": { + "type": "object", + "description": "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.speech_stopped" + ], + "description": "The event type, must be `input_audio_buffer.speech_stopped`.", + "x-stainless-const": true + }, + "audio_end_ms": { + "type": "integer", + "description": "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n" + }, + "item_id": { + "type": "string", + "description": "The ID of the user message item that will be created." + } + }, + "required": [ + "event_id", + "type", + "audio_end_ms", + "item_id" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.speech_stopped", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1718\",\n \"type\": \"input_audio_buffer.speech_stopped\",\n \"audio_end_ms\": 2000,\n \"item_id\": \"msg_003\"\n}\n" + } + }, + "RealtimeBetaServerEventMCPListToolsCompleted": { + "type": "object", + "description": "Returned when listing MCP tools has completed for an item.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "mcp_list_tools.completed" + ], + "description": "The event type, must be `mcp_list_tools.completed`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP list tools item." + } + }, + "required": [ + "event_id", + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "mcp_list_tools.completed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6102\",\n \"type\": \"mcp_list_tools.completed\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" + } + }, + "RealtimeBetaServerEventMCPListToolsFailed": { + "type": "object", + "description": "Returned when listing MCP tools has failed for an item.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "mcp_list_tools.failed" + ], + "description": "The event type, must be `mcp_list_tools.failed`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP list tools item." + } + }, + "required": [ + "event_id", + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "mcp_list_tools.failed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6103\",\n \"type\": \"mcp_list_tools.failed\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" + } + }, + "RealtimeBetaServerEventMCPListToolsInProgress": { + "type": "object", + "description": "Returned when listing MCP tools is in progress for an item.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "mcp_list_tools.in_progress" + ], + "description": "The event type, must be `mcp_list_tools.in_progress`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP list tools item." + } + }, + "required": [ + "event_id", + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "mcp_list_tools.in_progress", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6101\",\n \"type\": \"mcp_list_tools.in_progress\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" + } + }, + "RealtimeBetaServerEventRateLimitsUpdated": { + "type": "object", + "description": "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "rate_limits.updated" + ], + "description": "The event type, must be `rate_limits.updated`.", + "x-stainless-const": true + }, + "rate_limits": { + "type": "array", + "description": "List of rate limit information.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "requests", + "tokens" + ], + "description": "The name of the rate limit (`requests`, `tokens`).\n" + }, + "limit": { + "type": "integer", + "description": "The maximum allowed value for the rate limit." + }, + "remaining": { + "type": "integer", + "description": "The remaining value before the limit is reached." + }, + "reset_seconds": { + "type": "number", + "description": "Seconds until the rate limit resets." + } + } + } + } + }, + "required": [ + "event_id", + "type", + "rate_limits" + ], + "x-oaiMeta": { + "name": "rate_limits.updated", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5758\",\n \"type\": \"rate_limits.updated\",\n \"rate_limits\": [\n {\n \"name\": \"requests\",\n \"limit\": 1000,\n \"remaining\": 999,\n \"reset_seconds\": 60\n },\n {\n \"name\": \"tokens\",\n \"limit\": 50000,\n \"remaining\": 49950,\n \"reset_seconds\": 60\n }\n ]\n}\n" + } + }, + "RealtimeBetaServerEventResponseAudioDelta": { + "type": "object", + "description": "Returned when the model-generated audio is updated.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.output_audio.delta" + ], + "description": "The event type, must be `response.output_audio.delta`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "delta": { + "type": "string", + "description": "Base64-encoded audio data delta." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "delta" + ], + "x-oaiMeta": { + "name": "response.output_audio.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4950\",\n \"type\": \"response.output_audio.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Base64EncodedAudioDelta\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseAudioDone": { + "type": "object", + "description": "Returned when the model-generated audio is done. Also emitted when a Response\nis interrupted, incomplete, or cancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.output_audio.done" + ], + "description": "The event type, must be `response.output_audio.done`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index" + ], + "x-oaiMeta": { + "name": "response.output_audio.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5152\",\n \"type\": \"response.output_audio.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0\n}\n" + } + }, + "RealtimeBetaServerEventResponseAudioTranscriptDelta": { + "type": "object", + "description": "Returned when the model-generated transcription of audio output is updated.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.output_audio_transcript.delta" + ], + "description": "The event type, must be `response.output_audio_transcript.delta`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "delta": { + "type": "string", + "description": "The transcript delta." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "delta" + ], + "x-oaiMeta": { + "name": "response.output_audio_transcript.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4546\",\n \"type\": \"response.output_audio_transcript.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Hello, how can I a\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseAudioTranscriptDone": { + "type": "object", + "description": "Returned when the model-generated transcription of audio output is done\nstreaming. Also emitted when a Response is interrupted, incomplete, or\ncancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.output_audio_transcript.done" + ], + "description": "The event type, must be `response.output_audio_transcript.done`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "transcript": { + "type": "string", + "description": "The final transcript of the audio." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "transcript" + ], + "x-oaiMeta": { + "name": "response.output_audio_transcript.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4748\",\n \"type\": \"response.output_audio_transcript.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"transcript\": \"Hello, how can I assist you today?\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseContentPartAdded": { + "type": "object", + "description": "Returned when a new content part is added to an assistant message item during\nresponse generation.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.content_part.added" + ], + "description": "The event type, must be `response.content_part.added`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item to which the content part was added." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "part": { + "type": "object", + "description": "The content part that was added.", + "properties": { + "type": { + "type": "string", + "enum": [ + "audio", + "text" + ], + "description": "The content type (\"text\", \"audio\")." + }, + "text": { + "type": "string", + "description": "The text content (if type is \"text\")." + }, + "audio": { + "type": "string", + "description": "Base64-encoded audio data (if type is \"audio\")." + }, + "transcript": { + "type": "string", + "description": "The transcript of the audio (if type is \"audio\")." + } + } + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "part" + ], + "x-oaiMeta": { + "name": "response.content_part.added", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3738\",\n \"type\": \"response.content_part.added\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"text\",\n \"text\": \"\"\n }\n}\n" + } + }, + "RealtimeBetaServerEventResponseContentPartDone": { + "type": "object", + "description": "Returned when a content part is done streaming in an assistant message item.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.content_part.done" + ], + "description": "The event type, must be `response.content_part.done`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "part": { + "type": "object", + "description": "The content part that is done.", + "properties": { + "type": { + "type": "string", + "enum": [ + "audio", + "text" + ], + "description": "The content type (\"text\", \"audio\")." + }, + "text": { + "type": "string", + "description": "The text content (if type is \"text\")." + }, + "audio": { + "type": "string", + "description": "Base64-encoded audio data (if type is \"audio\")." + }, + "transcript": { + "type": "string", + "description": "The transcript of the audio (if type is \"audio\")." + } + } + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "part" + ], + "x-oaiMeta": { + "name": "response.content_part.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3940\",\n \"type\": \"response.content_part.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"text\",\n \"text\": \"Sure, I can help with that.\"\n }\n}\n" + } + }, + "RealtimeBetaServerEventResponseCreated": { + "type": "object", + "description": "Returned when a new Response is created. The first event of response creation,\nwhere the response is in an initial state of `in_progress`.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.created" + ], + "description": "The event type, must be `response.created`.", + "x-stainless-const": true + }, + "response": { + "$ref": "#/components/schemas/RealtimeBetaResponse" + } + }, + "required": [ + "event_id", + "type", + "response" + ], + "x-oaiMeta": { + "name": "response.created", + "group": "realtime", + "example": "{\n \"type\": \"response.created\",\n \"event_id\": \"event_C9G8pqbTEddBSIxbBN6Os\",\n \"response\": {\n \"object\": \"realtime.response\",\n \"id\": \"resp_C9G8p7IH2WxLbkgPNouYL\",\n \"status\": \"in_progress\",\n \"status_details\": null,\n \"output\": [],\n \"conversation_id\": \"conv_C9G8mmBkLhQJwCon3hoJN\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"max_output_tokens\": \"inf\",\n \"audio\": {\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"marin\"\n }\n },\n \"usage\": null,\n \"metadata\": null\n },\n \"timestamp\": \"2:30:35 PM\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseDone": { + "type": "object", + "description": "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.done" + ], + "description": "The event type, must be `response.done`.", + "x-stainless-const": true + }, + "response": { + "$ref": "#/components/schemas/RealtimeBetaResponse" + } + }, + "required": [ + "event_id", + "type", + "response" + ], + "x-oaiMeta": { + "name": "response.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3132\",\n \"type\": \"response.done\",\n \"response\": {\n \"id\": \"resp_001\",\n \"object\": \"realtime.response\",\n \"status\": \"completed\",\n \"status_details\": null,\n \"output\": [\n {\n \"id\": \"msg_006\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Sure, how can I assist you today?\"\n }\n ]\n }\n ],\n \"usage\": {\n \"total_tokens\":275,\n \"input_tokens\":127,\n \"output_tokens\":148,\n \"input_token_details\": {\n \"cached_tokens\":384,\n \"text_tokens\":119,\n \"audio_tokens\":8,\n \"cached_tokens_details\": {\n \"text_tokens\": 128,\n \"audio_tokens\": 256\n }\n },\n \"output_token_details\": {\n \"text_tokens\":36,\n \"audio_tokens\":112\n }\n }\n }\n}\n" + } + }, + "RealtimeBetaServerEventResponseFunctionCallArgumentsDelta": { + "type": "object", + "description": "Returned when the model-generated function call arguments are updated.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.function_call_arguments.delta" + ], + "description": "The event type, must be `response.function_call_arguments.delta`.\n", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the function call item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "call_id": { + "type": "string", + "description": "The ID of the function call." + }, + "delta": { + "type": "string", + "description": "The arguments delta as a JSON string." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "call_id", + "delta" + ], + "x-oaiMeta": { + "name": "response.function_call_arguments.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5354\",\n \"type\": \"response.function_call_arguments.delta\",\n \"response_id\": \"resp_002\",\n \"item_id\": \"fc_001\",\n \"output_index\": 0,\n \"call_id\": \"call_001\",\n \"delta\": \"{\\\"location\\\": \\\"San\\\"\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseFunctionCallArgumentsDone": { + "type": "object", + "description": "Returned when the model-generated function call arguments are done streaming.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.function_call_arguments.done" + ], + "description": "The event type, must be `response.function_call_arguments.done`.\n", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the function call item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "call_id": { + "type": "string", + "description": "The ID of the function call." + }, + "name": { + "type": "string", + "description": "The name of the function that was called." + }, + "arguments": { + "type": "string", + "description": "The final arguments as a JSON string." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "call_id", + "name", + "arguments" + ], + "x-oaiMeta": { + "name": "response.function_call_arguments.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5556\",\n \"type\": \"response.function_call_arguments.done\",\n \"response_id\": \"resp_002\",\n \"item_id\": \"fc_001\",\n \"output_index\": 0,\n \"call_id\": \"call_001\",\n \"name\": \"get_weather\",\n \"arguments\": \"{\\\"location\\\": \\\"San Francisco\\\"}\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseMCPCallArgumentsDelta": { + "type": "object", + "description": "Returned when MCP tool call arguments are updated during response generation.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.mcp_call_arguments.delta" + ], + "description": "The event type, must be `response.mcp_call_arguments.delta`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "delta": { + "type": "string", + "description": "The JSON-encoded arguments delta." + }, + "obfuscation": { + "anyOf": [ + { + "type": "string", + "description": "If present, indicates the delta text was obfuscated." + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "delta" + ], + "x-oaiMeta": { + "name": "response.mcp_call_arguments.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6201\",\n \"type\": \"response.mcp_call_arguments.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"mcp_call_001\",\n \"output_index\": 0,\n \"delta\": \"{\\\"partial\\\":true}\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseMCPCallArgumentsDone": { + "type": "object", + "description": "Returned when MCP tool call arguments are finalized during response generation.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.mcp_call_arguments.done" + ], + "description": "The event type, must be `response.mcp_call_arguments.done`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "arguments": { + "type": "string", + "description": "The final JSON-encoded arguments string." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "arguments" + ], + "x-oaiMeta": { + "name": "response.mcp_call_arguments.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6202\",\n \"type\": \"response.mcp_call_arguments.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"mcp_call_001\",\n \"output_index\": 0,\n \"arguments\": \"{\\\"q\\\":\\\"docs\\\"}\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseMCPCallCompleted": { + "type": "object", + "description": "Returned when an MCP tool call has completed successfully.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.mcp_call.completed" + ], + "description": "The event type, must be `response.mcp_call.completed`.", + "x-stainless-const": true + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." + } + }, + "required": [ + "event_id", + "type", + "output_index", + "item_id" + ], + "x-oaiMeta": { + "name": "response.mcp_call.completed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6302\",\n \"type\": \"response.mcp_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseMCPCallFailed": { + "type": "object", + "description": "Returned when an MCP tool call has failed.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.mcp_call.failed" + ], + "description": "The event type, must be `response.mcp_call.failed`.", + "x-stainless-const": true + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." + } + }, + "required": [ + "event_id", + "type", + "output_index", + "item_id" + ], + "x-oaiMeta": { + "name": "response.mcp_call.failed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6303\",\n \"type\": \"response.mcp_call.failed\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseMCPCallInProgress": { + "type": "object", + "description": "Returned when an MCP tool call has started and is in progress.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.mcp_call.in_progress" + ], + "description": "The event type, must be `response.mcp_call.in_progress`.", + "x-stainless-const": true + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." + } + }, + "required": [ + "event_id", + "type", + "output_index", + "item_id" + ], + "x-oaiMeta": { + "name": "response.mcp_call.in_progress", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6301\",\n \"type\": \"response.mcp_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseOutputItemAdded": { + "type": "object", + "description": "Returned when a new Item is created during Response generation.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.output_item.added" + ], + "description": "The event type, must be `response.output_item.added`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the Response to which the item belongs." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the Response." + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + }, + "required": [ + "event_id", + "type", + "response_id", + "output_index", + "item" + ], + "x-oaiMeta": { + "name": "response.output_item.added", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3334\",\n \"type\": \"response.output_item.added\",\n \"response_id\": \"resp_001\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_007\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"in_progress\",\n \"role\": \"assistant\",\n \"content\": []\n }\n}\n" + } + }, + "RealtimeBetaServerEventResponseOutputItemDone": { + "type": "object", + "description": "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.output_item.done" + ], + "description": "The event type, must be `response.output_item.done`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the Response to which the item belongs." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the Response." + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + }, + "required": [ + "event_id", + "type", + "response_id", + "output_index", + "item" + ], + "x-oaiMeta": { + "name": "response.output_item.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3536\",\n \"type\": \"response.output_item.done\",\n \"response_id\": \"resp_001\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_007\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Sure, I can help with that.\"\n }\n ]\n }\n}\n" + } + }, + "RealtimeBetaServerEventResponseTextDelta": { + "type": "object", + "description": "Returned when the text value of an \"output_text\" content part is updated.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.output_text.delta" + ], + "description": "The event type, must be `response.output_text.delta`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "delta": { + "type": "string", + "description": "The text delta." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "delta" + ], + "x-oaiMeta": { + "name": "response.output_text.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4142\",\n \"type\": \"response.output_text.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Sure, I can h\"\n}\n" + } + }, + "RealtimeBetaServerEventResponseTextDone": { + "type": "object", + "description": "Returned when the text value of an \"output_text\" content part is done streaming. Also\nemitted when a Response is interrupted, incomplete, or cancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.output_text.done" + ], + "description": "The event type, must be `response.output_text.done`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "text": { + "type": "string", + "description": "The final text content." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "text" + ], + "x-oaiMeta": { + "name": "response.output_text.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4344\",\n \"type\": \"response.output_text.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"Sure, I can help with that.\"\n}\n" + } + }, + "RealtimeBetaServerEventSessionCreated": { + "type": "object", + "description": "Returned when a Session is created. Emitted automatically when a new\nconnection is established as the first server event. This event will contain\nthe default Session configuration.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "session.created" + ], + "description": "The event type, must be `session.created`.", + "x-stainless-const": true + }, + "session": { + "$ref": "#/components/schemas/RealtimeSession" + } + }, + "required": [ + "event_id", + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.created", + "group": "realtime", + "example": "{\n \"type\": \"session.created\",\n \"event_id\": \"event_C9G5RJeJ2gF77mV7f2B1j\",\n \"session\": {\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9G5QPteg4UIbotdKLoYQ\",\n \"model\": \"gpt-realtime-2025-08-28\",\n \"modalities\": [\n \"audio\"\n ],\n \"instructions\": \"Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.\",\n \"tools\": [],\n \"tool_choice\": \"auto\",\n \"max_response_output_tokens\": \"inf\",\n \"tracing\": null,\n \"prompt\": null,\n \"expires_at\": 1756324625,\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200,\n \"idle_timeout_ms\": null,\n \"create_response\": true,\n \"interrupt_response\": true\n },\n \"output_audio_format\": \"pcm16\",\n \"voice\": \"marin\",\n \"include\": null\n }\n}\n" + } + }, + "RealtimeBetaServerEventSessionUpdated": { + "type": "object", + "description": "Returned when a session is updated with a `session.update` event, unless\nthere is an error.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "session.updated" + ], + "description": "The event type, must be `session.updated`.", + "x-stainless-const": true + }, + "session": { + "$ref": "#/components/schemas/RealtimeSession" + } + }, + "required": [ + "event_id", + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.updated", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5678\",\n \"type\": \"session.updated\",\n \"session\": {\n \"id\": \"sess_001\",\n \"object\": \"realtime.session\",\n \"model\": \"gpt-realtime\",\n \"modalities\": [\"text\"],\n \"instructions\": \"New instructions\",\n \"voice\": \"sage\",\n \"input_audio_format\": \"pcm16\",\n \"output_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"whisper-1\"\n },\n \"turn_detection\": null,\n \"tools\": [],\n \"tool_choice\": \"none\",\n \"temperature\": 0.7,\n \"max_response_output_tokens\": 200,\n \"speed\": 1.1,\n \"tracing\": \"auto\"\n }\n}\n" + } + }, + "RealtimeBetaServerEventTranscriptionSessionCreated": { + "type": "object", + "description": "Returned when a transcription session is created.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "transcription_session.created" + ], + "description": "The event type, must be `transcription_session.created`.", + "x-stainless-const": true + }, + "session": { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponse" + } + }, + "required": [ + "event_id", + "type", + "session" + ], + "x-oaiMeta": { + "name": "transcription_session.created", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5566\",\n \"type\": \"transcription_session.created\",\n \"session\": {\n \"id\": \"sess_001\",\n \"object\": \"realtime.transcription_session\",\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": []\n }\n}\n" + } + }, + "RealtimeBetaServerEventTranscriptionSessionUpdated": { + "type": "object", + "description": "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "transcription_session.updated" + ], + "description": "The event type, must be `transcription_session.updated`.", + "x-stainless-const": true + }, + "session": { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponse" + } + }, + "required": [ + "event_id", + "type", + "session" + ], + "x-oaiMeta": { + "name": "transcription_session.updated", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5678\",\n \"type\": \"transcription_session.updated\",\n \"session\": {\n \"id\": \"sess_001\",\n \"object\": \"realtime.transcription_session\",\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500,\n \"create_response\": true,\n // \"interrupt_response\": false -- this will NOT be returned\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": [\n \"item.input_audio_transcription.avg_logprob\",\n ],\n }\n}\n" + } + }, + "RealtimeCallCreateRequest": { + "title": "Realtime call creation request", + "type": "object", + "description": "Parameters required to initiate a realtime call and receive the SDP answer\nneeded to complete a WebRTC peer connection. Provide an SDP offer generated\nby your client and optionally configure the session that will answer the call.", + "required": [ + "sdp" + ], + "properties": { + "sdp": { + "type": "string", + "description": "WebRTC Session Description Protocol (SDP) offer generated by the caller." + }, + "session": { + "title": "Session configuration", + "allOf": [ + { + "$ref": "#/components/schemas/RealtimeSessionCreateRequestGA" + } + ], + "description": "Optional session configuration to apply before the realtime session is\ncreated. Use the same parameters you would send in a [`create client secret`](https://developers.openai.com/api/reference/resources/realtime/subresources/client_secrets/methods/create)\nrequest." + } + }, + "additionalProperties": false + }, + "RealtimeCallReferRequest": { + "title": "Realtime call refer request", + "type": "object", + "description": "Parameters required to transfer a SIP call to a new destination using the\nRealtime API.", + "required": [ + "target_uri" + ], + "properties": { + "target_uri": { + "type": "string", + "description": "URI that should appear in the SIP Refer-To header. Supports values like\n`tel:+14155550123` or `sip:agent@example.com`.", + "example": "tel:+14155550123" + } + }, + "additionalProperties": false + }, + "RealtimeCallRejectRequest": { + "title": "Realtime call reject request", + "type": "object", + "description": "Parameters used to decline an incoming SIP call handled by the Realtime API.", + "properties": { + "status_code": { + "type": "integer", + "description": "SIP response code to send back to the caller. Defaults to `603` (Decline)\nwhen omitted.", + "example": 486 + } + }, + "additionalProperties": false + }, + "RealtimeClientEvent": { + "discriminator": { + "propertyName": "type" + }, + "description": "A realtime client event.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/RealtimeClientEventConversationItemCreate" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventConversationItemDelete" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventConversationItemRetrieve" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventConversationItemTruncate" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventInputAudioBufferAppend" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventInputAudioBufferClear" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventOutputAudioBufferClear" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventInputAudioBufferCommit" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventResponseCancel" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventResponseCreate" + }, + { + "$ref": "#/components/schemas/RealtimeClientEventSessionUpdate" + } + ] + }, + "RealtimeClientEventConversationItemCreate": { + "type": "object", + "description": "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will emit a `conversation.item.added` event and,\nwhen the item is finalized, a `conversation.item.done` event. Otherwise, an\n`error` event will be sent.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.create" + ], + "description": "The event type, must be `conversation.item.create`.", + "x-stainless-const": true + }, + "previous_item_id": { + "type": "string", + "description": "The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation.\n\nIf set to `root`, the new item will be added to the beginning of the conversation.\n\nIf set to an existing ID, it allows an item to be inserted mid-conversation. If the ID cannot be found, an error will be returned and the item will not be added.\n" + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + }, + "required": [ + "type", + "item" + ], + "x-oaiMeta": { + "name": "conversation.item.create", + "group": "realtime", + "example": "{\n \"type\": \"conversation.item.create\",\n \"item\": {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"hi\"\n }\n ]\n }\n}\n" + } + }, + "RealtimeClientEventConversationItemDelete": { + "type": "object", + "description": "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.delete" + ], + "description": "The event type, must be `conversation.item.delete`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the item to delete." + } + }, + "required": [ + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "conversation.item.delete", + "group": "realtime", + "example": "{\n \"event_id\": \"event_901\",\n \"type\": \"conversation.item.delete\",\n \"item_id\": \"item_003\"\n}\n" + } + }, + "RealtimeClientEventConversationItemRetrieve": { + "type": "object", + "description": "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.retrieve" + ], + "description": "The event type, must be `conversation.item.retrieve`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the item to retrieve." + } + }, + "required": [ + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "conversation.item.retrieve", + "group": "realtime", + "example": "{\n \"event_id\": \"event_901\",\n \"type\": \"conversation.item.retrieve\",\n \"item_id\": \"item_003\"\n}\n" + } + }, + "RealtimeClientEventConversationItemTruncate": { + "type": "object", + "description": "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "conversation.item.truncate" + ], + "description": "The event type, must be `conversation.item.truncate`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n" + }, + "content_index": { + "type": "integer", + "description": "The index of the content part to truncate. Set this to `0`." + }, + "audio_end_ms": { + "type": "integer", + "description": "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n" + } + }, + "required": [ + "type", + "item_id", + "content_index", + "audio_end_ms" + ], + "x-oaiMeta": { + "name": "conversation.item.truncate", + "group": "realtime", + "example": "{\n \"event_id\": \"event_678\",\n \"type\": \"conversation.item.truncate\",\n \"item_id\": \"item_002\",\n \"content_index\": 0,\n \"audio_end_ms\": 1500\n}\n" + } + }, + "RealtimeClientEventInputAudioBufferAppend": { + "type": "object", + "description": "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. A \"commit\" will create a new\nuser message item in the conversation history from the buffer content and clear the buffer.\nInput audio transcription (if enabled) will be generated when the buffer is committed.\n\nIf VAD is enabled the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually. Input audio noise reduction operates on writes to the audio buffer.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike most other client events, the server will \nnot send a confirmation response to this event.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.append" + ], + "description": "The event type, must be `input_audio_buffer.append`.", + "x-stainless-const": true + }, + "audio": { + "type": "string", + "description": "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n" + } + }, + "required": [ + "type", + "audio" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.append", + "group": "realtime", + "example": "{\n \"event_id\": \"event_456\",\n \"type\": \"input_audio_buffer.append\",\n \"audio\": \"Base64EncodedAudioData\"\n}\n" + } + }, + "RealtimeClientEventInputAudioBufferClear": { + "type": "object", + "description": "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.clear" + ], + "description": "The event type, must be `input_audio_buffer.clear`.", + "x-stainless-const": true + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.clear", + "group": "realtime", + "example": "{\n \"event_id\": \"event_012\",\n \"type\": \"input_audio_buffer.clear\"\n}\n" + } + }, + "RealtimeClientEventInputAudioBufferCommit": { + "type": "object", + "description": "Send this event to commit the user input audio buffer, which will create a new user message item in the conversation. This event will produce an error if the input audio buffer is empty. When in Server VAD mode, the client does not need to send this event, the server will commit the audio buffer automatically.\n\nCommitting the input audio buffer will trigger input audio transcription (if enabled in session configuration), but it will not create a response from the model. The server will respond with an `input_audio_buffer.committed` event.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "input_audio_buffer.commit" + ], + "description": "The event type, must be `input_audio_buffer.commit`.", + "x-stainless-const": true + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.commit", + "group": "realtime", + "example": "{\n \"event_id\": \"event_789\",\n \"type\": \"input_audio_buffer.commit\"\n}\n" + } + }, + "RealtimeClientEventOutputAudioBufferClear": { + "type": "object", + "description": "**WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to\nstop generating audio and emit a `output_audio_buffer.cleared` event. This\nevent should be preceded by a `response.cancel` client event to stop the\ngeneration of the current response.\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the client event used for error handling." + }, + "type": { + "type": "string", + "enum": [ + "output_audio_buffer.clear" + ], + "description": "The event type, must be `output_audio_buffer.clear`.", + "x-stainless-const": true + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "output_audio_buffer.clear", + "group": "realtime", + "example": "{\n \"event_id\": \"optional_client_event_id\",\n \"type\": \"output_audio_buffer.clear\"\n}\n" + } + }, + "RealtimeClientEventResponseCancel": { + "type": "object", + "description": "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error. It's safe\nto call `response.cancel` even if no response is in progress, an error will be\nreturned the session will remain unaffected.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "response.cancel" + ], + "description": "The event type, must be `response.cancel`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n" + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "response.cancel", + "group": "realtime", + "example": "{\n \"type\": \"response.cancel\",\n \"response_id\": \"resp_12345\"\n}\n" + } + }, + "RealtimeClientEventResponseCreate": { + "type": "object", + "description": "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history by default.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event includes inference configuration like \n`instructions` and `tools`. If these are set, they will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel. The `metadata` field is a good way to disambiguate\nmultiple simultaneous Responses.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "response.create" + ], + "description": "The event type, must be `response.create`.", + "x-stainless-const": true + }, + "response": { + "$ref": "#/components/schemas/RealtimeResponseCreateParams" + } + }, + "required": [ + "type" + ], + "x-oaiMeta": { + "name": "response.create", + "group": "realtime", + "example": "// Trigger a response with the default Conversation and no special parameters\n{\n \"type\": \"response.create\"\n}\n\n// Trigger an out-of-band response that does not write to the default Conversation\n{\n \"type\": \"response.create\",\n \"response\": {\n \"instructions\": \"Provide a concise answer.\",\n \"tools\": [], // clear any session tools\n \"conversation\": \"none\",\n \"output_modalities\": [\"text\"],\n \"metadata\": {\n \"response_purpose\": \"summarization\"\n },\n \"input\": [\n {\n \"type\": \"item_reference\",\n \"id\": \"item_12345\"\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Summarize the above message in one sentence.\"\n }\n ]\n }\n ]\n }\n}\n" + } + }, + "RealtimeClientEventSessionUpdate": { + "type": "object", + "description": "Send this event to update the session’s configuration.\nThe client may send this event at any time to update any field\nexcept for `voice` and `model`. `voice` can be updated only if there have been no other audio outputs yet.\n\nWhen the server receives a `session.update`, it will respond\nwith a `session.updated` event showing the full, effective configuration.\nOnly the fields that are present in the `session.update` are updated. To clear a field like\n`instructions`, pass an empty string. To clear a field like `tools`, pass an empty array.\nTo clear a field like `turn_detection`, pass `null`.\n\nTo turn off input audio noise reduction, send this Realtime event:\n\n```json\n{\"type\":\"session.update\",\"session\":{\"type\":\"realtime\",\"audio\":{\"input\":{\"noise_reduction\":null}}}}\n```\n\nFor a transcription session, use `\"type\":\"transcription\"` inside `session`.\nOmitting `audio.input.noise_reduction` from an update leaves its current setting unchanged.\n", + "properties": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event. This is an arbitrary string that a client may assign. It will be passed back if there is an error with the event, but the corresponding `session.updated` event will not include it." + }, + "type": { + "type": "string", + "enum": [ + "session.update" + ], + "description": "The event type, must be `session.update`.", + "x-stainless-const": true + }, + "session": { + "type": "object", + "description": "Update the Realtime session. Choose either a realtime\nsession or a transcription session.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/RealtimeSessionCreateRequestGA" + }, + { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA" + } + ] + } + }, + "required": [ + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.update", + "group": "realtime", + "example": "{\n \"type\": \"session.update\",\n \"session\": {\n \"type\": \"realtime\",\n \"instructions\": \"You are a creative assistant that helps with design tasks.\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"display_color_palette\",\n \"description\": \"Call this function when a user asks for a color palette.\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"theme\": {\n \"type\": \"string\",\n \"description\": \"Description of the theme for the color scheme.\"\n },\n \"colors\": {\n \"type\": \"array\",\n \"description\": \"Array of five hex color codes based on the theme.\",\n \"items\": {\n \"type\": \"string\",\n \"description\": \"Hex color code\"\n }\n }\n },\n \"required\": [\n \"theme\",\n \"colors\"\n ]\n }\n }\n ],\n \"tool_choice\": \"auto\"\n }\n}\n" + } + }, + "RealtimeClientEventTranscriptionSessionUpdate": { + "type": "object", + "description": "Send this event to update a transcription session.\n", + "properties": { + "event_id": { + "type": "string", + "description": "Optional client-generated ID used to identify this event." + }, + "type": { + "type": "string", + "enum": [ + "transcription_session.update" + ], + "description": "The event type, must be `transcription_session.update`.", + "x-stainless-const": true + }, + "session": { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateRequest" + } + }, + "required": [ + "type", + "session" + ], + "x-oaiMeta": { + "name": "transcription_session.update", + "group": "realtime", + "example": "{\n \"type\": \"transcription_session.update\",\n \"session\": {\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500,\n \"create_response\": true,\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\",\n ]\n }\n}\n" + } + }, + "RealtimeConnectDocumentationParams": { + "type": "object", + "properties": { + "model": { + "type": "string" + }, + "call_id": { + "type": "string" + }, + "intent": { + "type": "string", + "enum": [ + "realtime", + "transcription" + ], + "description": "Selects the session type. Set `transcription` and omit `model` for a transcription session. If omitted, the session type from a client secret applies when present; otherwise the intent is `realtime`.\n" + } + } + }, + "RealtimeConnectParams": { + "type": "object", + "properties": { + "model": { + "type": "string" + }, + "call_id": { + "type": "string" + } + } + }, + "RealtimeConversationItem": { + "description": "A single item within a Realtime conversation.", + "anyOf": [ + { + "$ref": "#/components/schemas/RealtimeConversationItemMessageSystem" + }, + { + "$ref": "#/components/schemas/RealtimeConversationItemMessageUser" + }, + { + "$ref": "#/components/schemas/RealtimeConversationItemMessageAssistant" + }, + { + "$ref": "#/components/schemas/RealtimeConversationItemFunctionCall" + }, + { + "$ref": "#/components/schemas/RealtimeConversationItemFunctionCallOutput" + }, + { + "$ref": "#/components/schemas/RealtimeMCPApprovalResponse" + }, + { + "$ref": "#/components/schemas/RealtimeMCPListTools" + }, + { + "$ref": "#/components/schemas/RealtimeMCPToolCall" + }, + { + "$ref": "#/components/schemas/RealtimeMCPApprovalRequest" + } + ], + "discriminator": { + "propertyName": "type" + } + }, + "RealtimeConversationItemFunctionCall": { + "type": "object", + "title": "Realtime function call item", + "description": "A function call item in a Realtime conversation.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the item. This may be provided by the client or generated by the server." + }, + "object": { + "type": "string", + "enum": [ + "realtime.item" + ], + "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", + "x-stainless-const": true + }, + "type": { + "type": "string", + "enum": [ + "function_call" + ], + "description": "The type of the item. Always `function_call`.", + "x-stainless-const": true + }, + "status": { + "type": "string", + "enum": [ + "completed", + "incomplete", + "in_progress" + ], + "description": "The status of the item. Has no effect on the conversation." + }, + "call_id": { + "type": "string", + "description": "The ID of the function call." + }, + "name": { + "type": "string", + "description": "The name of the function being called." + }, + "arguments": { + "type": "string", + "description": "The arguments of the function call. This is a JSON-encoded string representing the arguments passed to the function, for example `{\"arg1\": \"value1\", \"arg2\": 42}`." + } + }, + "required": [ + "type", + "name", + "arguments" + ] + }, + "RealtimeConversationItemFunctionCallOutput": { + "type": "object", + "title": "Realtime function call output item", + "description": "A function call output item in a Realtime conversation.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the item. This may be provided by the client or generated by the server." + }, + "object": { + "type": "string", + "enum": [ + "realtime.item" + ], + "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", + "x-stainless-const": true + }, + "type": { + "type": "string", + "enum": [ + "function_call_output" + ], + "description": "The type of the item. Always `function_call_output`.", + "x-stainless-const": true + }, + "status": { + "type": "string", + "enum": [ + "completed", + "incomplete", + "in_progress" + ], + "description": "The status of the item. Has no effect on the conversation." + }, + "call_id": { + "type": "string", + "description": "The ID of the function call this output is for." + }, + "output": { + "type": "string", + "description": "The output of the function call, this is free text and can contain any information or simply be empty." + } + }, + "required": [ + "type", + "call_id", + "output" + ] + }, + "RealtimeConversationItemMessageAssistant": { + "type": "object", + "title": "Realtime assistant message item", + "description": "An assistant message item in a Realtime conversation.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the item. This may be provided by the client or generated by the server." + }, + "object": { + "type": "string", + "enum": [ + "realtime.item" + ], + "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", + "x-stainless-const": true + }, + "type": { + "type": "string", + "enum": [ + "message" + ], + "description": "The type of the item. Always `message`.", + "x-stainless-const": true + }, + "status": { + "type": "string", + "enum": [ + "completed", + "incomplete", + "in_progress" + ], + "description": "The status of the item. Has no effect on the conversation." + }, + "role": { + "type": "string", + "enum": [ + "assistant" + ], + "description": "The role of the message sender. Always `assistant`.", + "x-stainless-const": true + }, + "content": { + "type": "array", + "description": "The content of the message.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "output_text", + "output_audio" + ], + "description": "The content type, `output_text` or `output_audio` depending on the session `output_modalities` configuration." + }, + "text": { + "type": "string", + "description": "The text content." + }, + "audio": { + "type": "string", + "description": "Base64-encoded audio bytes, these will be parsed as the format specified in the session output audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified." + }, + "transcript": { + "type": "string", + "description": "The transcript of the audio content, this will always be present if the output type is `audio`." + } + } + } + } + }, + "required": [ + "type", + "role", + "content" + ] + }, + "RealtimeConversationItemMessageSystem": { + "type": "object", + "title": "Realtime system message item", + "description": "A system message in a Realtime conversation can be used to provide additional context or instructions to the model. This is similar but distinct from the instruction prompt provided at the start of a conversation, as system messages can be added at any point in the conversation. For major changes to the conversation's behavior, use instructions, but for smaller updates (e.g. \"the user is now asking about a different topic\"), use system messages.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the item. This may be provided by the client or generated by the server." + }, + "object": { + "type": "string", + "enum": [ + "realtime.item" + ], + "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", + "x-stainless-const": true + }, + "type": { + "type": "string", + "enum": [ + "message" + ], + "description": "The type of the item. Always `message`.", + "x-stainless-const": true + }, + "status": { + "type": "string", + "enum": [ + "completed", + "incomplete", + "in_progress" + ], + "description": "The status of the item. Has no effect on the conversation." + }, + "role": { + "type": "string", + "enum": [ + "system" + ], + "description": "The role of the message sender. Always `system`.", + "x-stainless-const": true + }, + "content": { + "type": "array", + "description": "The content of the message.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_text" + ], + "description": "The content type. Always `input_text` for system messages.", + "x-stainless-const": true + }, + "text": { + "type": "string", + "description": "The text content." + } + } + } + } + }, + "required": [ + "type", + "role", + "content" + ] + }, + "RealtimeConversationItemMessageUser": { + "type": "object", + "title": "Realtime user message item", + "description": "A user message item in a Realtime conversation.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the item. This may be provided by the client or generated by the server." + }, + "object": { + "type": "string", + "enum": [ + "realtime.item" + ], + "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", + "x-stainless-const": true + }, + "type": { + "type": "string", + "enum": [ + "message" + ], + "description": "The type of the item. Always `message`.", + "x-stainless-const": true + }, + "status": { + "type": "string", + "enum": [ + "completed", + "incomplete", + "in_progress" + ], + "description": "The status of the item. Has no effect on the conversation." + }, + "role": { + "type": "string", + "enum": [ + "user" + ], + "description": "The role of the message sender. Always `user`.", + "x-stainless-const": true + }, + "content": { + "type": "array", + "description": "The content of the message.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_text", + "input_audio", + "input_image" + ], + "description": "The content type (`input_text`, `input_audio`, or `input_image`)." + }, + "text": { + "type": "string", + "description": "The text content (for `input_text`)." + }, + "audio": { + "type": "string", + "description": "Base64-encoded audio bytes (for `input_audio`), these will be parsed as the format specified in the session input audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified." + }, + "image_url": { + "type": "string", + "format": "uri", + "description": "Base64-encoded image bytes (for `input_image`) as a data URI. For example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported formats are PNG and JPEG." + }, + "detail": { + "type": "string", + "description": "The detail level of the image (for `input_image`). `auto` will default to `high`.", + "default": "auto", + "enum": [ + "auto", + "low", + "high" + ] + }, + "transcript": { + "type": "string", + "description": "Transcript of the audio (for `input_audio`). This is not sent to the model, but will be attached to the message item for reference." + } + } + } + } + }, + "required": [ + "type", + "role", + "content" + ] + }, + "RealtimeConversationItemWithReference": { + "type": "object", + "description": "The item to add to the conversation.", + "properties": { + "id": { + "type": "string", + "description": "For an item of type (`message` | `function_call` | `function_call_output`)\nthis field allows the client to assign the unique ID of the item. It is\nnot required because the server will generate one if not provided.\n\nFor an item of type `item_reference`, this field is required and is a\nreference to any item that has previously existed in the conversation.\n" + }, + "type": { + "type": "string", + "enum": [ + "message", + "function_call", + "function_call_output" + ], + "description": "The type of the item (`message`, `function_call`, `function_call_output`, `item_reference`).\n" + }, + "object": { + "type": "string", + "enum": [ + "realtime.item" + ], + "description": "Identifier for the API object being returned - always `realtime.item`.\n", + "x-stainless-const": true + }, + "status": { + "type": "string", + "enum": [ + "completed", + "incomplete", + "in_progress" + ], + "description": "The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect \non the conversation, but are accepted for consistency with the \n`conversation.item.created` event.\n" + }, + "role": { + "type": "string", + "enum": [ + "user", + "assistant", + "system" + ], + "description": "The role of the message sender (`user`, `assistant`, `system`), only \napplicable for `message` items.\n" + }, + "content": { + "type": "array", + "description": "The content of the message, applicable for `message` items. \n- Message items of role `system` support only `input_text` content\n- Message items of role `user` support `input_text` and `input_audio` \n content\n- Message items of role `assistant` support `text` content.\n", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_audio", + "input_text", + "item_reference", + "text" + ], + "description": "The content type (`input_text`, `input_audio`, `item_reference`, `text`).\n" + }, + "text": { + "type": "string", + "description": "The text content, used for `input_text` and `text` content types.\n" + }, + "id": { + "type": "string", + "description": "ID of a previous conversation item to reference (for `item_reference`\ncontent types in `response.create` events). These can reference both\nclient and server created items.\n" + }, + "audio": { + "type": "string", + "description": "Base64-encoded audio bytes, used for `input_audio` content type.\n" + }, + "transcript": { + "type": "string", + "description": "The transcript of the audio, used for `input_audio` content type.\n" + } + } + } + }, + "call_id": { + "type": "string", + "description": "The ID of the function call (for `function_call` and \n`function_call_output` items). If passed on a `function_call_output` \nitem, the server will check that a `function_call` item with the same \nID exists in the conversation history.\n" + }, + "name": { + "type": "string", + "description": "The name of the function being called (for `function_call` items).\n" + }, + "arguments": { + "type": "string", + "description": "The arguments of the function call (for `function_call` items).\n" + }, + "output": { + "type": "string", + "description": "The output of the function call (for `function_call_output` items).\n" + } + } + }, + "RealtimeCreateClientSecretRequest": { + "type": "object", + "title": "Realtime client secret creation request", + "description": "Create a session and client secret for the Realtime API. The request can specify\neither a realtime or a transcription session configuration.\n[Learn more about the Realtime API](https://developers.openai.com/api/docs/guides/realtime).\n", + "properties": { + "expires_after": { + "type": "object", + "title": "Client secret expiration", + "description": "Configuration for the client secret expiration. Expiration refers to the time after which\na client secret will no longer be valid for creating sessions. The session itself may\ncontinue after that time once started. A secret can be used to create multiple sessions\nuntil it expires.\n", + "properties": { + "anchor": { + "type": "string", + "enum": [ + "created_at" + ], + "description": "The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported.\n", + "default": "created_at", + "x-stainless-const": true + }, + "seconds": { + "type": "integer", + "format": "int64", + "description": "The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified.\n", + "minimum": 10, + "maximum": 7200, + "default": 600 + } + } + }, + "session": { + "title": "Session configuration", + "description": "Session configuration to use for the client secret. Choose either a realtime\nsession or a transcription session.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/RealtimeSessionCreateRequestGA" + }, + { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA" + } + ] + } + } + }, + "RealtimeCreateClientSecretResponse": { + "type": "object", + "title": "Realtime session and client secret", + "description": "Response from creating a session and client secret for the Realtime API.\n", + "properties": { + "value": { + "type": "string", + "description": "The generated client secret value." + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "Expiration timestamp for the client secret, in seconds since epoch." + }, + "session": { + "title": "Session configuration", + "description": "The session configuration for either a realtime or transcription session.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/RealtimeSessionCreateResponseGA" + }, + { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "realtime": "#/components/schemas/RealtimeSessionCreateResponseGA", + "transcription": "#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA" + } + } + } + }, + "required": [ + "value", + "expires_at", + "session" + ], + "x-oaiMeta": { + "name": "Session response object", + "group": "realtime", + "example": "{\n \"value\": \"ek_68af296e8e408191a1120ab6383263c2\",\n \"expires_at\": 1756310470,\n \"session\": {\n \"type\": \"realtime\",\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9CiUVUzUzYIssh3ELY1d\",\n \"model\": \"gpt-realtime-2025-08-25\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"instructions\": \"You are a friendly assistant.\",\n \"tools\": [],\n \"tool_choice\": \"auto\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": null,\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"expires_at\": 0,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": null,\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200,\n \"idle_timeout_ms\": null,\n \"create_response\": true,\n \"interrupt_response\": true\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"alloy\",\n \"speed\": 1.0\n }\n },\n \"include\": null\n }\n}\n" + } + }, + "RealtimeFunctionTool": { + "type": "object", + "title": "Function tool", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ], + "description": "The type of the tool, i.e. `function`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the function." + }, + "description": { + "type": "string", + "description": "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n" + }, + "parameters": { + "type": "object", + "description": "Parameters of the function in JSON Schema." + } + } + }, + "RealtimeMCPApprovalRequest": { + "type": "object", + "title": "Realtime MCP approval request", + "description": "A Realtime item requesting human approval of a tool invocation.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_approval_request" + ], + "description": "The type of the item. Always `mcp_approval_request`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the approval request." + }, + "server_label": { + "type": "string", + "description": "The label of the MCP server making the request." + }, + "name": { + "type": "string", + "description": "The name of the tool to run." + }, + "arguments": { + "type": "string", + "description": "A JSON string of arguments for the tool." + } + }, + "required": [ + "type", + "id", + "server_label", + "name", + "arguments" + ] + }, + "RealtimeMCPApprovalResponse": { + "type": "object", + "title": "Realtime MCP approval response", + "description": "A Realtime item responding to an MCP approval request.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_approval_response" + ], + "description": "The type of the item. Always `mcp_approval_response`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the approval response." + }, + "approval_request_id": { + "type": "string", + "description": "The ID of the approval request being answered." + }, + "approve": { + "type": "boolean", + "description": "Whether the request was approved." + }, + "reason": { + "anyOf": [ + { + "type": "string", + "description": "Optional reason for the decision." + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "id", + "approval_request_id", + "approve" + ] + }, + "RealtimeMCPHTTPError": { + "type": "object", + "title": "Realtime MCP HTTP error", + "properties": { + "type": { + "type": "string", + "enum": [ + "http_error" + ], + "x-stainless-const": true + }, + "code": { + "type": "integer" + }, + "message": { + "type": "string" + } + }, + "required": [ + "type", + "code", + "message" + ] + }, + "RealtimeMCPListTools": { + "type": "object", + "title": "Realtime MCP list tools", + "description": "A Realtime item listing tools available on an MCP server.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_list_tools" + ], + "description": "The type of the item. Always `mcp_list_tools`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the list." + }, + "server_label": { + "type": "string", + "description": "The label of the MCP server." + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MCPListToolsTool" + }, + "description": "The tools available on the server." + } + }, + "required": [ + "type", + "server_label", + "tools" + ] + }, + "RealtimeMCPProtocolError": { + "type": "object", + "title": "Realtime MCP protocol error", + "properties": { + "type": { + "type": "string", + "enum": [ + "protocol_error" + ], + "x-stainless-const": true + }, + "code": { + "type": "integer" + }, + "message": { + "type": "string" + } + }, + "required": [ + "type", + "code", + "message" + ] + }, + "RealtimeMCPToolCall": { + "type": "object", + "title": "Realtime MCP tool call", + "description": "A Realtime item representing an invocation of a tool on an MCP server.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_call" + ], + "description": "The type of the item. Always `mcp_call`.", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the tool call." + }, + "server_label": { + "type": "string", + "description": "The label of the MCP server running the tool." + }, + "name": { + "type": "string", + "description": "The name of the tool that was run." + }, + "arguments": { + "type": "string", + "description": "A JSON string of the arguments passed to the tool." + }, + "approval_request_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of an associated approval request, if any." + }, + { + "type": "null" + } + ] + }, + "output": { + "anyOf": [ + { + "type": "string", + "description": "The output from the tool call." + }, + { + "type": "null" + } + ] + }, + "error": { + "anyOf": [ + { + "description": "The error from the tool call, if any.", + "oneOf": [ + { + "$ref": "#/components/schemas/RealtimeMCPProtocolError" + }, + { + "$ref": "#/components/schemas/RealtimeMCPToolExecutionError" + }, + { + "$ref": "#/components/schemas/RealtimeMCPHTTPError" + } + ] + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "id", + "server_label", + "name", + "arguments" + ] + }, + "RealtimeMCPToolExecutionError": { + "type": "object", + "title": "Realtime MCP tool execution error", + "properties": { + "type": { + "type": "string", + "enum": [ + "tool_execution_error" + ], + "x-stainless-const": true + }, + "message": { + "type": "string" + } + }, + "required": [ + "type", + "message" + ] + }, + "RealtimeNoiseReductionStrength": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "description": "Input noise suppression strength. Higher values apply more suppression.\nDefaults to 1 when noise reduction is first enabled. Omitting strength\nfrom a session update preserves the current strength.\n" + }, + "RealtimeReasoning": { + "type": "object", + "title": "Realtime reasoning configuration", + "description": "Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.\n", + "properties": { + "effort": { + "$ref": "#/components/schemas/RealtimeReasoningEffort" + } + } + }, + "RealtimeReasoningEffort": { + "type": "string", + "description": "Constrains effort on reasoning for reasoning-capable Realtime models such as\n`gpt-realtime-2`.\n", + "enum": [ + "minimal", + "low", + "medium", + "high", + "xhigh" + ], + "default": "low" + }, + "RealtimeResponse": { + "type": "object", + "description": "The response resource.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the response, will look like `resp_1234`." + }, + "object": { + "type": "string", + "enum": [ + "realtime.response" + ], + "description": "The object type, must be `realtime.response`.", + "x-stainless-const": true + }, + "status": { + "type": "string", + "enum": [ + "completed", + "cancelled", + "failed", + "incomplete", + "in_progress" + ], + "description": "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n" + }, + "status_details": { + "type": "object", + "description": "Additional details about the status.", + "properties": { + "type": { + "type": "string", + "enum": [ + "completed", + "cancelled", + "failed", + "incomplete" + ], + "description": "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n" + }, + "reason": { + "type": "string", + "enum": [ + "turn_detected", + "client_cancelled", + "max_output_tokens", + "content_filter" + ], + "description": "The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected` (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter` (the server-side safety filter activated and cut off the response).\n" + }, + "error": { + "type": "object", + "description": "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of error." + }, + "code": { + "type": "string", + "description": "Error code, if any." + }, + "message": { + "type": "string", + "description": "A human-readable error message." + } + } + } + } + }, + "output": { + "type": "array", + "description": "The list of output items generated by the response.", + "items": { + "$ref": "#/components/schemas/RealtimeConversationItem" + } + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "audio": { + "type": "object", + "description": "Configuration for audio output.", + "properties": { + "output": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats", + "description": "The format of the output audio." + }, + "voice": { + "$ref": "#/components/schemas/VoiceIdsShared", + "default": "alloy", + "description": "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for\nbest quality.\n" + } + } + } + } + }, + "usage": { + "type": "object", + "description": "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n", + "properties": { + "total_tokens": { + "type": "integer", + "description": "The total number of tokens in the Response including input and output \ntext and audio tokens.\n" + }, + "input_tokens": { + "type": "integer", + "description": "The number of input tokens used in the Response, including text and \naudio tokens.\n" + }, + "output_tokens": { + "type": "integer", + "description": "The number of output tokens sent in the Response, including text and \naudio tokens.\n" + }, + "input_token_details": { + "type": "object", + "description": "Details about the input tokens used in the Response. Cached tokens are tokens from previous turns in the conversation that are included as context for the current response. Cached tokens here are counted as a subset of input tokens, meaning input tokens will include cached and uncached tokens.", + "properties": { + "cached_tokens": { + "type": "integer", + "description": "The number of cached tokens used as input for the Response." + }, + "text_tokens": { + "type": "integer", + "description": "The number of text tokens used as input for the Response." + }, + "image_tokens": { + "type": "integer", + "description": "The number of image tokens used as input for the Response." + }, + "audio_tokens": { + "type": "integer", + "description": "The number of audio tokens used as input for the Response." + }, + "cached_tokens_details": { + "type": "object", + "description": "Details about the cached tokens used as input for the Response.", + "properties": { + "text_tokens": { + "type": "integer", + "description": "The number of cached text tokens used as input for the Response." + }, + "image_tokens": { + "type": "integer", + "description": "The number of cached image tokens used as input for the Response." + }, + "audio_tokens": { + "type": "integer", + "description": "The number of cached audio tokens used as input for the Response." + } + } + } + } + }, + "output_token_details": { + "type": "object", + "description": "Details about the output tokens used in the Response.", + "properties": { + "text_tokens": { + "type": "integer", + "description": "The number of text tokens used in the Response." + }, + "audio_tokens": { + "type": "integer", + "description": "The number of audio tokens used in the Response." + } + } + } + } + }, + "conversation_id": { + "description": "Which conversation the response is added to, determined by the `conversation`\nfield in the `response.create` event. If `auto`, the response will be added to\nthe default conversation and the value of `conversation_id` will be an id like\n`conv_1234`. If `none`, the response will not be added to any conversation and\nthe value of `conversation_id` will be `null`. If responses are being triggered\nautomatically by VAD the response will be added to the default conversation\n", + "type": "string" + }, + "output_modalities": { + "type": "array", + "description": "The set of modalities the model used to respond, currently the only possible values are\n`[\\\"audio\\\"]`, `[\\\"text\\\"]`. Audio output always include a text transcript. Setting the\noutput to mode `text` will disable audio output from the model.\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } + }, + "max_output_tokens": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string", + "enum": [ + "inf" + ], + "x-stainless-const": true + } + ], + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls, that was used in this response.\n" + } + } + }, + "RealtimeResponseCreateParams": { + "type": "object", + "description": "Create a new Realtime response with these parameters", + "properties": { + "output_modalities": { + "type": "array", + "description": "The set of modalities the model used to respond, currently the only possible values are\n`[\\\"audio\\\"]`, `[\\\"text\\\"]`. Audio output always include a text transcript. Setting the\noutput to mode `text` will disable audio output from the model.\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } + }, + "instructions": { + "type": "string", + "description": "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n" + }, + "audio": { + "type": "object", + "description": "Configuration for audio input and output.", + "properties": { + "output": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats", + "description": "The format of the output audio." + }, + "voice": { + "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", + "default": "alloy", + "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with\nan `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed\nduring the session once the model has responded with audio at least once.\nCustom voices must be created from audio samples. Voices created from text prompts are supported only in Live.\nWe recommend `marin` and `cedar` for best quality.\n" + } + } + } + } + }, + "tools": { + "type": "array", + "description": "Tools available to the model.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/RealtimeFunctionTool" + }, + { + "$ref": "#/components/schemas/MCPTool" + } + ] + } + }, + "tool_choice": { + "description": "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ToolChoiceOptions" + }, + { + "$ref": "#/components/schemas/ToolChoiceFunction" + }, + { + "$ref": "#/components/schemas/ToolChoiceMCP" + } + ], + "default": "auto" + }, + "parallel_tool_calls": { + "type": "boolean", + "description": "Whether the model may call multiple tools in parallel. Only supported by\nreasoning Realtime models such as `gpt-realtime-2`.\n" + }, + "reasoning": { + "$ref": "#/components/schemas/RealtimeReasoning" + }, + "max_output_tokens": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string", + "enum": [ + "inf" + ], + "x-stainless-const": true + } + ], + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" + }, + "conversation": { + "description": "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which\nwill not add items to default conversation.\n", + "oneOf": [ + { + "type": "string" + }, + { + "type": "string", + "default": "auto", + "enum": [ + "auto", + "none" + ] + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "prompt": { + "$ref": "#/components/schemas/Prompt" + }, + "input": { + "type": "array", + "description": "Input items to include in the prompt for the model. Using this field\ncreates a new context for this Response instead of using the default\nconversation. An empty array `[]` will clear the context for this Response.\nNote that this can include references to items that previously appeared in the session\nusing their id.\n", + "items": { + "$ref": "#/components/schemas/RealtimeResponseInputItem" + } + } + } + }, + "RealtimeResponseInputAudio": { + "title": "Realtime response input audio", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_audio" + ] + }, + "audio": { + "type": "string", + "minLength": 1, + "description": "Base64 audio bytes in the session input audio format." + }, + "transcript": { + "type": [ + "string", + "null" + ], + "description": "Optional text to associate with the input audio." + } + }, + "required": [ + "type", + "audio" + ], + "additionalProperties": false + }, + "RealtimeResponseInputFunctionCall": { + "title": "Realtime response input function call", + "description": "A function call supplied as input to a Realtime response.", + "type": "object", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_-]+$", + "not": { + "enum": [ + "root" + ] + } + }, + "type": { + "type": "string", + "enum": [ + "function_call" + ] + }, + "status": { + "type": [ + "string", + "null" + ], + "default": "completed", + "enum": [ + "completed", + "incomplete", + null + ] + }, + "call_id": { + "type": "string", + "minLength": 1, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_-]+$", + "not": { + "enum": [ + "root" + ] + } + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" + }, + "arguments": { + "type": "string", + "maxLength": 1048576 + } + }, + "required": [ + "type", + "call_id", + "name", + "arguments" + ], + "additionalProperties": false + }, + "RealtimeResponseInputFunctionCallOutput": { + "title": "Realtime response input function call output", + "description": "The result of a function call supplied as input to a Realtime response.", + "type": "object", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_-]+$", + "not": { + "enum": [ + "root" + ] + } + }, + "type": { + "type": "string", + "enum": [ + "function_call_output" + ] + }, + "status": { + "type": [ + "string", + "null" + ], + "default": "completed", + "enum": [ + "completed", + "incomplete", + null + ] + }, + "call_id": { + "type": "string", + "minLength": 1, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_-]+$", + "not": { + "enum": [ + "root" + ] + } + }, + "output": { + "type": "string", + "maxLength": 1048576 + } + }, + "required": [ + "type", + "call_id", + "output" + ], + "additionalProperties": false + }, + "RealtimeResponseInputImage": { + "title": "Realtime response input image", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_image" + ] + }, + "image_url": { + "type": "string", + "format": "uri", + "pattern": "^data:image/[^;,]+;base64,.+", + "description": "A base64 data URL with an image MIME type; use PNG or JPEG." + }, + "detail": { + "type": [ + "string", + "null" + ], + "enum": [ + "low", + "high", + "auto", + null + ], + "default": "auto" + } + }, + "required": [ + "type", + "image_url" + ], + "additionalProperties": false + }, + "RealtimeResponseInputItem": { + "title": "Realtime response input item", + "description": "An existing item reference or a new message or function call item for a Realtime response.", + "discriminator": { + "propertyName": "type", + "mapping": { + "message": "#/components/schemas/RealtimeResponseInputMessage", + "function_call": "#/components/schemas/RealtimeResponseInputFunctionCall", + "function_call_output": "#/components/schemas/RealtimeResponseInputFunctionCallOutput", + "item_reference": "#/components/schemas/RealtimeResponseItemReference" + } + }, + "anyOf": [ { - "$ref": "#/components/schemas/LiveSessionUsageUpdated" + "$ref": "#/components/schemas/RealtimeResponseInputMessage" }, { - "$ref": "#/components/schemas/LiveSessionClosed" + "$ref": "#/components/schemas/RealtimeResponseInputFunctionCall" }, { - "$ref": "#/components/schemas/LiveErrorEvent" + "$ref": "#/components/schemas/RealtimeResponseInputFunctionCallOutput" }, { - "$ref": "#/components/schemas/LiveInfoEvent" + "$ref": "#/components/schemas/RealtimeResponseItemReference" } ] }, - "LiveWebRTCTransport": { + "RealtimeResponseInputMessage": { "type": "object", - "description": "WebRTC transport carrying the offer SDP in a creation request or answer SDP in its response.", "properties": { "type": { "type": "string", - "description": "The transport used for the Live session. Always `webrtc`.", "enum": [ - "webrtc" + "message" + ] + } + }, + "required": [ + "type" + ], + "discriminator": { + "propertyName": "role", + "mapping": { + "system": "#/components/schemas/RealtimeResponseInputMessageSystem", + "developer": "#/components/schemas/RealtimeResponseInputMessageDeveloper", + "user": "#/components/schemas/RealtimeResponseInputMessageUser", + "assistant": "#/components/schemas/RealtimeResponseInputMessageAssistant" + } + }, + "anyOf": [ + { + "$ref": "#/components/schemas/RealtimeResponseInputMessageSystem" + }, + { + "$ref": "#/components/schemas/RealtimeResponseInputMessageDeveloper" + }, + { + "$ref": "#/components/schemas/RealtimeResponseInputMessageUser" + }, + { + "$ref": "#/components/schemas/RealtimeResponseInputMessageAssistant" + } + ], + "title": "Realtime response input message", + "description": "A message supplied as input to a Realtime response. The role determines the allowed content." + }, + "RealtimeResponseInputMessageAssistant": { + "title": "Realtime response input assistant message", + "allOf": [ + { + "$ref": "#/components/schemas/RealtimeResponseInputMessageFields" + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "array", + "minItems": 1, + "items": { + "title": "Realtime response input assistant text", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "output_text" + ] + }, + "text": { + "type": "string", + "maxLength": 256000 + } + }, + "required": [ + "type", + "text" + ], + "additionalProperties": false + } + } + } + } + ] + }, + "RealtimeResponseInputMessageDeveloper": { + "title": "Realtime response input developer message", + "allOf": [ + { + "$ref": "#/components/schemas/RealtimeResponseInputMessageFields" + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "developer" + ] + }, + "content": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "$ref": "#/components/schemas/RealtimeResponseInputText" + } + } + } + } + ] + }, + "RealtimeResponseInputMessageFields": { + "title": "Realtime response input message fields", + "type": "object", + "properties": { + "id": { + "type": [ + "string", + "null" ], - "x-stainless-const": true + "minLength": 1, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_-]+$", + "description": "An optional client ID. The value `root` is reserved." }, - "sdp": { + "type": { "type": "string", - "minLength": 1, - "description": "Session Description Protocol message for the WebRTC connection." + "enum": [ + "message" + ] + }, + "status": { + "type": [ + "string", + "null" + ], + "default": "completed", + "enum": [ + "completed", + "incomplete", + null + ], + "description": "Optional input status. Omission or null defaults to completed." + }, + "role": { + "type": "string" + }, + "content": { + "type": "array", + "minItems": 1 } }, "required": [ "type", - "sdp" + "role", + "content" + ], + "additionalProperties": false, + "not": { + "required": [ + "id" + ], + "properties": { + "id": { + "enum": [ + "root" + ] + } + } + } + }, + "RealtimeResponseInputMessageSystem": { + "title": "Realtime response input system message", + "allOf": [ + { + "$ref": "#/components/schemas/RealtimeResponseInputMessageFields" + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "$ref": "#/components/schemas/RealtimeResponseInputText" + } + } + } + } + ] + }, + "RealtimeResponseInputMessageUser": { + "title": "Realtime response input user message", + "allOf": [ + { + "$ref": "#/components/schemas/RealtimeResponseInputMessageFields" + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "array", + "minItems": 1, + "items": { + "discriminator": { + "propertyName": "type", + "mapping": { + "input_text": "#/components/schemas/RealtimeResponseInputText", + "input_audio": "#/components/schemas/RealtimeResponseInputAudio", + "input_image": "#/components/schemas/RealtimeResponseInputImage" + } + }, + "anyOf": [ + { + "$ref": "#/components/schemas/RealtimeResponseInputText" + }, + { + "$ref": "#/components/schemas/RealtimeResponseInputAudio" + }, + { + "$ref": "#/components/schemas/RealtimeResponseInputImage" + } + ] + } + } + } + } + ] + }, + "RealtimeResponseInputText": { + "title": "Realtime response input text", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_text" + ] + }, + "text": { + "type": "string", + "maxLength": 256000 + } + }, + "required": [ + "type", + "text" ], "additionalProperties": false }, - "LocalShellToolCall": { + "RealtimeResponseItemReference": { "type": "object", - "title": "Local shell call", - "description": "A tool call to run a command on the local shell.\n", + "description": "Reference an existing item in this Realtime session as response.create input.\nItem references are only accepted in the response input array, not as new\nconversation items.\n", "properties": { "type": { "type": "string", "enum": [ - "local_shell_call" + "item_reference" ], - "description": "The type of the local shell call. Always `local_shell_call`.\n", - "x-stainless-const": true + "x-stainless-const": true, + "description": "The type of this item. Always `item_reference`." + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_-]+$", + "description": "The ID of an existing item in the same Realtime session." + } + }, + "required": [ + "type", + "id" + ], + "additionalProperties": false, + "not": { + "properties": { + "id": { + "enum": [ + "root" + ] + } + } + } + }, + "RealtimeServerEvent": { + "discriminator": { + "propertyName": "type" + }, + "description": "A realtime server event.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/RealtimeServerEventConversationCreated" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemCreated" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemDeleted" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionCompleted" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionDelta" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionFailed" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemRetrieved" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemTruncated" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventError" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferCleared" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferCommitted" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferDtmfEventReceived" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStarted" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStopped" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventRateLimitsUpdated" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseAudioDelta" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseAudioDone" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseAudioTranscriptDelta" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseAudioTranscriptDone" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseContentPartAdded" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseContentPartDone" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseCreated" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseDone" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDelta" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDone" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseOutputItemAdded" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseOutputItemDone" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseTextDelta" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventResponseTextDone" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventSessionCreated" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventSessionUpdated" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventOutputAudioBufferStarted" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventOutputAudioBufferStopped" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventOutputAudioBufferCleared" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemAdded" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemDone" + }, + { + "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferTimeoutTriggered" }, - "id": { - "type": "string", - "description": "The unique ID of the local shell call.\n" + { + "$ref": "#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment" }, - "call_id": { - "type": "string", - "description": "The unique ID of the local shell tool call generated by the model.\n" + { + "$ref": "#/components/schemas/RealtimeServerEventMCPListToolsInProgress" }, - "action": { - "$ref": "#/components/schemas/LocalShellExecAction" + { + "$ref": "#/components/schemas/RealtimeServerEventMCPListToolsCompleted" }, - "status": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" - ], - "description": "The status of the local shell call.\n" - } - }, - "required": [ - "type", - "id", - "call_id", - "action", - "status" - ] - }, - "LocalShellToolCallOutput": { - "type": "object", - "title": "Local shell call output", - "description": "The output of a local shell tool call.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "local_shell_call_output" - ], - "description": "The type of the local shell tool call output. Always `local_shell_call_output`.\n", - "x-stainless-const": true + { + "$ref": "#/components/schemas/RealtimeServerEventMCPListToolsFailed" }, - "id": { - "type": "string", - "description": "The unique ID of the local shell tool call generated by the model.\n" + { + "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta" }, - "output": { - "type": "string", - "description": "A JSON string of the output of the local shell tool call.\n" + { + "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone" }, - "status": { - "anyOf": [ - { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" - ], - "description": "The status of the item. One of `in_progress`, `completed`, or `incomplete`.\n" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "id", - "type", - "call_id", - "output" - ] - }, - "LogProbProperties": { - "type": "object", - "description": "A log probability object.\n", - "properties": { - "token": { - "type": "string", - "description": "The token that was used to generate the log probability.\n" + { + "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallInProgress" }, - "logprob": { - "type": "number", - "description": "The log probability of the token.\n" + { + "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallCompleted" }, - "bytes": { - "type": "array", - "items": { - "type": "integer" - }, - "description": "The bytes that were used to generate the log probability.\n" + { + "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallFailed" } - }, - "required": [ - "token", - "logprob", - "bytes" ] }, - "MCPApprovalRequest": { + "RealtimeServerEventConversationCreated": { "type": "object", - "title": "MCP approval request", - "description": "A request for human approval of a tool invocation.\n", + "description": "Returned when a conversation is created. Emitted right after session creation.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { "type": "string", "enum": [ - "mcp_approval_request" + "conversation.created" ], - "description": "The type of the item. Always `mcp_approval_request`.\n", + "description": "The event type, must be `conversation.created`.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The unique ID of the approval request.\n" - }, - "server_label": { - "type": "string", - "description": "The label of the MCP server making the request.\n" - }, - "name": { - "type": "string", - "description": "The name of the tool to run.\n" - }, - "arguments": { - "type": "string", - "description": "A JSON string of arguments for the tool.\n" + "conversation": { + "type": "object", + "description": "The conversation resource.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the conversation." + }, + "object": { + "type": "string", + "description": "The object type, must be `realtime.conversation`." + } + } } }, "required": [ + "event_id", "type", - "id", - "server_label", - "name", - "arguments" - ] + "conversation" + ], + "x-oaiMeta": { + "name": "conversation.created", + "group": "realtime", + "example": "{\n \"event_id\": \"event_9101\",\n \"type\": \"conversation.created\",\n \"conversation\": {\n \"id\": \"conv_001\",\n \"object\": \"realtime.conversation\"\n }\n}\n" + } }, - "MCPApprovalResponse": { + "RealtimeServerEventConversationItemAdded": { "type": "object", - "title": "MCP approval response", - "description": "A response to an MCP approval request.\n", + "description": "Sent by the server when an Item is added to the default Conversation. This can happen in several cases:\n- When the client sends a `conversation.item.create` event.\n- When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer.\n- When the model is generating a Response. In this case the `conversation.item.added` event will be sent when the model starts generating a specific Item, and thus it will not yet have any content (and `status` will be `in_progress`).\n\nThe event will include the full content of the Item (except when model is generating a Response) except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if necessary.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { "type": "string", "enum": [ - "mcp_approval_response" + "conversation.item.added" ], - "description": "The type of the item. Always `mcp_approval_response`.\n", + "description": "The event type, must be `conversation.item.added`.", "x-stainless-const": true }, - "id": { + "previous_item_id": { "anyOf": [ { "type": "string", - "description": "The unique ID of the approval response\n" + "description": "The ID of the item that precedes this one, if any. This is used to\nmaintain ordering when items are inserted.\n" }, { "type": "null" } ] }, - "approval_request_id": { - "type": "string", - "description": "The ID of the approval request being answered.\n" - }, - "approve": { - "type": "boolean", - "description": "Whether the request was approved.\n" - }, - "reason": { - "anyOf": [ - { - "type": "string", - "description": "Optional reason for the decision.\n" - }, - { - "type": "null" - } - ] + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" } }, "required": [ + "event_id", "type", - "request_id", - "approve", - "approval_request_id" - ] + "item" + ], + "x-oaiMeta": { + "name": "conversation.item.added", + "group": "realtime", + "example": "{\n \"type\": \"conversation.item.added\",\n \"event_id\": \"event_C9G8pjSJCfRNEhMEnYAVy\",\n \"previous_item_id\": null,\n \"item\": {\n \"id\": \"item_C9G8pGVKYnaZu8PH5YQ9O\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"hi\"\n }\n ]\n }\n}\n" + } }, - "MCPApprovalResponseResource": { + "RealtimeServerEventConversationItemCreated": { "type": "object", - "title": "MCP approval response", - "description": "A response to an MCP approval request.\n", + "description": "Returned when a conversation item is created. There are several scenarios that produce this event:\n - The server is generating a Response, which if successful will produce\n either one or two Items, which will be of type `message`\n (role `assistant`) or type `function_call`.\n - The input audio buffer has been committed, either by the client or the\n server (in `server_vad` mode). The server will take the content of the\n input audio buffer and add it to a new user message Item.\n - The client has sent a `conversation.item.create` event to add a new Item\n to the Conversation.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { "type": "string", "enum": [ - "mcp_approval_response" + "conversation.item.created" ], - "description": "The type of the item. Always `mcp_approval_response`.\n", + "description": "The event type, must be `conversation.item.created`.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The unique ID of the approval response\n" - }, - "approval_request_id": { - "type": "string", - "description": "The ID of the approval request being answered.\n" - }, - "approve": { - "type": "boolean", - "description": "Whether the request was approved.\n" - }, - "reason": { + "previous_item_id": { "anyOf": [ { "type": "string", - "description": "Optional reason for the decision.\n" + "description": "The ID of the preceding item in the Conversation context, allows the\nclient to understand the order of the conversation. Can be `null` if the\nitem has no predecessor.\n" }, { "type": "null" } ] + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" } }, "required": [ + "event_id", "type", - "id", - "request_id", - "approve", - "approval_request_id" - ] + "item" + ], + "x-oaiMeta": { + "name": "conversation.item.created", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1920\",\n \"type\": \"conversation.item.created\",\n \"previous_item_id\": \"msg_002\",\n \"item\": {\n \"id\": \"msg_003\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"user\",\n \"content\": []\n }\n}\n" + } }, - "MCPListTools": { + "RealtimeServerEventConversationItemDeleted": { "type": "object", - "title": "MCP list tools", - "description": "A list of tools available on an MCP server.\n", + "description": "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { "type": "string", "enum": [ - "mcp_list_tools" + "conversation.item.deleted" ], - "description": "The type of the item. Always `mcp_list_tools`.\n", + "description": "The event type, must be `conversation.item.deleted`.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The unique ID of the list.\n" - }, - "server_label": { + "item_id": { "type": "string", - "description": "The label of the MCP server.\n" - }, - "tools": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MCPListToolsTool" - }, - "description": "The tools available on the server.\n" - }, - "error": { - "anyOf": [ - { - "type": "string", - "description": "Error message if the server could not list tools.\n" - }, - { - "type": "null" - } - ] + "description": "The ID of the item that was deleted." } }, "required": [ + "event_id", "type", - "id", - "server_label", - "tools" - ] + "item_id" + ], + "x-oaiMeta": { + "name": "conversation.item.deleted", + "group": "realtime", + "example": "{\n \"event_id\": \"event_2728\",\n \"type\": \"conversation.item.deleted\",\n \"item_id\": \"msg_005\"\n}\n" + } }, - "MCPListToolsTool": { + "RealtimeServerEventConversationItemDone": { "type": "object", - "title": "MCP list tools tool", - "description": "A tool available on an MCP server.\n", + "description": "Returned when a conversation item is finalized.\n\nThe event will include the full content of the Item except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if needed.\n", "properties": { - "name": { + "event_id": { "type": "string", - "description": "The name of the tool.\n" - }, - "description": { - "anyOf": [ - { - "type": "string", - "description": "The description of the tool.\n" - }, - { - "type": "null" - } - ] - }, - "input_schema": { - "type": "object", - "description": "The JSON schema describing the tool's input.\n" + "description": "The unique ID of the server event." }, - "annotations": { - "anyOf": [ - { - "type": "object", - "description": "Additional annotations about the tool.\n" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "name", - "input_schema" - ] - }, - "MCPTool": { - "type": "object", - "title": "MCP tool", - "description": "Give the model access to additional tools via remote Model Context Protocol\n(MCP) servers. [Learn more about MCP](https://developers.openai.com/api/docs/guides/tools-connectors-mcp).\n", - "properties": { "type": { "type": "string", "enum": [ - "mcp" + "conversation.item.done" ], - "description": "The type of the MCP tool. Always `mcp`.", + "description": "The event type, must be `conversation.item.done`.", "x-stainless-const": true }, - "server_label": { - "type": "string", - "description": "A label for this MCP server, used to identify it in tool calls.\n" - }, - "server_url": { - "type": "string", - "format": "uri", - "description": "The URL for the MCP server. One of `server_url`, `connector_id`, or\n`tunnel_id` must be provided.\n" - }, - "connector_id": { - "type": "string", - "enum": [ - "connector_dropbox", - "connector_gmail", - "connector_googlecalendar", - "connector_googledrive", - "connector_microsoftteams", - "connector_outlookcalendar", - "connector_outlookemail", - "connector_sharepoint" - ], - "description": "Identifier for service connectors, like those available in ChatGPT. One of\n`server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more\nabout service connectors [here](https://developers.openai.com/api/docs/guides/tools-connectors-mcp#connectors).\n\nCurrently supported `connector_id` values are:\n\n- Dropbox: `connector_dropbox`\n- Gmail: `connector_gmail`\n- Google Calendar: `connector_googlecalendar`\n- Google Drive: `connector_googledrive`\n- Microsoft Teams: `connector_microsoftteams`\n- Outlook Calendar: `connector_outlookcalendar`\n- Outlook Email: `connector_outlookemail`\n- SharePoint: `connector_sharepoint`\n" - }, - "tunnel_id": { - "type": "string", - "pattern": "^tunnel_[a-z0-9]{32}$", - "description": "The Secure MCP Tunnel ID to use instead of a direct server URL. One of\n`server_url`, `connector_id`, or `tunnel_id` must be provided.\n" - }, - "authorization": { - "type": "string", - "description": "An OAuth access token that can be used with a remote MCP server, either\nwith a custom MCP server URL or a service connector. Your application\nmust handle the OAuth authorization flow and provide the token here.\n" - }, - "server_description": { - "type": "string", - "description": "Optional description of the MCP server, used to provide more context.\n" - }, - "headers": { - "anyOf": [ - { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Optional HTTP headers to send to the MCP server. Use for authentication\nor other purposes.\n" - }, - { - "type": "null" - } - ] - }, - "allowed_tools": { - "anyOf": [ - { - "description": "List of allowed tool names or a filter object.\n", - "oneOf": [ - { - "type": "array", - "title": "MCP allowed tools", - "description": "A string array of allowed tool names", - "items": { - "type": "string" - } - }, - { - "$ref": "#/components/schemas/MCPToolFilter" - } - ] - }, - { - "type": "null" - } - ] - }, - "allowed_callers": { - "anyOf": [ - { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/CallableToolAllowedCaller" - }, - "description": "The tool invocation context(s)." - }, - { - "type": "null" - } - ] - }, - "require_approval": { + "previous_item_id": { "anyOf": [ { - "description": "Specify which of the MCP server's tools require approval.", - "oneOf": [ - { - "type": "object", - "title": "MCP tool approval filter", - "description": "Specify which of the MCP server's tools require approval. Can be\n`always`, `never`, or a filter object associated with tools\nthat require approval.\n", - "properties": { - "always": { - "$ref": "#/components/schemas/MCPToolFilter" - }, - "never": { - "$ref": "#/components/schemas/MCPToolFilter" - } - }, - "additionalProperties": false - }, - { - "type": "string", - "title": "MCP tool approval setting", - "description": "Specify a single approval policy for all tools. One of `always` or\n`never`. When set to `always`, all tools will require approval. When\nset to `never`, all tools will not require approval.\n", - "enum": [ - "always", - "never" - ] - } - ], - "default": "always" + "type": "string", + "description": "The ID of the item that precedes this one, if any. This is used to\nmaintain ordering when items are inserted.\n" }, { "type": "null" } ] }, - "defer_loading": { - "type": "boolean", - "description": "Whether this MCP tool is deferred and discovered via tool search.\n" + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" } }, "required": [ + "event_id", "type", - "server_label" - ] + "item" + ], + "x-oaiMeta": { + "name": "conversation.item.done", + "group": "realtime", + "example": "{\n \"type\": \"conversation.item.done\",\n \"event_id\": \"event_CCXLgMZPo3qioWCeQa4WH\",\n \"previous_item_id\": \"item_CCXLecNJVIVR2HUy3ABLj\",\n \"item\": {\n \"id\": \"item_CCXLfxmM5sXVJVz4mCa2S\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_audio\",\n \"transcript\": \"Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?\"\n }\n ]\n }\n}\n" + } }, - "MCPToolCall": { + "RealtimeServerEventConversationItemInputAudioTranscriptionCompleted": { "type": "object", - "title": "MCP tool call", - "description": "An invocation of a tool on an MCP server.\n", + "description": "This event is the output of audio transcription for user audio written to the\nuser audio buffer. Transcription begins when the input audio buffer is\ncommitted by the client or server (when VAD is enabled). Transcription runs\nasynchronously with Response creation, so this event may come before or after\nthe Response events.\n\nRealtime API models accept audio natively, and thus input transcription is a\nseparate process run on a separate ASR (Automatic Speech Recognition) model.\nThe transcript may diverge somewhat from the model's interpretation, and\nshould be treated as a rough guide.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { "type": "string", "enum": [ - "mcp_call" + "conversation.item.input_audio_transcription.completed" ], - "description": "The type of the item. Always `mcp_call`.\n", + "description": "The event type, must be\n`conversation.item.input_audio_transcription.completed`.\n", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The unique ID of the tool call.\n" - }, - "server_label": { - "type": "string", - "description": "The label of the MCP server running the tool.\n" - }, - "name": { + "item_id": { "type": "string", - "description": "The name of the tool that was run.\n" + "description": "The ID of the item containing the audio that is being transcribed." }, - "arguments": { + "content_index": { + "type": "integer", + "description": "The index of the content part containing the audio." + }, + "transcript": { "type": "string", - "description": "A JSON string of the arguments passed to the tool.\n" + "description": "The transcribed text." }, - "output": { - "anyOf": [ - { - "type": "string", - "description": "The output from the tool call.\n" - }, - { - "type": "null" - } - ] + "languages": { + "type": "array", + "description": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n", + "items": { + "$ref": "#/components/schemas/TranscriptionLanguage" + } }, - "error": { - "description": "The error from the tool call, if any.", + "logprobs": { "anyOf": [ { - "$ref": "#/components/schemas/MCPToolCallError" + "type": "array", + "description": "The log probabilities of the transcription.", + "items": { + "$ref": "#/components/schemas/LogProbProperties" + } }, { "type": "null" } ] }, - "status": { - "$ref": "#/components/schemas/MCPToolCallStatus", - "description": "The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\n" - }, - "approval_request_id": { - "anyOf": [ + "usage": { + "type": "object", + "description": "Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing.", + "oneOf": [ { - "type": "string", - "description": "Unique identifier for the MCP tool call approval request.\nInclude this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.\n" + "$ref": "#/components/schemas/TranscriptTextUsageTokens", + "title": "Token Usage" }, { - "type": "null" + "$ref": "#/components/schemas/TranscriptTextUsageDuration", + "title": "Duration Usage" } ] } }, "required": [ + "event_id", "type", - "id", - "server_label", - "name", - "arguments" - ] - }, - "MCPToolCallError": { - "oneOf": [ - { - "$ref": "#/components/schemas/MCPProtocolError" - }, - { - "$ref": "#/components/schemas/MCPToolExecutionError" - }, - { - "$ref": "#/components/schemas/HTTPError" - } + "item_id", + "content_index", + "transcript", + "usage" ], - "discriminator": { - "propertyName": "type" + "x-oaiMeta": { + "name": "conversation.item.input_audio_transcription.completed", + "group": "realtime", + "example": "{\n \"type\": \"conversation.item.input_audio_transcription.completed\",\n \"event_id\": \"event_CCXGRvtUVrax5SJAnNOWZ\",\n \"item_id\": \"item_CCXGQ4e1ht4cOraEYcuR2\",\n \"content_index\": 0,\n \"transcript\": \"Hey, can you hear me?\",\n \"usage\": {\n \"type\": \"tokens\",\n \"total_tokens\": 22,\n \"input_tokens\": 13,\n \"input_token_details\": {\n \"text_tokens\": 0,\n \"audio_tokens\": 13\n },\n \"output_tokens\": 9\n }\n}\n" } }, - "MCPToolFilter": { + "RealtimeServerEventConversationItemInputAudioTranscriptionDelta": { "type": "object", - "title": "MCP tool filter", - "description": "A filter object to specify which tools are allowed.\n", + "description": "Returned when the text value of an input audio transcription content part is updated with incremental transcription results.\n", "properties": { - "tool_names": { - "type": "array", - "title": "MCP allowed tools", - "items": { - "type": "string" - }, - "description": "List of allowed tool names." + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - "read_only": { - "type": "boolean", - "description": "Indicates whether or not a tool modifies data or is read-only. If an\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\nit will match this filter.\n" - } - }, - "required": [], - "additionalProperties": false - }, - "MessageContentImageFileObject": { - "title": "Image file", - "type": "object", - "description": "References an image [File](https://developers.openai.com/api/reference/resources/files) in the content of a message.", - "properties": { "type": { - "description": "Always `image_file`.", "type": "string", "enum": [ - "image_file" + "conversation.item.input_audio_transcription.delta" ], + "description": "The event type, must be `conversation.item.input_audio_transcription.delta`.", "x-stainless-const": true }, - "image_file": { - "type": "object", - "properties": { - "file_id": { - "description": "The [File](https://developers.openai.com/api/reference/resources/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content.", - "type": "string" + "item_id": { + "type": "string", + "description": "The ID of the item containing the audio that is being transcribed." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "delta": { + "type": "string", + "description": "The text delta." + }, + "logprobs": { + "anyOf": [ + { + "type": "array", + "description": "The log probabilities of the transcription. These can be enabled by configuring the session with `\"include\": [\"item.input_audio_transcription.logprobs\"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription.", + "items": { + "$ref": "#/components/schemas/LogProbProperties" + } }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" + { + "type": "null" } - }, - "required": [ - "file_id" ] } }, "required": [ + "event_id", "type", - "image_file" - ] + "item_id" + ], + "x-oaiMeta": { + "name": "conversation.item.input_audio_transcription.delta", + "group": "realtime", + "example": "{\n \"type\": \"conversation.item.input_audio_transcription.delta\",\n \"event_id\": \"event_CCXGRxsAimPAs8kS2Wc7Z\",\n \"item_id\": \"item_CCXGQ4e1ht4cOraEYcuR2\",\n \"content_index\": 0,\n \"delta\": \"Hey\",\n \"obfuscation\": \"aLxx0jTEciOGe\"\n}\n" + } }, - "MessageContentImageUrlObject": { - "title": "Image URL", + "RealtimeServerEventConversationItemInputAudioTranscriptionFailed": { "type": "object", - "description": "References an image URL in the content of a message.", + "description": "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { "type": "string", "enum": [ - "image_url" + "conversation.item.input_audio_transcription.failed" ], - "description": "The type of the content part.", + "description": "The event type, must be\n`conversation.item.input_audio_transcription.failed`.\n", "x-stainless-const": true }, - "image_url": { + "item_id": { + "type": "string", + "description": "The ID of the user message item." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part containing the audio." + }, + "error": { "type": "object", + "description": "Details of the transcription error.", "properties": { - "url": { + "type": { "type": "string", - "description": "The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.", - "format": "uri" + "description": "The type of error." }, - "detail": { + "code": { "type": "string", - "description": "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" + "description": "Error code, if any." + }, + "message": { + "type": "string", + "description": "A human-readable error message." + }, + "param": { + "type": "string", + "description": "Parameter related to the error, if any." } - }, - "required": [ - "url" - ] + } } }, "required": [ + "event_id", "type", - "image_url" - ] + "item_id", + "content_index", + "error" + ], + "x-oaiMeta": { + "name": "conversation.item.input_audio_transcription.failed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_2324\",\n \"type\": \"conversation.item.input_audio_transcription.failed\",\n \"item_id\": \"msg_003\",\n \"content_index\": 0,\n \"error\": {\n \"type\": \"transcription_error\",\n \"code\": \"audio_unintelligible\",\n \"message\": \"The audio could not be transcribed.\",\n \"param\": null\n }\n}\n" + } }, - "MessageContentRefusalObject": { - "title": "Refusal", + "RealtimeServerEventConversationItemInputAudioTranscriptionSegment": { "type": "object", - "description": "The refusal content generated by the assistant.", + "description": "Returned when an input audio transcription segment is identified for an item.", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { - "description": "Always `refusal`.", "type": "string", "enum": [ - "refusal" + "conversation.item.input_audio_transcription.segment" ], + "description": "The event type, must be `conversation.item.input_audio_transcription.segment`.", "x-stainless-const": true }, - "refusal": { - "type": "string" + "item_id": { + "type": "string", + "description": "The ID of the item containing the input audio content." + }, + "content_index": { + "type": "integer", + "description": "The index of the input audio content part within the item." + }, + "text": { + "type": "string", + "description": "The text for this segment." + }, + "id": { + "type": "string", + "description": "The segment identifier." + }, + "speaker": { + "type": "string", + "description": "The detected speaker label for this segment." + }, + "start": { + "type": "number", + "format": "double", + "description": "Start time of the segment in seconds." + }, + "end": { + "type": "number", + "format": "double", + "description": "End time of the segment in seconds." } }, "required": [ + "event_id", "type", - "refusal" - ] + "item_id", + "content_index", + "text", + "id", + "speaker", + "start", + "end" + ], + "x-oaiMeta": { + "name": "conversation.item.input_audio_transcription.segment", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6501\",\n \"type\": \"conversation.item.input_audio_transcription.segment\",\n \"item_id\": \"msg_011\",\n \"content_index\": 0,\n \"text\": \"hello\",\n \"id\": \"seg_0001\",\n \"speaker\": \"spk_1\",\n \"start\": 0.0,\n \"end\": 0.4\n}\n" + } }, - "MessageContentTextAnnotationsFileCitationObject": { - "title": "File citation", + "RealtimeServerEventConversationItemRetrieved": { "type": "object", - "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files.", + "description": "Returned when a conversation item is retrieved with `conversation.item.retrieve`. This is provided as a way to fetch the server's representation of an item, for example to get access to the post-processed audio data after noise cancellation and VAD. It includes the full content of the Item, including audio data.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { - "description": "Always `file_citation`.", "type": "string", "enum": [ - "file_citation" + "conversation.item.retrieved" ], + "description": "The event type, must be `conversation.item.retrieved`.", "x-stainless-const": true }, - "text": { - "description": "The text in the message content that needs to be replaced.", - "type": "string" - }, - "file_citation": { - "type": "object", - "properties": { - "file_id": { - "description": "The ID of the specific File the citation is from.", - "type": "string" - } - }, - "required": [ - "file_id" - ] - }, - "start_index": { - "type": "integer", - "minimum": 0 - }, - "end_index": { - "type": "integer", - "minimum": 0 + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" } }, "required": [ + "event_id", "type", - "text", - "file_citation", - "start_index", - "end_index" - ] + "item" + ], + "x-oaiMeta": { + "name": "conversation.item.retrieved", + "group": "realtime", + "example": "{\n \"type\": \"conversation.item.retrieved\",\n \"event_id\": \"event_CCXGSizgEppa2d4XbKA7K\",\n \"item\": {\n \"id\": \"item_CCXGRxbY0n6WE4EszhF5w\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_audio\",\n \"transcript\": \"Yes, I can hear you loud and clear. How can I help you today?\",\n \"audio\": \"AAABAP//AAA=\"\n }\n ]\n }\n}\n" + } }, - "MessageContentTextAnnotationsFilePathObject": { - "title": "File path", + "RealtimeServerEventConversationItemTruncated": { "type": "object", - "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.", + "description": "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { - "description": "Always `file_path`.", "type": "string", "enum": [ - "file_path" + "conversation.item.truncated" ], + "description": "The event type, must be `conversation.item.truncated`.", "x-stainless-const": true }, - "text": { - "description": "The text in the message content that needs to be replaced.", - "type": "string" - }, - "file_path": { - "type": "object", - "properties": { - "file_id": { - "description": "The ID of the file that was generated.", - "type": "string" - } - }, - "required": [ - "file_id" - ] + "item_id": { + "type": "string", + "description": "The ID of the assistant message item that was truncated." }, - "start_index": { + "content_index": { "type": "integer", - "minimum": 0 + "description": "The index of the content part that was truncated." }, - "end_index": { + "audio_end_ms": { "type": "integer", - "minimum": 0 + "description": "The duration up to which the audio was truncated, in milliseconds.\n" } }, "required": [ + "event_id", "type", - "text", - "file_path", - "start_index", - "end_index" - ] + "item_id", + "content_index", + "audio_end_ms" + ], + "x-oaiMeta": { + "name": "conversation.item.truncated", + "group": "realtime", + "example": "{\n \"event_id\": \"event_2526\",\n \"type\": \"conversation.item.truncated\",\n \"item_id\": \"msg_004\",\n \"content_index\": 0,\n \"audio_end_ms\": 1500\n}\n" + } }, - "MessageContentTextObject": { - "title": "Text", + "RealtimeServerEventError": { "type": "object", - "description": "The text content that is part of a message.", + "description": "Returned when an error occurs, which could be a client problem or a server\nproblem. Most errors are recoverable and the session will stay open, we\nrecommend to implementers to monitor and log error messages by default.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { - "description": "Always `text`.", "type": "string", "enum": [ - "text" + "error" ], + "description": "The event type, must be `error`.", "x-stainless-const": true }, - "text": { + "error": { "type": "object", + "description": "Details of the error.", + "required": [ + "type", + "message" + ], "properties": { - "value": { - "description": "The data that makes up the text.", - "type": "string" + "type": { + "type": "string", + "description": "The type of error (e.g., \"invalid_request_error\", \"server_error\").\n" }, - "annotations": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageContentTextAnnotationsFileCitationObject" - }, - { - "$ref": "#/components/schemas/MessageContentTextAnnotationsFilePathObject" - } - ] - } + "code": { + "anyOf": [ + { + "type": "string", + "description": "Error code, if any." + }, + { + "type": "null" + } + ] + }, + "message": { + "type": "string", + "description": "A human-readable error message." + }, + "param": { + "anyOf": [ + { + "type": "string", + "description": "Parameter related to the error, if any." + }, + { + "type": "null" + } + ] + }, + "event_id": { + "anyOf": [ + { + "type": "string", + "description": "The event_id of the client event that caused the error, if applicable.\n" + }, + { + "type": "null" + } + ] } - }, - "required": [ - "value", - "annotations" - ] + } } }, "required": [ + "event_id", "type", - "text" - ] + "error" + ], + "x-oaiMeta": { + "name": "error", + "group": "realtime", + "example": "{\n \"event_id\": \"event_890\",\n \"type\": \"error\",\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"code\": \"invalid_event\",\n \"message\": \"The 'type' field is missing.\",\n \"param\": null,\n \"event_id\": \"event_567\"\n }\n}\n" + } }, - "MessageDeltaContentImageFileObject": { - "title": "Image file", + "RealtimeServerEventInputAudioBufferCleared": { "type": "object", - "description": "References an image [File](https://developers.openai.com/api/reference/resources/files) in the content of a message.", + "description": "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n", "properties": { - "index": { - "type": "integer", - "description": "The index of the content part in the message." + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, "type": { - "description": "Always `image_file`.", "type": "string", "enum": [ - "image_file" + "input_audio_buffer.cleared" ], + "description": "The event type, must be `input_audio_buffer.cleared`.", "x-stainless-const": true - }, - "image_file": { - "type": "object", - "properties": { - "file_id": { - "description": "The [File](https://developers.openai.com/api/reference/resources/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content.", - "type": "string" - }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" - } - } } }, "required": [ - "index", + "event_id", "type" - ] + ], + "x-oaiMeta": { + "name": "input_audio_buffer.cleared", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1314\",\n \"type\": \"input_audio_buffer.cleared\"\n}\n" + } }, - "MessageDeltaContentImageUrlObject": { - "title": "Image URL", + "RealtimeServerEventInputAudioBufferCommitted": { "type": "object", - "description": "References an image URL in the content of a message.", + "description": "Returned when an input audio buffer is committed, either by the client or\nautomatically in server VAD mode. The `item_id` property is the ID of the user\nmessage item that will be created, thus a `conversation.item.created` event\nwill also be sent to the client.\n", "properties": { - "index": { - "type": "integer", - "description": "The index of the content part in the message." + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, "type": { - "description": "Always `image_url`.", "type": "string", "enum": [ - "image_url" + "input_audio_buffer.committed" ], + "description": "The event type, must be `input_audio_buffer.committed`.", "x-stainless-const": true }, - "image_url": { - "type": "object", - "properties": { - "url": { - "description": "The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.", + "previous_item_id": { + "anyOf": [ + { "type": "string", - "format": "uri" + "description": "The ID of the preceding item after which the new item will be inserted.\nCan be `null` if the item has no predecessor.\n" }, - "detail": { - "type": "string", - "description": "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`.", - "enum": [ - "auto", - "low", - "high" - ], - "default": "auto" + { + "type": "null" } - } + ] + }, + "item_id": { + "type": "string", + "description": "The ID of the user message item that will be created." } }, "required": [ - "index", - "type" - ] + "event_id", + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.committed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1121\",\n \"type\": \"input_audio_buffer.committed\",\n \"previous_item_id\": \"msg_001\",\n \"item_id\": \"msg_002\"\n}\n" + } }, - "MessageDeltaContentRefusalObject": { - "title": "Refusal", + "RealtimeServerEventInputAudioBufferDtmfEventReceived": { "type": "object", - "description": "The refusal content that is part of a message.", + "description": "**SIP Only:** Returned when an DTMF event is received. A DTMF event is a message that\nrepresents a telephone keypad press (0–9, *, #, A–D). The `event` property\nis the keypad that the user press. The `received_at` is the UTC Unix Timestamp\nthat the server received the event.\n", "properties": { - "index": { - "type": "integer", - "description": "The index of the refusal part in the message." - }, "type": { - "description": "Always `refusal`.", "type": "string", "enum": [ - "refusal" + "input_audio_buffer.dtmf_event_received" ], + "description": "The event type, must be `input_audio_buffer.dtmf_event_received`.", "x-stainless-const": true }, - "refusal": { - "type": "string" + "event": { + "type": "string", + "description": "The telephone keypad that was pressed by the user." + }, + "received_at": { + "type": "integer", + "description": "UTC Unix Timestamp when DTMF Event was received by server.\n" } }, "required": [ - "index", - "type" - ] + "type", + "event", + "received_at" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.dtmf_event_received", + "group": "realtime", + "example": "{\n \"type\": \"input_audio_buffer.dtmf_event_received\",\n \"event\": \"9\",\n \"received_at\": 1763605109\n}\n" + } }, - "MessageDeltaContentTextAnnotationsFileCitationObject": { - "title": "File citation", + "RealtimeServerEventInputAudioBufferSpeechStarted": { "type": "object", - "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files.", + "description": "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n", "properties": { - "index": { - "type": "integer", - "description": "The index of the annotation in the text content part." + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, "type": { - "description": "Always `file_citation`.", "type": "string", "enum": [ - "file_citation" + "input_audio_buffer.speech_started" ], + "description": "The event type, must be `input_audio_buffer.speech_started`.", "x-stainless-const": true }, - "text": { - "description": "The text in the message content that needs to be replaced.", - "type": "string" - }, - "file_citation": { - "type": "object", - "properties": { - "file_id": { - "description": "The ID of the specific File the citation is from.", - "type": "string" - }, - "quote": { - "description": "The specific quote in the file.", - "type": "string" - } - } - }, - "start_index": { + "audio_start_ms": { "type": "integer", - "minimum": 0 + "description": "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n" }, - "end_index": { - "type": "integer", - "minimum": 0 + "item_id": { + "type": "string", + "description": "The ID of the user message item that will be created when speech stops.\n" } }, "required": [ - "index", - "type" - ] + "event_id", + "type", + "audio_start_ms", + "item_id" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.speech_started", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1516\",\n \"type\": \"input_audio_buffer.speech_started\",\n \"audio_start_ms\": 1000,\n \"item_id\": \"msg_003\"\n}\n" + } }, - "MessageDeltaContentTextAnnotationsFilePathObject": { - "title": "File path", + "RealtimeServerEventInputAudioBufferSpeechStopped": { "type": "object", - "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.", + "description": "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n", "properties": { - "index": { - "type": "integer", - "description": "The index of the annotation in the text content part." + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, "type": { - "description": "Always `file_path`.", "type": "string", "enum": [ - "file_path" + "input_audio_buffer.speech_stopped" ], + "description": "The event type, must be `input_audio_buffer.speech_stopped`.", "x-stainless-const": true }, - "text": { - "description": "The text in the message content that needs to be replaced.", - "type": "string" - }, - "file_path": { - "type": "object", - "properties": { - "file_id": { - "description": "The ID of the file that was generated.", - "type": "string" - } - } - }, - "start_index": { + "audio_end_ms": { "type": "integer", - "minimum": 0 + "description": "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n" }, - "end_index": { - "type": "integer", - "minimum": 0 + "item_id": { + "type": "string", + "description": "The ID of the user message item that will be created." } }, "required": [ - "index", - "type" - ] + "event_id", + "type", + "audio_end_ms", + "item_id" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.speech_stopped", + "group": "realtime", + "example": "{\n \"event_id\": \"event_1718\",\n \"type\": \"input_audio_buffer.speech_stopped\",\n \"audio_end_ms\": 2000,\n \"item_id\": \"msg_003\"\n}\n" + } }, - "MessageDeltaContentTextObject": { - "title": "Text", + "RealtimeServerEventInputAudioBufferTimeoutTriggered": { "type": "object", - "description": "The text content that is part of a message.", + "description": "Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured\nwith `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that\nthere hasn't been any speech detected for the configured duration.\n\nThe `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last\nmodel response up to the triggering time, as an offset from the beginning of audio written\nto the input audio buffer. This means it demarcates the segment of audio that was silent and\nthe difference between the start and end values will roughly match the configured timeout.\n\nThe empty audio will be committed to the conversation as an `input_audio` item (there will be a\n`input_audio_buffer.committed` event) and a model response will be generated. There may be speech\nthat didn't trigger VAD but is still detected by the model, so the model may respond with\nsomething relevant to the conversation or a prompt to continue speaking.\n", "properties": { - "index": { - "type": "integer", - "description": "The index of the content part in the message." + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, "type": { - "description": "Always `text`.", "type": "string", "enum": [ - "text" + "input_audio_buffer.timeout_triggered" ], + "description": "The event type, must be `input_audio_buffer.timeout_triggered`.", "x-stainless-const": true }, - "text": { - "type": "object", - "properties": { - "value": { - "description": "The data that makes up the text.", - "type": "string" - }, - "annotations": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject" - }, - { - "$ref": "#/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject" - } - ] - } - } - } + "audio_start_ms": { + "type": "integer", + "description": "Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response." + }, + "audio_end_ms": { + "type": "integer", + "description": "Millisecond offset of audio written to the input audio buffer at the time the timeout was triggered." + }, + "item_id": { + "type": "string", + "description": "The ID of the item associated with this segment." } }, "required": [ - "index", - "type" - ] + "event_id", + "type", + "audio_start_ms", + "audio_end_ms", + "item_id" + ], + "x-oaiMeta": { + "name": "input_audio_buffer.timeout_triggered", + "group": "realtime", + "example": "{\n \"type\":\"input_audio_buffer.timeout_triggered\",\n \"event_id\":\"event_CEKKrf1KTGvemCPyiJTJ2\",\n \"audio_start_ms\":13216,\n \"audio_end_ms\":19232,\n \"item_id\":\"item_CEKKrWH0GiwN0ET97NUZc\"\n}\n" + } }, - "MessageDeltaObject": { + "RealtimeServerEventMCPListToolsCompleted": { "type": "object", - "title": "Message delta object", - "description": "Represents a message delta i.e. any changed fields on a message during streaming.\n", + "description": "Returned when listing MCP tools has completed for an item.", "properties": { - "id": { - "description": "The identifier of the message, which can be referenced in API endpoints.", - "type": "string" + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - "object": { - "description": "The object type, which is always `thread.message.delta`.", + "type": { "type": "string", "enum": [ - "thread.message.delta" + "mcp_list_tools.completed" ], + "description": "The event type, must be `mcp_list_tools.completed`.", "x-stainless-const": true }, - "delta": { - "description": "The delta containing the fields that have changed on the Message.", - "type": "object", - "properties": { - "role": { - "description": "The entity that produced the message. One of `user` or `assistant`.", - "type": "string", - "enum": [ - "user", - "assistant" - ] - }, - "content": { - "description": "The content of the message in array of text and/or images.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageDeltaContentImageFileObject" - }, - { - "$ref": "#/components/schemas/MessageDeltaContentTextObject" - }, - { - "$ref": "#/components/schemas/MessageDeltaContentRefusalObject" - }, - { - "$ref": "#/components/schemas/MessageDeltaContentImageUrlObject" - } - ] - } - } - } + "item_id": { + "type": "string", + "description": "The ID of the MCP list tools item." } }, "required": [ - "id", - "object", - "delta" + "event_id", + "type", + "item_id" ], "x-oaiMeta": { - "name": "The message delta object", - "beta": true, - "example": "{\n \"id\": \"msg_123\",\n \"object\": \"thread.message.delta\",\n \"delta\": {\n \"content\": [\n {\n \"index\": 0,\n \"type\": \"text\",\n \"text\": { \"value\": \"Hello\", \"annotations\": [] }\n }\n ]\n }\n}\n" + "name": "mcp_list_tools.completed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6102\",\n \"type\": \"mcp_list_tools.completed\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" } }, - "MessageObject": { + "RealtimeServerEventMCPListToolsFailed": { "type": "object", - "title": "The message object", - "description": "Represents a message within a [thread](https://developers.openai.com/api/docs/assistants/migration).", + "description": "Returned when listing MCP tools has failed for an item.", "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - "object": { - "description": "The object type, which is always `thread.message`.", + "type": { "type": "string", "enum": [ - "thread.message" + "mcp_list_tools.failed" ], + "description": "The event type, must be `mcp_list_tools.failed`.", "x-stainless-const": true }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the message was created.", - "type": "integer", - "format": "unixtime" - }, - "thread_id": { - "description": "The [thread](https://developers.openai.com/api/docs/assistants/migration) ID that this message belongs to.", - "type": "string" - }, - "status": { - "description": "The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.", - "type": "string", - "enum": [ - "in_progress", - "incomplete", - "completed" - ] - }, - "incomplete_details": { - "anyOf": [ - { - "description": "On an incomplete message, details about why the message is incomplete.", - "type": "object", - "properties": { - "reason": { - "type": "string", - "description": "The reason the message is incomplete.", - "enum": [ - "content_filter", - "max_tokens", - "run_cancelled", - "run_expired", - "run_failed" - ] - } - }, - "required": [ - "reason" - ] - }, - { - "type": "null" - } - ] - }, - "completed_at": { - "anyOf": [ - { - "description": "The Unix timestamp (in seconds) for when the message was completed.", - "type": "integer", - "format": "unixtime" - }, - { - "type": "null" - } - ] - }, - "incomplete_at": { - "anyOf": [ - { - "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", - "type": "integer", - "format": "unixtime" - }, - { - "type": "null" - } - ] - }, - "role": { - "description": "The entity that produced the message. One of `user` or `assistant`.", + "item_id": { "type": "string", - "enum": [ - "user", - "assistant" - ] - }, - "content": { - "description": "The content of the message in array of text and/or images.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/MessageContentImageFileObject" - }, - { - "$ref": "#/components/schemas/MessageContentImageUrlObject" - }, - { - "$ref": "#/components/schemas/MessageContentTextObject" - }, - { - "$ref": "#/components/schemas/MessageContentRefusalObject" - } - ] - } - }, - "assistant_id": { - "anyOf": [ - { - "description": "If applicable, the ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) that authored this message.", - "type": "string" - }, - { - "type": "null" - } - ] - }, - "run_id": { - "anyOf": [ - { - "description": "The ID of the [run](https://developers.openai.com/api/docs/assistants/migration) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints.", - "type": "string" - }, - { - "type": "null" - } - ] - }, - "attachments": { - "anyOf": [ - { - "type": "array", - "items": { - "type": "object", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file to attach to the message." - }, - "tools": { - "description": "The tools to add this file to.", - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearchTypeOnly" - } - ] - } - } - } - }, - "description": "A list of files attached to the message, and the tools they were added to." - }, - { - "type": "null" - } - ] + "description": "The ID of the MCP list tools item." + } + }, + "required": [ + "event_id", + "type", + "item_id" + ], + "x-oaiMeta": { + "name": "mcp_list_tools.failed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6103\",\n \"type\": \"mcp_list_tools.failed\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" + } + }, + "RealtimeServerEventMCPListToolsInProgress": { + "type": "object", + "description": "Returned when listing MCP tools is in progress for an item.", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "type": { + "type": "string", + "enum": [ + "mcp_list_tools.in_progress" + ], + "description": "The event type, must be `mcp_list_tools.in_progress`.", + "x-stainless-const": true + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP list tools item." } }, "required": [ - "id", - "object", - "created_at", - "thread_id", - "status", - "incomplete_details", - "completed_at", - "incomplete_at", - "role", - "content", - "assistant_id", - "run_id", - "attachments", - "metadata" + "event_id", + "type", + "item_id" ], "x-oaiMeta": { - "name": "The message object", - "beta": true, - "example": "{\n \"id\": \"msg_abc123\",\n \"object\": \"thread.message\",\n \"created_at\": 1698983503,\n \"thread_id\": \"thread_abc123\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": {\n \"value\": \"Hi! How can I help you today?\",\n \"annotations\": []\n }\n }\n ],\n \"assistant_id\": \"asst_abc123\",\n \"run_id\": \"run_abc123\",\n \"attachments\": [],\n \"metadata\": {}\n}\n" + "name": "mcp_list_tools.in_progress", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6101\",\n \"type\": \"mcp_list_tools.in_progress\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" } }, - "MessagePhase": { - "type": "string", - "description": "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`).\nFor models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend\nphase on all assistant messages — dropping it can degrade performance. Not used for user messages.\n", - "enum": [ - "commentary", - "final_answer" - ] - }, - "MessageRequestContentTextObject": { - "title": "Text", + "RealtimeServerEventOutputAudioBufferCleared": { "type": "object", - "description": "The text content that is part of a message.", + "description": "**WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. This happens either in VAD\nmode when the user has interrupted (`input_audio_buffer.speech_started`),\nor when the client has emitted the `output_audio_buffer.clear` event to manually\ncut off the current audio response.\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { - "description": "Always `text`.", "type": "string", "enum": [ - "text" + "output_audio_buffer.cleared" ], + "description": "The event type, must be `output_audio_buffer.cleared`.", "x-stainless-const": true }, - "text": { + "response_id": { "type": "string", - "description": "Text content to be sent to the model" + "description": "The unique ID of the response that produced the audio." } }, "required": [ + "event_id", "type", - "text" - ] + "response_id" + ], + "x-oaiMeta": { + "name": "output_audio_buffer.cleared", + "group": "realtime", + "example": "{\n \"event_id\": \"event_abc123\",\n \"type\": \"output_audio_buffer.cleared\",\n \"response_id\": \"resp_abc123\"\n}\n" + } }, - "MessageStreamEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.created" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) is created.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)" - } + "RealtimeServerEventOutputAudioBufferStarted": { + "type": "object", + "description": "**WebRTC/SIP Only:** Emitted when the server begins streaming audio to the client. This event is\nemitted after an audio content part has been added (`response.content_part.added`)\nto the response.\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.in_progress" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "required": [ - "event", - "data" + "type": { + "type": "string", + "enum": [ + "output_audio_buffer.started" ], - "description": "Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` state.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)" - } + "description": "The event type, must be `output_audio_buffer.started`.", + "x-stainless-const": true }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.delta" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/MessageDeltaObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when parts of a [Message](https://developers.openai.com/api/docs/assistants/migration) are being streamed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message delta](https://developers.openai.com/api/docs/assistants/migration)" - } + "response_id": { + "type": "string", + "description": "The unique ID of the response that produced the audio." + } + }, + "required": [ + "event_id", + "type", + "response_id" + ], + "x-oaiMeta": { + "name": "output_audio_buffer.started", + "group": "realtime", + "example": "{\n \"event_id\": \"event_abc123\",\n \"type\": \"output_audio_buffer.started\",\n \"response_id\": \"resp_abc123\"\n}\n" + } + }, + "RealtimeServerEventOutputAudioBufferStopped": { + "type": "object", + "description": "**WebRTC/SIP Only:** Emitted when the output audio buffer has been completely drained on the server,\nand no more audio is forthcoming. This event is emitted after the full response\ndata has been sent to the client (`response.done`).\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.completed" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "required": [ - "event", - "data" + "type": { + "type": "string", + "enum": [ + "output_audio_buffer.stopped" ], - "description": "Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) is completed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)" - } + "description": "The event type, must be `output_audio_buffer.stopped`.", + "x-stainless-const": true }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.message.incomplete" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/MessageObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) ends before it is completed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)" - } + "response_id": { + "type": "string", + "description": "The unique ID of the response that produced the audio." } - ] + }, + "required": [ + "event_id", + "type", + "response_id" + ], + "x-oaiMeta": { + "name": "output_audio_buffer.stopped", + "group": "realtime", + "example": "{\n \"event_id\": \"event_abc123\",\n \"type\": \"output_audio_buffer.stopped\",\n \"response_id\": \"resp_abc123\"\n}\n" + } }, - "Metadata": { - "anyOf": [ - { - "type": "object", - "description": "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n", - "additionalProperties": { - "type": "string" - }, - "x-oaiTypeLabel": "map" + "RealtimeServerEventRateLimitsUpdated": { + "type": "object", + "description": "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - { - "type": "null" + "type": { + "type": "string", + "enum": [ + "rate_limits.updated" + ], + "description": "The event type, must be `rate_limits.updated`.", + "x-stainless-const": true + }, + "rate_limits": { + "type": "array", + "description": "List of rate limit information.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "requests", + "tokens" + ], + "description": "The name of the rate limit (`requests`, `tokens`).\n" + }, + "limit": { + "type": "integer", + "description": "The maximum allowed value for the rate limit." + }, + "remaining": { + "type": "integer", + "description": "The remaining value before the limit is reached." + }, + "reset_seconds": { + "type": "number", + "description": "Seconds until the rate limit resets." + } + } + } } - ] + }, + "required": [ + "event_id", + "type", + "rate_limits" + ], + "x-oaiMeta": { + "name": "rate_limits.updated", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5758\",\n \"type\": \"rate_limits.updated\",\n \"rate_limits\": [\n {\n \"name\": \"requests\",\n \"limit\": 1000,\n \"remaining\": 999,\n \"reset_seconds\": 60\n },\n {\n \"name\": \"tokens\",\n \"limit\": 50000,\n \"remaining\": 49950,\n \"reset_seconds\": 60\n }\n ]\n}\n" + } }, - "Model": { - "title": "Model", - "description": "Describes an OpenAI model offering that can be used with the API.", + "RealtimeServerEventResponseAudioDelta": { + "type": "object", + "description": "Returned when the model-generated audio is updated.", "properties": { - "id": { + "event_id": { "type": "string", - "description": "The model identifier, which can be referenced in the API endpoints." - }, - "created": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) when the model was created." + "description": "The unique ID of the server event." }, - "object": { + "type": { "type": "string", - "description": "The object type, which is always \"model\".", "enum": [ - "model" + "response.output_audio.delta" ], + "description": "The event type, must be `response.output_audio.delta`.", "x-stainless-const": true }, - "owned_by": { + "response_id": { "type": "string", - "description": "The organization that owns the model." + "description": "The ID of the response." }, - "shutdown_date": { - "anyOf": [ - { - "type": "string", - "format": "date" - }, - { - "type": "null" - } - ], - "description": "The date when the model will shut down, or null if not announced." + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "delta": { + "type": "string", + "description": "Base64-encoded audio data delta." } }, "required": [ - "id", - "object", - "created", - "owned_by" + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "delta" ], "x-oaiMeta": { - "name": "The model object", - "example": "{\n \"id\": \"gpt-6-astra\",\n \"object\": \"model\",\n \"created\": 1686935002,\n \"owned_by\": \"openai\",\n \"shutdown_date\": \"2026-10-23\"\n}\n" + "name": "response.output_audio.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4950\",\n \"type\": \"response.output_audio.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Base64EncodedAudioDelta\"\n}\n" } }, - "ModelIds": { - "anyOf": [ - { - "$ref": "#/components/schemas/ModelIdsShared" + "RealtimeServerEventResponseAudioDone": { + "type": "object", + "description": "Returned when the model-generated audio is done. Also emitted when a Response\nis interrupted, incomplete, or cancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - { - "$ref": "#/components/schemas/ModelIdsResponses" - } - ] - }, - "ModelIdsCompaction": { - "anyOf": [ - { - "$ref": "#/components/schemas/ModelIdsResponses" + "type": { + "type": "string", + "enum": [ + "response.output_audio.done" + ], + "description": "The event type, must be `response.output_audio.done`.", + "x-stainless-const": true }, - { - "type": "string" + "response_id": { + "type": "string", + "description": "The ID of the response." }, - { - "type": "null" + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index" ], - "description": "Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models." + "x-oaiMeta": { + "name": "response.output_audio.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5152\",\n \"type\": \"response.output_audio.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0\n}\n" + } }, - "ModelIdsLive": { - "description": "The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter.", - "example": "gpt-live-1", - "anyOf": [ - { + "RealtimeServerEventResponseAudioTranscriptDelta": { + "type": "object", + "description": "Returned when the model-generated transcription of audio output is updated.\n", + "properties": { + "event_id": { "type": "string", - "minLength": 1 + "description": "The unique ID of the server event." }, - { + "type": { "type": "string", "enum": [ - "gpt-live-1" - ] - } - ] - }, - "ModelIdsResponses": { - "example": "gpt-6-astra", - "anyOf": [ - { - "$ref": "#/components/schemas/ModelIdsShared" + "response.output_audio_transcript.delta" + ], + "description": "The event type, must be `response.output_audio_transcript.delta`.", + "x-stainless-const": true }, - { + "response_id": { "type": "string", - "title": "ResponsesOnlyModel", - "enum": [ - "o1-pro", - "o1-pro-2025-03-19", - "o3-pro", - "o3-pro-2025-06-10", - "o3-deep-research", - "o3-deep-research-2025-06-26", - "o4-mini-deep-research", - "o4-mini-deep-research-2025-06-26", - "computer-use-preview", - "computer-use-preview-2025-03-11", - "gpt-5.5-pro", - "gpt-5.5-pro-2026-04-23", - "gpt-5-codex", - "gpt-5-pro", - "gpt-5-pro-2025-10-06", - "gpt-5.1-codex-max", - "gpt-daybreak-blue-latest", - "gpt-daybreak-red-latest", - "gpt-5.6-cyber" - ] + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "delta": { + "type": "string", + "description": "The transcript delta." } - ] + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "delta" + ], + "x-oaiMeta": { + "name": "response.output_audio_transcript.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4546\",\n \"type\": \"response.output_audio_transcript.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Hello, how can I a\"\n}\n" + } }, - "ModelIdsShared": { - "example": "gpt-6-astra", - "anyOf": [ - { - "type": "string" + "RealtimeServerEventResponseAudioTranscriptDone": { + "type": "object", + "description": "Returned when the model-generated transcription of audio output is done\nstreaming. Also emitted when a Response is interrupted, incomplete, or\ncancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - { + "type": { "type": "string", "enum": [ - "gpt-6-astra", - "gpt-5.6-sol", - "gpt-5.6-terra", - "gpt-5.6-luna", - "gpt-5.5", - "gpt-5.5-2026-04-23", - "gpt-5.4", - "gpt-5.4-mini", - "gpt-5.4-nano", - "gpt-5.4-mini-2026-03-17", - "gpt-5.4-nano-2026-03-17", - "gpt-5.3-chat-latest", - "gpt-5.2", - "gpt-5.2-2025-12-11", - "gpt-5.2-chat-latest", - "gpt-5.2-pro", - "gpt-5.2-pro-2025-12-11", - "gpt-5.1", - "gpt-5.1-2025-11-13", - "gpt-5.1-codex", - "gpt-5.1-mini", - "gpt-5.1-chat-latest", - "gpt-5", - "gpt-5-mini", - "gpt-5-nano", - "gpt-5-2025-08-07", - "gpt-5-mini-2025-08-07", - "gpt-5-nano-2025-08-07", - "gpt-5-chat-latest", - "gpt-4.1", - "gpt-4.1-mini", - "gpt-4.1-nano", - "gpt-4.1-2025-04-14", - "gpt-4.1-mini-2025-04-14", - "gpt-4.1-nano-2025-04-14", - "o4-mini", - "o4-mini-2025-04-16", - "o3", - "o3-2025-04-16", - "o3-mini", - "o3-mini-2025-01-31", - "o1", - "o1-2024-12-17", - "o1-preview", - "o1-preview-2024-09-12", - "o1-mini", - "o1-mini-2024-09-12", - "gpt-4o", - "gpt-4o-2024-11-20", - "gpt-4o-2024-08-06", - "gpt-4o-2024-05-13", - "gpt-4o-audio-preview", - "gpt-4o-audio-preview-2024-10-01", - "gpt-4o-audio-preview-2024-12-17", - "gpt-4o-audio-preview-2025-06-03", - "gpt-4o-mini-audio-preview", - "gpt-4o-mini-audio-preview-2024-12-17", - "gpt-4o-search-preview", - "gpt-4o-mini-search-preview", - "gpt-4o-search-preview-2025-03-11", - "gpt-4o-mini-search-preview-2025-03-11", - "chatgpt-4o-latest", - "codex-mini-latest", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-1106-preview", - "gpt-4-vision-preview", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-3.5-turbo", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-0301", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k-0613" - ] + "response.output_audio_transcript.done" + ], + "description": "The event type, must be `response.output_audio_transcript.done`.", + "x-stainless-const": true + }, + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "transcript": { + "type": "string", + "description": "The final transcript of the audio." } - ] + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "transcript" + ], + "x-oaiMeta": { + "name": "response.output_audio_transcript.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4748\",\n \"type\": \"response.output_audio_transcript.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"transcript\": \"Hello, how can I assist you today?\"\n}\n" + } }, - "ModelResponseProperties": { + "RealtimeServerEventResponseContentPartAdded": { "type": "object", + "description": "Returned when a new content part is added to an assistant message item during\nresponse generation.\n", "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "top_logprobs": { - "anyOf": [ - { - "description": "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n", - "type": "integer", - "minimum": 0, - "maximum": 20 - }, - { - "type": "null" - } - ] + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - "temperature": { - "anyOf": [ - { - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1, - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n" - }, - { - "type": "null" - } - ] + "type": { + "type": "string", + "enum": [ + "response.content_part.added" + ], + "description": "The event type, must be `response.content_part.added`.", + "x-stainless-const": true }, - "top_p": { - "anyOf": [ - { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "description": "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" - }, - { - "type": "null" - } - ] + "response_id": { + "type": "string", + "description": "The ID of the response." }, - "user": { + "item_id": { "type": "string", - "example": "user-1234", - "deprecated": true, - "description": "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" + "description": "The ID of the item to which the content part was added." }, - "safety_identifier": { - "anyOf": [ - { - "type": "string", - "maxLength": 64, - "example": "safety-identifier-1234", - "description": "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" - }, - { - "type": "null" - } - ] + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." }, - "prompt_cache_key": { - "anyOf": [ - { - "type": "string", - "example": "prompt-cache-key-1234", - "description": "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching).\n" - }, - { - "type": "null" - } - ] + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." }, - "prompt_cache_retention": { - "deprecated": true, - "anyOf": [ - { + "part": { + "type": "object", + "description": "The content part that was added.", + "properties": { + "type": { "type": "string", "enum": [ - "in_memory", - "24h" + "audio", + "text" ], - "description": "Deprecated. Use `prompt_cache_options.ttl` instead.\n\nThe retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention).\nThis field expresses a maximum retention policy, while\n`prompt_cache_options.ttl` expresses a minimum cache lifetime. The two\nfields are independent and do not interact.\nFor `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported.\n\nFor older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy:\n - Organizations without ZDR enabled default to `24h`.\n - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified.\n" + "description": "The content type (\"text\", \"audio\")." }, - { - "type": "null" + "text": { + "type": "string", + "description": "The text content (if type is \"text\")." + }, + "audio": { + "type": "string", + "description": "Base64-encoded audio data (if type is \"audio\")." + }, + "transcript": { + "type": "string", + "description": "The transcript of the audio (if type is \"audio\")." } - ] + } } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "part" + ], + "x-oaiMeta": { + "name": "response.content_part.added", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3738\",\n \"type\": \"response.content_part.added\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"text\",\n \"text\": \"\"\n }\n}\n" } }, - "ModifyAssistantRequest": { + "RealtimeServerEventResponseContentPartDone": { "type": "object", - "additionalProperties": false, + "description": "Returned when a content part is done streaming in an assistant message item.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n", "properties": { - "model": { - "description": "ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them.\n", - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/components/schemas/AssistantSupportedModels" - } - ] - }, - "reasoning_effort": { - "$ref": "#/components/schemas/ReasoningEffort" - }, - "name": { - "anyOf": [ - { - "description": "The name of the assistant. The maximum length is 256 characters.\n", - "type": "string", - "maxLength": 256 - }, - { - "type": "null" - } - ] + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - "description": { - "anyOf": [ - { - "description": "The description of the assistant. The maximum length is 512 characters.\n", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "type": { + "type": "string", + "enum": [ + "response.content_part.done" + ], + "description": "The event type, must be `response.content_part.done`.", + "x-stainless-const": true }, - "instructions": { - "anyOf": [ - { - "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n", - "type": "string", - "maxLength": 256000 - }, - { - "type": "null" - } - ] + "response_id": { + "type": "string", + "description": "The ID of the response." }, - "tools": { - "description": "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n", - "default": [], - "type": "array", - "maxItems": 128, - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ] - } + "item_id": { + "type": "string", + "description": "The ID of the item." }, - "tool_resources": { - "anyOf": [ - { - "type": "object", - "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "Overrides the list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "Overrides the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "null" - } - ] + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." }, - "temperature": { - "anyOf": [ - { - "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n", - "type": "number", - "minimum": 0, - "maximum": 2, - "default": 1, - "example": 1 + "part": { + "type": "object", + "description": "The content part that is done.", + "properties": { + "type": { + "type": "string", + "enum": [ + "audio", + "text" + ], + "description": "The content type (\"text\", \"audio\")." }, - { - "type": "null" - } - ] - }, - "top_p": { - "anyOf": [ - { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1, - "example": 1, - "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n" + "text": { + "type": "string", + "description": "The text content (if type is \"text\")." }, - { - "type": "null" - } - ] - }, - "response_format": { - "anyOf": [ - { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption" + "audio": { + "type": "string", + "description": "Base64-encoded audio data (if type is \"audio\")." }, - { - "type": "null" + "transcript": { + "type": "string", + "description": "The transcript of the audio (if type is \"audio\")." } - ] + } } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "part" + ], + "x-oaiMeta": { + "name": "response.content_part.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3940\",\n \"type\": \"response.content_part.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"text\",\n \"text\": \"Sure, I can help with that.\"\n }\n}\n" } }, - "ModifyCertificateRequest": { + "RealtimeServerEventResponseCreated": { "type": "object", + "description": "Returned when a new Response is created. The first event of response creation,\nwhere the response is in an initial state of `in_progress`.\n", "properties": { - "name": { + "event_id": { "type": "string", - "description": "The updated name for the certificate" - } - } - }, - "ModifyMessageRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.created" + ], + "description": "The event type, must be `response.created`.", + "x-stainless-const": true + }, + "response": { + "$ref": "#/components/schemas/RealtimeResponse" } + }, + "required": [ + "event_id", + "type", + "response" + ], + "x-oaiMeta": { + "name": "response.created", + "group": "realtime", + "example": "{\n \"type\": \"response.created\",\n \"event_id\": \"event_C9G8pqbTEddBSIxbBN6Os\",\n \"response\": {\n \"object\": \"realtime.response\",\n \"id\": \"resp_C9G8p7IH2WxLbkgPNouYL\",\n \"status\": \"in_progress\",\n \"status_details\": null,\n \"output\": [],\n \"conversation_id\": \"conv_C9G8mmBkLhQJwCon3hoJN\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"max_output_tokens\": \"inf\",\n \"audio\": {\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"marin\"\n }\n },\n \"usage\": null,\n \"metadata\": null\n }\n}\n" } }, - "ModifyRunRequest": { + "RealtimeServerEventResponseDone": { "type": "object", - "additionalProperties": false, + "description": "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n\nClients should check the `status` field of the Response to determine if it was successful\n(`completed`) or if there was another outcome: `cancelled`, `failed`, or `incomplete`.\n\nA response will contain all output items that were generated during the response, excluding\nany audio content.\n", "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "response.done" + ], + "description": "The event type, must be `response.done`.", + "x-stainless-const": true + }, + "response": { + "$ref": "#/components/schemas/RealtimeResponse" } + }, + "required": [ + "event_id", + "type", + "response" + ], + "x-oaiMeta": { + "name": "response.done", + "group": "realtime", + "example": "{\n \"type\": \"response.done\",\n \"event_id\": \"event_CCXHxcMy86rrKhBLDdqCh\",\n \"response\": {\n \"object\": \"realtime.response\",\n \"id\": \"resp_CCXHw0UJld10EzIUXQCNh\",\n \"status\": \"completed\",\n \"status_details\": null,\n \"output\": [\n {\n \"id\": \"item_CCXHwGjjDUfOXbiySlK7i\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_audio\",\n \"transcript\": \"Loud and clear! I can hear you perfectly. How can I help you today?\"\n }\n ]\n }\n ],\n \"conversation_id\": \"conv_CCXHsurMKcaVxIZvaCI5m\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"max_output_tokens\": \"inf\",\n \"audio\": {\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"alloy\"\n }\n },\n \"usage\": {\n \"total_tokens\": 253,\n \"input_tokens\": 132,\n \"output_tokens\": 121,\n \"input_token_details\": {\n \"text_tokens\": 119,\n \"audio_tokens\": 13,\n \"image_tokens\": 0,\n \"cached_tokens\": 64,\n \"cached_tokens_details\": {\n \"text_tokens\": 64,\n \"audio_tokens\": 0,\n \"image_tokens\": 0\n }\n },\n \"output_token_details\": {\n \"text_tokens\": 30,\n \"audio_tokens\": 91\n }\n },\n \"metadata\": null\n }\n}\n" } }, - "ModifyThreadRequest": { + "RealtimeServerEventResponseFunctionCallArgumentsDelta": { "type": "object", - "additionalProperties": false, + "description": "Returned when the model-generated function call arguments are updated.\n", "properties": { - "tool_resources": { - "anyOf": [ - { - "type": "object", - "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } - }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "null" - } - ] + "event_id": { + "type": "string", + "description": "The unique ID of the server event." }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - } - } - }, - "NoiseReductionType": { - "type": "string", - "enum": [ - "near_field", - "far_field" - ], - "description": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n" - }, - "OpenAIFile": { - "title": "OpenAIFile", - "description": "The `File` object represents a document that has been uploaded to OpenAI.", - "properties": { - "id": { + "type": { "type": "string", - "description": "The file identifier, which can be referenced in the API endpoints." + "enum": [ + "response.function_call_arguments.delta" + ], + "description": "The event type, must be `response.function_call_arguments.delta`.\n", + "x-stainless-const": true }, - "bytes": { - "type": "integer", - "description": "The size of the file, in bytes." + "response_id": { + "type": "string", + "description": "The ID of the response." }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the file was created." + "item_id": { + "type": "string", + "description": "The ID of the function call item." }, - "expires_at": { + "output_index": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the file will expire." + "description": "The index of the output item in the response." }, - "filename": { + "call_id": { "type": "string", - "description": "The name of the file." + "description": "The ID of the function call." }, - "object": { + "delta": { + "type": "string", + "description": "The arguments delta as a JSON string." + } + }, + "required": [ + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "call_id", + "delta" + ], + "x-oaiMeta": { + "name": "response.function_call_arguments.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5354\",\n \"type\": \"response.function_call_arguments.delta\",\n \"response_id\": \"resp_002\",\n \"item_id\": \"fc_001\",\n \"output_index\": 0,\n \"call_id\": \"call_001\",\n \"delta\": \"{\\\"location\\\": \\\"San\\\"\"\n}\n" + } + }, + "RealtimeServerEventResponseFunctionCallArgumentsDone": { + "type": "object", + "description": "Returned when the model-generated function call arguments are done streaming.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n", + "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", - "description": "The object type, which is always `file`.", "enum": [ - "file" + "response.function_call_arguments.done" ], + "description": "The event type, must be `response.function_call_arguments.done`.\n", "x-stainless-const": true }, - "purpose": { + "response_id": { "type": "string", - "description": "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.", - "enum": [ - "assistants", - "assistants_output", - "batch", - "batch_output", - "fine-tune", - "fine-tune-results", - "vision", - "user_data" - ] + "description": "The ID of the response." }, - "status": { + "item_id": { "type": "string", - "deprecated": true, - "description": "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.", - "enum": [ - "uploaded", - "processed", - "error" - ] + "description": "The ID of the function call item." }, - "status_details": { + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "call_id": { "type": "string", - "deprecated": true, - "description": "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`." + "description": "The ID of the function call." + }, + "name": { + "type": "string", + "description": "The name of the function that was called." + }, + "arguments": { + "type": "string", + "description": "The final arguments as a JSON string." } }, "required": [ - "id", - "object", - "bytes", - "created_at", - "filename", - "purpose", - "status" + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "call_id", + "name", + "arguments" ], "x-oaiMeta": { - "name": "The file object", - "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"file\",\n \"bytes\": 120000,\n \"created_at\": 1677610602,\n \"expires_at\": 1680202602,\n \"filename\": \"salesOverview.pdf\",\n \"purpose\": \"assistants\",\n}\n" + "name": "response.function_call_arguments.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5556\",\n \"type\": \"response.function_call_arguments.done\",\n \"response_id\": \"resp_002\",\n \"item_id\": \"fc_001\",\n \"output_index\": 0,\n \"call_id\": \"call_001\",\n \"name\": \"get_weather\",\n \"arguments\": \"{\\\"location\\\": \\\"San Francisco\\\"}\"\n}\n" } }, - "OrganizationCertificate": { + "RealtimeServerEventResponseMCPCallArgumentsDelta": { "type": "object", - "description": "Represents an individual certificate configured at the organization level.", + "description": "Returned when MCP tool call arguments are updated during response generation.", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "organization.certificate" + "response.mcp_call_arguments.delta" ], - "description": "The object type, which is always `organization.certificate`.", + "description": "The event type, must be `response.mcp_call_arguments.delta`.", "x-stainless-const": true }, - "id": { + "response_id": { "type": "string", - "description": "The identifier, which can be referenced in API endpoints" + "description": "The ID of the response." }, - "name": { + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "delta": { + "type": "string", + "description": "The JSON-encoded arguments delta." + }, + "obfuscation": { "anyOf": [ { - "type": "string" + "type": "string", + "description": "If present, indicates the delta text was obfuscated." }, { "type": "null" } - ], - "description": "The name of the certificate." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate was uploaded." - }, - "certificate_details": { - "type": "object", - "properties": { - "valid_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate becomes valid." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate expires." - } - } - }, - "active": { - "type": "boolean", - "description": "Whether the certificate is currently active at the organization level." + ] } }, "required": [ - "object", - "id", - "name", - "created_at", - "certificate_details", - "active" - ] + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "delta" + ], + "x-oaiMeta": { + "name": "response.mcp_call_arguments.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6201\",\n \"type\": \"response.mcp_call_arguments.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"mcp_call_001\",\n \"output_index\": 0,\n \"delta\": \"{\\\"partial\\\":true}\"\n}\n" + } }, - "OrganizationCertificateActivationResponse": { + "RealtimeServerEventResponseMCPCallArgumentsDone": { "type": "object", + "description": "Returned when MCP tool call arguments are finalized during response generation.", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "organization.certificate.activation" + "response.mcp_call_arguments.done" ], - "description": "The organization certificate activation result type.", + "description": "The event type, must be `response.mcp_call_arguments.done`.", "x-stainless-const": true }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OrganizationCertificate" - } + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "arguments": { + "type": "string", + "description": "The final JSON-encoded arguments string." } }, "required": [ - "object", - "data" - ] + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "arguments" + ], + "x-oaiMeta": { + "name": "response.mcp_call_arguments.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6202\",\n \"type\": \"response.mcp_call_arguments.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"mcp_call_001\",\n \"output_index\": 0,\n \"arguments\": \"{\\\"q\\\":\\\"docs\\\"}\"\n}\n" + } }, - "OrganizationCertificateDeactivationResponse": { + "RealtimeServerEventResponseMCPCallCompleted": { "type": "object", + "description": "Returned when an MCP tool call has completed successfully.", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "organization.certificate.deactivation" + "response.mcp_call.completed" ], - "description": "The organization certificate deactivation result type.", + "description": "The event type, must be `response.mcp_call.completed`.", "x-stainless-const": true }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OrganizationCertificate" - } + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." } }, "required": [ - "object", - "data" - ] + "event_id", + "type", + "output_index", + "item_id" + ], + "x-oaiMeta": { + "name": "response.mcp_call.completed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6302\",\n \"type\": \"response.mcp_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" + } }, - "OrganizationDataRetention": { + "RealtimeServerEventResponseMCPCallFailed": { "type": "object", - "description": "Represents the organization's data retention control setting.", + "description": "Returned when an MCP tool call has failed.", "properties": { - "object": { + "event_id": { "type": "string", - "enum": [ - "organization.data_retention" - ], - "description": "The object type, which is always `organization.data_retention`.", - "x-stainless-const": true + "description": "The unique ID of the server event." }, "type": { "type": "string", "enum": [ - "zero_data_retention", - "modified_abuse_monitoring", - "enhanced_zero_data_retention", - "enhanced_modified_abuse_monitoring" + "response.mcp_call.failed" ], - "description": "The configured organization data retention type." + "description": "The event type, must be `response.mcp_call.failed`.", + "x-stainless-const": true + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." } }, "required": [ - "object", - "type" + "event_id", + "type", + "output_index", + "item_id" ], "x-oaiMeta": { - "name": "The organization data retention object", - "example": "{\n \"object\": \"organization.data_retention\",\n \"type\": \"modified_abuse_monitoring\"\n}\n" + "name": "response.mcp_call.failed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6303\",\n \"type\": \"response.mcp_call.failed\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" } }, - "OrganizationProjectCertificate": { + "RealtimeServerEventResponseMCPCallInProgress": { "type": "object", - "description": "Represents an individual certificate configured at the project level.", + "description": "Returned when an MCP tool call has started and is in progress.", "properties": { - "object": { + "event_id": { "type": "string", - "enum": [ - "organization.project.certificate" - ], - "description": "The object type, which is always `organization.project.certificate`.", - "x-stainless-const": true + "description": "The unique ID of the server event." }, - "id": { + "type": { "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "enum": [ + "response.mcp_call.in_progress" ], - "description": "The name of the certificate." + "description": "The event type, must be `response.mcp_call.in_progress`.", + "x-stainless-const": true }, - "created_at": { + "output_index": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate was uploaded." - }, - "certificate_details": { - "type": "object", - "properties": { - "valid_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate becomes valid." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the certificate expires." - } - } + "description": "The index of the output item in the response." }, - "active": { - "type": "boolean", - "description": "Whether the certificate is currently active at the project level." + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item." } }, "required": [ - "object", - "id", - "name", - "created_at", - "certificate_details", - "active" - ] + "event_id", + "type", + "output_index", + "item_id" + ], + "x-oaiMeta": { + "name": "response.mcp_call.in_progress", + "group": "realtime", + "example": "{\n \"event_id\": \"event_6301\",\n \"type\": \"response.mcp_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" + } }, - "OrganizationProjectCertificateActivationResponse": { + "RealtimeServerEventResponseOutputItemAdded": { "type": "object", + "description": "Returned when a new Item is created during Response generation.", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "organization.project.certificate.activation" + "response.output_item.added" ], - "description": "The project certificate activation result type.", + "description": "The event type, must be `response.output_item.added`.", "x-stainless-const": true }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OrganizationProjectCertificate" - } + "response_id": { + "type": "string", + "description": "The ID of the Response to which the item belongs." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the Response." + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" } }, "required": [ - "object", - "data" - ] + "event_id", + "type", + "response_id", + "output_index", + "item" + ], + "x-oaiMeta": { + "name": "response.output_item.added", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3334\",\n \"type\": \"response.output_item.added\",\n \"response_id\": \"resp_001\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_007\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"in_progress\",\n \"role\": \"assistant\",\n \"content\": []\n }\n}\n" + } }, - "OrganizationProjectCertificateDeactivationResponse": { + "RealtimeServerEventResponseOutputItemDone": { "type": "object", + "description": "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "organization.project.certificate.deactivation" + "response.output_item.done" ], - "description": "The project certificate deactivation result type.", + "description": "The event type, must be `response.output_item.done`.", "x-stainless-const": true }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OrganizationProjectCertificate" - } + "response_id": { + "type": "string", + "description": "The ID of the Response to which the item belongs." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the Response." + }, + "item": { + "$ref": "#/components/schemas/RealtimeConversationItem" } }, "required": [ - "object", - "data" - ] + "event_id", + "type", + "response_id", + "output_index", + "item" + ], + "x-oaiMeta": { + "name": "response.output_item.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_3536\",\n \"type\": \"response.output_item.done\",\n \"response_id\": \"resp_001\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_007\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"Sure, I can help with that.\"\n }\n ]\n }\n}\n" + } }, - "OrganizationSpendAlert": { + "RealtimeServerEventResponseTextDelta": { "type": "object", - "description": "Represents a spend alert configured at the organization level.", + "description": "Returned when the text value of an \"output_text\" content part is updated.", "properties": { - "id": { + "event_id": { "type": "string", - "description": "The identifier, which can be referenced in API endpoints." + "description": "The unique ID of the server event." }, - "object": { + "type": { "type": "string", "enum": [ - "organization.spend_alert" + "response.output_text.delta" ], - "description": "The object type, which is always `organization.spend_alert`.", + "description": "The event type, must be `response.output_text.delta`.", "x-stainless-const": true }, - "threshold_amount": { - "type": "integer", - "description": "The alert threshold amount, in cents." - }, - "currency": { + "response_id": { "type": "string", - "enum": [ - "USD" - ], - "description": "The currency for the threshold amount." + "description": "The ID of the response." }, - "interval": { + "item_id": { "type": "string", - "enum": [ - "month" - ], - "description": "The time interval for evaluating spend against the threshold." + "description": "The ID of the item." }, - "notification_channel": { - "$ref": "#/components/schemas/SpendAlertNotificationChannel" + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "delta": { + "type": "string", + "description": "The text delta." } }, "required": [ - "id", - "object", - "threshold_amount", - "currency", - "interval", - "notification_channel" + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "delta" ], "x-oaiMeta": { - "name": "The organization spend alert object", - "example": "{\n \"id\": \"alert_abc123\",\n \"object\": \"organization.spend_alert\",\n \"threshold_amount\": 100000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"notification_channel\": {\n \"type\": \"email\",\n \"recipients\": [\"finance@example.com\"],\n \"subject_prefix\": \"OpenAI spend alert\"\n }\n}\n" + "name": "response.output_text.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4142\",\n \"type\": \"response.output_text.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Sure, I can h\"\n}\n" } }, - "OrganizationSpendAlertDeletedResource": { + "RealtimeServerEventResponseTextDone": { "type": "object", - "description": "Confirmation payload returned after deleting an organization spend alert.", + "description": "Returned when the text value of an \"output_text\" content part is done streaming. Also\nemitted when a Response is interrupted, incomplete, or cancelled.\n", "properties": { - "id": { + "event_id": { "type": "string", - "description": "The deleted spend alert ID." + "description": "The unique ID of the server event." }, - "object": { + "type": { "type": "string", "enum": [ - "organization.spend_alert.deleted" + "response.output_text.done" ], - "description": "Always `organization.spend_alert.deleted`.", + "description": "The event type, must be `response.output_text.done`.", "x-stainless-const": true }, - "deleted": { - "type": "boolean", - "description": "Whether the spend alert was deleted." + "response_id": { + "type": "string", + "description": "The ID of the response." + }, + "item_id": { + "type": "string", + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response." + }, + "content_index": { + "type": "integer", + "description": "The index of the content part in the item's content array." + }, + "text": { + "type": "string", + "description": "The final text content." } }, "required": [ - "id", - "object", - "deleted" - ] + "event_id", + "type", + "response_id", + "item_id", + "output_index", + "content_index", + "text" + ], + "x-oaiMeta": { + "name": "response.output_text.done", + "group": "realtime", + "example": "{\n \"event_id\": \"event_4344\",\n \"type\": \"response.output_text.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"Sure, I can help with that.\"\n}\n" + } }, - "OrganizationSpendAlertListResource": { + "RealtimeServerEventSessionCreated": { "type": "object", - "description": "Paginated list of organization spend alerts.", + "description": "Returned when a Session is created. Emitted automatically when a new\nconnection is established as the first server event. This event will contain\nthe default Session configuration.\n", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "list" + "session.created" ], - "description": "Always `list`.", + "description": "The event type, must be `session.created`.", "x-stainless-const": true }, - "data": { - "type": "array", - "description": "Spend alerts returned in the current page.", - "items": { - "$ref": "#/components/schemas/OrganizationSpendAlert" - } - }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "The ID of the first spend alert in this page." - }, - "last_id": { - "anyOf": [ + "session": { + "description": "The session configuration.", + "oneOf": [ { - "type": "string" + "$ref": "#/components/schemas/RealtimeSessionCreateResponseGA" }, { - "type": "null" + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA" } - ], - "description": "The ID of the last spend alert in this page." - }, - "has_more": { - "type": "boolean", - "description": "Whether more spend alerts are available when paginating." + ] } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] + "event_id", + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.created", + "group": "realtime", + "example": "{\n \"type\": \"session.created\",\n \"event_id\": \"event_C9G5RJeJ2gF77mV7f2B1j\",\n \"session\": {\n \"type\": \"realtime\",\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9G5QPteg4UIbotdKLoYQ\",\n \"model\": \"gpt-realtime-2025-08-28\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"instructions\": \"Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.\",\n \"tools\": [],\n \"tool_choice\": \"auto\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": null,\n \"prompt\": null,\n \"expires_at\": 1756324625,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": null,\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200,\n \"idle_timeout_ms\": null,\n \"create_response\": true,\n \"interrupt_response\": true\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"marin\",\n \"speed\": 1\n }\n },\n \"include\": null\n }\n}\n" + } }, - "OtherChunkingStrategyResponseParam": { + "RealtimeServerEventSessionUpdated": { "type": "object", - "title": "Other Chunking Strategy", - "description": "This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.", - "additionalProperties": false, + "description": "Returned when a session is updated with a `session.update` event, unless\nthere is an error.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { "type": "string", - "description": "Always `other`.", "enum": [ - "other" + "session.updated" ], + "description": "The event type, must be `session.updated`.", "x-stainless-const": true + }, + "session": { + "description": "The session configuration.", + "oneOf": [ + { + "$ref": "#/components/schemas/RealtimeSessionCreateResponseGA" + }, + { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA" + } + ] } }, "required": [ - "type" - ] + "event_id", + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.updated", + "group": "realtime", + "example": "{\n \"type\": \"session.updated\",\n \"event_id\": \"event_C9G8mqI3IucaojlVKE8Cs\",\n \"session\": {\n \"type\": \"realtime\",\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9G8l3zp50uFv4qgxfJ8o\",\n \"model\": \"gpt-realtime-2025-08-28\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"instructions\": \"Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"display_color_palette\",\n \"description\": \"\\nCall this function when a user asks for a color palette.\\n\",\n \"parameters\": {\n \"type\": \"object\",\n \"strict\": true,\n \"properties\": {\n \"theme\": {\n \"type\": \"string\",\n \"description\": \"Description of the theme for the color scheme.\"\n },\n \"colors\": {\n \"type\": \"array\",\n \"description\": \"Array of five hex color codes based on the theme.\",\n \"items\": {\n \"type\": \"string\",\n \"description\": \"Hex color code\"\n }\n }\n },\n \"required\": [\n \"theme\",\n \"colors\"\n ]\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": null,\n \"prompt\": null,\n \"expires_at\": 1756324832,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": null,\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200,\n \"idle_timeout_ms\": null,\n \"create_response\": true,\n \"interrupt_response\": true\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"marin\",\n \"speed\": 1\n }\n },\n \"include\": null\n }\n}\n" + } }, - "OutputAudio": { + "RealtimeServerEventTranscriptionSessionUpdated": { "type": "object", - "title": "Output audio", - "description": "An audio output from the model.\n", + "description": "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n", "properties": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, "type": { "type": "string", - "description": "The type of the output audio. Always `output_audio`.\n", "enum": [ - "output_audio" + "transcription_session.updated" ], + "description": "The event type, must be `transcription_session.updated`.", "x-stainless-const": true }, - "data": { - "type": "string", - "description": "Base64-encoded audio data from the model.\n" - }, - "transcript": { - "type": "string", - "description": "The transcript of the audio data from the model.\n" + "session": { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponse" } }, "required": [ + "event_id", "type", - "data", - "transcript" - ] - }, - "OutputContent": { - "oneOf": [ - { - "$ref": "#/components/schemas/OutputTextContent" - }, - { - "$ref": "#/components/schemas/RefusalContent" - }, - { - "$ref": "#/components/schemas/ReasoningTextContent" - } + "session" ], - "discriminator": { - "propertyName": "type" + "x-oaiMeta": { + "name": "transcription_session.updated", + "group": "realtime", + "example": "{\n \"event_id\": \"event_5678\",\n \"type\": \"transcription_session.updated\",\n \"session\": {\n \"id\": \"sess_001\",\n \"object\": \"realtime.transcription_session\",\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500,\n \"create_response\": true,\n // \"interrupt_response\": false -- this will NOT be returned\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": [\n \"item.input_audio_transcription.avg_logprob\",\n ],\n }\n}\n" } }, - "OutputItem": { - "oneOf": [ - { - "$ref": "#/components/schemas/OutputMessage" - }, - { - "$ref": "#/components/schemas/FileSearchToolCall" - }, - { - "$ref": "#/components/schemas/FunctionToolCall" - }, - { - "$ref": "#/components/schemas/FunctionToolCallOutputResource" - }, - { - "$ref": "#/components/schemas/WebSearchToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCallOutputResource" - }, - { - "$ref": "#/components/schemas/ReasoningItem" - }, - { - "$ref": "#/components/schemas/Program" - }, - { - "$ref": "#/components/schemas/ProgramOutput" - }, - { - "$ref": "#/components/schemas/ToolSearchCall" - }, - { - "$ref": "#/components/schemas/ToolSearchOutput" - }, - { - "$ref": "#/components/schemas/AdditionalTools" - }, - { - "$ref": "#/components/schemas/CompactionBody" - }, - { - "$ref": "#/components/schemas/ImageGenToolCall" - }, - { - "$ref": "#/components/schemas/CodeInterpreterToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCallOutput" - }, - { - "$ref": "#/components/schemas/FunctionShellCall" - }, - { - "$ref": "#/components/schemas/FunctionShellCallOutput" - }, - { - "$ref": "#/components/schemas/ApplyPatchToolCall" - }, - { - "$ref": "#/components/schemas/ApplyPatchToolCallOutput" + "RealtimeSession": { + "type": "object", + "description": "Realtime session object for the beta interface.", + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" }, - { - "$ref": "#/components/schemas/MCPToolCall" + "object": { + "type": "string", + "enum": [ + "realtime.session" + ], + "description": "The object type. Always `realtime.session`." }, - { - "$ref": "#/components/schemas/MCPListTools" + "modalities": { + "type": "array", + "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } }, - { - "$ref": "#/components/schemas/MCPApprovalRequest" + "model": { + "description": "The Realtime model used for this session.\n", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "gpt-realtime", + "gpt-realtime-1.5", + "gpt-realtime-2025-08-28", + "gpt-4o-realtime-preview", + "gpt-4o-realtime-preview-2024-10-01", + "gpt-4o-realtime-preview-2024-12-17", + "gpt-4o-realtime-preview-2025-06-03", + "gpt-4o-mini-realtime-preview", + "gpt-4o-mini-realtime-preview-2024-12-17", + "gpt-realtime-mini", + "gpt-realtime-mini-2025-10-06", + "gpt-realtime-mini-2025-12-15", + "gpt-audio-1.5", + "gpt-audio-mini", + "gpt-audio-mini-2025-10-06", + "gpt-audio-mini-2025-12-15" + ], + "x-openai-enum-deprecations": { + "gpt-realtime-2025-08-28": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime-mini-2025-12-15": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini-2025-12-15": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime-mini": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } + } + ] }, - { - "$ref": "#/components/schemas/MCPApprovalResponseResource" + "instructions": { + "type": "string", + "description": "The default system instructions (i.e. system message) prepended to model\ncalls. This field allows the client to guide the model on desired\nresponses. The model can be instructed on response content and format,\n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good\nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion\ninto your voice\", \"laugh frequently\"). The instructions are not\nguaranteed to be followed by the model, but they provide guidance to the\nmodel on the desired behavior.\n\n\nNote that the server sets default instructions which will be used if this\nfield is not set and are visible in the `session.created` event at the\nstart of the session.\n" }, - { - "$ref": "#/components/schemas/CustomToolCall" + "voice": { + "$ref": "#/components/schemas/VoiceIdsShared", + "description": "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n" }, - { - "$ref": "#/components/schemas/CustomToolCallOutputResource" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "OutputMessage": { - "type": "object", - "title": "Output message", - "description": "An output message from the model.\n", - "properties": { - "id": { + "input_audio_format": { "type": "string", - "description": "The unique ID of the output message.\n" + "default": "pcm16", + "enum": [ + "pcm16", + "g711_ulaw", + "g711_alaw" + ], + "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n" }, - "type": { + "output_audio_format": { "type": "string", - "description": "The type of the output message. Always `message`.\n", + "default": "pcm16", "enum": [ - "message" + "pcm16", + "g711_ulaw", + "g711_alaw" ], - "x-stainless-const": true + "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, output audio is sampled at a rate of 24kHz.\n" + }, + "input_audio_transcription": { + "anyOf": [ + { + "allOf": [ + { + "$ref": "#/components/schemas/AudioTranscriptionResponse" + } + ], + "description": "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n" + }, + { + "type": "null" + } + ] }, - "role": { - "type": "string", - "description": "The role of the output message. Always `assistant`.\n", - "enum": [ - "assistant" - ], - "x-stainless-const": true + "turn_detection": { + "$ref": "#/components/schemas/RealtimeTurnDetection" }, - "content": { - "type": "array", - "description": "The content of the output message.\n", - "items": { - "$ref": "#/components/schemas/OutputMessageContent" + "input_audio_noise_reduction": { + "not": { + "type": [ + "array", + "string", + "number", + "boolean" + ] + }, + "default": null, + "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + } } }, - "phase": { + "speed": { + "type": "number", + "default": 1, + "maximum": 1.5, + "minimum": 0.25, + "description": "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n" + }, + "tracing": { "anyOf": [ { - "$ref": "#/components/schemas/MessagePhase" + "title": "Tracing Configuration", + "description": "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", + "oneOf": [ + { + "type": "string", + "default": "auto", + "description": "Default tracing mode for the session.\n", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "object", + "title": "Tracing Configuration", + "description": "Granular configuration for tracing.\n", + "properties": { + "workflow_name": { + "type": "string", + "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n" + }, + "group_id": { + "type": "string", + "description": "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n" + }, + "metadata": { + "type": "object", + "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n" + } + } + } + ] }, { "type": "null" } ] }, - "status": { - "type": "string", - "description": "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n", - "enum": [ - "in_progress", - "completed", - "incomplete" - ] - } - }, - "required": [ - "id", - "type", - "role", - "content", - "status" - ] - }, - "OutputMessageContent": { - "oneOf": [ - { - "$ref": "#/components/schemas/OutputTextContent" - }, - { - "$ref": "#/components/schemas/RefusalContent" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "ParallelToolCalls": { - "description": "Whether to enable [parallel function calling](https://developers.openai.com/api/docs/guides/function-calling#parallel-function-calling) during tool use.", - "type": "boolean", - "default": true - }, - "PartialImages": { - "anyOf": [ - { - "type": "integer", - "maximum": 3, - "minimum": 0, - "default": 0, - "example": 1, - "description": "The number of partial images to generate. This parameter is used for\nstreaming responses that return partial images. Value must be between 0 and 3.\nWhen set to 0, the response will be a single image sent in one streaming event.\n\nNote that the final image may be sent before the full number of partial images\nare generated if the full image is generated more quickly.\n" + "tools": { + "type": "array", + "description": "Tools (functions) available to the model.", + "items": { + "$ref": "#/components/schemas/RealtimeFunctionTool" + } }, - { - "type": "null" - } - ] - }, - "PredictionContent": { - "type": "object", - "title": "Static Content", - "description": "Static predicted output content, such as the content of a text file that is\nbeing regenerated.\n", - "required": [ - "type", - "content" - ], - "properties": { - "type": { + "tool_choice": { "type": "string", - "enum": [ - "content" - ], - "description": "The type of the predicted content you want to provide. This type is\ncurrently always `content`.\n", - "x-stainless-const": true + "default": "auto", + "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n" }, - "content": { - "description": "The content that should be matched when generating a model response.\nIf generated tokens would match this content, the entire model response\ncan be returned much more quickly.\n", + "temperature": { + "type": "number", + "default": 0.8, + "description": "Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance.\n" + }, + "max_response_output_tokens": { "oneOf": [ + { + "type": "integer" + }, { "type": "string", - "title": "Text content", - "description": "The content used for a Predicted Output. This is often the\ntext of a file you are regenerating with minor changes.\n" + "enum": [ + "inf" + ], + "x-stainless-const": true + } + ], + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "Expiration timestamp for the session, in seconds since epoch." + }, + "prompt": { + "anyOf": [ + { + "$ref": "#/components/schemas/Prompt" }, + { + "type": "null" + } + ] + }, + "include": { + "anyOf": [ { "type": "array", - "description": "An array of content parts with a defined type. Supported options differ based on the [model](https://developers.openai.com/api/docs/models) being used to generate the response. Can contain text inputs.", - "title": "Array of content parts", "items": { - "$ref": "#/components/schemas/ChatCompletionRequestMessageContentPartText" + "type": "string", + "enum": [ + "item.input_audio_transcription.logprobs" + ] }, - "minItems": 1 + "description": "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" + }, + { + "type": "null" } ] } } }, - "Project": { + "RealtimeSessionCreateRequest": { "type": "object", - "description": "Represents an individual project.", + "description": "A new Realtime session configuration, with an ephemeral key. Default TTL\nfor keys is one minute.\n", "properties": { - "id": { + "client_secret": { + "type": "object", + "description": "Ephemeral key returned by the API.", + "properties": { + "value": { + "type": "string", + "description": "Ephemeral key usable in client environments to authenticate connections\nto the Realtime API. Use this in client-side environments rather than\na standard API token, which should only be used server-side.\n" + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "Timestamp for when the token expires. Currently, all tokens expire\nafter one minute.\n" + } + }, + "required": [ + "value", + "expires_at" + ] + }, + "modalities": { + "type": "array", + "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } + }, + "instructions": { "type": "string", - "description": "The identifier, which can be referenced in API endpoints" + "description": "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n" }, - "object": { + "voice": { + "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", + "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with an\n`id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed during\nthe session once the model has responded with audio at least once.\nCustom voices must be created from audio samples. Voices created from text prompts are supported only in Live.\n" + }, + "input_audio_format": { "type": "string", - "enum": [ - "organization.project" - ], - "description": "The object type, which is always `organization.project`", - "x-stainless-const": true + "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" + "output_audio_format": { + "type": "string", + "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" + }, + "input_audio_transcription": { + "type": "object", + "description": "Configuration for input audio transcription, defaults to off and can be\nset to `null` to turn off once on. Input audio transcription is not native\nto the model, since the model consumes audio directly. Transcription runs\nasynchronously and should be treated as rough guidance\nrather than the representation understood by the model.\n", + "properties": { + "model": { + "type": "string", + "description": "The model to use for transcription.\n" } - ], - "description": "The name of the project. This appears in reporting." + } }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the project was created." + "speed": { + "type": "number", + "default": 1, + "maximum": 1.5, + "minimum": 0.25, + "description": "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n" }, - "archived_at": { - "anyOf": [ + "tracing": { + "title": "Tracing Configuration", + "description": "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", + "oneOf": [ { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the project was archived or `null`." + "type": "string", + "default": "auto", + "description": "Default tracing mode for the session.\n", + "enum": [ + "auto" + ], + "x-stainless-const": true }, { - "type": "null" + "type": "object", + "title": "Tracing Configuration", + "description": "Granular configuration for tracing.\n", + "properties": { + "workflow_name": { + "type": "string", + "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n" + }, + "group_id": { + "type": "string", + "description": "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n" + }, + "metadata": { + "type": "object", + "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n" + } + } } ] }, - "status": { - "anyOf": [ - { - "type": "string" + "turn_detection": { + "type": "object", + "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n", + "properties": { + "type": { + "type": "string", + "description": "Type of turn detection, only `server_vad` is currently supported.\n" }, - { - "type": "null" + "threshold": { + "type": "number", + "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" + }, + "prefix_padding_ms": { + "type": "integer", + "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + }, + "silence_duration_ms": { + "type": "integer", + "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" } - ], - "description": "`active` or `archived`" + } }, - "external_key_id": { - "anyOf": [ + "tools": { + "type": "array", + "description": "Tools (functions) available to the model.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ], + "description": "The type of the tool, i.e. `function`.", + "x-stainless-const": true + }, + "name": { + "type": "string", + "description": "The name of the function." + }, + "description": { + "type": "string", + "description": "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n" + }, + "parameters": { + "type": "object", + "description": "Parameters of the function in JSON Schema." + } + } + } + }, + "tool_choice": { + "type": "string", + "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n" + }, + "temperature": { + "type": "number", + "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n" + }, + "max_response_output_tokens": { + "oneOf": [ { - "type": "string" + "type": "integer" }, { - "type": "null" + "type": "string", + "enum": [ + "inf" + ], + "x-stainless-const": true } ], - "description": "The external key associated with the project." + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" }, - "residency": { - "$ref": "#/components/schemas/PublicProjectResidency", - "description": "The residency configuration for the project." + "truncation": { + "$ref": "#/components/schemas/RealtimeTruncation" + }, + "prompt": { + "$ref": "#/components/schemas/Prompt" } }, "required": [ - "id", - "object", - "created_at" + "client_secret" ], "x-oaiMeta": { - "name": "The project object", - "example": "{\n \"id\": \"proj_abc\",\n \"object\": \"organization.project\",\n \"name\": \"Project example\",\n \"created_at\": 1711471533,\n \"archived_at\": null,\n \"status\": \"active\",\n \"external_key_id\": null\n}\n" + "name": "The session object", + "group": "realtime", + "example": "{\n \"id\": \"sess_001\",\n \"object\": \"realtime.session\",\n \"model\": \"gpt-realtime-2025-08-25\",\n \"modalities\": [\"audio\", \"text\"],\n \"instructions\": \"You are a friendly assistant.\",\n \"voice\": \"alloy\",\n \"input_audio_format\": \"pcm16\",\n \"output_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"whisper-1\"\n },\n \"turn_detection\": null,\n \"tools\": [],\n \"tool_choice\": \"none\",\n \"temperature\": 0.7,\n \"speed\": 1.1,\n \"tracing\": \"auto\",\n \"max_response_output_tokens\": 200,\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"client_secret\": {\n \"value\": \"ek_abc123\",\n \"expires_at\": 1234567890\n }\n}\n" } }, - "ProjectApiKey": { + "RealtimeSessionCreateRequestGA": { "type": "object", - "description": "Represents an individual API key in a project.", + "title": "Realtime session configuration", + "description": "Realtime session object configuration.", "properties": { - "object": { + "type": { "type": "string", + "description": "The type of session to create. Always `realtime` for the Realtime API.\n", "enum": [ - "organization.project.api_key" + "realtime" ], - "description": "The object type, which is always `organization.project.api_key`", "x-stainless-const": true }, - "redacted_value": { - "type": "string", - "description": "The redacted value of the API key" - }, - "name": { - "type": "string", - "description": "The name of the API key" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the API key was created" + "output_modalities": { + "type": "array", + "description": "The set of modalities the model can respond with. It defaults to `[\"audio\"]`, indicating\nthat the model will respond with audio plus a transcript. `[\"text\"]` can be used to make\nthe model respond with text only. It is not possible to request both `text` and `audio` at the same time.\n", + "default": [ + "audio" + ], + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } }, - "expires_at": { + "model": { "anyOf": [ { - "type": "integer", - "format": "unixtime" + "type": "string" }, { - "type": "null" + "type": "string", + "enum": [ + "gpt-realtime", + "gpt-realtime-1.5", + "gpt-realtime-2", + "gpt-realtime-2.1", + "gpt-realtime-2.1-mini", + "gpt-realtime-2025-08-28", + "gpt-4o-realtime-preview", + "gpt-4o-realtime-preview-2024-10-01", + "gpt-4o-realtime-preview-2024-12-17", + "gpt-4o-realtime-preview-2025-06-03", + "gpt-4o-mini-realtime-preview", + "gpt-4o-mini-realtime-preview-2024-12-17", + "gpt-realtime-mini", + "gpt-realtime-mini-2025-10-06", + "gpt-realtime-mini-2025-12-15", + "gpt-audio-1.5", + "gpt-audio-mini", + "gpt-audio-mini-2025-10-06", + "gpt-audio-mini-2025-12-15" + ], + "x-openai-enum-deprecations": { + "gpt-realtime-2025-08-28": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime-mini-2025-12-15": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini-2025-12-15": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime-mini": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } } ], - "description": "The Unix timestamp (in seconds) when the API key expires, or null if it does not expire." + "description": "The Realtime model used for this session.\n" }, - "last_used_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime" + "instructions": { + "type": "string", + "description": "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n" + }, + "audio": { + "type": "object", + "description": "Configuration for input and output audio.\n", + "properties": { + "input": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats", + "description": "The format of the input audio." + }, + "transcription": { + "description": "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n", + "$ref": "#/components/schemas/AudioTranscription" + }, + "noise_reduction": { + "not": { + "type": [ + "array", + "string", + "number", + "boolean" + ] + }, + "default": null, + "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + }, + "strength": { + "$ref": "#/components/schemas/RealtimeNoiseReductionStrength" + } + } + }, + "turn_detection": { + "$ref": "#/components/schemas/RealtimeTurnDetection" + } + } }, - { - "type": "null" + "output": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats", + "description": "The format of the output audio." + }, + "voice": { + "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", + "default": "alloy", + "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with\nan `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed\nduring the session once the model has responded with audio at least once.\nCustom voices must be created from audio samples. Voices created from text prompts are supported only in Live.\nWe recommend `marin` and `cedar` for best quality.\n" + }, + "speed": { + "type": "number", + "default": 1, + "maximum": 1.5, + "minimum": 0.25, + "description": "The speed of the model's spoken response as a multiple of the original speed.\n1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.\n\nThis parameter is a post-processing adjustment to the audio after it is generated, it's\nalso possible to prompt the model to speak faster or slower.\n" + } + } } - ], - "description": "The Unix timestamp (in seconds) of when the API key was last used." - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" + } }, - "owner_project_access": { - "type": "string", - "enum": [ - "active", - "inactive" - ], - "description": "Whether the API key's owner currently has effective access to the project." + "include": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "item.input_audio_transcription.logprobs" + ] + }, + "description": "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" }, - "owner": { - "type": "object", - "properties": { - "type": { + "tracing": { + "title": "Tracing Configuration", + "default": null, + "description": "Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", + "oneOf": [ + { "type": "string", + "title": "auto", + "default": "auto", + "description": "Enables tracing and sets default values for tracing configuration options. Always `auto`.\n", "enum": [ - "user", - "service_account" + "auto" ], - "description": "`user` or `service_account`" + "x-stainless-const": true }, - "user": { - "$ref": "#/components/schemas/ProjectApiKeyOwnerUser" + { + "type": "object", + "title": "Tracing Configuration", + "description": "Granular configuration for tracing.\n", + "properties": { + "workflow_name": { + "type": "string", + "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the Traces Dashboard.\n" + }, + "group_id": { + "type": "string", + "description": "The group id to attach to this trace to enable filtering and\ngrouping in the Traces Dashboard.\n" + }, + "metadata": { + "type": "object", + "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the Traces Dashboard.\n" + } + } }, - "service_account": { - "$ref": "#/components/schemas/ProjectApiKeyOwnerServiceAccount" + { + "type": "null" } - } - } - }, - "required": [ - "object", - "redacted_value", - "name", - "created_at", - "last_used_at", - "id", - "owner_project_access", - "owner" - ], - "x-oaiMeta": { - "name": "The project API key object", - "example": "{\n \"object\": \"organization.project.api_key\",\n \"redacted_value\": \"sk-abc...def\",\n \"name\": \"My API Key\",\n \"created_at\": 1711471533,\n \"expires_at\": 1714063533,\n \"last_used_at\": 1711471534,\n \"id\": \"key_abc\",\n \"owner_project_access\": \"active\",\n \"owner\": {\n \"type\": \"user\",\n \"user\": {\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n }\n }\n}\n" - } - }, - "ProjectApiKeyDeleteResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.api_key.deleted" - ], - "x-stainless-const": true - }, - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" - } - }, - "required": [ - "object", - "id", - "deleted" - ] - }, - "ProjectApiKeyListResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "x-stainless-const": true + ] }, - "data": { + "tools": { "type": "array", + "description": "Tools available to the model.", "items": { - "$ref": "#/components/schemas/ProjectApiKey" + "oneOf": [ + { + "$ref": "#/components/schemas/RealtimeFunctionTool" + }, + { + "$ref": "#/components/schemas/MCPTool" + } + ] } }, - "first_id": { - "anyOf": [ + "tool_choice": { + "description": "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n", + "oneOf": [ { - "type": "string" + "$ref": "#/components/schemas/ToolChoiceOptions" }, { - "type": "null" + "$ref": "#/components/schemas/ToolChoiceFunction" + }, + { + "$ref": "#/components/schemas/ToolChoiceMCP" } - ] + ], + "default": "auto" }, - "last_id": { - "anyOf": [ + "parallel_tool_calls": { + "type": "boolean", + "description": "Whether the model may call multiple tools in parallel. Only supported by\nreasoning Realtime models such as `gpt-realtime-2`.\n" + }, + "reasoning": { + "$ref": "#/components/schemas/RealtimeReasoning" + }, + "max_output_tokens": { + "oneOf": [ { - "type": "string" + "type": "integer" }, { - "type": "null" + "type": "string", + "enum": [ + "inf" + ], + "x-stainless-const": true } - ] + ], + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" }, - "has_more": { - "type": "boolean" + "truncation": { + "$ref": "#/components/schemas/RealtimeTruncation" + }, + "prompt": { + "$ref": "#/components/schemas/Prompt" } }, "required": [ - "object", - "data", - "has_more" + "type" ] }, - "ProjectApiKeyOwnerServiceAccount": { + "RealtimeSessionCreateResponse": { "type": "object", - "description": "The service account that owns a project API key.", + "title": "Realtime session configuration object", + "description": "A Realtime session configuration object.\n", "properties": { "id": { "type": "string", - "description": "The identifier, which can be referenced in API endpoints" + "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" }, - "name": { + "object": { "type": "string", - "description": "The name of the service account." + "description": "The object type. Always `realtime.session`." }, - "created_at": { + "expires_at": { "type": "integer", "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the service account was created." - }, - "role": { - "type": "string", - "description": "The service account's project role." - } - }, - "required": [ - "id", - "name", - "created_at", - "role" - ] - }, - "ProjectApiKeyOwnerUser": { - "type": "object", - "description": "The user that owns a project API key.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints" + "description": "Expiration timestamp for the session, in seconds since epoch." }, - "email": { - "type": "string", - "description": "The email address of the user." + "include": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "item.input_audio_transcription.logprobs" + ] + }, + "description": "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" }, - "name": { + "model": { "type": "string", - "description": "The name of the user." + "description": "The Realtime model used for this session." }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the user was created." + "output_modalities": { + "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } }, - "role": { - "type": "string", - "description": "The user's project role." - } - }, - "required": [ - "id", - "email", - "name", - "created_at", - "role" - ] - }, - "ProjectCreateRequest": { - "type": "object", - "properties": { - "name": { + "instructions": { "type": "string", - "description": "The friendly name of the project, this name appears in reports." + "description": "The default system instructions (i.e. system message) prepended to model\ncalls. This field allows the client to guide the model on desired\nresponses. The model can be instructed on response content and format,\n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good\nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion\ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed\nto be followed by the model, but they provide guidance to the model on the\ndesired behavior.\n\nNote that the server sets default instructions which will be used if this\nfield is not set and are visible in the `session.created` event at the\nstart of the session.\n" }, - "geography": { - "anyOf": [ - { - "type": "string" + "audio": { + "type": "object", + "description": "Configuration for input and output audio for the session.\n", + "properties": { + "input": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats" + }, + "transcription": { + "description": "Configuration for input audio transcription.\n", + "$ref": "#/components/schemas/AudioTranscriptionResponse" + }, + "noise_reduction": { + "type": [ + "object", + "null" + ], + "description": "Configuration for input audio noise reduction.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + } + } + }, + "turn_detection": { + "type": [ + "object", + "null" + ], + "description": "Configuration for turn detection.\n", + "properties": { + "type": { + "type": "string", + "description": "Type of turn detection, only `server_vad` is currently supported.\n" + }, + "threshold": { + "type": "number" + }, + "prefix_padding_ms": { + "type": "integer" + }, + "silence_duration_ms": { + "type": "integer" + } + } + } + } }, - { - "type": "null" + "output": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats" + }, + "voice": { + "$ref": "#/components/schemas/VoiceIdsShared" + }, + "speed": { + "type": "number" + } + } } - ], - "deprecated": true, - "description": "Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field.\nDeprecated: use `residency` instead. Do not provide both `geography` and `residency`." + } }, - "residency": { - "anyOf": [ + "tracing": { + "title": "Tracing Configuration", + "description": "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", + "oneOf": [ { - "$ref": "#/components/schemas/PublicProjectResidency" + "type": "string", + "default": "auto", + "description": "Default tracing mode for the session.\n", + "enum": [ + "auto" + ], + "x-stainless-const": true }, { - "type": "null" + "type": "object", + "title": "Tracing Configuration", + "description": "Granular configuration for tracing.\n", + "properties": { + "workflow_name": { + "type": "string", + "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n" + }, + "group_id": { + "type": "string", + "description": "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n" + }, + "metadata": { + "type": "object", + "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n" + } + } } - ], - "description": "Create the project with the specified residency configuration. Your organization must have access to the requested residency configuration in order to use it. See [data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field." + ] }, - "external_key_id": { - "anyOf": [ - { - "type": "string" + "turn_detection": { + "type": [ + "object", + "null" + ], + "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n", + "properties": { + "type": { + "type": "string", + "description": "Type of turn detection, only `server_vad` is currently supported.\n" }, - { - "type": "null" + "threshold": { + "type": "number", + "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" + }, + "prefix_padding_ms": { + "type": "integer", + "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + }, + "silence_duration_ms": { + "type": "integer", + "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" } - ], - "description": "External key ID to associate with the project." - } - }, - "required": [ - "name" - ] - }, - "ProjectDataRetention": { - "type": "object", - "description": "Represents a project's data retention control setting.", - "properties": { - "object": { - "type": "string", - "enum": [ - "project.data_retention" - ], - "description": "The object type, which is always `project.data_retention`.", - "x-stainless-const": true - }, - "type": { - "type": "string", - "enum": [ - "organization_default", - "none", - "zero_data_retention", - "modified_abuse_monitoring", - "enhanced_zero_data_retention", - "enhanced_modified_abuse_monitoring" - ], - "description": "The configured project data retention type." - } - }, - "required": [ - "object", - "type" - ], - "x-oaiMeta": { - "name": "The project data retention object", - "example": "{\n \"object\": \"project.data_retention\",\n \"type\": \"organization_default\"\n}\n" - } - }, - "ProjectGroup": { - "type": "object", - "description": "Details about a group's membership in a project.", - "properties": { - "object": { - "type": "string", - "enum": [ - "project.group" - ], - "description": "Always `project.group`.", - "x-stainless-const": true - }, - "project_id": { - "type": "string", - "description": "Identifier of the project." - }, - "group_id": { - "type": "string", - "description": "Identifier of the group that has access to the project." + } }, - "group_name": { - "type": "string", - "description": "Display name of the group." + "tools": { + "type": "array", + "description": "Tools (functions) available to the model.", + "items": { + "$ref": "#/components/schemas/RealtimeFunctionTool" + } }, - "group_type": { + "tool_choice": { "type": "string", - "enum": [ - "group", - "tenant_group" - ], - "description": "The type of the group." + "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n" }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the group was granted project access." + "max_output_tokens": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string", + "enum": [ + "inf" + ], + "x-stainless-const": true + } + ], + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" } }, - "required": [ - "object", - "project_id", - "group_id", - "group_name", - "group_type", - "created_at" - ], "x-oaiMeta": { - "name": "The project group object", - "example": "{\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"group_type\": \"group\",\n \"created_at\": 1711471533\n}\n" + "name": "The session object", + "group": "realtime", + "example": "{\n \"id\": \"sess_001\",\n \"object\": \"realtime.session\",\n \"expires_at\": 1742188264,\n \"model\": \"gpt-realtime\",\n \"output_modalities\": [\"audio\"],\n \"instructions\": \"You are a friendly assistant.\",\n \"tools\": [],\n \"tool_choice\": \"none\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": \"auto\",\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": { \"model\": \"whisper-1\" },\n \"noise_reduction\": null,\n \"turn_detection\": null\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"alloy\",\n \"speed\": 1.0\n }\n }\n}\n" } }, - "ProjectGroupDeletedResource": { + "RealtimeSessionCreateResponseGA": { "type": "object", - "description": "Confirmation payload returned after removing a group from a project.", + "title": "Realtime session configuration object", + "description": "A Realtime session configuration object.\n", "properties": { - "object": { + "type": { "type": "string", + "description": "The type of session to create. Always `realtime` for the Realtime API.\n", "enum": [ - "project.group.deleted" + "realtime" ], - "description": "Always `project.group.deleted`.", "x-stainless-const": true }, - "deleted": { - "type": "boolean", - "description": "Whether the group membership in the project was removed." - } - }, - "required": [ - "object", - "deleted" - ], - "x-oaiMeta": { - "name": "Project group deletion confirmation", - "example": "{\n \"object\": \"project.group.deleted\",\n \"deleted\": true\n}\n" - } - }, - "ProjectGroupListResource": { - "type": "object", - "description": "Paginated list of groups that have access to a project.", - "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" + }, "object": { "type": "string", + "description": "The object type. Always `realtime.session`.", "enum": [ - "list" + "realtime.session" ], - "description": "Always `list`.", "x-stainless-const": true }, - "data": { + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "Expiration timestamp for the session, in seconds since epoch." + }, + "output_modalities": { "type": "array", - "description": "Project group memberships returned in the current page.", + "description": "The set of modalities the model can respond with. It defaults to `[\"audio\"]`, indicating\nthat the model will respond with audio plus a transcript. `[\"text\"]` can be used to make\nthe model respond with text only. It is not possible to request both `text` and `audio` at the same time.\n", + "default": [ + "audio" + ], "items": { - "$ref": "#/components/schemas/ProjectGroup" + "type": "string", + "enum": [ + "text", + "audio" + ] } }, - "has_more": { - "type": "boolean", - "description": "Whether additional project group memberships are available." - }, - "next": { - "description": "Cursor to fetch the next page of results, or `null` when there are no more results.", + "model": { "anyOf": [ { "type": "string" }, { - "type": "null" + "type": "string", + "enum": [ + "gpt-realtime", + "gpt-realtime-1.5", + "gpt-realtime-2", + "gpt-realtime-2.1", + "gpt-realtime-2.1-mini", + "gpt-realtime-2025-08-28", + "gpt-4o-realtime-preview", + "gpt-4o-realtime-preview-2024-10-01", + "gpt-4o-realtime-preview-2024-12-17", + "gpt-4o-realtime-preview-2025-06-03", + "gpt-4o-mini-realtime-preview", + "gpt-4o-mini-realtime-preview-2024-12-17", + "gpt-realtime-mini", + "gpt-realtime-mini-2025-10-06", + "gpt-realtime-mini-2025-12-15", + "gpt-audio-1.5", + "gpt-audio-mini", + "gpt-audio-mini-2025-10-06", + "gpt-audio-mini-2025-12-15" + ], + "x-openai-enum-deprecations": { + "gpt-realtime-2025-08-28": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime-mini-2025-12-15": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini-2025-12-15": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-realtime-mini": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } } - ] - } - }, - "required": [ - "object", - "data", - "has_more", - "next" - ], - "x-oaiMeta": { - "name": "Project group list", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"project.group\",\n \"project_id\": \"proj_abc123\",\n \"group_id\": \"group_01J1F8ABCDXYZ\",\n \"group_name\": \"Support Team\",\n \"created_at\": 1711471533\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" - } - }, - "ProjectHostedToolPermissions": { - "type": "object", - "description": "Represents hosted tool permissions for a project.", - "properties": { - "file_search": { - "$ref": "#/components/schemas/HostedToolPermission" - }, - "web_search": { - "$ref": "#/components/schemas/HostedToolPermission" - }, - "image_generation": { - "$ref": "#/components/schemas/HostedToolPermission" + ], + "description": "The Realtime model used for this session.\n" }, - "mcp": { - "$ref": "#/components/schemas/HostedToolPermission" + "instructions": { + "type": "string", + "description": "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n" }, - "code_interpreter": { - "$ref": "#/components/schemas/HostedToolPermission" - } - }, - "required": [ - "file_search", - "web_search", - "image_generation", - "mcp", - "code_interpreter" - ], - "x-oaiMeta": { - "name": "The project hosted tool permissions object", - "example": "{\n \"file_search\": {\n \"enabled\": true\n },\n \"web_search\": {\n \"enabled\": true\n },\n \"image_generation\": {\n \"enabled\": true\n },\n \"mcp\": {\n \"enabled\": true\n },\n \"code_interpreter\": {\n \"enabled\": true\n }\n}\n" - } - }, - "ProjectHostedToolPermissionsUpdateRequest": { - "type": "object", - "properties": { - "file_search": { - "anyOf": [ - { - "$ref": "#/components/schemas/HostedToolPermissionUpdate" + "audio": { + "type": "object", + "description": "Configuration for input and output audio.\n", + "properties": { + "input": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats", + "description": "The format of the input audio." + }, + "transcription": { + "description": "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/AudioTranscriptionResponse" + }, + { + "type": "null" + } + ] + }, + "noise_reduction": { + "type": [ + "object", + "null" + ], + "default": null, + "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + }, + "strength": { + "$ref": "#/components/schemas/RealtimeNoiseReductionStrength" + } + } + }, + "turn_detection": { + "$ref": "#/components/schemas/RealtimeTurnDetection" + } + } }, - { - "type": "null" + "output": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats", + "description": "The format of the output audio." + }, + "voice": { + "$ref": "#/components/schemas/VoiceIdsShared", + "default": "alloy", + "description": "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for\nbest quality.\n" + }, + "speed": { + "type": "number", + "default": 1, + "maximum": 1.5, + "minimum": 0.25, + "description": "The speed of the model's spoken response as a multiple of the original speed.\n1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.\n\nThis parameter is a post-processing adjustment to the audio after it is generated, it's\nalso possible to prompt the model to speak faster or slower.\n" + } + } } + } + }, + "include": { + "type": [ + "array", + "null" ], - "description": "The file search permission update." + "items": { + "type": "string", + "enum": [ + "item.input_audio_transcription.logprobs" + ] + }, + "description": "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" }, - "web_search": { + "tracing": { "anyOf": [ { - "$ref": "#/components/schemas/HostedToolPermissionUpdate" + "title": "Tracing Configuration", + "default": null, + "description": "Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", + "oneOf": [ + { + "type": "string", + "title": "auto", + "default": "auto", + "description": "Enables tracing and sets default values for tracing configuration options. Always `auto`.\n", + "enum": [ + "auto" + ], + "x-stainless-const": true + }, + { + "type": "object", + "title": "Tracing Configuration", + "description": "Granular configuration for tracing.\n", + "properties": { + "workflow_name": { + "type": "string", + "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the Traces Dashboard.\n" + }, + "group_id": { + "type": "string", + "description": "The group id to attach to this trace to enable filtering and\ngrouping in the Traces Dashboard.\n" + }, + "metadata": { + "type": "object", + "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the Traces Dashboard.\n" + } + } + } + ] }, { "type": "null" } - ], - "description": "The web search permission update." + ] }, - "image_generation": { - "anyOf": [ + "tools": { + "type": "array", + "description": "Tools available to the model.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/RealtimeFunctionTool" + }, + { + "$ref": "#/components/schemas/MCPTool" + } + ] + } + }, + "tool_choice": { + "description": "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n", + "oneOf": [ { - "$ref": "#/components/schemas/HostedToolPermissionUpdate" + "$ref": "#/components/schemas/ToolChoiceOptions" }, { - "type": "null" - } - ], - "description": "The image generation permission update." - }, - "mcp": { - "anyOf": [ - { - "$ref": "#/components/schemas/HostedToolPermissionUpdate" + "$ref": "#/components/schemas/ToolChoiceFunction" }, { - "type": "null" + "$ref": "#/components/schemas/ToolChoiceMCP" } ], - "description": "The MCP permission update." + "default": "auto" }, - "code_interpreter": { - "anyOf": [ + "reasoning": { + "$ref": "#/components/schemas/RealtimeReasoning" + }, + "max_output_tokens": { + "oneOf": [ { - "$ref": "#/components/schemas/HostedToolPermissionUpdate" + "type": "integer" }, { - "type": "null" + "type": "string", + "enum": [ + "inf" + ], + "x-stainless-const": true } ], - "description": "The code interpreter permission update." + "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" + }, + "truncation": { + "$ref": "#/components/schemas/RealtimeTruncation" + }, + "prompt": { + "$ref": "#/components/schemas/Prompt" } + }, + "required": [ + "type", + "id", + "object" + ], + "x-oaiMeta": { + "name": "The session object", + "group": "realtime" } }, - "ProjectListResponse": { + "RealtimeTranscriptionSessionCreateRequest": { "type": "object", + "title": "Realtime transcription session configuration", + "description": "Realtime transcription session object configuration.", "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "x-stainless-const": true - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Project" - } - }, - "first_id": { - "anyOf": [ - { - "type": "string" + "turn_detection": { + "type": "object", + "description": "Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\n", + "properties": { + "type": { + "type": "string", + "description": "Type of turn detection. Only `server_vad` is currently supported for transcription sessions.\n", + "enum": [ + "server_vad" + ] }, - { - "type": "null" + "threshold": { + "type": "number", + "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" + }, + "prefix_padding_ms": { + "type": "integer", + "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + }, + "silence_duration_ms": { + "type": "integer", + "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" } - ] + } }, - "last_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" + "input_audio_noise_reduction": { + "not": { + "type": [ + "array", + "string", + "number", + "boolean" + ] + }, + "default": null, + "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" } - ] + } }, - "has_more": { - "type": "boolean" - } - }, - "required": [ - "object", - "data", - "has_more" - ] - }, - "ProjectModelPermissions": { - "type": "object", - "description": "Represents the model allowlist or denylist policy for a project.", - "properties": { - "object": { + "input_audio_format": { "type": "string", + "default": "pcm16", "enum": [ - "project.model_permissions" + "pcm16", + "g711_ulaw", + "g711_alaw" ], - "description": "The object type, which is always `project.model_permissions`.", - "x-stainless-const": true + "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n" }, - "mode": { - "type": "string", - "enum": [ - "allow_list", - "deny_list" - ], - "description": "Whether the project uses an allowlist or a denylist." + "input_audio_transcription": { + "description": "Configuration for input audio transcription. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n", + "$ref": "#/components/schemas/AudioTranscription" }, - "model_ids": { + "include": { "type": "array", "items": { - "type": "string" + "type": "string", + "enum": [ + "item.input_audio_transcription.logprobs" + ] }, - "description": "The model IDs included in the model permissions policy." + "description": "The set of items to include in the transcription. Current available items are:\n`item.input_audio_transcription.logprobs`\n" } - }, - "required": [ - "object", - "mode", - "model_ids" - ], - "x-oaiMeta": { - "name": "The project model permissions object", - "example": "{\n \"object\": \"project.model_permissions\",\n \"mode\": \"allow_list\",\n \"model_ids\": [\n \"gpt-6-astra\",\n \"o3\"\n ]\n}\n" } }, - "ProjectModelPermissionsDeleteResponse": { + "RealtimeTranscriptionSessionCreateRequestGA": { "type": "object", - "description": "Confirmation payload returned after deleting project model permissions.", + "title": "Realtime transcription session configuration", + "description": "Realtime transcription session object configuration.", "properties": { - "object": { + "type": { "type": "string", + "description": "The type of session to create. Always `transcription` for transcription sessions.\n", "enum": [ - "project.model_permissions.deleted" + "transcription" ], - "description": "The object type, which is always `project.model_permissions.deleted`.", "x-stainless-const": true }, - "deleted": { - "type": "boolean", - "description": "Whether the project model permissions were deleted." - } - }, - "required": [ - "object", - "deleted" - ], - "x-oaiMeta": { - "name": "Project model permissions deletion confirmation", - "example": "{\n \"object\": \"project.model_permissions.deleted\",\n \"deleted\": true\n}\n" - } - }, - "ProjectModelPermissionsUpdateRequest": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "allow_list", - "deny_list" - ], - "description": "The model permissions mode to apply." + "audio": { + "type": "object", + "description": "Configuration for input and output audio.\n", + "properties": { + "input": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats" + }, + "transcription": { + "description": "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n", + "$ref": "#/components/schemas/AudioTranscription" + }, + "noise_reduction": { + "not": { + "type": [ + "array", + "string", + "number", + "boolean" + ] + }, + "default": null, + "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + }, + "strength": { + "$ref": "#/components/schemas/RealtimeNoiseReductionStrength" + } + } + }, + "turn_detection": { + "$ref": "#/components/schemas/RealtimeTurnDetection" + } + } + } + } }, - "model_ids": { + "include": { "type": "array", "items": { - "type": "string" + "type": "string", + "enum": [ + "item.input_audio_transcription.logprobs" + ] }, - "description": "The model IDs included in this permissions policy." + "description": "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" } }, "required": [ - "mode", - "model_ids" + "type" ] }, - "ProjectRateLimit": { + "RealtimeTranscriptionSessionCreateResponse": { "type": "object", - "description": "Represents a project rate limit config.", + "description": "A new Realtime transcription session configuration.\n\nWhen a session is created on the server via REST API, the session object\nalso contains an ephemeral key. Default TTL for keys is 10 minutes. This\nproperty is not present when a session is updated via the WebSocket API.\n", "properties": { - "object": { - "type": "string", - "enum": [ - "project.rate_limit" - ], - "description": "The object type, which is always `project.rate_limit`", - "x-stainless-const": true + "client_secret": { + "type": "object", + "description": "Ephemeral key returned by the API. Only present when the session is\ncreated on the server via REST API.\n", + "properties": { + "value": { + "type": "string", + "description": "Ephemeral key usable in client environments to authenticate connections\nto the Realtime API. Use this in client-side environments rather than\na standard API token, which should only be used server-side.\n" + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "Timestamp for when the token expires. Currently, all tokens expire\nafter one minute.\n" + } + }, + "required": [ + "value", + "expires_at" + ] }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." + "modalities": { + "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } }, - "model": { + "input_audio_format": { "type": "string", - "description": "The model this rate limit applies to." - }, - "max_requests_per_1_minute": { - "type": "integer", - "description": "The maximum requests per minute." - }, - "max_tokens_per_1_minute": { - "type": "integer", - "description": "The maximum tokens per minute." - }, - "max_images_per_1_minute": { - "type": "integer", - "description": "The maximum images per minute. Only present for relevant models." - }, - "max_audio_megabytes_per_1_minute": { - "type": "integer", - "description": "The maximum audio megabytes per minute. Only present for relevant models." + "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" }, - "max_requests_per_1_day": { - "type": "integer", - "description": "The maximum requests per day. Only present for relevant models." + "input_audio_transcription": { + "description": "Configuration of the transcription model.\n", + "$ref": "#/components/schemas/AudioTranscriptionResponse" }, - "batch_1_day_max_input_tokens": { - "type": "integer", - "description": "The maximum batch input tokens per day. Only present for relevant models." + "turn_detection": { + "type": "object", + "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n", + "properties": { + "type": { + "type": "string", + "description": "Type of turn detection, only `server_vad` is currently supported.\n" + }, + "threshold": { + "type": "number", + "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" + }, + "prefix_padding_ms": { + "type": "integer", + "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + }, + "silence_duration_ms": { + "type": "integer", + "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" + } + } } }, "required": [ - "object", - "id", - "model", - "max_requests_per_1_minute", - "max_tokens_per_1_minute" + "client_secret" ], "x-oaiMeta": { - "name": "The project rate limit object", - "example": "{\n \"object\": \"project.rate_limit\",\n \"id\": \"rl_ada\",\n \"model\": \"ada\",\n \"max_requests_per_1_minute\": 600,\n \"max_tokens_per_1_minute\": 150000,\n \"max_images_per_1_minute\": 10\n}\n" + "name": "The transcription session object", + "group": "realtime", + "example": "{\n \"id\": \"sess_BBwZc7cFV3XizEyKGDCGL\",\n \"object\": \"realtime.transcription_session\",\n \"expires_at\": 1742188264,\n \"modalities\": [\"audio\", \"text\"],\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200\n },\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"language\": null,\n \"prompt\": \"\"\n },\n \"client_secret\": {\n \"value\": \"ek_abc123\",\n \"expires_at\": 1742188264\n }\n}\n" } }, - "ProjectRateLimitListResponse": { + "RealtimeTranscriptionSessionCreateResponseGA": { "type": "object", + "title": "Realtime transcription session configuration object", + "description": "A Realtime transcription session configuration object.\n", "properties": { - "object": { + "type": { "type": "string", + "description": "The type of session. Always `transcription` for transcription sessions.\n", "enum": [ - "list" + "transcription" ], "x-stainless-const": true }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProjectRateLimit" - } + "id": { + "type": "string", + "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "object": { + "type": "string", + "description": "The object type. Always `realtime.transcription_session`." }, - "last_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "Expiration timestamp for the session, in seconds since epoch." }, - "has_more": { - "type": "boolean" + "include": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "enum": [ + "item.input_audio_transcription.logprobs" + ] + }, + "description": "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" + }, + "audio": { + "type": "object", + "description": "Configuration for input audio for the session.\n", + "properties": { + "input": { + "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/RealtimeAudioFormats" + }, + "transcription": { + "description": "Configuration of the transcription model.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/AudioTranscriptionResponse" + }, + { + "type": "null" + } + ] + }, + "noise_reduction": { + "type": [ + "object", + "null" + ], + "description": "Configuration for input audio noise reduction.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + }, + "strength": { + "$ref": "#/components/schemas/RealtimeNoiseReductionStrength" + } + } + }, + "turn_detection": { + "description": "Configuration for turn detection. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.\n", + "anyOf": [ + { + "type": "object", + "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.\n", + "properties": { + "type": { + "type": "string", + "description": "Type of turn detection, only `server_vad` is currently supported.\n" + }, + "threshold": { + "type": "number", + "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" + }, + "prefix_padding_ms": { + "type": "integer", + "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + }, + "silence_duration_ms": { + "type": "integer", + "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" + } + } + }, + { + "type": "null" + } + ] + } + } + } + } } }, "required": [ - "object", - "data", - "has_more" - ] + "type", + "id", + "object" + ], + "x-oaiMeta": { + "name": "The transcription session object", + "group": "realtime", + "example": "{\n \"id\": \"sess_BBwZc7cFV3XizEyKGDCGL\",\n \"type\": \"transcription\",\n \"object\": \"realtime.transcription_session\",\n \"expires_at\": 1742188264,\n \"include\": [\"item.input_audio_transcription.logprobs\"],\n \"audio\": {\n \"input\": {\n \"format\": {\"type\": \"audio/pcm\", \"rate\": 24000},\n \"transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"language\": null,\n \"prompt\": \"\"\n },\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200\n }\n }\n }\n}\n" + } }, - "ProjectRateLimitUpdateRequest": { - "type": "object", - "properties": { - "max_requests_per_1_minute": { - "type": "integer", - "description": "The maximum requests per minute." - }, - "max_tokens_per_1_minute": { - "type": "integer", - "description": "The maximum tokens per minute." - }, - "max_images_per_1_minute": { - "type": "integer", - "description": "The maximum images per minute. Only relevant for certain models." - }, - "max_audio_megabytes_per_1_minute": { - "type": "integer", - "description": "The maximum audio megabytes per minute. Only relevant for certain models." + "RealtimeTranslationClientEvent": { + "discriminator": { + "propertyName": "type" + }, + "description": "A Realtime translation client event.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate" }, - "max_requests_per_1_day": { - "type": "integer", - "description": "The maximum requests per day. Only relevant for certain models." + { + "$ref": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend" }, - "batch_1_day_max_input_tokens": { - "type": "integer", - "description": "The maximum batch input tokens per day. Only relevant for certain models." + { + "$ref": "#/components/schemas/RealtimeTranslationClientEventSessionClose" } - } + ] }, - "ProjectServiceAccount": { + "RealtimeTranslationClientEventInputAudioBufferAppend": { "type": "object", - "description": "Represents an individual service account in a project.", + "description": "Send this event to append audio bytes to the translation session input audio buffer.\n\nWebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono\nlittle-endian raw audio bytes. Unsupported websocket audio formats return a\nvalidation error because lower-quality audio materially degrades translation\nquality.\n\nTranslation consumes 200 ms engine frames. For best realtime behavior, append\naudio in 200 ms chunks. If a chunk is shorter, the server buffers it until it\nhas enough audio for one frame. If a chunk is longer, the server splits it into\n200 ms frames and enqueues them back-to-back.\n\nKeep appending silence while the session is active. If a client stops sending\naudio and later resumes, model time treats the resumed audio as contiguous with\nthe previous audio rather than as a real-world pause.\n", "properties": { - "object": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { "type": "string", "enum": [ - "organization.project.service_account" + "session.input_audio_buffer.append" ], - "description": "The object type, which is always `organization.project.service_account`", + "description": "The event type, must be `session.input_audio_buffer.append`.", "x-stainless-const": true }, - "id": { + "audio": { "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "name": { + "description": "Base64-encoded 24 kHz PCM16 mono audio bytes." + } + }, + "required": [ + "type", + "audio" + ], + "x-oaiMeta": { + "name": "session.input_audio_buffer.append", + "group": "realtime", + "example": "{\n \"event_id\": \"event_456\",\n \"type\": \"session.input_audio_buffer.append\",\n \"audio\": \"Base64EncodedAudioData\"\n}\n" + } + }, + "RealtimeTranslationClientEventSessionClose": { + "type": "object", + "description": "Gracefully close the realtime translation session. The server flushes pending\ninput audio and emits any remaining translated output before closing the\nsession.\n", + "properties": { + "event_id": { "type": "string", - "description": "The name of the service account" + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." }, - "role": { + "type": { "type": "string", "enum": [ - "owner", - "member", - "none" + "session.close" ], - "description": "`owner`, `member`, or `none`" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the service account was created" + "description": "The event type, must be `session.close`.", + "x-stainless-const": true } }, "required": [ - "object", - "id", - "name", - "role", - "created_at" + "type" ], "x-oaiMeta": { - "name": "The project service account object", - "example": "{\n \"object\": \"organization.project.service_account\",\n \"id\": \"svc_acct_abc\",\n \"name\": \"Service Account\",\n \"role\": \"owner\",\n \"created_at\": 1711471533\n}\n" + "name": "session.close", + "group": "realtime", + "example": "{\n \"event_id\": \"event_789\",\n \"type\": \"session.close\"\n}\n" } }, - "ProjectServiceAccountApiKey": { + "RealtimeTranslationClientEventSessionUpdate": { "type": "object", + "description": "Send this event to update the translation session configuration. Translation\nsessions support updates to `audio.output.language`, `audio.input.transcription`,\nand `audio.input.noise_reduction`.\n", "properties": { - "object": { + "event_id": { + "type": "string", + "maxLength": 512, + "description": "Optional client-generated ID used to identify this event." + }, + "type": { "type": "string", "enum": [ - "organization.project.service_account.api_key" + "session.update" ], - "description": "The object type, which is always `organization.project.service_account.api_key`", + "description": "The event type, must be `session.update`.", "x-stainless-const": true }, - "value": { - "type": "string" - }, - "name": { - "type": "string" - }, - "created_at": { - "type": "integer", - "format": "unixtime" - }, - "expires_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime" - }, - { - "type": "null" - } - ], - "description": "The Unix timestamp (in seconds) when the API key expires, or null if it does not expire." - }, - "id": { - "type": "string" + "session": { + "$ref": "#/components/schemas/RealtimeTranslationSessionUpdateRequest", + "description": "Translation session fields to update. The session `type` and `model` are set\nat creation and cannot be changed with `session.update`.\n" } }, "required": [ - "object", - "value", - "name", - "created_at", - "id" - ] + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.update", + "group": "realtime", + "example": "{\n \"type\": \"session.update\",\n \"session\": {\n \"audio\": {\n \"input\": {\n \"transcription\": {\n \"model\": \"gpt-realtime-whisper\"\n },\n \"noise_reduction\": null\n },\n \"output\": {\n \"language\": \"es\"\n }\n }\n }\n}\n" + } }, - "ProjectServiceAccountCreateRequest": { + "RealtimeTranslationClientSecretCreateRequest": { "type": "object", + "title": "Realtime translation client secret creation request", + "description": "Create a translation session and client secret for the Realtime API.\n", "properties": { - "name": { - "type": "string", - "description": "The name of the service account being created." - }, - "create_service_account_only": { - "anyOf": [ - { - "type": "boolean", - "description": "Create the service account without default roles or an API key." + "expires_after": { + "type": "object", + "title": "Client secret expiration", + "description": "Configuration for the client secret expiration. Expiration refers to the time after which\na client secret will no longer be valid for creating sessions. The session itself may\ncontinue after that time once started. A secret can be used to create multiple sessions\nuntil it expires.\n", + "properties": { + "anchor": { + "type": "string", + "enum": [ + "created_at" + ], + "description": "The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported.\n", + "default": "created_at", + "x-stainless-const": true }, - { - "type": "null" - } - ] - }, - "expires_in_seconds": { - "anyOf": [ - { + "seconds": { "type": "integer", - "minimum": 1, - "maximum": 31536000 - }, - { - "type": "null" + "format": "int64", + "description": "The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified.\n", + "minimum": 10, + "maximum": 7200, + "default": 600 } - ], - "description": "Number of seconds until the initial API key expires. If omitted or null, the key does not expire unless the effective organization or project policy requires an expiration. When a policy sets a maximum lifetime, this value must be provided and must not exceed that limit. A non-null value cannot be used when `create_service_account_only` is true." + } + }, + "session": { + "$ref": "#/components/schemas/RealtimeTranslationSessionCreateRequest" } }, "required": [ - "name" + "session" ] }, - "ProjectServiceAccountCreateResponse": { + "RealtimeTranslationClientSecretCreateResponse": { "type": "object", + "title": "Realtime translation session and client secret", + "description": "Response from creating a translation session and client secret for the Realtime API.\n", "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.service_account" - ], - "x-stainless-const": true - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "role": { + "value": { "type": "string", - "enum": [ - "member", - "none" - ], - "description": "Service accounts created with default project membership have role `member`. Accounts created with `create_service_account_only` have role `none`.\n" + "description": "The generated client secret value." }, - "created_at": { + "expires_at": { "type": "integer", - "format": "unixtime" - }, - "api_key": { - "anyOf": [ - { - "$ref": "#/components/schemas/ProjectServiceAccountApiKey" - }, - { - "type": "null" - } - ] + "format": "unixtime", + "description": "Expiration timestamp for the client secret, in seconds since epoch." + }, + "session": { + "$ref": "#/components/schemas/RealtimeTranslationSession" } }, "required": [ - "object", - "id", - "name", - "role", - "created_at", - "api_key" - ] + "value", + "expires_at", + "session" + ], + "x-oaiMeta": { + "name": "Translation session response object", + "group": "realtime", + "example": "{\n \"value\": \"ek_68af296e8e408191a1120ab6383263c2\",\n \"expires_at\": 1756310470,\n \"session\": {\n \"id\": \"sess_C9CiUVUzUzYIssh3ELY1d\",\n \"type\": \"translation\",\n \"expires_at\": 1756310470,\n \"model\": \"gpt-realtime-translate\",\n \"audio\": {\n \"input\": {\n \"transcription\": null,\n \"noise_reduction\": null\n },\n \"output\": {\n \"language\": \"es\"\n }\n }\n }\n}\n" + } }, - "ProjectServiceAccountDeleteResponse": { + "RealtimeTranslationConnectParams": { "type": "object", "properties": { - "object": { - "type": "string", - "enum": [ - "organization.project.service_account.deleted" - ], - "x-stainless-const": true - }, - "id": { + "model": { "type": "string" - }, - "deleted": { - "type": "boolean" } }, "required": [ - "object", - "id", - "deleted" + "model" ] }, - "ProjectServiceAccountListResponse": { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "x-stainless-const": true + "RealtimeTranslationServerEvent": { + "discriminator": { + "propertyName": "type" + }, + "description": "A Realtime translation server event.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/RealtimeServerEventError" }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProjectServiceAccount" - } + { + "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionCreated" }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionUpdated" }, - "last_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionClosed" }, - "has_more": { - "type": "boolean" + { + "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta" + }, + { + "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta" + }, + { + "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta" } - }, - "required": [ - "object", - "data", - "has_more" ] }, - "ProjectSpendAlert": { + "RealtimeTranslationServerEventSessionClosed": { "type": "object", - "description": "Represents a spend alert configured at the project level.", + "description": "Returned when a realtime translation session is closed.\n", "properties": { - "id": { + "event_id": { "type": "string", - "description": "The identifier, which can be referenced in API endpoints." + "description": "The unique ID of the server event." }, - "object": { + "type": { "type": "string", "enum": [ - "project.spend_alert" + "session.closed" ], - "description": "The object type, which is always `project.spend_alert`.", + "description": "The event type, must be `session.closed`.", "x-stainless-const": true - }, - "threshold_amount": { - "type": "integer", - "description": "The alert threshold amount, in cents." - }, - "currency": { - "type": "string", - "enum": [ - "USD" - ], - "description": "The currency for the threshold amount." - }, - "interval": { - "type": "string", - "enum": [ - "month" - ], - "description": "The time interval for evaluating spend against the threshold." - }, - "notification_channel": { - "$ref": "#/components/schemas/SpendAlertNotificationChannel" } }, "required": [ - "id", - "object", - "threshold_amount", - "currency", - "interval", - "notification_channel" + "event_id", + "type" ], "x-oaiMeta": { - "name": "The project spend alert object", - "example": "{\n \"id\": \"alert_abc123\",\n \"object\": \"project.spend_alert\",\n \"threshold_amount\": 100000,\n \"currency\": \"USD\",\n \"interval\": \"month\",\n \"notification_channel\": {\n \"type\": \"email\",\n \"recipients\": [\"finance@example.com\"],\n \"subject_prefix\": \"OpenAI spend alert\"\n }\n}\n" + "name": "session.closed", + "group": "realtime", + "example": "{\n \"event_id\": \"event_987\",\n \"type\": \"session.closed\"\n}\n" } }, - "ProjectSpendAlertDeletedResource": { + "RealtimeTranslationServerEventSessionCreated": { "type": "object", - "description": "Confirmation payload returned after deleting a project spend alert.", + "description": "Returned when a translation session is created. Emitted automatically when a\nnew connection is established as the first server event. This event contains\nthe default translation session configuration.\n", "properties": { - "id": { + "event_id": { "type": "string", - "description": "The deleted spend alert ID." + "description": "The unique ID of the server event." }, - "object": { + "type": { "type": "string", "enum": [ - "project.spend_alert.deleted" + "session.created" ], - "description": "Always `project.spend_alert.deleted`.", + "description": "The event type, must be `session.created`.", "x-stainless-const": true }, - "deleted": { - "type": "boolean", - "description": "Whether the spend alert was deleted." + "session": { + "$ref": "#/components/schemas/RealtimeTranslationSession", + "description": "The translation session configuration." } }, "required": [ - "id", - "object", - "deleted" - ] + "event_id", + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.created", + "group": "realtime", + "example": "{\n \"type\": \"session.created\",\n \"event_id\": \"event_123\",\n \"session\": {\n \"id\": \"sess_123\",\n \"type\": \"translation\",\n \"model\": \"gpt-realtime-translate\",\n \"expires_at\": 1714857600,\n \"audio\": {\n \"input\": {\n \"transcription\": {\n \"model\": \"gpt-realtime-whisper\",\n \"language\": \"en\"\n },\n \"noise_reduction\": {\n \"type\": \"near_field\"\n }\n },\n \"output\": {\n \"language\": \"fr\"\n }\n }\n }\n}\n" + } }, - "ProjectSpendAlertListResource": { + "RealtimeTranslationServerEventSessionInputTranscriptDelta": { "type": "object", - "description": "Paginated list of project spend alerts.", + "description": "Returned when optional source-language transcript text is available. This event\nis emitted only when `audio.input.transcription` is configured.\n\nTranscript deltas are append-only text fragments. Clients should not insert\nunconditional spaces between deltas.\n", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "list" + "session.input_transcript.delta" ], - "description": "Always `list`.", + "description": "The event type, must be `session.input_transcript.delta`.", "x-stainless-const": true }, - "data": { - "type": "array", - "description": "Spend alerts returned in the current page.", - "items": { - "$ref": "#/components/schemas/ProjectSpendAlert" - } - }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "The ID of the first spend alert in this page." + "delta": { + "type": "string", + "description": "Append-only source-language transcript text." }, - "last_id": { + "elapsed_ms": { "anyOf": [ { - "type": "string" + "type": "integer", + "description": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. It advances in 200 ms increments, but multiple transcript\ndeltas may share the same `elapsed_ms`. Treat it as alignment metadata,\nnot a unique transcript-delta identifier.\n" }, { "type": "null" } - ], - "description": "The ID of the last spend alert in this page." - }, - "has_more": { - "type": "boolean", - "description": "Whether more spend alerts are available when paginating." + ] } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "ProjectUpdateRequest": { - "type": "object", - "properties": { - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "The updated name of the project, this name appears in reports." - }, - "external_key_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "External key ID to associate with the project." - }, - "geography": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "deprecated": true, - "description": "Geography for the project.\nDeprecated: use `residency` when creating a project to configure data residency. This field is retained for backward compatibility." - } + "event_id", + "type", + "delta" + ], + "x-oaiMeta": { + "name": "session.input_transcript.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_125\",\n \"type\": \"session.input_transcript.delta\",\n \"delta\": \" hear\",\n \"elapsed_ms\": 1200\n}\n" } }, - "ProjectUser": { + "RealtimeTranslationServerEventSessionOutputAudioDelta": { "type": "object", - "description": "Represents an individual user in a project.", + "description": "Returned when translated output audio is available. The `delta` contains a\nPCM16 audio chunk whose length can vary. Clients should decode and queue the\ncomplete delta instead of assuming a fixed byte or sample count.\n", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "organization.project.user" + "session.output_audio.delta" ], - "description": "The object type, which is always `organization.project.user`", + "description": "The event type, must be `session.output_audio.delta`.", "x-stainless-const": true }, - "id": { + "delta": { "type": "string", - "description": "The identifier, which can be referenced in API endpoints" + "description": "Base64-encoded translated audio data." }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "sample_rate": { + "type": "integer", + "description": "Sample rate of the audio delta.", + "default": 24000 + }, + "channels": { + "type": "integer", + "description": "Number of audio channels.", + "default": 1 + }, + "format": { + "type": "string", + "enum": [ + "pcm16" ], - "description": "The name of the user" + "description": "Audio encoding for `delta`.", + "x-stainless-const": true }, - "email": { + "elapsed_ms": { "anyOf": [ { - "type": "string" + "type": "integer", + "description": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. Treat `elapsed_ms` as alignment metadata, not a unique\nevent identifier.\n" }, { "type": "null" } - ], - "description": "The email address of the user" - }, - "role": { - "type": "string", - "description": "`owner` or `member`" - }, - "added_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the project was added." + ] } }, "required": [ - "object", - "id", - "role", - "added_at" + "event_id", + "type", + "delta" ], "x-oaiMeta": { - "name": "The project user object", - "example": "{\n \"object\": \"organization.project.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" + "name": "session.output_audio.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_123\",\n \"type\": \"session.output_audio.delta\",\n \"delta\": \"Base64EncodedAudioDelta\",\n \"sample_rate\": 24000,\n \"channels\": 1,\n \"format\": \"pcm16\",\n \"elapsed_ms\": 1200\n}\n" } }, - "ProjectUserCreateRequest": { + "RealtimeTranslationServerEventSessionOutputTranscriptDelta": { "type": "object", + "description": "Returned when translated transcript text is available.\n\nTranscript deltas are append-only text fragments. Clients should not insert\nunconditional spaces between deltas.\n", "properties": { - "user_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { + "type": "string", + "enum": [ + "session.output_transcript.delta" ], - "description": "The ID of the user." + "description": "The event type, must be `session.output_transcript.delta`.", + "x-stainless-const": true }, - "email": { + "delta": { + "type": "string", + "description": "Append-only transcript text for the translated output audio." + }, + "elapsed_ms": { "anyOf": [ { - "type": "string" + "type": "integer", + "description": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. It advances in 200 ms increments, but multiple transcript\ndeltas may share the same `elapsed_ms`. Treat it as alignment metadata,\nnot a unique transcript-delta identifier.\n" }, { "type": "null" } - ], - "description": "Email of the user to add." - }, - "role": { - "type": "string", - "description": "`owner` or `member`" + ] } }, "required": [ - "role" - ] + "event_id", + "type", + "delta" + ], + "x-oaiMeta": { + "name": "session.output_transcript.delta", + "group": "realtime", + "example": "{\n \"event_id\": \"event_124\",\n \"type\": \"session.output_transcript.delta\",\n \"delta\": \" escuch\",\n \"elapsed_ms\": 1200\n}\n" + } }, - "ProjectUserDeleteResponse": { + "RealtimeTranslationServerEventSessionUpdated": { "type": "object", + "description": "Returned when a translation session is updated with a `session.update` event,\nunless there is an error.\n", "properties": { - "object": { + "event_id": { + "type": "string", + "description": "The unique ID of the server event." + }, + "type": { "type": "string", "enum": [ - "organization.project.user.deleted" + "session.updated" ], + "description": "The event type, must be `session.updated`.", "x-stainless-const": true }, - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean" + "session": { + "$ref": "#/components/schemas/RealtimeTranslationSession", + "description": "The translation session configuration." } }, "required": [ - "object", - "id", - "deleted" - ] + "event_id", + "type", + "session" + ], + "x-oaiMeta": { + "name": "session.updated", + "group": "realtime", + "example": "{\n \"type\": \"session.updated\",\n \"event_id\": \"event_124\",\n \"session\": {\n \"id\": \"sess_123\",\n \"type\": \"translation\",\n \"model\": \"gpt-realtime-translate\",\n \"expires_at\": 1714857600,\n \"audio\": {\n \"input\": {\n \"transcription\": {\n \"model\": \"gpt-realtime-whisper\",\n \"language\": \"en\"\n },\n \"noise_reduction\": {\n \"type\": \"near_field\"\n }\n },\n \"output\": {\n \"language\": \"es\"\n }\n }\n }\n}\n" + } }, - "ProjectUserListResponse": { + "RealtimeTranslationSession": { "type": "object", + "title": "Realtime translation session", + "description": "A Realtime translation session. Translation sessions continuously translate input\naudio into the configured output language.\n", "properties": { - "object": { - "type": "string" + "id": { + "type": "string", + "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProjectUser" - } + "type": { + "type": "string", + "enum": [ + "translation" + ], + "description": "The session type. Always `translation` for Realtime translation sessions.\n", + "x-stainless-const": true }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "Expiration timestamp for the session, in seconds since epoch." }, - "last_id": { - "anyOf": [ - { - "type": "string" + "model": { + "type": "string", + "description": "The Realtime translation model used for this session. This field is set at\nsession creation and cannot be changed with `session.update`.\n" + }, + "audio": { + "type": "object", + "description": "Configuration for translation input and output audio.\n", + "properties": { + "input": { + "type": "object", + "properties": { + "transcription": { + "anyOf": [ + { + "type": "object", + "description": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n", + "properties": { + "model": { + "type": "string", + "description": "The transcription model used for source transcript deltas." + } + }, + "required": [ + "model" + ] + }, + { + "type": "null" + } + ] + }, + "noise_reduction": { + "anyOf": [ + { + "type": "object", + "description": "Optional input noise reduction.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + }, + "strength": { + "$ref": "#/components/schemas/RealtimeNoiseReductionStrength" + } + }, + "required": [ + "type" + ] + }, + { + "type": "null" + } + ] + } + } }, - { - "type": "null" + "output": { + "type": "object", + "properties": { + "language": { + "type": "string", + "description": "Target language for translated output audio and transcript deltas.\n" + } + } } - ] - }, - "has_more": { - "type": "boolean" + } } }, "required": [ - "object", - "data", - "has_more" - ] + "id", + "type", + "expires_at", + "model", + "audio" + ], + "x-oaiMeta": { + "name": "The translation session object", + "group": "realtime", + "example": "{\n \"id\": \"sess_C9G5QPteg4UIbotdKLoYQ\",\n \"type\": \"translation\",\n \"expires_at\": 1756324625,\n \"model\": \"gpt-realtime-translate\",\n \"audio\": {\n \"input\": {\n \"transcription\": {\n \"model\": \"gpt-realtime-whisper\"\n },\n \"noise_reduction\": null\n },\n \"output\": {\n \"language\": \"es\"\n }\n }\n}\n" + } }, - "ProjectUserUpdateRequest": { + "RealtimeTranslationSessionCreateRequest": { "type": "object", + "title": "Realtime translation session configuration", + "description": "Realtime translation session configuration. Translation sessions stream source\naudio in and translated audio plus transcript deltas out continuously.\n", "properties": { - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "`owner` or `member`" - } - } - }, - "Prompt": { - "anyOf": [ - { + "model": { + "type": "string", + "description": "The Realtime translation model used for this session.\n" + }, + "audio": { "type": "object", - "description": "Reference to a prompt template and its variables.\n[Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code).\n", - "required": [ - "id" - ], + "description": "Configuration for translation input and output audio.\n", "properties": { - "id": { - "type": "string", - "description": "The unique identifier of the prompt template to use." - }, - "version": { - "anyOf": [ - { - "type": "string", - "description": "Optional version of the prompt template." + "input": { + "type": "object", + "properties": { + "transcription": { + "anyOf": [ + { + "type": "object", + "description": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n", + "properties": { + "model": { + "type": "string", + "description": "The transcription model to use for source transcript deltas." + } + }, + "required": [ + "model" + ] + }, + { + "type": "null" + } + ] }, - { - "type": "null" + "noise_reduction": { + "anyOf": [ + { + "type": "object", + "description": "Optional input noise reduction. Set to `null` to disable it.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + }, + "strength": { + "$ref": "#/components/schemas/RealtimeNoiseReductionStrength" + } + }, + "required": [ + "type" + ] + }, + { + "type": "null" + } + ] } - ] + } }, - "variables": { - "$ref": "#/components/schemas/ResponsePromptVariables" + "output": { + "type": "object", + "properties": { + "language": { + "type": "string", + "description": "Target language for translated output audio and transcript deltas.\n" + } + } } } - }, - { - "type": "null" - } - ] - }, - "PublicAssignOrganizationGroupRoleBody": { - "type": "object", - "description": "Request payload for assigning a role to a group or user.", - "properties": { - "role_id": { - "type": "string", - "description": "Identifier of the role to assign." } }, "required": [ - "role_id" - ], - "x-oaiMeta": { - "example": "{\n \"role_id\": \"role_01J1F8ROLE01\"\n}\n" - } + "model" + ] }, - "PublicCreateOrganizationRoleBody": { + "RealtimeTranslationSessionUpdateRequest": { "type": "object", - "description": "Request payload for creating a custom role.", + "title": "Realtime translation session update", + "description": "Realtime translation session fields that can be updated with `session.update`.\n", "properties": { - "role_name": { - "type": "string", - "description": "Unique name for the role." - }, - "permissions": { - "type": "array", - "description": "Permissions to grant to the role.", - "items": { - "type": "string" - } - }, - "description": { - "description": "Optional description of the role.", - "anyOf": [ - { - "type": "string" + "audio": { + "type": "object", + "description": "Configuration for translation input and output audio.\n", + "properties": { + "input": { + "type": "object", + "properties": { + "transcription": { + "anyOf": [ + { + "type": "object", + "description": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n", + "properties": { + "model": { + "type": "string", + "description": "The transcription model to use for source transcript deltas." + } + }, + "required": [ + "model" + ] + }, + { + "type": "null" + } + ] + }, + "noise_reduction": { + "anyOf": [ + { + "type": "object", + "description": "Optional input noise reduction. Set to `null` to disable it.\n", + "properties": { + "type": { + "$ref": "#/components/schemas/NoiseReductionType" + }, + "strength": { + "$ref": "#/components/schemas/RealtimeNoiseReductionStrength" + } + }, + "required": [ + "type" + ] + }, + { + "type": "null" + } + ] + } + } }, - { - "type": "null" + "output": { + "type": "object", + "properties": { + "language": { + "type": "string", + "description": "Target language for translated output audio and transcript deltas.\n" + } + } } - ] + } } - }, - "required": [ - "role_name", - "permissions" - ], - "x-oaiMeta": { - "example": "{\n \"role_name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"description\": \"Allows managing organization groups\"\n}\n" } }, - "PublicRoleListResource": { - "type": "object", - "description": "Paginated list of roles available on an organization or project.", - "properties": { - "object": { + "RealtimeTruncation": { + "title": "Realtime Truncation Controls", + "description": "When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs.\n\nClients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.\n\nTruncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate.\n\nTruncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit.\n", + "oneOf": [ + { "type": "string", + "description": "The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit.", "enum": [ - "list" - ], - "description": "Always `list`.", - "x-stainless-const": true - }, - "data": { - "type": "array", - "description": "Roles returned in the current page.", - "items": { - "$ref": "#/components/schemas/Role" - } - }, - "has_more": { - "type": "boolean", - "description": "Whether more roles are available when paginating." + "auto", + "disabled" + ] }, - "next": { - "description": "Cursor to fetch the next page of results, or `null` when there are no additional roles.", - "anyOf": [ - { - "type": "string" + { + "type": "object", + "title": "Retention ratio truncation", + "description": "Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.", + "properties": { + "type": { + "type": "string", + "enum": [ + "retention_ratio" + ], + "description": "Use retention ratio truncation.", + "x-stainless-const": true }, - { - "type": "null" + "retention_ratio": { + "type": "number", + "description": "Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates.\n", + "minimum": 0, + "maximum": 1 + }, + "token_limits": { + "type": "object", + "description": "Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used.", + "properties": { + "post_instructions": { + "type": "integer", + "description": "Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens.", + "minimum": 0 + } + } } + }, + "required": [ + "type", + "retention_ratio" ] } - }, - "required": [ - "object", - "data", - "has_more", - "next" - ], - "x-oaiMeta": { - "name": "Role list", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"role\",\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"description\": \"Allows managing organization groups\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" - } + ] }, - "PublicUpdateOrganizationRoleBody": { - "type": "object", - "description": "Request payload for updating an existing role.", - "properties": { - "permissions": { - "description": "Updated set of permissions for the role.", - "anyOf": [ + "RealtimeTurnDetection": { + "anyOf": [ + { + "title": "Realtime Turn Detection", + "description": "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\n\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\n\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n\nFor `gpt-realtime-whisper` transcription sessions, turn detection must be\nset to `null`; VAD is not supported.\n", + "oneOf": [ { - "type": "array", - "items": { - "type": "string" + "type": "object", + "title": "Server VAD", + "description": "Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "default": "server_vad", + "const": "server_vad", + "description": "Type of turn detection, `server_vad` to turn on simple Server VAD.\n" + }, + "threshold": { + "type": "number", + "description": "Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" + }, + "prefix_padding_ms": { + "type": "integer", + "description": "Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + }, + "silence_duration_ms": { + "type": "integer", + "description": "Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" + }, + "create_response": { + "type": "boolean", + "default": true, + "description": "Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.\n\nIf both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.\n" + }, + "interrupt_response": { + "type": "boolean", + "default": true, + "description": "Whether or not to automatically interrupt (cancel) any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.\n\nIf both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.\n" + }, + "idle_timeout_ms": { + "anyOf": [ + { + "type": "integer", + "minimum": 5000, + "maximum": 30000, + "description": "Optional timeout after which a model response will be triggered automatically. This is\nuseful for situations in which a long pause from the user is unexpected, such as a phone\ncall. The model will effectively prompt the user to continue the conversation based\non the current context.\n\nThe timeout value will be applied after the last model response's audio has finished playing,\ni.e. it's set to the `response.done` time plus audio playback duration.\n\nAn `input_audio_buffer.timeout_triggered` event (plus events\nassociated with the Response) will be emitted when the timeout is reached.\nIdle timeout is currently only supported for `server_vad` mode.\n" + }, + { + "type": "null" + } + ] + } } }, { - "type": "null" + "type": "object", + "title": "Semantic VAD", + "description": "Server-side semantic turn detection which uses a model to determine when the user has finished speaking.", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "const": "semantic_vad", + "description": "Type of turn detection, `semantic_vad` to turn on Semantic VAD.\n" + }, + "eagerness": { + "type": "string", + "default": "auto", + "enum": [ + "low", + "medium", + "high", + "auto" + ], + "description": "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.\n" + }, + "create_response": { + "type": "boolean", + "default": true, + "description": "Whether or not to automatically generate a response when a VAD stop event occurs.\n" + }, + "interrupt_response": { + "type": "boolean", + "default": true, + "description": "Whether or not to automatically interrupt any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs.\n" + } + } } - ] + ], + "discriminator": { + "propertyName": "type" + } }, - "description": { - "description": "New description for the role.", + { + "type": "null" + } + ] + }, + "Reasoning": { + "type": "object", + "description": "Configuration options for\n[reasoning models](https://developers.openai.com/api/docs/guides/reasoning).\n", + "title": "Reasoning", + "properties": { + "mode": { + "$ref": "#/components/schemas/ReasoningModeEnum", + "description": "Controls the reasoning execution mode for the request.\n\nWhen returned on a response, this is the effective execution mode.\n" + }, + "effort": { + "$ref": "#/components/schemas/ReasoningEffort" + }, + "summary": { "anyOf": [ { - "type": "string" + "type": "string", + "description": "A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n\n`concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.\n", + "enum": [ + "auto", + "concise", + "detailed" + ] }, { "type": "null" } ] }, - "role_name": { - "description": "New name for the role.", + "context": { "anyOf": [ { - "type": "string" - }, - { - "type": "null" - } - ] - } - }, - "x-oaiMeta": { - "example": "{\n \"role_name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"description\": \"Allows managing organization groups\"\n}\n" - } - }, - "RealtimeAudioFormats": { - "anyOf": [ - { - "type": "object", - "title": "PCM audio format", - "description": "The PCM audio format. Only a 24kHz sample rate is supported.", - "properties": { - "type": { "type": "string", - "description": "The audio format. Always `audio/pcm`.", + "description": "Controls which reasoning items are rendered back to the model on later turns.\nIf omitted or set to `auto`, the model determines the context mode. The\n`gpt-5.6` model family defaults to `all_turns`; earlier models default to\n`current_turn`.\n\nWhen returned on a response, this is the effective reasoning context mode\nused for the response.\n", "enum": [ - "audio/pcm" + "auto", + "current_turn", + "all_turns" ] }, - "rate": { - "type": "integer", - "description": "The sample rate of the audio. Always `24000`.", - "enum": [ - 24000 - ] - } - } - }, - { - "type": "object", - "title": "PCMU audio format", - "description": "The G.711 μ-law format.", - "properties": { - "type": { - "type": "string", - "description": "The audio format. Always `audio/pcmu`.", - "enum": [ - "audio/pcmu" - ] + { + "type": "null" } - } + ] }, - { - "type": "object", - "title": "PCMA audio format", - "description": "The G.711 A-law format.", - "properties": { - "type": { + "generate_summary": { + "anyOf": [ + { "type": "string", - "description": "The audio format. Always `audio/pcma`.", + "deprecated": true, + "description": "**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n", "enum": [ - "audio/pcma" + "auto", + "concise", + "detailed" ] + }, + { + "type": "null" } - } + ] } - ] + } }, - "RealtimeBetaClientEventConversationItemCreate": { - "type": "object", - "description": "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n", - "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, - "type": { + "ReasoningEffort": { + "anyOf": [ + { "type": "string", "enum": [ - "conversation.item.create" + "none", + "minimal", + "low", + "medium", + "high", + "xhigh", + "max" ], - "description": "The event type, must be `conversation.item.create`.", - "x-stainless-const": true - }, - "previous_item_id": { - "type": "string", - "description": "The ID of the preceding item after which the new item will be inserted. \nIf not set, the new item will be appended to the end of the conversation.\nIf set to `root`, the new item will be added to the beginning of the conversation.\nIf set to an existing ID, it allows an item to be inserted mid-conversation. If the\nID cannot be found, an error will be returned and the item will not be added.\n" + "default": "medium", + "description": "Constrains effort on reasoning for reasoning models. Currently supported\nvalues are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.\nReducing reasoning effort can result in faster responses and fewer tokens\nused on reasoning in a response. Not all reasoning models support every\nvalue. See the\n[reasoning guide](https://developers.openai.com/api/docs/guides/reasoning)\nfor model-specific support.\n" }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" + { + "type": "null" } - }, - "required": [ - "type", - "item" - ], - "x-oaiMeta": { - "name": "conversation.item.create", - "group": "realtime", - "example": "{\n \"type\": \"conversation.item.create\",\n \"item\": {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"hi\"\n }\n ]\n },\n \"event_id\": \"b904fba0-0ec4-40af-8bbb-f908a9b26793\",\n}\n" - } + ] }, - "RealtimeBetaClientEventConversationItemDelete": { + "ReasoningItem": { "type": "object", - "description": "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n", + "description": "A description of the chain of thought used by a reasoning model while generating\na response. Be sure to include these items in your `input` to the Responses API\nfor subsequent turns of a conversation if you are manually\n[managing context](https://developers.openai.com/api/docs/guides/conversation-state).\n", + "title": "Reasoning", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the object. Always `reasoning`.\n", "enum": [ - "conversation.item.delete" + "reasoning" ], - "description": "The event type, must be `conversation.item.delete`.", "x-stainless-const": true }, - "item_id": { + "id": { "type": "string", - "description": "The ID of the item to delete." + "description": "The unique identifier of the reasoning content.\n" + }, + "encrypted_content": { + "anyOf": [ + { + "type": "string", + "description": "The encrypted content of the reasoning item. This is populated by default\nfor reasoning items returned by `POST /v1/responses` and WebSocket\n`response.create` requests.\n\nWhen streaming, use the completed reasoning item and its\n`encrypted_content` from the `response.output_item.done` event in\nsubsequent requests. The `encrypted_content` in\n`response.output_item.added` may be incomplete. This is especially\nimportant when `store` is `false` or when using Zero Data Retention.\n" + }, + { + "type": "null" + } + ] + }, + "summary": { + "type": "array", + "description": "Reasoning summary content.\n", + "items": { + "$ref": "#/components/schemas/SummaryTextContent" + } + }, + "content": { + "type": "array", + "description": "Reasoning text content.\n", + "items": { + "$ref": "#/components/schemas/ReasoningTextContent" + } + }, + "status": { + "type": "string", + "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] } }, "required": [ - "type", - "item_id" - ], - "x-oaiMeta": { - "name": "conversation.item.delete", - "group": "realtime", - "example": "{\n \"event_id\": \"event_901\",\n \"type\": \"conversation.item.delete\",\n \"item_id\": \"msg_003\"\n}\n" - } + "id", + "summary", + "type" + ] }, - "RealtimeBetaClientEventConversationItemRetrieve": { - "type": "object", - "description": "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n", - "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." + "Response": { + "title": "The response object", + "allOf": [ + { + "$ref": "#/components/schemas/ModelResponseProperties" }, - "type": { - "type": "string", - "enum": [ - "conversation.item.retrieve" - ], - "description": "The event type, must be `conversation.item.retrieve`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseProperties" }, - "item_id": { - "type": "string", - "description": "The ID of the item to retrieve." + { + "type": "object", + "properties": { + "image": { + "$ref": "#/components/schemas/ResolvedImageOptions" + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTierResponses" + }, + "truncation": { + "anyOf": [ + { + "type": "string", + "description": "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n", + "enum": [ + "auto", + "disabled" + ], + "default": "disabled" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string", + "description": "Unique identifier for this Response.\n" + }, + "object": { + "type": "string", + "description": "The object type of this resource - always set to `response`.\n", + "enum": [ + "response" + ], + "x-stainless-const": true + }, + "status": { + "type": "string", + "description": "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n", + "enum": [ + "completed", + "failed", + "in_progress", + "cancelled", + "queued", + "incomplete" + ] + }, + "access_programs": { + "anyOf": [ + { + "$ref": "#/components/schemas/AccessProgramsBody" + }, + { + "type": "null" + } + ] + }, + "created_at": { + "type": "number", + "format": "unixtime", + "description": "Unix timestamp (in seconds) of when this Response was created.\n" + }, + "completed_at": { + "anyOf": [ + { + "type": "number", + "format": "unixtime", + "description": "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n" + }, + { + "type": "null" + } + ] + }, + "error": { + "$ref": "#/components/schemas/ResponseError" + }, + "incomplete_details": { + "anyOf": [ + { + "type": "object", + "description": "Details about why the response is incomplete.\n", + "properties": { + "reason": { + "type": "string", + "description": "The reason why the response is incomplete. `steered` means\nthe response stopped at a safe output boundary after a\nWebSocket `response.steer` event. The server can then create\na successor response automatically with the queued input.\n", + "enum": [ + "max_output_tokens", + "max_messages", + "content_filter", + "steered" + ] + } + } + }, + { + "type": "null" + } + ] + }, + "output": { + "type": "array", + "description": "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n", + "items": { + "$ref": "#/components/schemas/OutputItem" + } + }, + "reasoning": { + "anyOf": [ + { + "$ref": "#/components/schemas/Reasoning" + }, + { + "type": "null" + } + ] + }, + "instructions": { + "anyOf": [ + { + "description": "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n", + "oneOf": [ + { + "type": "string", + "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n" + }, + { + "type": "array", + "title": "Input item list", + "description": "A list of one or many input items to the model, containing\ndifferent content types.\n", + "items": { + "$ref": "#/components/schemas/InputItem" + } + } + ] + }, + { + "type": "null" + } + ] + }, + "output_text": { + "anyOf": [ + { + "type": "string", + "description": "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n", + "x-oaiSupportedSDKs": [ + "python", + "javascript" + ] + }, + { + "type": "null" + } + ] + }, + "usage": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResponseUsage" + }, + { + "type": "null" + } + ] + }, + "tool_usage": { + "$ref": "#/components/schemas/ResponseToolUsage", + "description": "Usage reported by hosted tools, separate from base model `usage`. The field\ncan be omitted when tool usage is unavailable. When present, tool families\nwith no recorded usage have zero counts.\n\n`image_gen` sums available token counts across image generation calls.\nCalls with missing or incomplete usage records may be skipped. Output\ntoken details and cached input counts can be omitted. An omitted cache\ncount means cache usage is unknown.\n\n`web_search.num_requests` counts billable searches. Discounted searches\nand actions such as opening a page are excluded. Use billing records to\nreconcile final charges.\n" + }, + "prompt_cache_options": { + "$ref": "#/components/schemas/PromptCacheOptions" + }, + "prompt_cache_diagnostics": { + "$ref": "#/components/schemas/PromptCacheDiagnostics" + }, + "moderation": { + "anyOf": [ + { + "$ref": "#/components/schemas/Moderation", + "description": "Moderation results for the response input and output, if moderated completions were requested.\n" + }, + { + "type": "null" + } + ] + }, + "parallel_tool_calls": { + "type": "boolean", + "description": "Whether to allow the model to run tool calls in parallel.\n", + "default": true + }, + "conversation": { + "anyOf": [ + { + "default": null, + "$ref": "#/components/schemas/ResponseConversation" + }, + { + "type": "null" + } + ] + }, + "max_output_tokens": { + "anyOf": [ + { + "description": "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning).\n", + "type": "integer" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "access_programs", + "id", + "object", + "created_at", + "error", + "incomplete_details", + "instructions", + "model", + "tools", + "output", + "parallel_tool_calls", + "metadata", + "tool_choice", + "temperature", + "top_p" + ] } - }, - "required": [ - "type", - "item_id" ], - "x-oaiMeta": { - "name": "conversation.item.retrieve", - "group": "realtime", - "example": "{\n \"event_id\": \"event_901\",\n \"type\": \"conversation.item.retrieve\",\n \"item_id\": \"msg_003\"\n}\n" + "example": { + "id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41", + "object": "response", + "access_programs": null, + "created_at": 1741476777, + "status": "completed", + "completed_at": 1741476778, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-6-astra", + "output": [ + { + "type": "message", + "id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.", + "annotations": [], + "logprobs": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null, + "context": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": { + "input_tokens": 328, + "input_tokens_details": { + "cached_tokens": 0, + "cache_write_tokens": 0 + }, + "output_tokens": 52, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 380 + }, + "tool_usage": { + "image_gen": { + "input_tokens": 0, + "input_tokens_details": { + "text_tokens": 0, + "image_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "text_tokens": 0, + "image_tokens": 0 + }, + "total_tokens": 0 + }, + "web_search": { + "num_requests": 0 + } + }, + "user": null, + "metadata": {} } }, - "RealtimeBetaClientEventConversationItemTruncate": { + "ResponseAudioDeltaEvent": { "type": "object", - "description": "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n", + "description": "Emitted when there is a partial audio response.", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.audio.delta`.\n", "enum": [ - "conversation.item.truncate" + "response.audio.delta" ], - "description": "The event type, must be `conversation.item.truncate`.", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n" - }, - "content_index": { + "sequence_number": { "type": "integer", - "description": "The index of the content part to truncate. Set this to 0." + "description": "A sequence number for this chunk of the stream response.\n" }, - "audio_end_ms": { - "type": "integer", - "description": "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n" + "delta": { + "type": "string", + "description": "A chunk of Base64 encoded response audio bytes.\n" } }, "required": [ "type", - "item_id", - "content_index", - "audio_end_ms" + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.truncate", - "group": "realtime", - "example": "{\n \"event_id\": \"event_678\",\n \"type\": \"conversation.item.truncate\",\n \"item_id\": \"msg_002\",\n \"content_index\": 0,\n \"audio_end_ms\": 1500\n}\n" + "name": "response.audio.delta", + "group": "responses", + "example": "{\n \"type\": \"response.audio.delta\",\n \"response_id\": \"resp_123\",\n \"delta\": \"base64encoded...\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaClientEventInputAudioBufferAppend": { + "ResponseAudioDoneEvent": { "type": "object", - "description": "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. In Server VAD \nmode, the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike made other client events, the server will \nnot send a confirmation response to this event.\n", + "description": "Emitted when the audio response is complete.", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.audio.done`.\n", "enum": [ - "input_audio_buffer.append" + "response.audio.done" ], - "description": "The event type, must be `input_audio_buffer.append`.", "x-stainless-const": true }, - "audio": { - "type": "string", - "description": "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n" + "sequence_number": { + "type": "integer", + "description": "The sequence number of the delta.\n" } }, "required": [ "type", - "audio" + "sequence_number", + "response_id" ], "x-oaiMeta": { - "name": "input_audio_buffer.append", - "group": "realtime", - "example": "{\n \"event_id\": \"event_456\",\n \"type\": \"input_audio_buffer.append\",\n \"audio\": \"Base64EncodedAudioData\"\n}\n" + "name": "response.audio.done", + "group": "responses", + "example": "{\n \"type\": \"response.audio.done\",\n \"response_id\": \"resp-123\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaClientEventInputAudioBufferClear": { + "ResponseAudioTranscriptDeltaEvent": { "type": "object", - "description": "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n", + "description": "Emitted when there is a partial transcript of audio.", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.audio.transcript.delta`.\n", "enum": [ - "input_audio_buffer.clear" + "response.audio.transcript.delta" ], - "description": "The event type, must be `input_audio_buffer.clear`.", "x-stainless-const": true + }, + "delta": { + "type": "string", + "description": "The partial transcript of the audio response.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "type" + "type", + "response_id", + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "input_audio_buffer.clear", - "group": "realtime", - "example": "{\n \"event_id\": \"event_012\",\n \"type\": \"input_audio_buffer.clear\"\n}\n" + "name": "response.audio.transcript.delta", + "group": "responses", + "example": "{\n \"type\": \"response.audio.transcript.delta\",\n \"response_id\": \"resp_123\",\n \"delta\": \" ... partial transcript ... \",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaClientEventInputAudioBufferCommit": { + "ResponseAudioTranscriptDoneEvent": { "type": "object", - "description": "Send this event to commit the user input audio buffer, which will create a \nnew user message item in the conversation. This event will produce an error \nif the input audio buffer is empty. When in Server VAD mode, the client does \nnot need to send this event, the server will commit the audio buffer \nautomatically.\n\nCommitting the input audio buffer will trigger input audio transcription \n(if enabled in session configuration), but it will not create a response \nfrom the model. The server will respond with an `input_audio_buffer.committed` \nevent.\n", + "description": "Emitted when the full audio transcript is completed.", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.audio.transcript.done`.\n", "enum": [ - "input_audio_buffer.commit" + "response.audio.transcript.done" ], - "description": "The event type, must be `input_audio_buffer.commit`.", "x-stainless-const": true + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "type" + "type", + "response_id", + "sequence_number" ], "x-oaiMeta": { - "name": "input_audio_buffer.commit", - "group": "realtime", - "example": "{\n \"event_id\": \"event_789\",\n \"type\": \"input_audio_buffer.commit\"\n}\n" + "name": "response.audio.transcript.done", + "group": "responses", + "example": "{\n \"type\": \"response.audio.transcript.done\",\n \"response_id\": \"resp_123\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaClientEventOutputAudioBufferClear": { + "ResponseCodeInterpreterCallCodeDeltaEvent": { "type": "object", - "description": "**WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to\nstop generating audio and emit a `output_audio_buffer.cleared` event. This\nevent should be preceded by a `response.cancel` client event to stop the\ngeneration of the current response.\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", + "description": "Emitted when a partial code snippet is streamed by the code interpreter.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the client event used for error handling." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.code_interpreter_call_code.delta`.", "enum": [ - "output_audio_buffer.clear" + "response.code_interpreter_call_code.delta" ], - "description": "The event type, must be `output_audio_buffer.clear`.", "x-stainless-const": true + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response for which the code is being streamed." + }, + "item_id": { + "type": "string", + "description": "The unique identifier of the code interpreter tool call item." + }, + "delta": { + "type": "string", + "description": "The partial code snippet being streamed by the code interpreter." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event, used to order streaming events." } }, "required": [ - "type" + "type", + "output_index", + "item_id", + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "output_audio_buffer.clear", - "group": "realtime", - "example": "{\n \"event_id\": \"optional_client_event_id\",\n \"type\": \"output_audio_buffer.clear\"\n}\n" + "name": "response.code_interpreter_call_code.delta", + "group": "responses", + "example": "{\n \"type\": \"response.code_interpreter_call_code.delta\",\n \"output_index\": 0,\n \"item_id\": \"ci_12345\",\n \"delta\": \"print('Hello, world')\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaClientEventResponseCancel": { + "ResponseCodeInterpreterCallCodeDoneEvent": { "type": "object", - "description": "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error.\n", + "description": "Emitted when the code snippet is finalized by the code interpreter.", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.code_interpreter_call_code.done`.", "enum": [ - "response.cancel" + "response.code_interpreter_call_code.done" ], - "description": "The event type, must be `response.cancel`.", "x-stainless-const": true }, - "response_id": { + "output_index": { + "type": "integer", + "description": "The index of the output item in the response for which the code is finalized." + }, + "item_id": { "type": "string", - "description": "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n" + "description": "The unique identifier of the code interpreter tool call item." + }, + "code": { + "type": "string", + "description": "The final code snippet output by the code interpreter." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event, used to order streaming events." } }, "required": [ - "type" + "type", + "output_index", + "item_id", + "code", + "sequence_number" ], "x-oaiMeta": { - "name": "response.cancel", - "group": "realtime", - "example": "{\n \"event_id\": \"event_567\",\n \"type\": \"response.cancel\"\n}\n" + "name": "response.code_interpreter_call_code.done", + "group": "responses", + "example": "{\n \"type\": \"response.code_interpreter_call_code.done\",\n \"output_index\": 3,\n \"item_id\": \"ci_12345\",\n \"code\": \"print('done')\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaClientEventResponseCreate": { + "ResponseCodeInterpreterCallCompletedEvent": { "type": "object", - "description": "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event can optionally include inference configuration like \n`instructions`, and `temperature`. These fields will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n", + "description": "Emitted when the code interpreter call is completed.", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.code_interpreter_call.completed`.", "enum": [ - "response.create" + "response.code_interpreter_call.completed" ], - "description": "The event type, must be `response.create`.", "x-stainless-const": true }, - "response": { - "$ref": "#/components/schemas/RealtimeBetaResponseCreateParams" + "output_index": { + "type": "integer", + "description": "The index of the output item in the response for which the code interpreter call is completed." + }, + "item_id": { + "type": "string", + "description": "The unique identifier of the code interpreter tool call item." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event, used to order streaming events." } }, "required": [ - "type" + "type", + "output_index", + "item_id", + "sequence_number" ], "x-oaiMeta": { - "name": "response.create", - "group": "realtime", - "example": "// Trigger a response with the default Conversation and no special parameters\n{\n \"type\": \"response.create\",\n}\n\n// Trigger an out-of-band response that does not write to the default Conversation\n{\n \"type\": \"response.create\",\n \"response\": {\n \"instructions\": \"Provide a concise answer.\",\n \"tools\": [], // clear any session tools\n \"conversation\": \"none\",\n \"output_modalities\": [\"text\"],\n \"input\": [\n {\n \"type\": \"item_reference\",\n \"id\": \"item_12345\",\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Summarize the above message in one sentence.\"\n }\n ]\n }\n ],\n }\n}\n" + "name": "response.code_interpreter_call.completed", + "group": "responses", + "example": "{\n \"type\": \"response.code_interpreter_call.completed\",\n \"output_index\": 5,\n \"item_id\": \"ci_12345\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaClientEventSessionUpdate": { + "ResponseCodeInterpreterCallInProgressEvent": { "type": "object", - "description": "Send this event to update the session’s default configuration.\nThe client may send this event at any time to update any field,\nexcept for `voice`. However, note that once a session has been\ninitialized with a particular `model`, it can’t be changed to\nanother model using `session.update`.\n\nWhen the server receives a `session.update`, it will respond\nwith a `session.updated` event showing the full, effective configuration.\nOnly the fields that are present are updated. To clear a field like\n`instructions`, pass an empty string.\n", + "description": "Emitted when a code interpreter call is in progress.", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.code_interpreter_call.in_progress`.", "enum": [ - "session.update" + "response.code_interpreter_call.in_progress" ], - "description": "The event type, must be `session.update`.", "x-stainless-const": true }, - "session": { - "$ref": "#/components/schemas/RealtimeSessionCreateRequest" + "output_index": { + "type": "integer", + "description": "The index of the output item in the response for which the code interpreter call is in progress." + }, + "item_id": { + "type": "string", + "description": "The unique identifier of the code interpreter tool call item." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event, used to order streaming events." } }, "required": [ "type", - "session" + "output_index", + "item_id", + "sequence_number" ], "x-oaiMeta": { - "name": "session.update", - "group": "realtime", - "example": "{\n \"type\": \"session.update\",\n \"session\": {\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"display_color_palette\",\n \"description\": \"Call this function when a user asks for a color palette.\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"theme\": {\n \"type\": \"string\",\n \"description\": \"Description of the theme for the color scheme.\"\n },\n \"colors\": {\n \"type\": \"array\",\n \"description\": \"Array of five hex color codes based on the theme.\",\n \"items\": {\n \"type\": \"string\",\n \"description\": \"Hex color code\"\n }\n }\n },\n \"required\": [\n \"theme\",\n \"colors\"\n ]\n }\n }\n ],\n \"tool_choice\": \"auto\"\n }\n}\n" + "name": "response.code_interpreter_call.in_progress", + "group": "responses", + "example": "{\n \"type\": \"response.code_interpreter_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"ci_12345\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaClientEventTranscriptionSessionUpdate": { + "ResponseCodeInterpreterCallInterpretingEvent": { "type": "object", - "description": "Send this event to update a transcription session.\n", + "description": "Emitted when the code interpreter is actively interpreting the code snippet.", "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.code_interpreter_call.interpreting`.", "enum": [ - "transcription_session.update" + "response.code_interpreter_call.interpreting" ], - "description": "The event type, must be `transcription_session.update`.", "x-stainless-const": true }, - "session": { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateRequest" + "output_index": { + "type": "integer", + "description": "The index of the output item in the response for which the code interpreter is interpreting code." + }, + "item_id": { + "type": "string", + "description": "The unique identifier of the code interpreter tool call item." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event, used to order streaming events." } }, "required": [ "type", - "session" + "output_index", + "item_id", + "sequence_number" ], "x-oaiMeta": { - "name": "transcription_session.update", - "group": "realtime", - "example": "{\n \"type\": \"transcription_session.update\",\n \"session\": {\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500,\n \"create_response\": true,\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\",\n ]\n }\n}\n" + "name": "response.code_interpreter_call.interpreting", + "group": "responses", + "example": "{\n \"type\": \"response.code_interpreter_call.interpreting\",\n \"output_index\": 4,\n \"item_id\": \"ci_12345\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaResponse": { + "ResponseCompactionCompactingEvent": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCompactionCompactingStreamingEvent" + } + ], + "x-oaiMeta": { + "name": "response.compaction.compacting", + "group": "responses", + "example": "{\n \"type\": \"response.compaction.compacting\",\n \"sequence_number\": 3,\n \"item_id\": \"cmp_123\",\n \"output_index\": 0\n}\n" + } + }, + "ResponseCompletedEvent": { "type": "object", - "description": "The response resource.", + "description": "Emitted when the model response is complete.", "properties": { - "id": { - "type": "string", - "description": "The unique ID of the response." - }, - "object": { + "type": { "type": "string", + "description": "The type of the event. Always `response.completed`.\n", "enum": [ - "realtime.response" + "response.completed" ], - "description": "The object type, must be `realtime.response`.", "x-stainless-const": true }, - "status": { - "type": "string", - "enum": [ - "completed", - "cancelled", - "failed", - "incomplete", - "in_progress" - ], - "description": "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n" - }, - "status_details": { - "type": "object", - "description": "Additional details about the status.", - "properties": { - "type": { - "type": "string", - "enum": [ - "completed", - "cancelled", - "failed", - "incomplete" - ], - "description": "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n" - }, - "reason": { - "type": "string", - "enum": [ - "turn_detected", - "client_cancelled", - "max_output_tokens", - "content_filter" - ], - "description": "The reason the Response did not complete. For a `cancelled` Response, \none of `turn_detected` (the server VAD detected a new start of speech) \nor `client_cancelled` (the client sent a cancel event). For an \n`incomplete` Response, one of `max_output_tokens` or `content_filter` \n(the server-side safety filter activated and cut off the response).\n" - }, - "error": { - "type": "object", - "description": "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of error." - }, - "code": { - "type": "string", - "description": "Error code, if any." - } - } - } - } - }, - "output": { - "type": "array", - "description": "The list of output items generated by the response.", - "items": { - "$ref": "#/components/schemas/RealtimeConversationItem" - } - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "usage": { - "type": "object", - "description": "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n", - "properties": { - "total_tokens": { - "type": "integer", - "description": "The total number of tokens in the Response including input and output \ntext and audio tokens.\n" - }, - "input_tokens": { - "type": "integer", - "description": "The number of input tokens used in the Response, including text and \naudio tokens.\n" - }, - "output_tokens": { - "type": "integer", - "description": "The number of output tokens sent in the Response, including text and \naudio tokens.\n" - }, - "input_token_details": { - "type": "object", - "description": "Details about the input tokens used in the Response.", - "properties": { - "cached_tokens": { - "type": "integer", - "description": "The number of cached tokens used as input for the Response." - }, - "text_tokens": { - "type": "integer", - "description": "The number of text tokens used as input for the Response." - }, - "image_tokens": { - "type": "integer", - "description": "The number of image tokens used as input for the Response." - }, - "audio_tokens": { - "type": "integer", - "description": "The number of audio tokens used as input for the Response." - }, - "cached_tokens_details": { - "type": "object", - "description": "Details about the cached tokens used as input for the Response.", - "properties": { - "text_tokens": { - "type": "integer", - "description": "The number of cached text tokens used as input for the Response." - }, - "image_tokens": { - "type": "integer", - "description": "The number of cached image tokens used as input for the Response." - }, - "audio_tokens": { - "type": "integer", - "description": "The number of cached audio tokens used as input for the Response." - } - } - } - } - }, - "output_token_details": { - "type": "object", - "description": "Details about the output tokens used in the Response.", - "properties": { - "text_tokens": { - "type": "integer", - "description": "The number of text tokens used in the Response." - }, - "audio_tokens": { - "type": "integer", - "description": "The number of audio tokens used in the Response." - } - } - } - } - }, - "conversation_id": { - "description": "Which conversation the response is added to, determined by the `conversation`\nfield in the `response.create` event. If `auto`, the response will be added to\nthe default conversation and the value of `conversation_id` will be an id like\n`conv_1234`. If `none`, the response will not be added to any conversation and\nthe value of `conversation_id` will be `null`. If responses are being triggered\nby server VAD, the response will be added to the default conversation, thus\nthe `conversation_id` will be an id like `conv_1234`.\n", - "type": "string" - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsShared", - "description": "The voice the model used to respond.\nCurrent voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n" - }, - "modalities": { - "type": "array", - "description": "The set of modalities the model used to respond. If there are multiple modalities,\nthe model will pick one, for example if `modalities` is `[\"text\", \"audio\"]`, the model\ncould be responding in either text or audio.\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] - } - }, - "output_audio_format": { - "type": "string", - "enum": [ - "pcm16", - "g711_ulaw", - "g711_alaw" - ], - "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" - }, - "temperature": { - "type": "number", - "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n" + "response": { + "$ref": "#/components/schemas/Response", + "description": "Properties of the completed response.\n" }, - "max_output_tokens": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string", - "enum": [ - "inf" - ], - "x-stainless-const": true - } - ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls, that was used in this response.\n" + "sequence_number": { + "type": "integer", + "description": "The sequence number for this event." } + }, + "required": [ + "type", + "response", + "sequence_number" + ], + "x-oaiMeta": { + "name": "response.completed", + "group": "responses", + "example": "{\n \"type\": \"response.completed\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1740855869,\n \"status\": \"completed\",\n \"completed_at\": 1740855870,\n \"error\": null,\n \"incomplete_details\": null,\n \"input\": [],\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"id\": \"msg_123\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ],\n \"status\": \"completed\"\n }\n ],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 0,\n \"output_tokens\": 0,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 0,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n }\n },\n \"user\": null,\n \"metadata\": {},\n \"parallel_tool_calls\": true\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaResponseCreateParams": { + "ResponseConfigurationUpdate": { "type": "object", - "description": "Create a new Realtime response with these parameters", + "description": "A configuration update for subsequent responses. Each setting stays in effect\nuntil a later update replaces that setting.\n", "properties": { - "modalities": { - "type": "array", - "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] - } - }, - "instructions": { + "id": { "type": "string", - "description": "The default system instructions (i.e. system message) prepended to model \ncalls. This field allows the client to guide the model on desired \nresponses. The model can be instructed on response content and format, \n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good \nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion \ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed \nto be followed by the model, but they provide guidance to the model on the \ndesired behavior.\n\nNote that the server sets default instructions which will be used if this \nfield is not set and are visible in the `session.created` event at the \nstart of the session.\n" - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", - "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with an\n`id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed during\nthe session once the model has responded with audio at least once.\n" + "description": "The unique ID of the configuration update item.", + "example": "cnfu_123" }, - "output_audio_format": { + "type": { "type": "string", - "enum": [ - "pcm16", - "g711_ulaw", - "g711_alaw" - ], - "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" - }, - "tools": { - "type": "array", - "description": "Tools (functions) available to the model.", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "function" - ], - "description": "The type of the tool, i.e. `function`.", - "x-stainless-const": true - }, - "name": { - "type": "string", - "description": "The name of the function." - }, - "description": { - "type": "string", - "description": "The description of the function, including guidance on when and how \nto call it, and guidance about what to tell the user when calling \n(if anything).\n" - }, - "parameters": { - "type": "object", - "description": "Parameters of the function in JSON Schema." - } + "enum": [ + "configuration_update" + ], + "description": "The item type. Always `configuration_update`.", + "default": "configuration_update", + "x-stainless-const": true + }, + "reasoning": { + "type": "object", + "description": "The reasoning configuration applied by this update.", + "properties": { + "effort": { + "$ref": "#/components/schemas/ReasoningEffort", + "description": "The reasoning effort used for subsequent responses until another\nconfiguration update replaces it.\n" } } }, - "tool_choice": { - "description": "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ToolChoiceOptions" - }, + "text": { + "type": "object", + "description": "The text output configuration for subsequent responses.", + "properties": { + "format": { + "description": "Use a JSON schema for structured output or text to return to plain text.", + "oneOf": [ + { + "$ref": "#/components/schemas/ResponseFormatText" + }, + { + "$ref": "#/components/schemas/TextResponseFormatJsonSchema" + } + ], + "discriminator": { + "propertyName": "type" + } + } + }, + "required": [ + "format" + ] + } + }, + "required": [ + "id", + "type" + ] + }, + "ResponseConfigurationUpdateItemParam": { + "type": "object", + "description": "An update to the conversation's response configuration. Supply reasoning,\ntext, or both. Each setting stays in effect until a later update replaces it.\n", + "properties": { + "id": { + "anyOf": [ { - "$ref": "#/components/schemas/ToolChoiceFunction" + "type": "string", + "description": "The unique ID of the configuration update item.", + "example": "cnfu_123" }, { - "$ref": "#/components/schemas/ToolChoiceMCP" + "type": "null" } + ] + }, + "type": { + "type": "string", + "enum": [ + "configuration_update" ], - "default": "auto" + "description": "The item type. Always `configuration_update`.", + "default": "configuration_update", + "x-stainless-const": true }, - "temperature": { - "type": "number", - "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n" + "reasoning": { + "type": "object", + "description": "Updates to reasoning configuration. Only effort is supported.", + "properties": { + "effort": { + "$ref": "#/components/schemas/ReasoningEffort", + "description": "The reasoning effort to use for subsequent responses until another\nconfiguration update replaces it.\n" + } + } }, - "max_output_tokens": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string", - "enum": [ - "inf" + "text": { + "type": "object", + "description": "The text output configuration for subsequent responses.", + "properties": { + "format": { + "description": "Use a JSON schema for structured output or text to return to plain text.", + "oneOf": [ + { + "$ref": "#/components/schemas/ResponseFormatText" + }, + { + "$ref": "#/components/schemas/TextResponseFormatJsonSchema" + } ], - "x-stainless-const": true + "discriminator": { + "propertyName": "type" + } } + }, + "required": [ + "format" + ] + } + }, + "required": [ + "type" + ] + }, + "ResponseContentPartAddedEvent": { + "type": "object", + "description": "Emitted when a new content part is added.", + "properties": { + "type": { + "type": "string", + "description": "The type of the event. Always `response.content_part.added`.\n", + "enum": [ + "response.content_part.added" ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" + "x-stainless-const": true }, - "conversation": { - "description": "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which \nwill not add items to default conversation.\n", - "oneOf": [ - { - "type": "string" - }, - { - "type": "string", - "default": "auto", - "enum": [ - "auto", - "none" - ] - } - ] + "item_id": { + "type": "string", + "description": "The ID of the output item that the content part was added to.\n" }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "output_index": { + "type": "integer", + "description": "The index of the output item that the content part was added to.\n" }, - "prompt": { - "$ref": "#/components/schemas/Prompt" + "content_index": { + "type": "integer", + "description": "The index of the content part that was added.\n" }, - "input": { - "type": "array", - "description": "Input items to include in the prompt for the model. Using this field\ncreates a new context for this Response instead of using the default\nconversation. An empty array `[]` will clear the context for this Response.\nNote that this can include references to items from the default conversation.\n", - "items": { - "$ref": "#/components/schemas/RealtimeConversationItem" - } + "part": { + "$ref": "#/components/schemas/OutputContent", + "description": "The content part that was added.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } + }, + "required": [ + "type", + "item_id", + "output_index", + "content_index", + "part", + "sequence_number" + ], + "x-oaiMeta": { + "name": "response.content_part.added", + "group": "responses", + "example": "{\n \"type\": \"response.content_part.added\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"output_text\",\n \"text\": \"\",\n \"annotations\": [],\n \"logprobs\": []\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventConversationItemCreated": { + "ResponseContentPartDoneEvent": { "type": "object", - "description": "Returned when a conversation item is created. There are several scenarios that produce this event:\n - The server is generating a Response, which if successful will produce\n either one or two Items, which will be of type `message`\n (role `assistant`) or type `function_call`.\n - The input audio buffer has been committed, either by the client or the\n server (in `server_vad` mode). The server will take the content of the\n input audio buffer and add it to a new user message Item.\n - The client has sent a `conversation.item.create` event to add a new Item\n to the Conversation.\n", + "description": "Emitted when a content part is done.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.content_part.done`.\n", "enum": [ - "conversation.item.created" + "response.content_part.done" ], - "description": "The event type, must be `conversation.item.created`.", "x-stainless-const": true }, - "previous_item_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the preceding item in the Conversation context, allows the\nclient to understand the order of the conversation. Can be `null` if the\nitem has no predecessor.\n" - }, - { - "type": "null" - } - ] + "item_id": { + "type": "string", + "description": "The ID of the output item that the content part was added to.\n" }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" + "output_index": { + "type": "integer", + "description": "The index of the output item that the content part was added to.\n" + }, + "content_index": { + "type": "integer", + "description": "The index of the content part that is done.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." + }, + "part": { + "$ref": "#/components/schemas/OutputContent", + "description": "The content part that is done.\n" } }, "required": [ - "event_id", "type", - "item" + "item_id", + "output_index", + "content_index", + "part", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.created", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1920\",\n \"type\": \"conversation.item.created\",\n \"previous_item_id\": \"msg_002\",\n \"item\": {\n \"id\": \"msg_003\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"user\",\n \"content\": []\n }\n}\n" + "name": "response.content_part.done", + "group": "responses", + "example": "{\n \"type\": \"response.content_part.done\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"sequence_number\": 1,\n \"part\": {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n}\n" } }, - "RealtimeBetaServerEventConversationItemDeleted": { + "ResponseCreatedEvent": { "type": "object", - "description": "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n", + "description": "An event that is emitted when a response is created.\n", "properties": { - "event_id": { + "type": { "type": "string", - "description": "The unique ID of the server event." + "description": "The type of the event. Always `response.created`.\n", + "enum": [ + "response.created" + ], + "x-stainless-const": true + }, + "response": { + "$ref": "#/components/schemas/Response", + "description": "The response that was created.\n" }, + "sequence_number": { + "type": "integer", + "description": "The sequence number for this event." + } + }, + "required": [ + "type", + "response", + "sequence_number" + ], + "x-oaiMeta": { + "name": "response.created", + "group": "responses", + "example": "{\n \"type\": \"response.created\",\n \"response\": {\n \"id\": \"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741487325,\n \"status\": \"in_progress\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" + } + }, + "ResponseCustomToolCallInputDeltaEvent": { + "title": "ResponseCustomToolCallInputDelta", + "type": "object", + "description": "Event representing a delta (partial update) to the input of a custom tool call.\n", + "properties": { "type": { "type": "string", "enum": [ - "conversation.item.deleted" + "response.custom_tool_call_input.delta" ], - "description": "The event type, must be `conversation.item.deleted`.", + "description": "The event type identifier.", "x-stainless-const": true }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." + }, + "output_index": { + "type": "integer", + "description": "The index of the output this delta applies to." + }, "item_id": { "type": "string", - "description": "The ID of the item that was deleted." + "description": "Unique identifier for the API item associated with this event." + }, + "delta": { + "type": "string", + "description": "The incremental input data (delta) for the custom tool call." } }, "required": [ - "event_id", "type", - "item_id" + "output_index", + "item_id", + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.deleted", - "group": "realtime", - "example": "{\n \"event_id\": \"event_2728\",\n \"type\": \"conversation.item.deleted\",\n \"item_id\": \"msg_005\"\n}\n" + "name": "response.custom_tool_call_input.delta", + "group": "responses", + "example": "{\n \"type\": \"response.custom_tool_call_input.delta\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"ctc_1234567890abcdef\",\n \"delta\": \"partial input text\"\n}\n" } }, - "RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted": { + "ResponseCustomToolCallInputDoneEvent": { + "title": "ResponseCustomToolCallInputDone", "type": "object", - "description": "This event is the output of audio transcription for user audio written to the\nuser audio buffer. Transcription begins when the input audio buffer is\ncommitted by the client or server (in `server_vad` mode). Transcription runs\nasynchronously with Response creation, so this event may come before or after\nthe Response events.\n\nRealtime API models accept audio natively, and thus input transcription is a\nseparate process run on a separate ASR (Automatic Speech Recognition) model.\nThe transcript may diverge somewhat from the model's interpretation, and\nshould be treated as a rough guide.\n", + "description": "Event indicating that input for a custom tool call is complete.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "conversation.item.input_audio_transcription.completed" + "response.custom_tool_call_input.done" ], - "description": "The event type, must be\n`conversation.item.input_audio_transcription.completed`.\n", + "description": "The event type identifier.", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the user message item containing the audio." + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." }, - "content_index": { + "output_index": { "type": "integer", - "description": "The index of the content part containing the audio." + "description": "The index of the output this event applies to." }, - "transcript": { + "item_id": { "type": "string", - "description": "The transcribed text." + "description": "Unique identifier for the API item associated with this event." }, - "languages": { - "type": "array", - "description": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n", - "items": { - "$ref": "#/components/schemas/TranscriptionLanguage" - } + "input": { + "type": "string", + "description": "The complete input data for the custom tool call." + } + }, + "required": [ + "type", + "output_index", + "item_id", + "input", + "sequence_number" + ], + "x-oaiMeta": { + "name": "response.custom_tool_call_input.done", + "group": "responses", + "example": "{\n \"type\": \"response.custom_tool_call_input.done\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"ctc_1234567890abcdef\",\n \"input\": \"final complete input text\"\n}\n" + } + }, + "ResponseError": { + "anyOf": [ + { + "type": "object", + "description": "An error object returned when the model fails to generate a Response.\n", + "properties": { + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The original error type, or null if it was not recorded." + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The request parameter associated with the error, or null if none was recorded." + }, + "code": { + "$ref": "#/components/schemas/ResponseErrorCode" + }, + "message": { + "type": "string", + "description": "A human-readable description of the error.\n" + }, + "misalignment": { + "$ref": "#/components/schemas/MisalignmentErrorDetailsResource" + } + }, + "required": [ + "code", + "message" + ] }, - "logprobs": { + { + "type": "null" + } + ] + }, + "ResponseErrorCode": { + "type": "string", + "description": "The error code for the response.\n", + "enum": [ + "server_error", + "rate_limit_exceeded", + "invalid_prompt", + "data_residency_mismatch", + "bio_policy", + "misalignment_policy_violation", + "vector_store_timeout", + "invalid_image", + "invalid_image_format", + "invalid_base64_image", + "invalid_image_url", + "image_too_large", + "image_too_small", + "image_parse_error", + "image_content_policy_violation", + "invalid_image_mode", + "image_file_too_large", + "unsupported_image_media_type", + "empty_image_file", + "failed_to_download_image", + "image_file_not_found" + ] + }, + "ResponseErrorEvent": { + "type": "object", + "description": "Emitted when an error occurs.", + "properties": { + "type": { + "type": "string", + "description": "The type of the event. Always `error`.\n", + "enum": [ + "error" + ], + "x-stainless-const": true + }, + "code": { "anyOf": [ { - "type": "array", - "description": "The log probabilities of the transcription.", - "items": { - "$ref": "#/components/schemas/LogProbProperties" - } + "type": "string", + "description": "The error code.\n" }, { "type": "null" } ] }, - "usage": { - "type": "object", - "description": "Usage statistics for the transcription.", - "oneOf": [ + "message": { + "type": "string", + "description": "The error message.\n" + }, + "param": { + "anyOf": [ { - "$ref": "#/components/schemas/TranscriptTextUsageTokens", - "title": "Token Usage" + "type": "string", + "description": "The error parameter.\n" }, { - "$ref": "#/components/schemas/TranscriptTextUsageDuration", - "title": "Duration Usage" + "type": "null" } ] + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "item_id", - "content_index", - "transcript", - "usage" + "code", + "message", + "param", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.input_audio_transcription.completed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_2122\",\n \"type\": \"conversation.item.input_audio_transcription.completed\",\n \"item_id\": \"msg_003\",\n \"content_index\": 0,\n \"transcript\": \"Hello, how are you?\",\n \"usage\": {\n \"type\": \"tokens\",\n \"total_tokens\": 48,\n \"input_tokens\": 38,\n \"input_token_details\": {\n \"text_tokens\": 10,\n \"audio_tokens\": 28,\n },\n \"output_tokens\": 10,\n }\n}\n" + "name": "error", + "group": "responses", + "example": "{\n \"type\": \"error\",\n \"code\": \"ERR_SOMETHING\",\n \"message\": \"Something went wrong\",\n \"param\": null,\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta": { + "ResponseFailedEvent": { "type": "object", - "description": "Returned when the text value of an input audio transcription content part is updated.\n", + "description": "An event that is emitted when a response fails.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.failed`.\n", "enum": [ - "conversation.item.input_audio_transcription.delta" + "response.failed" ], - "description": "The event type, must be `conversation.item.input_audio_transcription.delta`.", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the item." - }, - "content_index": { + "sequence_number": { "type": "integer", - "description": "The index of the content part in the item's content array." - }, - "delta": { - "type": "string", - "description": "The text delta." + "description": "The sequence number of this event." }, - "logprobs": { - "anyOf": [ - { - "type": "array", - "description": "The log probabilities of the transcription.", - "items": { - "$ref": "#/components/schemas/LogProbProperties" - } - }, - { - "type": "null" - } - ] + "response": { + "$ref": "#/components/schemas/Response", + "description": "The response that failed.\n" } }, "required": [ - "event_id", "type", - "item_id" + "response", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.input_audio_transcription.delta", - "group": "realtime", - "example": "{\n \"type\": \"conversation.item.input_audio_transcription.delta\",\n \"event_id\": \"event_001\",\n \"item_id\": \"item_001\",\n \"content_index\": 0,\n \"delta\": \"Hello\"\n}\n" + "name": "response.failed", + "group": "responses", + "example": "{\n \"type\": \"response.failed\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1740855869,\n \"status\": \"failed\",\n \"completed_at\": null,\n \"error\": {\n \"code\": \"server_error\",\n \"message\": \"The model failed to generate a response.\"\n },\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {},\n \"parallel_tool_calls\": true\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed": { + "ResponseFileSearchCallCompletedEvent": { "type": "object", - "description": "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n", + "description": "Emitted when a file search call is completed (results found).", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.file_search_call.completed`.\n", "enum": [ - "conversation.item.input_audio_transcription.failed" + "response.file_search_call.completed" ], - "description": "The event type, must be\n`conversation.item.input_audio_transcription.failed`.\n", "x-stainless-const": true }, + "output_index": { + "type": "integer", + "description": "The index of the output item that the file search call is initiated.\n" + }, "item_id": { "type": "string", - "description": "The ID of the user message item." + "description": "The ID of the output item that the file search call is initiated.\n" }, - "content_index": { + "sequence_number": { "type": "integer", - "description": "The index of the content part containing the audio." - }, - "error": { - "type": "object", - "description": "Details of the transcription error.", - "properties": { - "type": { - "type": "string", - "description": "The type of error." - }, - "code": { - "type": "string", - "description": "Error code, if any." - }, - "message": { - "type": "string", - "description": "A human-readable error message." - }, - "param": { - "type": "string", - "description": "Parameter related to the error, if any." - } - } + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", + "output_index", "item_id", - "content_index", - "error" + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.input_audio_transcription.failed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_2324\",\n \"type\": \"conversation.item.input_audio_transcription.failed\",\n \"item_id\": \"msg_003\",\n \"content_index\": 0,\n \"error\": {\n \"type\": \"transcription_error\",\n \"code\": \"audio_unintelligible\",\n \"message\": \"The audio could not be transcribed.\",\n \"param\": null\n }\n}\n" + "name": "response.file_search_call.completed", + "group": "responses", + "example": "{\n \"type\": \"response.file_search_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"fs_123\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventConversationItemInputAudioTranscriptionSegment": { + "ResponseFileSearchCallInProgressEvent": { "type": "object", - "description": "Returned when an input audio transcription segment is identified for an item.", + "description": "Emitted when a file search call is initiated.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.file_search_call.in_progress`.\n", "enum": [ - "conversation.item.input_audio_transcription.segment" + "response.file_search_call.in_progress" ], - "description": "The event type, must be `conversation.item.input_audio_transcription.segment`.", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the item containing the input audio content." - }, - "content_index": { + "output_index": { "type": "integer", - "description": "The index of the input audio content part within the item." - }, - "text": { - "type": "string", - "description": "The text for this segment." - }, - "id": { - "type": "string", - "description": "The segment identifier." + "description": "The index of the output item that the file search call is initiated.\n" }, - "speaker": { + "item_id": { "type": "string", - "description": "The detected speaker label for this segment." - }, - "start": { - "type": "number", - "format": "double", - "description": "Start time of the segment in seconds." + "description": "The ID of the output item that the file search call is initiated.\n" }, - "end": { - "type": "number", - "format": "double", - "description": "End time of the segment in seconds." + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", + "output_index", "item_id", - "content_index", - "text", - "id", - "speaker", - "start", - "end" + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.input_audio_transcription.segment", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6501\",\n \"type\": \"conversation.item.input_audio_transcription.segment\",\n \"item_id\": \"msg_011\",\n \"content_index\": 0,\n \"text\": \"hello\",\n \"id\": \"seg_0001\",\n \"speaker\": \"spk_1\",\n \"start\": 0.0,\n \"end\": 0.4\n}\n" + "name": "response.file_search_call.in_progress", + "group": "responses", + "example": "{\n \"type\": \"response.file_search_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"fs_123\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventConversationItemRetrieved": { + "ResponseFileSearchCallSearchingEvent": { "type": "object", - "description": "Returned when a conversation item is retrieved with `conversation.item.retrieve`.\n", + "description": "Emitted when a file search is currently searching.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.file_search_call.searching`.\n", "enum": [ - "conversation.item.retrieved" + "response.file_search_call.searching" ], - "description": "The event type, must be `conversation.item.retrieved`.", "x-stainless-const": true }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" + "output_index": { + "type": "integer", + "description": "The index of the output item that the file search call is searching.\n" + }, + "item_id": { + "type": "string", + "description": "The ID of the output item that the file search call is initiated.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "item" + "output_index", + "item_id", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.retrieved", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1920\",\n \"type\": \"conversation.item.created\",\n \"previous_item_id\": \"msg_002\",\n \"item\": {\n \"id\": \"msg_003\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_audio\",\n \"transcript\": \"hello how are you\",\n \"audio\": \"base64encodedaudio==\"\n }\n ]\n }\n}\n" + "name": "response.file_search_call.searching", + "group": "responses", + "example": "{\n \"type\": \"response.file_search_call.searching\",\n \"output_index\": 0,\n \"item_id\": \"fs_123\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventConversationItemTruncated": { + "ResponseFormatJsonObject": { "type": "object", - "description": "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n", + "title": "JSON object", + "description": "JSON object response format. An older method of generating JSON responses.\nUsing `json_schema` is recommended for models that support it. Note that the\nmodel will not generate JSON without a system or user message instructing it\nto do so.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of response format being defined. Always `json_object`.", "enum": [ - "conversation.item.truncated" + "json_object" ], - "description": "The event type, must be `conversation.item.truncated`.", "x-stainless-const": true - }, - "item_id": { - "type": "string", - "description": "The ID of the assistant message item that was truncated." - }, - "content_index": { - "type": "integer", - "description": "The index of the content part that was truncated." - }, - "audio_end_ms": { - "type": "integer", - "description": "The duration up to which the audio was truncated, in milliseconds.\n" } }, "required": [ - "event_id", - "type", - "item_id", - "content_index", - "audio_end_ms" - ], - "x-oaiMeta": { - "name": "conversation.item.truncated", - "group": "realtime", - "example": "{\n \"event_id\": \"event_2526\",\n \"type\": \"conversation.item.truncated\",\n \"item_id\": \"msg_004\",\n \"content_index\": 0,\n \"audio_end_ms\": 1500\n}\n" - } + "type" + ] }, - "RealtimeBetaServerEventError": { + "ResponseFormatJsonSchema": { "type": "object", - "description": "Returned when an error occurs, which could be a client problem or a server\nproblem. Most errors are recoverable and the session will stay open, we\nrecommend to implementors to monitor and log error messages by default.\n", + "title": "JSON schema", + "description": "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs).\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of response format being defined. Always `json_schema`.", "enum": [ - "error" + "json_schema" ], - "description": "The event type, must be `error`.", "x-stainless-const": true }, - "error": { + "json_schema": { + "x-openai-structured-output": "json_schema", "type": "object", - "description": "Details of the error.", - "required": [ - "type", - "message" - ], + "title": "JSON schema", + "description": "Structured Outputs configuration options, including a JSON Schema.\n", "properties": { - "type": { + "description": { "type": "string", - "description": "The type of error (e.g., \"invalid_request_error\", \"server_error\").\n" - }, - "code": { - "anyOf": [ - { - "type": "string", - "description": "Error code, if any." - }, - { - "type": "null" - } - ] + "description": "A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n" }, - "message": { + "name": { "type": "string", - "description": "A human-readable error message." + "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n" }, - "param": { - "anyOf": [ - { - "type": "string", - "description": "Parameter related to the error, if any." - }, - { - "type": "null" - } - ] + "schema": { + "$ref": "#/components/schemas/ResponseFormatJsonSchemaSchema" }, - "event_id": { + "strict": { "anyOf": [ { - "type": "string", - "description": "The event_id of the client event that caused the error, if applicable.\n" + "type": "boolean", + "default": false, + "description": "Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](https://developers.openai.com/api/docs/guides/structured-outputs).\n" }, { "type": "null" } ] } - } + }, + "required": [ + "name" + ] } }, "required": [ - "event_id", "type", - "error" - ], - "x-oaiMeta": { - "name": "error", - "group": "realtime", - "example": "{\n \"event_id\": \"event_890\",\n \"type\": \"error\",\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"code\": \"invalid_event\",\n \"message\": \"The 'type' field is missing.\",\n \"param\": null,\n \"event_id\": \"event_567\"\n }\n}\n" - } + "json_schema" + ] }, - "RealtimeBetaServerEventInputAudioBufferCleared": { + "ResponseFormatJsonSchemaSchema": { "type": "object", - "description": "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n", + "title": "JSON schema", + "description": "The schema for the response format, described as a JSON Schema object.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n", + "additionalProperties": true + }, + "ResponseFormatText": { + "type": "object", + "title": "Text", + "description": "Default response format. Used to generate text responses.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of response format being defined. Always `text`.", "enum": [ - "input_audio_buffer.cleared" + "text" ], - "description": "The event type, must be `input_audio_buffer.cleared`.", "x-stainless-const": true } }, "required": [ - "event_id", "type" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.cleared", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1314\",\n \"type\": \"input_audio_buffer.cleared\"\n}\n" - } + ] }, - "RealtimeBetaServerEventInputAudioBufferCommitted": { + "ResponseFormatTextGrammar": { "type": "object", - "description": "Returned when an input audio buffer is committed, either by the client or\nautomatically in server VAD mode. The `item_id` property is the ID of the user\nmessage item that will be created, thus a `conversation.item.created` event\nwill also be sent to the client.\n", + "title": "Text grammar", + "description": "A custom grammar for the model to follow when generating text.\nLearn more in the [custom grammars guide](https://developers.openai.com/api/docs/guides/function-calling#context-free-grammars).\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of response format being defined. Always `grammar`.", "enum": [ - "input_audio_buffer.committed" + "grammar" ], - "description": "The event type, must be `input_audio_buffer.committed`.", "x-stainless-const": true }, - "previous_item_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the preceding item after which the new item will be inserted.\nCan be `null` if the item has no predecessor.\n" - }, - { - "type": "null" - } - ] - }, - "item_id": { + "grammar": { "type": "string", - "description": "The ID of the user message item that will be created." + "description": "The custom grammar for the model to follow." } }, "required": [ - "event_id", "type", - "item_id" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.committed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1121\",\n \"type\": \"input_audio_buffer.committed\",\n \"previous_item_id\": \"msg_001\",\n \"item_id\": \"msg_002\"\n}\n" - } + "grammar" + ] }, - "RealtimeBetaServerEventInputAudioBufferSpeechStarted": { + "ResponseFormatTextPython": { "type": "object", - "description": "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n", + "title": "Python grammar", + "description": "Configure the model to generate valid Python code. See the\n[custom grammars guide](https://developers.openai.com/api/docs/guides/function-calling#context-free-grammars) for more details.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of response format being defined. Always `python`.", "enum": [ - "input_audio_buffer.speech_started" + "python" ], - "description": "The event type, must be `input_audio_buffer.speech_started`.", "x-stainless-const": true - }, - "audio_start_ms": { - "type": "integer", - "description": "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n" - }, - "item_id": { - "type": "string", - "description": "The ID of the user message item that will be created when speech stops.\n" } }, "required": [ - "event_id", - "type", - "audio_start_ms", - "item_id" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.speech_started", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1516\",\n \"type\": \"input_audio_buffer.speech_started\",\n \"audio_start_ms\": 1000,\n \"item_id\": \"msg_003\"\n}\n" - } + "type" + ] }, - "RealtimeBetaServerEventInputAudioBufferSpeechStopped": { + "ResponseFunctionCallArgumentsDeltaEvent": { "type": "object", - "description": "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n", + "description": "Emitted when there is a partial function-call arguments delta.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.function_call_arguments.delta`.\n", "enum": [ - "input_audio_buffer.speech_stopped" + "response.function_call_arguments.delta" ], - "description": "The event type, must be `input_audio_buffer.speech_stopped`.", "x-stainless-const": true }, - "audio_end_ms": { + "item_id": { + "type": "string", + "description": "The ID of the output item that the function-call arguments delta is added to.\n" + }, + "output_index": { "type": "integer", - "description": "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n" + "description": "The index of the output item that the function-call arguments delta is added to.\n" }, - "item_id": { + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." + }, + "delta": { "type": "string", - "description": "The ID of the user message item that will be created." + "description": "The function-call arguments delta that is added.\n" } }, "required": [ - "event_id", "type", - "audio_end_ms", - "item_id" + "item_id", + "output_index", + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "input_audio_buffer.speech_stopped", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1718\",\n \"type\": \"input_audio_buffer.speech_stopped\",\n \"audio_end_ms\": 2000,\n \"item_id\": \"msg_003\"\n}\n" + "name": "response.function_call_arguments.delta", + "group": "responses", + "example": "{\n \"type\": \"response.function_call_arguments.delta\",\n \"item_id\": \"item-abc\",\n \"output_index\": 0,\n \"delta\": \"{ \\\"arg\\\":\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventMCPListToolsCompleted": { + "ResponseFunctionCallArgumentsDoneEvent": { "type": "object", - "description": "Returned when listing MCP tools has completed for an item.", + "description": "Emitted when function-call arguments are finalized.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "mcp_list_tools.completed" + "response.function_call_arguments.done" ], - "description": "The event type, must be `mcp_list_tools.completed`.", "x-stainless-const": true }, "item_id": { "type": "string", - "description": "The ID of the MCP list tools item." + "description": "The ID of the item." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." + }, + "arguments": { + "type": "string", + "description": "The function-call arguments." } }, "required": [ - "event_id", "type", - "item_id" + "item_id", + "output_index", + "arguments", + "sequence_number" ], "x-oaiMeta": { - "name": "mcp_list_tools.completed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6102\",\n \"type\": \"mcp_list_tools.completed\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" + "name": "response.function_call_arguments.done", + "group": "responses", + "example": "{\n \"type\": \"response.function_call_arguments.done\",\n \"item_id\": \"item-abc\",\n \"output_index\": 1,\n \"arguments\": \"{ \\\"arg\\\": 123 }\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventMCPListToolsFailed": { + "ResponseImageGenCallCompletedEvent": { "type": "object", - "description": "Returned when listing MCP tools has failed for an item.", + "title": "ResponseImageGenCallCompletedEvent", + "description": "Emitted when an image generation tool call has completed and the final image is available.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "mcp_list_tools.failed" + "response.image_generation_call.completed" ], - "description": "The event type, must be `mcp_list_tools.failed`.", + "description": "The type of the event. Always 'response.image_generation_call.completed'.", "x-stainless-const": true }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response's output array." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." + }, "item_id": { "type": "string", - "description": "The ID of the MCP list tools item." + "description": "The unique identifier of the image generation item being processed." } }, "required": [ - "event_id", "type", - "item_id" + "output_index", + "item_id", + "sequence_number" ], "x-oaiMeta": { - "name": "mcp_list_tools.failed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6103\",\n \"type\": \"mcp_list_tools.failed\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" + "name": "response.image_generation_call.completed", + "group": "responses", + "example": "{\n \"type\": \"response.image_generation_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"item-123\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventMCPListToolsInProgress": { + "ResponseImageGenCallGeneratingEvent": { "type": "object", - "description": "Returned when listing MCP tools is in progress for an item.", + "title": "ResponseImageGenCallGeneratingEvent", + "description": "Emitted when an image generation tool call is actively generating an image (intermediate state).\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "mcp_list_tools.in_progress" + "response.image_generation_call.generating" ], - "description": "The event type, must be `mcp_list_tools.in_progress`.", + "description": "The type of the event. Always 'response.image_generation_call.generating'.", "x-stainless-const": true }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response's output array." + }, "item_id": { "type": "string", - "description": "The ID of the MCP list tools item." + "description": "The unique identifier of the image generation item being processed." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of the image generation item being processed." } }, "required": [ - "event_id", "type", - "item_id" + "output_index", + "item_id", + "sequence_number" ], "x-oaiMeta": { - "name": "mcp_list_tools.in_progress", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6101\",\n \"type\": \"mcp_list_tools.in_progress\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" + "name": "response.image_generation_call.generating", + "group": "responses", + "example": "{\n \"type\": \"response.image_generation_call.generating\",\n \"output_index\": 0,\n \"item_id\": \"item-123\",\n \"sequence_number\": 0\n}\n" } }, - "RealtimeBetaServerEventRateLimitsUpdated": { + "ResponseImageGenCallInProgressEvent": { "type": "object", - "description": "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n", + "title": "ResponseImageGenCallInProgressEvent", + "description": "Emitted when an image generation tool call is in progress.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "rate_limits.updated" + "response.image_generation_call.in_progress" ], - "description": "The event type, must be `rate_limits.updated`.", + "description": "The type of the event. Always 'response.image_generation_call.in_progress'.", "x-stainless-const": true }, - "rate_limits": { - "type": "array", - "description": "List of rate limit information.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "requests", - "tokens" - ], - "description": "The name of the rate limit (`requests`, `tokens`).\n" - }, - "limit": { - "type": "integer", - "description": "The maximum allowed value for the rate limit." - }, - "remaining": { - "type": "integer", - "description": "The remaining value before the limit is reached." - }, - "reset_seconds": { - "type": "number", - "description": "Seconds until the rate limit resets." - } - } - } + "output_index": { + "type": "integer", + "description": "The index of the output item in the response's output array." + }, + "item_id": { + "type": "string", + "description": "The unique identifier of the image generation item being processed." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of the image generation item being processed." } }, "required": [ - "event_id", "type", - "rate_limits" + "output_index", + "item_id", + "sequence_number" ], "x-oaiMeta": { - "name": "rate_limits.updated", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5758\",\n \"type\": \"rate_limits.updated\",\n \"rate_limits\": [\n {\n \"name\": \"requests\",\n \"limit\": 1000,\n \"remaining\": 999,\n \"reset_seconds\": 60\n },\n {\n \"name\": \"tokens\",\n \"limit\": 50000,\n \"remaining\": 49950,\n \"reset_seconds\": 60\n }\n ]\n}\n" + "name": "response.image_generation_call.in_progress", + "group": "responses", + "example": "{\n \"type\": \"response.image_generation_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"item-123\",\n \"sequence_number\": 0\n}\n" } }, - "RealtimeBetaServerEventResponseAudioDelta": { + "ResponseImageGenCallPartialImageEvent": { "type": "object", - "description": "Returned when the model-generated audio is updated.", + "title": "ResponseImageGenCallPartialImageEvent", + "description": "Emitted when a partial image is available during image generation streaming.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.output_audio.delta" + "response.image_generation_call.partial_image" ], - "description": "The event type, must be `response.output_audio.delta`.", + "description": "The type of the event. Always 'response.image_generation_call.partial_image'.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." + "output_index": { + "type": "integer", + "description": "The index of the output item in the response's output array." }, "item_id": { "type": "string", - "description": "The ID of the item." + "description": "The unique identifier of the image generation item being processed." }, - "output_index": { + "sequence_number": { "type": "integer", - "description": "The index of the output item in the response." + "description": "The sequence number of the image generation item being processed." }, - "content_index": { + "partial_image_index": { "type": "integer", - "description": "The index of the content part in the item's content array." + "description": "0-based index for the partial image (backend is 1-based, but this is 0-based for the user)." }, - "delta": { + "partial_image_b64": { "type": "string", - "description": "Base64-encoded audio data delta." + "description": "Base64-encoded partial image data, suitable for rendering as an image." + }, + "size": { + "type": "string", + "description": "The image size that was used." + }, + "quality": { + "type": "string", + "description": "The image quality that was used." + }, + "background": { + "type": "string", + "description": "The background setting that was used." + }, + "output_format": { + "type": "string", + "description": "The output format that was used." } }, "required": [ - "event_id", "type", - "response_id", - "item_id", "output_index", - "content_index", - "delta" + "item_id", + "sequence_number", + "partial_image_index", + "partial_image_b64" ], "x-oaiMeta": { - "name": "response.output_audio.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4950\",\n \"type\": \"response.output_audio.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Base64EncodedAudioDelta\"\n}\n" + "name": "response.image_generation_call.partial_image", + "group": "responses", + "example": "{\n \"type\": \"response.image_generation_call.partial_image\",\n \"output_index\": 0,\n \"item_id\": \"item-123\",\n \"sequence_number\": 0,\n \"partial_image_index\": 0,\n \"partial_image_b64\": \"...\"\n}\n" } }, - "RealtimeBetaServerEventResponseAudioDone": { + "ResponseInProgressEvent": { "type": "object", - "description": "Returned when the model-generated audio is done. Also emitted when a Response\nis interrupted, incomplete, or cancelled.\n", + "description": "Emitted when the response is in progress.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.in_progress`.\n", "enum": [ - "response.output_audio.done" + "response.in_progress" ], - "description": "The event type, must be `response.output_audio.done`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the item." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "response": { + "$ref": "#/components/schemas/Response", + "description": "The response that is in progress.\n" }, - "content_index": { + "sequence_number": { "type": "integer", - "description": "The index of the content part in the item's content array." + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "response_id", - "item_id", - "output_index", - "content_index" + "response", + "sequence_number" ], "x-oaiMeta": { - "name": "response.output_audio.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5152\",\n \"type\": \"response.output_audio.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0\n}\n" + "name": "response.in_progress", + "group": "responses", + "example": "{\n \"type\": \"response.in_progress\",\n \"response\": {\n \"id\": \"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741487325,\n \"status\": \"in_progress\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseAudioTranscriptDelta": { + "ResponseIncompleteEvent": { "type": "object", - "description": "Returned when the model-generated transcription of audio output is updated.\n", + "description": "An event that is emitted when a response finishes as incomplete.\n\nOver WebSocket, steering can finish a response with\n`response.incomplete_details.reason` set to `steered`, followed automatically\nby a successor `response.created` that commits the queued steering input.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.incomplete`.\n", "enum": [ - "response.output_audio_transcript.delta" + "response.incomplete" ], - "description": "The event type, must be `response.output_audio_transcript.delta`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." + "response": { + "$ref": "#/components/schemas/Response", + "description": "The response that was incomplete.\n" }, - "item_id": { + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." + } + }, + "required": [ + "type", + "response", + "sequence_number" + ], + "x-oaiMeta": { + "name": "response.incomplete", + "group": "responses", + "example": "{\n \"type\": \"response.incomplete\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1740855869,\n \"status\": \"incomplete\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": {\n \"reason\": \"max_output_tokens\"\n },\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {},\n \"parallel_tool_calls\": true\n },\n \"sequence_number\": 1\n}\n" + } + }, + "ResponseItemList": { + "type": "object", + "description": "A list of Response items.", + "properties": { + "object": { "type": "string", - "description": "The ID of the item." + "description": "The type of object returned, must be `list`.", + "enum": [ + "list" + ], + "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "data": { + "type": "array", + "description": "A list of items used to generate this response.", + "items": { + "$ref": "#/components/schemas/ItemResource" + } }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." }, - "delta": { + "first_id": { "type": "string", - "description": "The transcript delta." + "description": "The ID of the first item in the list." + }, + "last_id": { + "type": "string", + "description": "The ID of the last item in the list." } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "content_index", - "delta" + "object", + "data", + "has_more", + "first_id", + "last_id" ], "x-oaiMeta": { - "name": "response.output_audio_transcript.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4546\",\n \"type\": \"response.output_audio_transcript.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Hello, how can I a\"\n}\n" + "name": "The input item list", + "group": "responses", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"msg_abc123\",\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Tell me a three sentence bedtime story about a unicorn.\"\n }\n ]\n }\n ],\n \"first_id\": \"msg_abc123\",\n \"last_id\": \"msg_abc123\",\n \"has_more\": false\n}\n" } }, - "RealtimeBetaServerEventResponseAudioTranscriptDone": { + "ResponseLogProb": { "type": "object", - "description": "Returned when the model-generated transcription of audio output is done\nstreaming. Also emitted when a Response is interrupted, incomplete, or\ncancelled.\n", + "description": "A logprob is the logarithmic probability that the model assigns to producing \na particular token at a given position in the sequence. Less-negative (higher) \nlogprob values indicate greater model confidence in that token choice.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "token": { + "description": "A possible text token.", + "type": "string" + }, + "logprob": { + "description": "The log probability of this token.\n", + "type": "number" }, + "top_logprobs": { + "description": "The log probabilities of up to 20 of the most likely tokens.\n", + "type": "array", + "items": { + "type": "object", + "properties": { + "token": { + "description": "A possible text token.", + "type": "string" + }, + "logprob": { + "description": "The log probability of this token.", + "type": "number" + } + } + } + } + }, + "required": [ + "token", + "logprob" + ] + }, + "ResponseMCPCallArgumentsDeltaEvent": { + "type": "object", + "title": "ResponseMCPCallArgumentsDeltaEvent", + "description": "Emitted when there is a delta (partial update) to the arguments of an MCP tool call.\n", + "properties": { "type": { "type": "string", "enum": [ - "response.output_audio_transcript.done" + "response.mcp_call_arguments.delta" ], - "description": "The event type, must be `response.output_audio_transcript.done`.", + "description": "The type of the event. Always 'response.mcp_call_arguments.delta'.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." + "output_index": { + "type": "integer", + "description": "The index of the output item in the response's output array." }, "item_id": { "type": "string", - "description": "The ID of the item." + "description": "The unique identifier of the MCP tool call item being processed." }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "delta": { + "type": "string", + "description": "A JSON string containing the partial update to the arguments for the MCP tool call.\n" }, - "content_index": { + "sequence_number": { "type": "integer", - "description": "The index of the content part in the item's content array." - }, - "transcript": { - "type": "string", - "description": "The final transcript of the audio." + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "response_id", - "item_id", "output_index", - "content_index", - "transcript" + "item_id", + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "response.output_audio_transcript.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4748\",\n \"type\": \"response.output_audio_transcript.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"transcript\": \"Hello, how can I assist you today?\"\n}\n" + "name": "response.mcp_call_arguments.delta", + "group": "responses", + "example": "{\n \"type\": \"response.mcp_call_arguments.delta\",\n \"output_index\": 0,\n \"item_id\": \"item-abc\",\n \"delta\": \"{\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseContentPartAdded": { + "ResponseMCPCallArgumentsDoneEvent": { "type": "object", - "description": "Returned when a new content part is added to an assistant message item during\nresponse generation.\n", + "title": "ResponseMCPCallArgumentsDoneEvent", + "description": "Emitted when the arguments for an MCP tool call are finalized.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.content_part.added" + "response.mcp_call_arguments.done" ], - "description": "The event type, must be `response.content_part.added`.", + "description": "The type of the event. Always 'response.mcp_call_arguments.done'.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." + "output_index": { + "type": "integer", + "description": "The index of the output item in the response's output array." }, "item_id": { "type": "string", - "description": "The ID of the item to which the content part was added." + "description": "The unique identifier of the MCP tool call item being processed." }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "arguments": { + "type": "string", + "description": "A JSON string containing the finalized arguments for the MCP tool call.\n" }, - "content_index": { + "sequence_number": { "type": "integer", - "description": "The index of the content part in the item's content array." - }, - "part": { - "type": "object", - "description": "The content part that was added.", - "properties": { - "type": { - "type": "string", - "enum": [ - "audio", - "text" - ], - "description": "The content type (\"text\", \"audio\")." - }, - "text": { - "type": "string", - "description": "The text content (if type is \"text\")." - }, - "audio": { - "type": "string", - "description": "Base64-encoded audio data (if type is \"audio\")." - }, - "transcript": { - "type": "string", - "description": "The transcript of the audio (if type is \"audio\")." - } - } + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "response_id", - "item_id", "output_index", - "content_index", - "part" + "item_id", + "arguments", + "sequence_number" ], "x-oaiMeta": { - "name": "response.content_part.added", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3738\",\n \"type\": \"response.content_part.added\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"text\",\n \"text\": \"\"\n }\n}\n" + "name": "response.mcp_call_arguments.done", + "group": "responses", + "example": "{\n \"type\": \"response.mcp_call_arguments.done\",\n \"output_index\": 0,\n \"item_id\": \"item-abc\",\n \"arguments\": \"{\\\"arg1\\\": \\\"value1\\\", \\\"arg2\\\": \\\"value2\\\"}\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseContentPartDone": { + "ResponseMCPCallCompletedEvent": { "type": "object", - "description": "Returned when a content part is done streaming in an assistant message item.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n", + "title": "ResponseMCPCallCompletedEvent", + "description": "Emitted when an MCP tool call has completed successfully.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.content_part.done" + "response.mcp_call.completed" ], - "description": "The event type, must be `response.content_part.done`.", + "description": "The type of the event. Always 'response.mcp_call.completed'.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, "item_id": { "type": "string", - "description": "The ID of the item." + "description": "The ID of the MCP tool call item that completed." }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." + "description": "The index of the output item that completed." }, - "content_index": { + "sequence_number": { "type": "integer", - "description": "The index of the content part in the item's content array." - }, - "part": { - "type": "object", - "description": "The content part that is done.", - "properties": { - "type": { - "type": "string", - "enum": [ - "audio", - "text" - ], - "description": "The content type (\"text\", \"audio\")." - }, - "text": { - "type": "string", - "description": "The text content (if type is \"text\")." - }, - "audio": { - "type": "string", - "description": "Base64-encoded audio data (if type is \"audio\")." - }, - "transcript": { - "type": "string", - "description": "The transcript of the audio (if type is \"audio\")." - } - } + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "response_id", "item_id", "output_index", - "content_index", - "part" + "sequence_number" ], "x-oaiMeta": { - "name": "response.content_part.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3940\",\n \"type\": \"response.content_part.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"text\",\n \"text\": \"Sure, I can help with that.\"\n }\n}\n" + "name": "response.mcp_call.completed", + "group": "responses", + "example": "{\n \"type\": \"response.mcp_call.completed\",\n \"sequence_number\": 1,\n \"item_id\": \"mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90\",\n \"output_index\": 0\n}\n" } }, - "RealtimeBetaServerEventResponseCreated": { + "ResponseMCPCallFailedEvent": { "type": "object", - "description": "Returned when a new Response is created. The first event of response creation,\nwhere the response is in an initial state of `in_progress`.\n", + "title": "ResponseMCPCallFailedEvent", + "description": "Emitted when an MCP tool call has failed.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.created" + "response.mcp_call.failed" ], - "description": "The event type, must be `response.created`.", + "description": "The type of the event. Always 'response.mcp_call.failed'.", "x-stainless-const": true }, - "response": { - "$ref": "#/components/schemas/RealtimeBetaResponse" + "item_id": { + "type": "string", + "description": "The ID of the MCP tool call item that failed." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item that failed." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "response" - ], - "x-oaiMeta": { - "name": "response.created", - "group": "realtime", - "example": "{\n \"type\": \"response.created\",\n \"event_id\": \"event_C9G8pqbTEddBSIxbBN6Os\",\n \"response\": {\n \"object\": \"realtime.response\",\n \"id\": \"resp_C9G8p7IH2WxLbkgPNouYL\",\n \"status\": \"in_progress\",\n \"status_details\": null,\n \"output\": [],\n \"conversation_id\": \"conv_C9G8mmBkLhQJwCon3hoJN\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"max_output_tokens\": \"inf\",\n \"audio\": {\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"marin\"\n }\n },\n \"usage\": null,\n \"metadata\": null\n },\n \"timestamp\": \"2:30:35 PM\"\n}\n" + "item_id", + "output_index", + "sequence_number" + ], + "x-oaiMeta": { + "name": "response.mcp_call.failed", + "group": "responses", + "example": "{\n \"type\": \"response.mcp_call.failed\",\n \"sequence_number\": 1,\n \"item_id\": \"mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90\",\n \"output_index\": 0\n}\n" } }, - "RealtimeBetaServerEventResponseDone": { + "ResponseMCPCallInProgressEvent": { "type": "object", - "description": "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n", + "title": "ResponseMCPCallInProgressEvent", + "description": "Emitted when an MCP tool call is in progress.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.done" + "response.mcp_call.in_progress" ], - "description": "The event type, must be `response.done`.", + "description": "The type of the event. Always 'response.mcp_call.in_progress'.", "x-stainless-const": true }, - "response": { - "$ref": "#/components/schemas/RealtimeBetaResponse" + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item in the response's output array." + }, + "item_id": { + "type": "string", + "description": "The unique identifier of the MCP tool call item being processed." } }, "required": [ - "event_id", "type", - "response" + "output_index", + "item_id", + "sequence_number" ], "x-oaiMeta": { - "name": "response.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3132\",\n \"type\": \"response.done\",\n \"response\": {\n \"id\": \"resp_001\",\n \"object\": \"realtime.response\",\n \"status\": \"completed\",\n \"status_details\": null,\n \"output\": [\n {\n \"id\": \"msg_006\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Sure, how can I assist you today?\"\n }\n ]\n }\n ],\n \"usage\": {\n \"total_tokens\":275,\n \"input_tokens\":127,\n \"output_tokens\":148,\n \"input_token_details\": {\n \"cached_tokens\":384,\n \"text_tokens\":119,\n \"audio_tokens\":8,\n \"cached_tokens_details\": {\n \"text_tokens\": 128,\n \"audio_tokens\": 256\n }\n },\n \"output_token_details\": {\n \"text_tokens\":36,\n \"audio_tokens\":112\n }\n }\n }\n}\n" + "name": "response.mcp_call.in_progress", + "group": "responses", + "example": "{\n \"type\": \"response.mcp_call.in_progress\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90\"\n}\n" } }, - "RealtimeBetaServerEventResponseFunctionCallArgumentsDelta": { + "ResponseMCPListToolsCompletedEvent": { "type": "object", - "description": "Returned when the model-generated function call arguments are updated.\n", + "title": "ResponseMCPListToolsCompletedEvent", + "description": "Emitted when the list of available MCP tools has been successfully retrieved.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.function_call_arguments.delta" + "response.mcp_list_tools.completed" ], - "description": "The event type, must be `response.function_call_arguments.delta`.\n", + "description": "The type of the event. Always 'response.mcp_list_tools.completed'.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, "item_id": { "type": "string", - "description": "The ID of the function call item." + "description": "The ID of the MCP tool call item that produced this output." }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." - }, - "call_id": { - "type": "string", - "description": "The ID of the function call." + "description": "The index of the output item that was processed." }, - "delta": { - "type": "string", - "description": "The arguments delta as a JSON string." + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "response_id", "item_id", "output_index", - "call_id", - "delta" + "sequence_number" ], "x-oaiMeta": { - "name": "response.function_call_arguments.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5354\",\n \"type\": \"response.function_call_arguments.delta\",\n \"response_id\": \"resp_002\",\n \"item_id\": \"fc_001\",\n \"output_index\": 0,\n \"call_id\": \"call_001\",\n \"delta\": \"{\\\"location\\\": \\\"San\\\"\"\n}\n" + "name": "response.mcp_list_tools.completed", + "group": "responses", + "example": "{\n \"type\": \"response.mcp_list_tools.completed\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90\"\n}\n" } }, - "RealtimeBetaServerEventResponseFunctionCallArgumentsDone": { + "ResponseMCPListToolsFailedEvent": { "type": "object", - "description": "Returned when the model-generated function call arguments are done streaming.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n", + "title": "ResponseMCPListToolsFailedEvent", + "description": "Emitted when the attempt to list available MCP tools has failed.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.function_call_arguments.done" + "response.mcp_list_tools.failed" ], - "description": "The event type, must be `response.function_call_arguments.done`.\n", + "description": "The type of the event. Always 'response.mcp_list_tools.failed'.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, "item_id": { "type": "string", - "description": "The ID of the function call item." + "description": "The ID of the MCP tool call item that failed." }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." - }, - "call_id": { - "type": "string", - "description": "The ID of the function call." - }, - "name": { - "type": "string", - "description": "The name of the function that was called." + "description": "The index of the output item that failed." }, - "arguments": { - "type": "string", - "description": "The final arguments as a JSON string." + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "response_id", "item_id", "output_index", - "call_id", - "name", - "arguments" + "sequence_number" ], "x-oaiMeta": { - "name": "response.function_call_arguments.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5556\",\n \"type\": \"response.function_call_arguments.done\",\n \"response_id\": \"resp_002\",\n \"item_id\": \"fc_001\",\n \"output_index\": 0,\n \"call_id\": \"call_001\",\n \"name\": \"get_weather\",\n \"arguments\": \"{\\\"location\\\": \\\"San Francisco\\\"}\"\n}\n" + "name": "response.mcp_list_tools.failed", + "group": "responses", + "example": "{\n \"type\": \"response.mcp_list_tools.failed\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90\"\n}\n" } }, - "RealtimeBetaServerEventResponseMCPCallArgumentsDelta": { + "ResponseMCPListToolsInProgressEvent": { "type": "object", - "description": "Returned when MCP tool call arguments are updated during response generation.", + "title": "ResponseMCPListToolsInProgressEvent", + "description": "Emitted when the system is in the process of retrieving the list of available MCP tools.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.mcp_call_arguments.delta" + "response.mcp_list_tools.in_progress" ], - "description": "The event type, must be `response.mcp_call_arguments.delta`.", + "description": "The type of the event. Always 'response.mcp_list_tools.in_progress'.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, "item_id": { "type": "string", - "description": "The ID of the MCP tool call item." + "description": "The ID of the MCP tool call item that is being processed." }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." - }, - "delta": { - "type": "string", - "description": "The JSON-encoded arguments delta." + "description": "The index of the output item that is being processed." }, - "obfuscation": { - "anyOf": [ - { - "type": "string", - "description": "If present, indicates the delta text was obfuscated." - }, - { - "type": "null" - } - ] + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." } }, "required": [ - "event_id", "type", - "response_id", "item_id", "output_index", - "delta" + "sequence_number" ], "x-oaiMeta": { - "name": "response.mcp_call_arguments.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6201\",\n \"type\": \"response.mcp_call_arguments.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"mcp_call_001\",\n \"output_index\": 0,\n \"delta\": \"{\\\"partial\\\":true}\"\n}\n" + "name": "response.mcp_list_tools.in_progress", + "group": "responses", + "example": "{\n \"type\": \"response.mcp_list_tools.in_progress\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90\"\n}\n" } }, - "RealtimeBetaServerEventResponseMCPCallArgumentsDone": { + "ResponseModalities": { + "anyOf": [ + { + "type": "array", + "description": "Output types that you would like the model to generate.\nMost models are capable of generating text, which is the default:\n\n`[\"text\"]`\n\nThe `gpt-4o-audio-preview` model can also be used to\n[generate audio](https://developers.openai.com/api/docs/guides/audio). To request that this model generate\nboth text and audio responses, you can use:\n\n`[\"text\", \"audio\"]`\n", + "items": { + "type": "string", + "enum": [ + "text", + "audio" + ] + } + }, + { + "type": "null" + } + ] + }, + "ResponseOutputItemAddedEvent": { "type": "object", - "description": "Returned when MCP tool call arguments are finalized during response generation.", + "description": "Emitted when a new output item is added.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.output_item.added`.\n", "enum": [ - "response.mcp_call_arguments.done" + "response.output_item.added" ], - "description": "The event type, must be `response.mcp_call_arguments.done`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item." - }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." + "description": "The index of the output item that was added.\n" }, - "arguments": { - "type": "string", - "description": "The final JSON-encoded arguments string." + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" + }, + "item": { + "$ref": "#/components/schemas/OutputItem", + "description": "The output item that was added. For reasoning items, `encrypted_content`\nmay be incomplete while the item is in progress. Use the reasoning item\nfrom the corresponding `response.output_item.done` event when passing it\nas input to a subsequent request.\n" } }, "required": [ - "event_id", "type", - "response_id", - "item_id", "output_index", - "arguments" + "item", + "sequence_number" ], "x-oaiMeta": { - "name": "response.mcp_call_arguments.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6202\",\n \"type\": \"response.mcp_call_arguments.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"mcp_call_001\",\n \"output_index\": 0,\n \"arguments\": \"{\\\"q\\\":\\\"docs\\\"}\"\n}\n" + "name": "response.output_item.added", + "group": "responses", + "example": "{\n \"type\": \"response.output_item.added\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_123\",\n \"status\": \"in_progress\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": []\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseMCPCallCompleted": { + "ResponseOutputItemDoneEvent": { "type": "object", - "description": "Returned when an MCP tool call has completed successfully.", + "description": "Emitted when an output item is marked done.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.output_item.done`.\n", "enum": [ - "response.mcp_call.completed" + "response.output_item.done" ], - "description": "The event type, must be `response.mcp_call.completed`.", "x-stainless-const": true }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." + "description": "The index of the output item that was marked done.\n" }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item." + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" + }, + "item": { + "$ref": "#/components/schemas/OutputItem", + "description": "The output item that was marked done.\n" } }, "required": [ - "event_id", "type", "output_index", - "item_id" + "item", + "sequence_number" ], "x-oaiMeta": { - "name": "response.mcp_call.completed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6302\",\n \"type\": \"response.mcp_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" + "name": "response.output_item.done", + "group": "responses", + "example": "{\n \"type\": \"response.output_item.done\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_123\",\n \"status\": \"completed\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseMCPCallFailed": { + "ResponseOutputTextAnnotationAddedEvent": { "type": "object", - "description": "Returned when an MCP tool call has failed.", + "title": "ResponseOutputTextAnnotationAddedEvent", + "description": "Emitted when an annotation is added to output text content.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "response.mcp_call.failed" + "response.output_text.annotation.added" ], - "description": "The event type, must be `response.mcp_call.failed`.", + "description": "The type of the event. Always 'response.output_text.annotation.added'.", "x-stainless-const": true }, + "item_id": { + "type": "string", + "description": "The unique identifier of the item to which the annotation is being added." + }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." + "description": "The index of the output item in the response's output array." }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item." + "content_index": { + "type": "integer", + "description": "The index of the content part within the output item." + }, + "annotation_index": { + "type": "integer", + "description": "The index of the annotation within the content part." + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event." + }, + "annotation": { + "anyOf": [ + { + "$ref": "#/components/schemas/Annotation" + }, + { + "type": "null" + } + ], + "description": "The annotation object being added. (See annotation schema for details.)" } }, "required": [ - "event_id", "type", + "item_id", "output_index", - "item_id" + "content_index", + "annotation_index", + "annotation", + "sequence_number" ], "x-oaiMeta": { - "name": "response.mcp_call.failed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6303\",\n \"type\": \"response.mcp_call.failed\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" + "name": "response.output_text.annotation.added", + "group": "responses", + "example": "{\n \"type\": \"response.output_text.annotation.added\",\n \"item_id\": \"item-abc\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"annotation_index\": 0,\n \"annotation\": {\n \"type\": \"file_citation\",\n \"file_id\": \"file-abc\",\n \"index\": 0,\n \"filename\": \"example.txt\"\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseMCPCallInProgress": { + "ResponsePromptVariables": { + "anyOf": [ + { + "type": "object", + "title": "Prompt Variables", + "description": "Optional map of values to substitute in for variables in your\nprompt. The substitution values can either be strings, or other\nResponse input types like images or files.\n", + "x-oaiExpandable": true, + "x-oaiTypeLabel": "map", + "additionalProperties": { + "x-oaiExpandable": true, + "x-oaiTypeLabel": "map", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/InputTextContent" + }, + { + "$ref": "#/components/schemas/InputImageContent" + }, + { + "$ref": "#/components/schemas/InputFileContent" + } + ] + } + }, + { + "type": "null" + } + ] + }, + "ResponseProperties": { "type": "object", - "description": "Returned when an MCP tool call has started and is in progress.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "previous_response_id": { + "anyOf": [ + { + "type": "string", + "description": "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n" + }, + { + "type": "null" + } + ] + }, + "model": { + "description": "Model ID used to generate the response, like `gpt-6-astra`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models)\nto browse and compare available models.\n", + "$ref": "#/components/schemas/ModelIdsResponses" + }, + "background": { + "anyOf": [ + { + "type": "boolean", + "description": "Whether to run the model response in the background.\n[Learn more](https://developers.openai.com/api/docs/guides/background).\n", + "default": false + }, + { + "type": "null" + } + ] + }, + "max_tool_calls": { + "anyOf": [ + { + "description": "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n", + "type": "integer" + }, + { + "type": "null" + } + ] + }, + "text": { + "$ref": "#/components/schemas/ResponseTextParam" + }, + "tools": { + "$ref": "#/components/schemas/ToolsArray" }, + "tool_choice": { + "$ref": "#/components/schemas/ToolChoiceParam" + }, + "prompt": { + "$ref": "#/components/schemas/Prompt" + } + } + }, + "ResponseQueuedEvent": { + "type": "object", + "title": "ResponseQueuedEvent", + "description": "Emitted when a response is queued and waiting to be processed.\n", + "properties": { "type": { "type": "string", "enum": [ - "response.mcp_call.in_progress" + "response.queued" ], - "description": "The event type, must be `response.mcp_call.in_progress`.", + "description": "The type of the event. Always 'response.queued'.", "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "response": { + "$ref": "#/components/schemas/Response", + "description": "The full response object that is queued." }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item." + "sequence_number": { + "type": "integer", + "description": "The sequence number for this event." } }, "required": [ - "event_id", "type", - "output_index", - "item_id" + "response", + "sequence_number" ], "x-oaiMeta": { - "name": "response.mcp_call.in_progress", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6301\",\n \"type\": \"response.mcp_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" + "name": "response.queued", + "group": "responses", + "example": "{\n \"type\": \"response.queued\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1609459200,\n \"status\": \"queued\",\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"temperature\": 1,\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseOutputItemAdded": { + "ResponseReasoningSummaryPartAddedEvent": { "type": "object", - "description": "Returned when a new Item is created during Response generation.", + "description": "Emitted when a new reasoning summary part is added.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.reasoning_summary_part.added`.\n", "enum": [ - "response.output_item.added" + "response.reasoning_summary_part.added" ], - "description": "The event type, must be `response.output_item.added`.", "x-stainless-const": true }, - "response_id": { + "item_id": { "type": "string", - "description": "The ID of the Response to which the item belongs." + "description": "The ID of the item this summary part is associated with.\n" }, "output_index": { "type": "integer", - "description": "The index of the output item in the Response." + "description": "The index of the output item this summary part is associated with.\n" }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" + "summary_index": { + "type": "integer", + "description": "The index of the summary part within the reasoning summary.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" + }, + "part": { + "type": "object", + "description": "The summary part that was added.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the summary part. Always `summary_text`.", + "enum": [ + "summary_text" + ], + "x-stainless-const": true + }, + "text": { + "type": "string", + "description": "The text of the summary part." + } + }, + "required": [ + "type", + "text" + ] } }, "required": [ - "event_id", "type", - "response_id", + "item_id", "output_index", - "item" + "summary_index", + "part", + "sequence_number" ], "x-oaiMeta": { - "name": "response.output_item.added", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3334\",\n \"type\": \"response.output_item.added\",\n \"response_id\": \"resp_001\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_007\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"in_progress\",\n \"role\": \"assistant\",\n \"content\": []\n }\n}\n" + "name": "response.reasoning_summary_part.added", + "group": "responses", + "example": "{\n \"type\": \"response.reasoning_summary_part.added\",\n \"item_id\": \"rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476\",\n \"output_index\": 0,\n \"summary_index\": 0,\n \"part\": {\n \"type\": \"summary_text\",\n \"text\": \"\"\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseOutputItemDone": { + "ResponseReasoningSummaryPartDoneEvent": { "type": "object", - "description": "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n", + "description": "Emitted when a reasoning summary part is completed.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.reasoning_summary_part.done`.\n", "enum": [ - "response.output_item.done" + "response.reasoning_summary_part.done" ], - "description": "The event type, must be `response.output_item.done`.", "x-stainless-const": true }, - "response_id": { + "item_id": { "type": "string", - "description": "The ID of the Response to which the item belongs." + "description": "The ID of the item this summary part is associated with.\n" }, "output_index": { "type": "integer", - "description": "The index of the output item in the Response." + "description": "The index of the output item this summary part is associated with.\n" }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" + "summary_index": { + "type": "integer", + "description": "The index of the summary part within the reasoning summary.\n" + }, + "status": { + "type": "string", + "description": "The completion status of the summary part. Omitted when the part completed\nnormally and set to `incomplete` when generation was interrupted.\n", + "enum": [ + "incomplete" + ] + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" + }, + "part": { + "type": "object", + "description": "The completed summary part.\n", + "properties": { + "type": { + "type": "string", + "description": "The type of the summary part. Always `summary_text`.", + "enum": [ + "summary_text" + ], + "x-stainless-const": true + }, + "text": { + "type": "string", + "description": "The text of the summary part." + } + }, + "required": [ + "type", + "text" + ] } }, "required": [ - "event_id", "type", - "response_id", + "item_id", "output_index", - "item" + "summary_index", + "part", + "sequence_number" ], "x-oaiMeta": { - "name": "response.output_item.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3536\",\n \"type\": \"response.output_item.done\",\n \"response_id\": \"resp_001\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_007\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Sure, I can help with that.\"\n }\n ]\n }\n}\n" + "name": "response.reasoning_summary_part.done", + "group": "responses", + "example": "{\n \"type\": \"response.reasoning_summary_part.done\",\n \"item_id\": \"rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476\",\n \"output_index\": 0,\n \"summary_index\": 0,\n \"part\": {\n \"type\": \"summary_text\",\n \"text\": \"**Responding to a greeting**\\n\\nThe user just said, \\\"Hello!\\\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \\\"Hello! How can I assist you today?\\\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!\"\n },\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseTextDelta": { + "ResponseReasoningSummaryTextDeltaEvent": { "type": "object", - "description": "Returned when the text value of an \"output_text\" content part is updated.", + "description": "Emitted when a delta is added to a reasoning summary text.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.reasoning_summary_text.delta`.\n", "enum": [ - "response.output_text.delta" + "response.reasoning_summary_text.delta" ], - "description": "The event type, must be `response.output_text.delta`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, "item_id": { "type": "string", - "description": "The ID of the item." + "description": "The ID of the item this summary text delta is associated with.\n" }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." + "description": "The index of the output item this summary text delta is associated with.\n" }, - "content_index": { + "summary_index": { "type": "integer", - "description": "The index of the content part in the item's content array." + "description": "The index of the summary part within the reasoning summary.\n" }, "delta": { "type": "string", - "description": "The text delta." + "description": "The text delta that was added to the summary.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" } }, "required": [ - "event_id", "type", - "response_id", "item_id", "output_index", - "content_index", - "delta" + "summary_index", + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "response.output_text.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4142\",\n \"type\": \"response.output_text.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Sure, I can h\"\n}\n" + "name": "response.reasoning_summary_text.delta", + "group": "responses", + "example": "{\n \"type\": \"response.reasoning_summary_text.delta\",\n \"item_id\": \"rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476\",\n \"output_index\": 0,\n \"summary_index\": 0,\n \"delta\": \"**Responding to a greeting**\\n\\nThe user just said, \\\"Hello!\\\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \\\"Hello! How can I assist you today?\\\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventResponseTextDone": { + "ResponseReasoningSummaryTextDoneEvent": { "type": "object", - "description": "Returned when the text value of an \"output_text\" content part is done streaming. Also\nemitted when a Response is interrupted, incomplete, or cancelled.\n", + "description": "Emitted when a reasoning summary text is completed.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.reasoning_summary_text.done`.\n", "enum": [ - "response.output_text.done" + "response.reasoning_summary_text.done" ], - "description": "The event type, must be `response.output_text.done`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, "item_id": { "type": "string", - "description": "The ID of the item." + "description": "The ID of the item this summary text is associated with.\n" }, "output_index": { "type": "integer", - "description": "The index of the output item in the response." + "description": "The index of the output item this summary text is associated with.\n" }, - "content_index": { + "summary_index": { "type": "integer", - "description": "The index of the content part in the item's content array." + "description": "The index of the summary part within the reasoning summary.\n" }, "text": { "type": "string", - "description": "The final text content." + "description": "The full text of the completed reasoning summary.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" } }, "required": [ - "event_id", "type", - "response_id", "item_id", "output_index", - "content_index", - "text" + "summary_index", + "text", + "sequence_number" ], "x-oaiMeta": { - "name": "response.output_text.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4344\",\n \"type\": \"response.output_text.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"Sure, I can help with that.\"\n}\n" + "name": "response.reasoning_summary_text.done", + "group": "responses", + "example": "{\n \"type\": \"response.reasoning_summary_text.done\",\n \"item_id\": \"rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476\",\n \"output_index\": 0,\n \"summary_index\": 0,\n \"text\": \"**Responding to a greeting**\\n\\nThe user just said, \\\"Hello!\\\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \\\"Hello! How can I assist you today?\\\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventSessionCreated": { + "ResponseReasoningTextDeltaEvent": { "type": "object", - "description": "Returned when a Session is created. Emitted automatically when a new\nconnection is established as the first server event. This event will contain\nthe default Session configuration.\n", + "description": "Emitted when a delta is added to a reasoning text.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.reasoning_text.delta`.\n", "enum": [ - "session.created" + "response.reasoning_text.delta" ], - "description": "The event type, must be `session.created`.", "x-stainless-const": true }, - "session": { - "$ref": "#/components/schemas/RealtimeSession" - } - }, - "required": [ - "event_id", - "type", - "session" - ], - "x-oaiMeta": { - "name": "session.created", - "group": "realtime", - "example": "{\n \"type\": \"session.created\",\n \"event_id\": \"event_C9G5RJeJ2gF77mV7f2B1j\",\n \"session\": {\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9G5QPteg4UIbotdKLoYQ\",\n \"model\": \"gpt-realtime-2025-08-28\",\n \"modalities\": [\n \"audio\"\n ],\n \"instructions\": \"Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.\",\n \"tools\": [],\n \"tool_choice\": \"auto\",\n \"max_response_output_tokens\": \"inf\",\n \"tracing\": null,\n \"prompt\": null,\n \"expires_at\": 1756324625,\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200,\n \"idle_timeout_ms\": null,\n \"create_response\": true,\n \"interrupt_response\": true\n },\n \"output_audio_format\": \"pcm16\",\n \"voice\": \"marin\",\n \"include\": null\n }\n}\n" - } - }, - "RealtimeBetaServerEventSessionUpdated": { - "type": "object", - "description": "Returned when a session is updated with a `session.update` event, unless\nthere is an error.\n", - "properties": { - "event_id": { + "item_id": { "type": "string", - "description": "The unique ID of the server event." + "description": "The ID of the item this reasoning text delta is associated with.\n" }, - "type": { - "type": "string", - "enum": [ - "session.updated" - ], - "description": "The event type, must be `session.updated`.", - "x-stainless-const": true + "output_index": { + "type": "integer", + "description": "The index of the output item this reasoning text delta is associated with.\n" }, - "session": { - "$ref": "#/components/schemas/RealtimeSession" - } - }, - "required": [ - "event_id", - "type", - "session" - ], - "x-oaiMeta": { - "name": "session.updated", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5678\",\n \"type\": \"session.updated\",\n \"session\": {\n \"id\": \"sess_001\",\n \"object\": \"realtime.session\",\n \"model\": \"gpt-realtime\",\n \"modalities\": [\"text\"],\n \"instructions\": \"New instructions\",\n \"voice\": \"sage\",\n \"input_audio_format\": \"pcm16\",\n \"output_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"whisper-1\"\n },\n \"turn_detection\": null,\n \"tools\": [],\n \"tool_choice\": \"none\",\n \"temperature\": 0.7,\n \"max_response_output_tokens\": 200,\n \"speed\": 1.1,\n \"tracing\": \"auto\"\n }\n}\n" - } - }, - "RealtimeBetaServerEventTranscriptionSessionCreated": { - "type": "object", - "description": "Returned when a transcription session is created.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "content_index": { + "type": "integer", + "description": "The index of the reasoning content part this delta is associated with.\n" }, - "type": { + "delta": { "type": "string", - "enum": [ - "transcription_session.created" - ], - "description": "The event type, must be `transcription_session.created`.", - "x-stainless-const": true + "description": "The text delta that was added to the reasoning content.\n" }, - "session": { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponse" + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" } }, "required": [ - "event_id", "type", - "session" + "item_id", + "output_index", + "content_index", + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "transcription_session.created", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5566\",\n \"type\": \"transcription_session.created\",\n \"session\": {\n \"id\": \"sess_001\",\n \"object\": \"realtime.transcription_session\",\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": []\n }\n}\n" + "name": "response.reasoning_text.delta", + "group": "responses", + "example": "{\n \"type\": \"response.reasoning_text.delta\",\n \"item_id\": \"rs_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"The\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeBetaServerEventTranscriptionSessionUpdated": { + "ResponseReasoningTextDoneEvent": { "type": "object", - "description": "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n", + "description": "Emitted when a reasoning text is completed.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.reasoning_text.done`.\n", "enum": [ - "transcription_session.updated" + "response.reasoning_text.done" ], - "description": "The event type, must be `transcription_session.updated`.", "x-stainless-const": true }, - "session": { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponse" - } - }, - "required": [ - "event_id", - "type", - "session" - ], - "x-oaiMeta": { - "name": "transcription_session.updated", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5678\",\n \"type\": \"transcription_session.updated\",\n \"session\": {\n \"id\": \"sess_001\",\n \"object\": \"realtime.transcription_session\",\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500,\n \"create_response\": true,\n // \"interrupt_response\": false -- this will NOT be returned\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": [\n \"item.input_audio_transcription.avg_logprob\",\n ],\n }\n}\n" - } - }, - "RealtimeCallCreateRequest": { - "title": "Realtime call creation request", - "type": "object", - "description": "Parameters required to initiate a realtime call and receive the SDP answer\nneeded to complete a WebRTC peer connection. Provide an SDP offer generated\nby your client and optionally configure the session that will answer the call.", - "required": [ - "sdp" - ], - "properties": { - "sdp": { + "item_id": { "type": "string", - "description": "WebRTC Session Description Protocol (SDP) offer generated by the caller." + "description": "The ID of the item this reasoning text is associated with.\n" }, - "session": { - "title": "Session configuration", - "allOf": [ - { - "$ref": "#/components/schemas/RealtimeSessionCreateRequestGA" - } - ], - "description": "Optional session configuration to apply before the realtime session is\ncreated. Use the same parameters you would send in a [`create client secret`](https://developers.openai.com/api/reference/resources/realtime/subresources/client_secrets/methods/create)\nrequest." - } - }, - "additionalProperties": false - }, - "RealtimeCallReferRequest": { - "title": "Realtime call refer request", - "type": "object", - "description": "Parameters required to transfer a SIP call to a new destination using the\nRealtime API.", - "required": [ - "target_uri" - ], - "properties": { - "target_uri": { - "type": "string", - "description": "URI that should appear in the SIP Refer-To header. Supports values like\n`tel:+14155550123` or `sip:agent@example.com`.", - "example": "tel:+14155550123" - } - }, - "additionalProperties": false - }, - "RealtimeCallRejectRequest": { - "title": "Realtime call reject request", - "type": "object", - "description": "Parameters used to decline an incoming SIP call handled by the Realtime API.", - "properties": { - "status_code": { + "output_index": { "type": "integer", - "description": "SIP response code to send back to the caller. Defaults to `603` (Decline)\nwhen omitted.", - "example": 486 - } - }, - "additionalProperties": false - }, - "RealtimeClientEvent": { - "discriminator": { - "propertyName": "type" - }, - "description": "A realtime client event.\n", - "anyOf": [ - { - "$ref": "#/components/schemas/RealtimeClientEventConversationItemCreate" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventConversationItemDelete" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventConversationItemRetrieve" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventConversationItemTruncate" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventInputAudioBufferAppend" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventInputAudioBufferClear" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventOutputAudioBufferClear" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventInputAudioBufferCommit" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventResponseCancel" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventResponseCreate" - }, - { - "$ref": "#/components/schemas/RealtimeClientEventSessionUpdate" - } - ] - }, - "RealtimeClientEventConversationItemCreate": { - "type": "object", - "description": "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n", - "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." + "description": "The index of the output item this reasoning text is associated with.\n" }, - "type": { - "type": "string", - "enum": [ - "conversation.item.create" - ], - "description": "The event type, must be `conversation.item.create`.", - "x-stainless-const": true + "content_index": { + "type": "integer", + "description": "The index of the reasoning content part.\n" }, - "previous_item_id": { + "text": { "type": "string", - "description": "The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation.\n\nIf set to `root`, the new item will be added to the beginning of the conversation.\n\nIf set to an existing ID, it allows an item to be inserted mid-conversation. If the ID cannot be found, an error will be returned and the item will not be added.\n" + "description": "The full text of the completed reasoning content.\n" }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" } }, "required": [ "type", - "item" + "item_id", + "output_index", + "content_index", + "text", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.create", - "group": "realtime", - "example": "{\n \"type\": \"conversation.item.create\",\n \"item\": {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"hi\"\n }\n ]\n }\n}\n" + "name": "response.reasoning_text.done", + "group": "responses", + "example": "{\n \"type\": \"response.reasoning_text.done\",\n \"item_id\": \"rs_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"The user is asking...\",\n \"sequence_number\": 4\n}\n" } }, - "RealtimeClientEventConversationItemDelete": { + "ResponseRefusalDeltaEvent": { "type": "object", - "description": "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n", + "description": "Emitted when there is a partial refusal text.", "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.refusal.delta`.\n", "enum": [ - "conversation.item.delete" + "response.refusal.delta" ], - "description": "The event type, must be `conversation.item.delete`.", "x-stainless-const": true }, "item_id": { "type": "string", - "description": "The ID of the item to delete." - } - }, - "required": [ - "type", - "item_id" - ], - "x-oaiMeta": { - "name": "conversation.item.delete", - "group": "realtime", - "example": "{\n \"event_id\": \"event_901\",\n \"type\": \"conversation.item.delete\",\n \"item_id\": \"item_003\"\n}\n" - } - }, - "RealtimeClientEventConversationItemRetrieve": { - "type": "object", - "description": "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n", - "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." + "description": "The ID of the output item that the refusal text is added to.\n" }, - "type": { - "type": "string", - "enum": [ - "conversation.item.retrieve" - ], - "description": "The event type, must be `conversation.item.retrieve`.", - "x-stainless-const": true + "output_index": { + "type": "integer", + "description": "The index of the output item that the refusal text is added to.\n" }, - "item_id": { + "content_index": { + "type": "integer", + "description": "The index of the content part that the refusal text is added to.\n" + }, + "delta": { "type": "string", - "description": "The ID of the item to retrieve." + "description": "The refusal text that is added.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of this event.\n" } }, "required": [ "type", - "item_id" + "item_id", + "output_index", + "content_index", + "delta", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.retrieve", - "group": "realtime", - "example": "{\n \"event_id\": \"event_901\",\n \"type\": \"conversation.item.retrieve\",\n \"item_id\": \"item_003\"\n}\n" + "name": "response.refusal.delta", + "group": "responses", + "example": "{\n \"type\": \"response.refusal.delta\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"refusal text so far\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeClientEventConversationItemTruncate": { + "ResponseRefusalDoneEvent": { "type": "object", - "description": "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n", + "description": "Emitted when refusal text is finalized.", "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of the event. Always `response.refusal.done`.\n", "enum": [ - "conversation.item.truncate" + "response.refusal.done" ], - "description": "The event type, must be `conversation.item.truncate`.", "x-stainless-const": true }, "item_id": { "type": "string", - "description": "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n" + "description": "The ID of the output item that the refusal text is finalized.\n" + }, + "output_index": { + "type": "integer", + "description": "The index of the output item that the refusal text is finalized.\n" }, "content_index": { "type": "integer", - "description": "The index of the content part to truncate. Set this to `0`." + "description": "The index of the content part that the refusal text is finalized.\n" }, - "audio_end_ms": { + "refusal": { + "type": "string", + "description": "The refusal text that is finalized.\n" + }, + "sequence_number": { "type": "integer", - "description": "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n" + "description": "The sequence number of this event.\n" } }, "required": [ "type", "item_id", + "output_index", "content_index", - "audio_end_ms" + "refusal", + "sequence_number" ], "x-oaiMeta": { - "name": "conversation.item.truncate", - "group": "realtime", - "example": "{\n \"event_id\": \"event_678\",\n \"type\": \"conversation.item.truncate\",\n \"item_id\": \"item_002\",\n \"content_index\": 0,\n \"audio_end_ms\": 1500\n}\n" + "name": "response.refusal.done", + "group": "responses", + "example": "{\n \"type\": \"response.refusal.done\",\n \"item_id\": \"item-abc\",\n \"output_index\": 1,\n \"content_index\": 2,\n \"refusal\": \"final refusal text\",\n \"sequence_number\": 1\n}\n" } }, - "RealtimeClientEventInputAudioBufferAppend": { + "ResponseSteerAcceptedEvent": { "type": "object", - "description": "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. A \"commit\" will create a new\nuser message item in the conversation history from the buffer content and clear the buffer.\nInput audio transcription (if enabled) will be generated when the buffer is committed.\n\nIf VAD is enabled the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually. Input audio noise reduction operates on writes to the audio buffer.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike most other client events, the server will \nnot send a confirmation response to this event.\n", + "title": "ResponseSteerAcceptedEvent", + "description": "Emitted when steering input has been validated and queued. Acceptance means\nthe server owns the input, not that it has been applied. The successor's\n`response.created` event is the commit point. If accepted input cannot be\ncommitted, `response.steer.failed` returns it with the same steering ID.\n\nWhen the response stops for client-owned tool output or approval, the input\nremains queued and `response.steer.pending` is emitted after\n`response.completed`. Fill the pending event's `required_input` stubs with\nsaved results and send one matching explicit `response.create` per parent.\nDo not resend accepted input while it is still queued.\n", "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", "enum": [ - "input_audio_buffer.append" + "response.steer.accepted" ], - "description": "The event type, must be `input_audio_buffer.append`.", + "description": "The event discriminator. Always `response.steer.accepted`.", "x-stainless-const": true }, - "audio": { + "sequence_number": { + "type": "integer", + "description": "The sequence number for this event." + }, + "steer": { + "type": "object", + "description": "The accepted steering submission.", + "properties": { + "id": { + "type": "string", + "description": "The ID assigned to the steering submission." + }, + "previous_response_id": { + "type": "string", + "description": "The ID of the response being steered." + } + }, + "required": [ + "id", + "previous_response_id" + ] + }, + "stream_id": { "type": "string", - "description": "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n" + "description": "The WebSocket lane that emitted this event. This field is present when\nthe target response's `response.create` event supplied a `stream_id`.\n" } }, "required": [ "type", - "audio" + "sequence_number", + "steer" ], "x-oaiMeta": { - "name": "input_audio_buffer.append", - "group": "realtime", - "example": "{\n \"event_id\": \"event_456\",\n \"type\": \"input_audio_buffer.append\",\n \"audio\": \"Base64EncodedAudioData\"\n}\n" + "name": "response.steer.accepted", + "group": "responses", + "example": "{\n \"type\": \"response.steer.accepted\",\n \"sequence_number\": 2,\n \"steer\": {\n \"id\": \"steer_456\",\n \"previous_response_id\": \"resp_123\"\n }\n}\n" } }, - "RealtimeClientEventInputAudioBufferClear": { - "type": "object", - "description": "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n", - "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, - "type": { + "ResponseSteerErrorCode": { + "title": "ResponseSteerErrorCode", + "description": "A machine-readable steering error code. Clients should handle unknown\nvalues because additional codes may be introduced. Known values include:\n- `response_not_found`: The target response is not available on this connection.\n- `invalid_input`: The event or input failed validation.\n- `steering_not_supported`: The model or response execution mode does not support steering.\n- `too_many_pending_steers`: Too much steering input is pending for the response.\n- `response_already_completed`: The response completed and is no longer accepting steering input.\n- `response_not_active`: The response is no longer accepting steering input.\n- `successor_creation_failed`: The successor response could not be created.\n", + "anyOf": [ + { "type": "string", "enum": [ - "input_audio_buffer.clear" - ], - "description": "The event type, must be `input_audio_buffer.clear`.", - "x-stainless-const": true + "response_not_found", + "invalid_input", + "steering_not_supported", + "too_many_pending_steers", + "response_already_completed", + "response_not_active", + "successor_creation_failed" + ] + }, + { + "type": "string" } - }, - "required": [ - "type" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.clear", - "group": "realtime", - "example": "{\n \"event_id\": \"event_012\",\n \"type\": \"input_audio_buffer.clear\"\n}\n" - } + ] }, - "RealtimeClientEventInputAudioBufferCommit": { + "ResponseSteerEvent": { "type": "object", - "description": "Send this event to commit the user input audio buffer, which will create a new user message item in the conversation. This event will produce an error if the input audio buffer is empty. When in Server VAD mode, the client does not need to send this event, the server will commit the audio buffer automatically.\n\nCommitting the input audio buffer will trigger input audio transcription (if enabled in session configuration), but it will not create a response from the model. The server will respond with an `input_audio_buffer.committed` event.\n", + "title": "ResponseSteerEvent", + "additionalProperties": false, + "description": "Queues user input to steer a response on this WebSocket connection. Input\ncan contain text, images, and files. Steering is supported only for\nsingle-agent responses on models and execution modes that support steering.\nResponses bound to a conversation or using automatic compaction do not\nsupport steering.\n\nA `response.steer.accepted` event acknowledges that the server owns the\nqueued input, not that it has been applied. The successor's `response.created`\nevent is the commit point. Input that cannot be committed is returned in\n`response.steer.failed`.\n\nSteering may cause the active response to finish at a safe output boundary\nwith `response.incomplete` and `incomplete_details.reason` set to `steered`,\nfollowed automatically by a successor `response.created`. Normal completion\ncan also be followed by an automatic successor. Automatic successors inherit\nthe previous response's settings and continue from it with the queued input.\n\nIf the response stops for client-owned tool output or approval, accepted\nsteering input remains queued and `response.steer.pending` is emitted after\n`response.completed`. Fill the `required_input` stubs from that event with\nsaved tool results or approval decisions, and send one explicit\n`response.create` per parent with the same `previous_response_id` and\nWebSocket lane. Do not rerun tools or resend accepted steering input. The\nqueued input is prepended in submission order to that request's input, and\nthe explicit request retains its own settings.\n\nThis event accepts only `type`, `previous_response_id`, and `input`. Do not\nsend `stream_id`; the target response determines the WebSocket lane.\n", "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", "enum": [ - "input_audio_buffer.commit" + "response.steer" ], - "description": "The event type, must be `input_audio_buffer.commit`.", + "description": "The event discriminator. Always `response.steer`.", "x-stainless-const": true + }, + "previous_response_id": { + "type": "string", + "description": "The ID of the response to steer on this WebSocket connection." + }, + "input": { + "$ref": "#/components/schemas/ResponseSteerInput" } }, "required": [ - "type" + "type", + "previous_response_id", + "input" ], "x-oaiMeta": { - "name": "input_audio_buffer.commit", - "group": "realtime", - "example": "{\n \"event_id\": \"event_789\",\n \"type\": \"input_audio_buffer.commit\"\n}\n" + "name": "response.steer", + "group": "responses", + "example": "{\n \"type\": \"response.steer\",\n \"previous_response_id\": \"resp_123\",\n \"input\": [\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Prioritize the database rollout.\"\n }\n ]\n }\n ]\n}\n" } }, - "RealtimeClientEventOutputAudioBufferClear": { + "ResponseSteerFailedEvent": { "type": "object", - "description": "**WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to\nstop generating audio and emit a `output_audio_buffer.cleared` event. This\nevent should be preceded by a `response.cancel` client event to stop the\ngeneration of the current response.\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", + "title": "ResponseSteerFailedEvent", + "description": "Emitted when steering input is rejected or cannot be committed to a\nsuccessor response. Returns the original, uncommitted input so the client\ncan carry it into `response.create` when appropriate. Invalid input must\nbe corrected before retrying.\n\nFailures after acceptance include the same steering ID. Failures before an\nID is allocated omit `steer.id`. A lost connection or missing acknowledgement\nleaves the outcome unknown; it is not proof that the input was rejected.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the client event used for error handling." - }, "type": { "type": "string", "enum": [ - "output_audio_buffer.clear" + "response.steer.failed" ], - "description": "The event type, must be `output_audio_buffer.clear`.", + "description": "The event discriminator. Always `response.steer.failed`.", "x-stainless-const": true + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number for this event." + }, + "steer": { + "type": "object", + "description": "The steering submission that could not be committed.", + "properties": { + "id": { + "type": "string", + "description": "The ID assigned to the steering submission, if one was allocated.\n" + }, + "previous_response_id": { + "type": "string", + "description": "The ID of the response that was targeted for steering." + }, + "input": { + "$ref": "#/components/schemas/ResponseSteerInput" + } + }, + "required": [ + "previous_response_id", + "input" + ] + }, + "error": { + "type": "object", + "description": "Information about why the input could not be committed.", + "properties": { + "type": { + "type": "string", + "enum": [ + "invalid_request_error" + ], + "description": "The error type. Always `invalid_request_error`.", + "x-stainless-const": true + }, + "code": { + "$ref": "#/components/schemas/ResponseSteerErrorCode" + }, + "message": { + "type": "string", + "description": "A human-readable description of the error." + } + }, + "required": [ + "type", + "code", + "message" + ] + }, + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event, when the target response is\navailable and its `response.create` event supplied a `stream_id`.\n" } }, "required": [ - "type" + "type", + "sequence_number", + "steer", + "error" ], "x-oaiMeta": { - "name": "output_audio_buffer.clear", - "group": "realtime", - "example": "{\n \"event_id\": \"optional_client_event_id\",\n \"type\": \"output_audio_buffer.clear\"\n}\n" + "name": "response.steer.failed", + "group": "responses", + "example": "{\n \"type\": \"response.steer.failed\",\n \"sequence_number\": 5,\n \"steer\": {\n \"id\": \"steer_456\",\n \"previous_response_id\": \"resp_123\",\n \"input\": [\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Prioritize the database rollout.\"\n }\n ]\n }\n ]\n },\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"code\": \"successor_creation_failed\",\n \"message\": \"We couldn't start the next response. Send this steering input again with response.create.\"\n }\n}\n" } }, - "RealtimeClientEventResponseCancel": { - "type": "object", - "description": "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error. It's safe\nto call `response.cancel` even if no response is in progress, an error will be\nreturned the session will remain unaffected.\n", - "properties": { - "event_id": { + "ResponseSteerInput": { + "title": "ResponseSteerInput", + "description": "Input to queue for a continuation of the response. Uses the same string or\ninput-item shape as `response.create.input`, with a non-empty array when\nsupplying input items.\n\nSteering accepts only messages with the `user` role. Each message may\ncontain only `type`, `role`, and `content`, with `content` as a string or an\narray of `input_text`, `input_image`, and `input_file` parts. The optional\n`type` must be `message`. Other roles, tool outputs, and item types are not\nsupported for steering.\n", + "oneOf": [ + { "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." + "title": "Text input", + "description": "A text input, equivalent to a message with the `user` role." }, - "type": { - "type": "string", - "enum": [ - "response.cancel" - ], - "description": "The event type, must be `response.cancel`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseSteerInputItemList" + } + ] + }, + "ResponseSteerInputItem": { + "title": "Response steer input item", + "anyOf": [ + { + "$ref": "#/components/schemas/UserMessageItemParam" }, - "response_id": { - "type": "string", - "description": "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n" + { + "$ref": "#/components/schemas/FunctionCallOutputItemParam" } - }, - "required": [ - "type" ], - "x-oaiMeta": { - "name": "response.cancel", - "group": "realtime", - "example": "{\n \"type\": \"response.cancel\",\n \"response_id\": \"resp_12345\"\n}\n" + "discriminator": { + "propertyName": "type" } }, - "RealtimeClientEventResponseCreate": { + "ResponseSteerInputItemList": { + "type": "array", + "title": "Response steer input item list", + "description": "A non-empty list of message inputs to queue for the response.", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/ResponseSteerInputItem" + } + }, + "ResponseSteerPendingEvent": { "type": "object", - "description": "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history by default.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event includes inference configuration like \n`instructions` and `tools`. If these are set, they will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel. The `metadata` field is a good way to disambiguate\nmultiple simultaneous Responses.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n", + "title": "ResponseSteerPendingEvent", + "description": "Emitted when accepted steering input remains queued after the target\nresponse completes. The server still owns the input. Do not resend it.\nThe successor's `response.created` event is the commit point.\n\nWhen `reason` is `waiting_for_required_input`, this event follows\n`response.completed` while the response waits for the tool results or\napproval decisions identified by `required_input`. Copy those stubs, fill\ntheir result fields using the ordinary `response.create` input schemas,\nand submit one continuation per parent with the same `previous_response_id`\nand WebSocket lane. Use saved results without rerunning tools. The queued\nsteering input is prepended in submission order to the continuation's\ninput. That explicit request retains its own settings.\n\nThis notification is emitted at most once per steering submission. Multiple\nsubmissions for the same parent can report the same required inputs; they\ndo not each require a separate continuation.\n", "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", "enum": [ - "response.create" + "response.steer.pending" ], - "description": "The event type, must be `response.create`.", + "description": "The event discriminator. Always `response.steer.pending`.", "x-stainless-const": true }, - "response": { - "$ref": "#/components/schemas/RealtimeResponseCreateParams" + "sequence_number": { + "type": "integer", + "description": "The sequence number for this event." + }, + "steer": { + "type": "object", + "description": "The steering submission that remains queued.", + "properties": { + "id": { + "type": "string", + "description": "The ID assigned to the steering submission." + }, + "previous_response_id": { + "type": "string", + "description": "The ID of the response being steered." + } + }, + "required": [ + "id", + "previous_response_id" + ] + }, + "reason": { + "$ref": "#/components/schemas/ResponseSteerPendingReason" + }, + "required_input": { + "type": "array", + "minItems": 1, + "description": "Input stubs identifying outstanding client-owned tool results or\napproval decisions. Each stub contains identifying fields only; the\nclient supplies the result before including it in `response.create`.\n", + "items": { + "$ref": "#/components/schemas/ResponseSteerRequiredInput" + } + }, + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present when\nthe target response's `response.create` event supplied a `stream_id`.\n" } }, "required": [ - "type" + "type", + "sequence_number", + "steer", + "reason", + "required_input" ], "x-oaiMeta": { - "name": "response.create", - "group": "realtime", - "example": "// Trigger a response with the default Conversation and no special parameters\n{\n \"type\": \"response.create\",\n}\n\n// Trigger an out-of-band response that does not write to the default Conversation\n{\n \"type\": \"response.create\",\n \"response\": {\n \"instructions\": \"Provide a concise answer.\",\n \"tools\": [], // clear any session tools\n \"conversation\": \"none\",\n \"output_modalities\": [\"text\"],\n \"metadata\": {\n \"response_purpose\": \"summarization\"\n },\n \"input\": [\n {\n \"type\": \"item_reference\",\n \"id\": \"item_12345\"\n },\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Summarize the above message in one sentence.\"\n }\n ]\n }\n ]\n }\n}\n" + "name": "response.steer.pending", + "group": "responses", + "example": "{\n \"type\": \"response.steer.pending\",\n \"sequence_number\": 10,\n \"steer\": {\n \"id\": \"steer_456\",\n \"previous_response_id\": \"resp_123\"\n },\n \"reason\": \"waiting_for_required_input\",\n \"required_input\": [\n {\n \"type\": \"function_call_output\",\n \"call_id\": \"call_789\",\n \"name\": \"lookup\"\n }\n ]\n}\n" } }, - "RealtimeClientEventSessionUpdate": { - "type": "object", - "description": "Send this event to update the session’s configuration.\nThe client may send this event at any time to update any field\nexcept for `voice` and `model`. `voice` can be updated only if there have been no other audio outputs yet.\n\nWhen the server receives a `session.update`, it will respond\nwith a `session.updated` event showing the full, effective configuration.\nOnly the fields that are present in the `session.update` are updated. To clear a field like\n`instructions`, pass an empty string. To clear a field like `tools`, pass an empty array.\nTo clear a field like `turn_detection`, pass `null`.\n", - "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event. This is an arbitrary string that a client may assign. It will be passed back if there is an error with the event, but the corresponding `session.updated` event will not include it." - }, - "type": { + "ResponseSteerPendingReason": { + "title": "ResponseSteerPendingReason", + "description": "An extensible enum describing why accepted steering input is still queued.\nClients should handle unknown values because additional reasons may be\nintroduced. Known values include:\n- `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`.\n", + "anyOf": [ + { "type": "string", "enum": [ - "session.update" - ], - "description": "The event type, must be `session.update`.", - "x-stainless-const": true + "waiting_for_required_input" + ] }, - "session": { + { + "type": "string" + } + ] + }, + "ResponseSteerRequiredInput": { + "title": "ResponseSteerRequiredInput", + "description": "An input stub identifying an outstanding client-owned tool result or\napproval decision. Copy the stub and fill the result fields using the\ncorresponding `response.create` input schema. Use saved results without\nrerunning the tool. The server does not supply results, approval decisions,\nor safety acknowledgements in these stubs.\n", + "oneOf": [ + { "type": "object", - "description": "Update the Realtime session. Choose either a realtime\nsession or a transcription session.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeSessionCreateRequestGA" + "title": "Required function tool call output", + "additionalProperties": false, + "description": "Supply `output` using the function tool call output input schema.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "function_call_output" + ], + "x-stainless-const": true + }, + "call_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "type", + "call_id", + "name" + ] + }, + { + "type": "object", + "title": "Required custom tool call output", + "additionalProperties": false, + "description": "Supply `output` using the custom tool call output input schema. The\noriginal custom tool call supplies the tool's name.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "custom_tool_call_output" + ], + "x-stainless-const": true + }, + "call_id": { + "type": "string" + } + }, + "required": [ + "type", + "call_id" + ] + }, + { + "type": "object", + "title": "Required computer tool call output", + "additionalProperties": false, + "description": "Supply `output` using the computer tool call output input schema,\nincluding any required `acknowledged_safety_checks`.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "computer_call_output" + ], + "x-stainless-const": true + }, + "call_id": { + "type": "string" + } + }, + "required": [ + "type", + "call_id" + ] + }, + { + "type": "object", + "title": "Required shell tool call output", + "additionalProperties": false, + "description": "Supply `output` using the shell tool call output input schema. Each\noutput entry includes `stdout`, `stderr`, and `outcome`.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "shell_call_output" + ], + "x-stainless-const": true + }, + "call_id": { + "type": "string" + } + }, + "required": [ + "type", + "call_id" + ] + }, + { + "type": "object", + "title": "Required apply patch tool call output", + "additionalProperties": false, + "description": "Supply `status` and optional `output` using the apply patch tool call\noutput input schema.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "apply_patch_call_output" + ], + "x-stainless-const": true + }, + "call_id": { + "type": "string" + } + }, + "required": [ + "type", + "call_id" + ] + }, + { + "type": "object", + "title": "Required tool search output", + "additionalProperties": false, + "description": "Supply `tools` using the tool search output input schema, retaining\n`execution: \"client\"`.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "tool_search_output" + ], + "x-stainless-const": true + }, + "call_id": { + "type": "string" + }, + "execution": { + "type": "string", + "enum": [ + "client" + ], + "x-stainless-const": true + } + }, + "required": [ + "type", + "call_id", + "execution" + ] + }, + { + "type": "object", + "title": "Required MCP approval response", + "additionalProperties": false, + "description": "Supply `approve` using the MCP approval response input schema. An\noptional `reason` can be supplied when denying the request. The original\napproval request identifies the tool and server.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "mcp_approval_response" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA" + "approval_request_id": { + "type": "string" } + }, + "required": [ + "type", + "approval_request_id" ] } - }, - "required": [ - "type", - "session" ], - "x-oaiMeta": { - "name": "session.update", - "group": "realtime", - "example": "{\n \"type\": \"session.update\",\n \"session\": {\n \"type\": \"realtime\",\n \"instructions\": \"You are a creative assistant that helps with design tasks.\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"display_color_palette\",\n \"description\": \"Call this function when a user asks for a color palette.\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"theme\": {\n \"type\": \"string\",\n \"description\": \"Description of the theme for the color scheme.\"\n },\n \"colors\": {\n \"type\": \"array\",\n \"description\": \"Array of five hex color codes based on the theme.\",\n \"items\": {\n \"type\": \"string\",\n \"description\": \"Hex color code\"\n }\n }\n },\n \"required\": [\n \"theme\",\n \"colors\"\n ]\n }\n }\n ],\n \"tool_choice\": \"auto\"\n }\n}\n" + "discriminator": { + "propertyName": "type" } }, - "RealtimeClientEventTranscriptionSessionUpdate": { - "type": "object", - "description": "Send this event to update a transcription session.\n", - "properties": { - "event_id": { - "type": "string", - "description": "Optional client-generated ID used to identify this event." + "ResponseStreamEvent": { + "description": "Event emitted while a response is streamed.", + "anyOf": [ + { + "$ref": "#/components/schemas/ResponseAudioDeltaEvent" }, - "type": { - "type": "string", - "enum": [ - "transcription_session.update" - ], - "description": "The event type, must be `transcription_session.update`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseAudioDoneEvent" }, - "session": { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateRequest" - } - }, - "required": [ - "type", - "session" - ], - "x-oaiMeta": { - "name": "transcription_session.update", - "group": "realtime", - "example": "{\n \"type\": \"transcription_session.update\",\n \"session\": {\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500,\n \"create_response\": true,\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\",\n ]\n }\n}\n" - } - }, - "RealtimeConversationItem": { - "description": "A single item within a Realtime conversation.", - "anyOf": [ { - "$ref": "#/components/schemas/RealtimeConversationItemMessageSystem" + "$ref": "#/components/schemas/ResponseAudioTranscriptDeltaEvent" }, { - "$ref": "#/components/schemas/RealtimeConversationItemMessageUser" + "$ref": "#/components/schemas/ResponseAudioTranscriptDoneEvent" }, { - "$ref": "#/components/schemas/RealtimeConversationItemMessageAssistant" + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent" }, { - "$ref": "#/components/schemas/RealtimeConversationItemFunctionCall" + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent" }, { - "$ref": "#/components/schemas/RealtimeConversationItemFunctionCallOutput" + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCompletedEvent" }, { - "$ref": "#/components/schemas/RealtimeMCPApprovalResponse" + "$ref": "#/components/schemas/ResponseCodeInterpreterCallInProgressEvent" }, { - "$ref": "#/components/schemas/RealtimeMCPListTools" + "$ref": "#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent" }, { - "$ref": "#/components/schemas/RealtimeMCPToolCall" + "$ref": "#/components/schemas/ResponseCompactionCompactingStreamingEvent" }, { - "$ref": "#/components/schemas/RealtimeMCPApprovalRequest" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "RealtimeConversationItemFunctionCall": { - "type": "object", - "title": "Realtime function call item", - "description": "A function call item in a Realtime conversation.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the item. This may be provided by the client or generated by the server." + "$ref": "#/components/schemas/ResponseCompletedEvent" }, - "object": { - "type": "string", - "enum": [ - "realtime.item" - ], - "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseContentPartAddedEvent" }, - "type": { - "type": "string", - "enum": [ - "function_call" - ], - "description": "The type of the item. Always `function_call`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseContentPartDoneEvent" }, - "status": { - "type": "string", - "enum": [ - "completed", - "incomplete", - "in_progress" - ], - "description": "The status of the item. Has no effect on the conversation." + { + "$ref": "#/components/schemas/ResponseCreatedEvent" }, - "call_id": { - "type": "string", - "description": "The ID of the function call." + { + "$ref": "#/components/schemas/ResponseErrorEvent" }, - "name": { - "type": "string", - "description": "The name of the function being called." + { + "$ref": "#/components/schemas/ResponseFileSearchCallCompletedEvent" }, - "arguments": { - "type": "string", - "description": "The arguments of the function call. This is a JSON-encoded string representing the arguments passed to the function, for example `{\"arg1\": \"value1\", \"arg2\": 42}`." - } - }, - "required": [ - "type", - "name", - "arguments" - ] - }, - "RealtimeConversationItemFunctionCallOutput": { - "type": "object", - "title": "Realtime function call output item", - "description": "A function call output item in a Realtime conversation.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the item. This may be provided by the client or generated by the server." + { + "$ref": "#/components/schemas/ResponseFileSearchCallInProgressEvent" }, - "object": { - "type": "string", - "enum": [ - "realtime.item" - ], - "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseFileSearchCallSearchingEvent" }, - "type": { - "type": "string", - "enum": [ - "function_call_output" - ], - "description": "The type of the item. Always `function_call_output`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent" }, - "status": { - "type": "string", - "enum": [ - "completed", - "incomplete", - "in_progress" - ], - "description": "The status of the item. Has no effect on the conversation." + { + "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDoneEvent" }, - "call_id": { - "type": "string", - "description": "The ID of the function call this output is for." + { + "$ref": "#/components/schemas/ResponseShellCallCommandAddedStreamingEvent" }, - "output": { - "type": "string", - "description": "The output of the function call, this is free text and can contain any information or simply be empty." - } - }, - "required": [ - "type", - "call_id", - "output" - ] - }, - "RealtimeConversationItemMessageAssistant": { - "type": "object", - "title": "Realtime assistant message item", - "description": "An assistant message item in a Realtime conversation.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the item. This may be provided by the client or generated by the server." + { + "$ref": "#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent" }, - "object": { - "type": "string", - "enum": [ - "realtime.item" - ], - "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseShellCallCommandDoneStreamingEvent" }, - "type": { - "type": "string", - "enum": [ - "message" - ], - "description": "The type of the item. Always `message`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent", + "x-stainless-skip": [ + "go" + ] }, - "status": { - "type": "string", - "enum": [ - "completed", - "incomplete", - "in_progress" - ], - "description": "The status of the item. Has no effect on the conversation." + { + "$ref": "#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent" }, - "role": { - "type": "string", - "enum": [ - "assistant" - ], - "description": "The role of the message sender. Always `assistant`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseInProgressEvent" }, - "content": { - "type": "array", - "description": "The content of the message.", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "output_text", - "output_audio" - ], - "description": "The content type, `output_text` or `output_audio` depending on the session `output_modalities` configuration." - }, - "text": { - "type": "string", - "description": "The text content." - }, - "audio": { - "type": "string", - "description": "Base64-encoded audio bytes, these will be parsed as the format specified in the session output audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified." - }, - "transcript": { - "type": "string", - "description": "The transcript of the audio content, this will always be present if the output type is `audio`." - } - } - } - } - }, - "required": [ - "type", - "role", - "content" - ] - }, - "RealtimeConversationItemMessageSystem": { - "type": "object", - "title": "Realtime system message item", - "description": "A system message in a Realtime conversation can be used to provide additional context or instructions to the model. This is similar but distinct from the instruction prompt provided at the start of a conversation, as system messages can be added at any point in the conversation. For major changes to the conversation's behavior, use instructions, but for smaller updates (e.g. \"the user is now asking about a different topic\"), use system messages.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the item. This may be provided by the client or generated by the server." + { + "$ref": "#/components/schemas/ResponseFailedEvent" }, - "object": { - "type": "string", - "enum": [ - "realtime.item" - ], - "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseIncompleteEvent" }, - "type": { - "type": "string", - "enum": [ - "message" - ], - "description": "The type of the item. Always `message`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseOutputItemAddedEvent" }, - "status": { - "type": "string", - "enum": [ - "completed", - "incomplete", - "in_progress" - ], - "description": "The status of the item. Has no effect on the conversation." + { + "$ref": "#/components/schemas/ResponseOutputItemDoneEvent" }, - "role": { - "type": "string", - "enum": [ - "system" - ], - "description": "The role of the message sender. Always `system`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseReasoningSummaryPartAddedEvent" }, - "content": { - "type": "array", - "description": "The content of the message.", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "input_text" - ], - "description": "The content type. Always `input_text` for system messages.", - "x-stainless-const": true - }, - "text": { - "type": "string", - "description": "The text content." - } - } - } - } - }, - "required": [ - "type", - "role", - "content" - ] - }, - "RealtimeConversationItemMessageUser": { - "type": "object", - "title": "Realtime user message item", - "description": "A user message item in a Realtime conversation.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the item. This may be provided by the client or generated by the server." + { + "$ref": "#/components/schemas/ResponseReasoningSummaryPartDoneEvent" }, - "object": { - "type": "string", - "enum": [ - "realtime.item" - ], - "description": "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseReasoningSummaryTextDeltaEvent" }, - "type": { - "type": "string", - "enum": [ - "message" - ], - "description": "The type of the item. Always `message`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseReasoningSummaryTextDoneEvent" }, - "status": { - "type": "string", - "enum": [ - "completed", - "incomplete", - "in_progress" - ], - "description": "The status of the item. Has no effect on the conversation." + { + "$ref": "#/components/schemas/ResponseReasoningTextDeltaEvent" }, - "role": { - "type": "string", - "enum": [ - "user" - ], - "description": "The role of the message sender. Always `user`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseReasoningTextDoneEvent" }, - "content": { - "type": "array", - "description": "The content of the message.", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "input_text", - "input_audio", - "input_image" - ], - "description": "The content type (`input_text`, `input_audio`, or `input_image`)." - }, - "text": { - "type": "string", - "description": "The text content (for `input_text`)." - }, - "audio": { - "type": "string", - "description": "Base64-encoded audio bytes (for `input_audio`), these will be parsed as the format specified in the session input audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified." - }, - "image_url": { - "type": "string", - "format": "uri", - "description": "Base64-encoded image bytes (for `input_image`) as a data URI. For example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported formats are PNG and JPEG." - }, - "detail": { - "type": "string", - "description": "The detail level of the image (for `input_image`). `auto` will default to `high`.", - "default": "auto", - "enum": [ - "auto", - "low", - "high" - ] - }, - "transcript": { - "type": "string", - "description": "Transcript of the audio (for `input_audio`). This is not sent to the model, but will be attached to the message item for reference." - } - } - } - } - }, - "required": [ - "type", - "role", - "content" - ] - }, - "RealtimeConversationItemWithReference": { - "type": "object", - "description": "The item to add to the conversation.", - "properties": { - "id": { - "type": "string", - "description": "For an item of type (`message` | `function_call` | `function_call_output`)\nthis field allows the client to assign the unique ID of the item. It is\nnot required because the server will generate one if not provided.\n\nFor an item of type `item_reference`, this field is required and is a\nreference to any item that has previously existed in the conversation.\n" + { + "$ref": "#/components/schemas/ResponseRefusalDeltaEvent" }, - "type": { - "type": "string", - "enum": [ - "message", - "function_call", - "function_call_output" - ], - "description": "The type of the item (`message`, `function_call`, `function_call_output`, `item_reference`).\n" + { + "$ref": "#/components/schemas/ResponseRefusalDoneEvent" }, - "object": { - "type": "string", - "enum": [ - "realtime.item" - ], - "description": "Identifier for the API object being returned - always `realtime.item`.\n", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseTextDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseTextDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseWebSearchCallCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseWebSearchCallInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseWebSearchCallSearchingEvent" + }, + { + "$ref": "#/components/schemas/ResponseImageGenCallCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseImageGenCallGeneratingEvent" + }, + { + "$ref": "#/components/schemas/ResponseImageGenCallInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseImageGenCallPartialImageEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPCallArgumentsDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPCallArgumentsDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPCallCompletedEvent" }, - "status": { - "type": "string", - "enum": [ - "completed", - "incomplete", - "in_progress" - ], - "description": "The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect \non the conversation, but are accepted for consistency with the \n`conversation.item.created` event.\n" + { + "$ref": "#/components/schemas/ResponseMCPCallFailedEvent" }, - "role": { - "type": "string", - "enum": [ - "user", - "assistant", - "system" - ], - "description": "The role of the message sender (`user`, `assistant`, `system`), only \napplicable for `message` items.\n" + { + "$ref": "#/components/schemas/ResponseMCPCallInProgressEvent" }, - "content": { - "type": "array", - "description": "The content of the message, applicable for `message` items. \n- Message items of role `system` support only `input_text` content\n- Message items of role `user` support `input_text` and `input_audio` \n content\n- Message items of role `assistant` support `text` content.\n", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "input_audio", - "input_text", - "item_reference", - "text" - ], - "description": "The content type (`input_text`, `input_audio`, `item_reference`, `text`).\n" - }, - "text": { - "type": "string", - "description": "The text content, used for `input_text` and `text` content types.\n" - }, - "id": { - "type": "string", - "description": "ID of a previous conversation item to reference (for `item_reference`\ncontent types in `response.create` events). These can reference both\nclient and server created items.\n" - }, - "audio": { - "type": "string", - "description": "Base64-encoded audio bytes, used for `input_audio` content type.\n" - }, - "transcript": { - "type": "string", - "description": "The transcript of the audio, used for `input_audio` content type.\n" - } - } - } + { + "$ref": "#/components/schemas/ResponseMCPListToolsCompletedEvent" }, - "call_id": { - "type": "string", - "description": "The ID of the function call (for `function_call` and \n`function_call_output` items). If passed on a `function_call_output` \nitem, the server will check that a `function_call` item with the same \nID exists in the conversation history.\n" + { + "$ref": "#/components/schemas/ResponseMCPListToolsFailedEvent" }, - "name": { - "type": "string", - "description": "The name of the function being called (for `function_call` items).\n" + { + "$ref": "#/components/schemas/ResponseMCPListToolsInProgressEvent" }, - "arguments": { - "type": "string", - "description": "The arguments of the function call (for `function_call` items).\n" + { + "$ref": "#/components/schemas/ResponseOutputTextAnnotationAddedEvent" }, - "output": { - "type": "string", - "description": "The output of the function call (for `function_call_output` items).\n" + { + "$ref": "#/components/schemas/ResponseQueuedEvent" + }, + { + "$ref": "#/components/schemas/ResponseCustomToolCallInputDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseCustomToolCallInputDoneEvent" } + ], + "discriminator": { + "propertyName": "type" } }, - "RealtimeCreateClientSecretRequest": { - "type": "object", - "title": "Realtime client secret creation request", - "description": "Create a session and client secret for the Realtime API. The request can specify\neither a realtime or a transcription session configuration.\n[Learn more about the Realtime API](https://developers.openai.com/api/docs/guides/realtime).\n", - "properties": { - "expires_after": { + "ResponseStreamOptions": { + "anyOf": [ + { + "description": "Options for streaming responses. Only set this when you set `stream: true`.\n", "type": "object", - "title": "Client secret expiration", - "description": "Configuration for the client secret expiration. Expiration refers to the time after which\na client secret will no longer be valid for creating sessions. The session itself may\ncontinue after that time once started. A secret can be used to create multiple sessions\nuntil it expires.\n", "properties": { - "anchor": { - "type": "string", - "enum": [ - "created_at" - ], - "description": "The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported.\n", - "default": "created_at", - "x-stainless-const": true - }, - "seconds": { - "type": "integer", - "format": "int64", - "description": "The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified.\n", - "minimum": 10, - "maximum": 7200, - "default": 600 + "include_obfuscation": { + "type": "boolean", + "description": "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events to\nnormalize payload sizes as a mitigation to certain side-channel attacks.\nThese obfuscation fields are included by default, but add a small amount\nof overhead to the data stream. You can set `include_obfuscation` to\nfalse to optimize for bandwidth if you trust the network links between\nyour application and the OpenAI API.\n" } } }, - "session": { - "title": "Session configuration", - "description": "Session configuration to use for the client secret. Choose either a realtime\nsession or a transcription session.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeSessionCreateRequestGA" - }, - { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA" - } - ] - } - } - }, - "RealtimeCreateClientSecretResponse": { - "type": "object", - "title": "Realtime session and client secret", - "description": "Response from creating a session and client secret for the Realtime API.\n", - "properties": { - "value": { - "type": "string", - "description": "The generated client secret value." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Expiration timestamp for the client secret, in seconds since epoch." - }, - "session": { - "title": "Session configuration", - "description": "The session configuration for either a realtime or transcription session.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeSessionCreateResponseGA" - }, - { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA" - } - ], - "discriminator": { - "propertyName": "type" - } + { + "type": "null" } - }, - "required": [ - "value", - "expires_at", - "session" - ], - "x-oaiMeta": { - "name": "Session response object", - "group": "realtime", - "example": "{\n \"value\": \"ek_68af296e8e408191a1120ab6383263c2\",\n \"expires_at\": 1756310470,\n \"session\": {\n \"type\": \"realtime\",\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9CiUVUzUzYIssh3ELY1d\",\n \"model\": \"gpt-realtime-2025-08-25\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"instructions\": \"You are a friendly assistant.\",\n \"tools\": [],\n \"tool_choice\": \"auto\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": null,\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"expires_at\": 0,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": null,\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200,\n \"idle_timeout_ms\": null,\n \"create_response\": true,\n \"interrupt_response\": true\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"alloy\",\n \"speed\": 1.0\n }\n },\n \"include\": null\n }\n}\n" - } + ] }, - "RealtimeFunctionTool": { + "ResponseTextDeltaEvent": { "type": "object", - "title": "Function tool", + "description": "Emitted when there is an additional text delta.", "properties": { "type": { "type": "string", + "description": "The type of the event. Always `response.output_text.delta`.\n", "enum": [ - "function" + "response.output_text.delta" ], - "description": "The type of the tool, i.e. `function`.", "x-stainless-const": true }, - "name": { - "type": "string", - "description": "The name of the function." - }, - "description": { + "item_id": { "type": "string", - "description": "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n" + "description": "The ID of the output item that the text delta was added to.\n" }, - "parameters": { - "type": "object", - "description": "Parameters of the function in JSON Schema." - } - } - }, - "RealtimeMCPApprovalRequest": { - "type": "object", - "title": "Realtime MCP approval request", - "description": "A Realtime item requesting human approval of a tool invocation.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "mcp_approval_request" - ], - "description": "The type of the item. Always `mcp_approval_request`.", - "x-stainless-const": true + "output_index": { + "type": "integer", + "description": "The index of the output item that the text delta was added to.\n" }, - "id": { - "type": "string", - "description": "The unique ID of the approval request." + "content_index": { + "type": "integer", + "description": "The index of the content part that the text delta was added to.\n" }, - "server_label": { + "delta": { "type": "string", - "description": "The label of the MCP server making the request." + "description": "The text delta that was added.\n" }, - "name": { - "type": "string", - "description": "The name of the tool to run." + "sequence_number": { + "type": "integer", + "description": "The sequence number for this event." }, - "arguments": { - "type": "string", - "description": "A JSON string of arguments for the tool." + "logprobs": { + "type": "array", + "description": "The log probabilities of the tokens in the delta.\n", + "items": { + "$ref": "#/components/schemas/ResponseLogProb" + } } }, "required": [ "type", - "id", - "server_label", - "name", - "arguments" - ] + "item_id", + "output_index", + "content_index", + "delta", + "sequence_number", + "logprobs" + ], + "x-oaiMeta": { + "name": "response.output_text.delta", + "group": "responses", + "example": "{\n \"type\": \"response.output_text.delta\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"In\",\n \"sequence_number\": 1,\n \"logprobs\": []\n}\n" + } }, - "RealtimeMCPApprovalResponse": { + "ResponseTextDoneEvent": { "type": "object", - "title": "Realtime MCP approval response", - "description": "A Realtime item responding to an MCP approval request.\n", + "description": "Emitted when text content is finalized.", "properties": { "type": { "type": "string", + "description": "The type of the event. Always `response.output_text.done`.\n", "enum": [ - "mcp_approval_response" + "response.output_text.done" ], - "description": "The type of the item. Always `mcp_approval_response`.", "x-stainless-const": true }, - "id": { + "item_id": { "type": "string", - "description": "The unique ID of the approval response." + "description": "The ID of the output item that the text content is finalized.\n" }, - "approval_request_id": { + "output_index": { + "type": "integer", + "description": "The index of the output item that the text content is finalized.\n" + }, + "content_index": { + "type": "integer", + "description": "The index of the content part that the text content is finalized.\n" + }, + "text": { "type": "string", - "description": "The ID of the approval request being answered." + "description": "The text content that is finalized.\n" }, - "approve": { - "type": "boolean", - "description": "Whether the request was approved." + "sequence_number": { + "type": "integer", + "description": "The sequence number for this event." }, - "reason": { - "anyOf": [ - { - "type": "string", - "description": "Optional reason for the decision." - }, - { - "type": "null" - } - ] + "logprobs": { + "type": "array", + "description": "The log probabilities of the tokens in the delta.\n", + "items": { + "$ref": "#/components/schemas/ResponseLogProb" + } } }, "required": [ "type", - "id", - "approval_request_id", - "approve" - ] + "item_id", + "output_index", + "content_index", + "text", + "sequence_number", + "logprobs" + ], + "x-oaiMeta": { + "name": "response.output_text.done", + "group": "responses", + "example": "{\n \"type\": \"response.output_text.done\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"sequence_number\": 1,\n \"logprobs\": []\n}\n" + } }, - "RealtimeMCPHTTPError": { + "ResponseTextParam": { "type": "object", - "title": "Realtime MCP HTTP error", + "description": "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text)\n- [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs)\n", "properties": { - "type": { - "type": "string", - "enum": [ - "http_error" - ], - "x-stainless-const": true - }, - "code": { - "type": "integer" + "format": { + "$ref": "#/components/schemas/TextResponseFormatConfiguration" }, - "message": { - "type": "string" + "verbosity": { + "$ref": "#/components/schemas/Verbosity" } - }, - "required": [ - "type", - "code", - "message" - ] + } }, - "RealtimeMCPListTools": { + "ResponseUsage": { "type": "object", - "title": "Realtime MCP list tools", - "description": "A Realtime item listing tools available on an MCP server.\n", + "description": "Represents token usage details including input tokens, output tokens,\na breakdown of output tokens, and the total tokens used.\n", "properties": { - "type": { - "type": "string", - "enum": [ - "mcp_list_tools" - ], - "description": "The type of the item. Always `mcp_list_tools`.", - "x-stainless-const": true + "input_tokens": { + "type": "integer", + "description": "The number of input tokens." }, - "id": { - "type": "string", - "description": "The unique ID of the list." + "input_tokens_details": { + "type": "object", + "description": "A detailed breakdown of the input tokens.", + "properties": { + "cached_tokens": { + "type": "integer", + "description": "The number of tokens that were retrieved from the cache.\n[More on prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).\n" + }, + "cache_write_tokens": { + "type": "integer", + "description": "The number of input tokens that were written to the cache." + } + }, + "required": [ + "cached_tokens", + "cache_write_tokens" + ] }, - "server_label": { - "type": "string", - "description": "The label of the MCP server." + "output_tokens": { + "type": "integer", + "description": "The number of output tokens." }, - "tools": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MCPListToolsTool" + "output_tokens_details": { + "type": "object", + "description": "A detailed breakdown of the output tokens.", + "properties": { + "reasoning_tokens": { + "type": "integer", + "description": "The number of reasoning tokens." + } }, - "description": "The tools available on the server." + "required": [ + "reasoning_tokens" + ] + }, + "total_tokens": { + "type": "integer", + "description": "The total number of tokens used." } }, "required": [ - "type", - "server_label", - "tools" + "input_tokens", + "input_tokens_details", + "output_tokens", + "output_tokens_details", + "total_tokens" ] }, - "RealtimeMCPProtocolError": { + "ResponseWebSearchCallCompletedEvent": { "type": "object", - "title": "Realtime MCP protocol error", + "description": "Emitted when a web search call is completed.", "properties": { "type": { "type": "string", + "description": "The type of the event. Always `response.web_search_call.completed`.\n", "enum": [ - "protocol_error" + "response.web_search_call.completed" ], "x-stainless-const": true }, - "code": { - "type": "integer" + "output_index": { + "type": "integer", + "description": "The index of the output item that the web search call is associated with.\n" }, - "message": { - "type": "string" + "item_id": { + "type": "string", + "description": "Unique ID for the output item associated with the web search call.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of the web search call being processed." } }, "required": [ "type", - "code", - "message" - ] + "output_index", + "item_id", + "sequence_number" + ], + "x-oaiMeta": { + "name": "response.web_search_call.completed", + "group": "responses", + "example": "{\n \"type\": \"response.web_search_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"ws_123\",\n \"sequence_number\": 0\n}\n" + } }, - "RealtimeMCPToolCall": { + "ResponseWebSearchCallInProgressEvent": { "type": "object", - "title": "Realtime MCP tool call", - "description": "A Realtime item representing an invocation of a tool on an MCP server.\n", + "description": "Emitted when a web search call is initiated.", "properties": { "type": { "type": "string", + "description": "The type of the event. Always `response.web_search_call.in_progress`.\n", "enum": [ - "mcp_call" + "response.web_search_call.in_progress" ], - "description": "The type of the item. Always `mcp_call`.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The unique ID of the tool call." - }, - "server_label": { - "type": "string", - "description": "The label of the MCP server running the tool." - }, - "name": { - "type": "string", - "description": "The name of the tool that was run." + "output_index": { + "type": "integer", + "description": "The index of the output item that the web search call is associated with.\n" }, - "arguments": { + "item_id": { "type": "string", - "description": "A JSON string of the arguments passed to the tool." - }, - "approval_request_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of an associated approval request, if any." - }, - { - "type": "null" - } - ] - }, - "output": { - "anyOf": [ - { - "type": "string", - "description": "The output from the tool call." - }, - { - "type": "null" - } - ] - }, - "error": { - "anyOf": [ - { - "description": "The error from the tool call, if any.", - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeMCPProtocolError" - }, - { - "$ref": "#/components/schemas/RealtimeMCPToolExecutionError" - }, - { - "$ref": "#/components/schemas/RealtimeMCPHTTPError" - } - ] - }, - { - "type": "null" - } - ] + "description": "Unique ID for the output item associated with the web search call.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of the web search call being processed." } }, "required": [ "type", - "id", - "server_label", - "name", - "arguments" - ] + "output_index", + "item_id", + "sequence_number" + ], + "x-oaiMeta": { + "name": "response.web_search_call.in_progress", + "group": "responses", + "example": "{\n \"type\": \"response.web_search_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"ws_123\",\n \"sequence_number\": 0\n}\n" + } }, - "RealtimeMCPToolExecutionError": { + "ResponseWebSearchCallSearchingEvent": { "type": "object", - "title": "Realtime MCP tool execution error", + "description": "Emitted when a web search call is executing.", "properties": { "type": { "type": "string", + "description": "The type of the event. Always `response.web_search_call.searching`.\n", "enum": [ - "tool_execution_error" + "response.web_search_call.searching" ], "x-stainless-const": true }, - "message": { - "type": "string" + "output_index": { + "type": "integer", + "description": "The index of the output item that the web search call is associated with.\n" + }, + "item_id": { + "type": "string", + "description": "Unique ID for the output item associated with the web search call.\n" + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of the web search call being processed." } }, "required": [ "type", - "message" - ] - }, - "RealtimeReasoning": { - "type": "object", - "title": "Realtime reasoning configuration", - "description": "Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.\n", - "properties": { - "effort": { - "$ref": "#/components/schemas/RealtimeReasoningEffort" - } - } - }, - "RealtimeReasoningEffort": { - "type": "string", - "description": "Constrains effort on reasoning for reasoning-capable Realtime models such as\n`gpt-realtime-2`.\n", - "enum": [ - "minimal", - "low", - "medium", - "high", - "xhigh" + "output_index", + "item_id", + "sequence_number" ], - "default": "low" + "x-oaiMeta": { + "name": "response.web_search_call.searching", + "group": "responses", + "example": "{\n \"type\": \"response.web_search_call.searching\",\n \"output_index\": 0,\n \"item_id\": \"ws_123\",\n \"sequence_number\": 0\n}\n" + } }, - "RealtimeResponse": { + "ResponseWsError": { "type": "object", - "description": "The response resource.", + "title": "ResponseWsError", + "description": "Emitted when an error occurs while processing a Responses WebSocket request.", "properties": { - "id": { - "type": "string", - "description": "The unique ID of the response, will look like `resp_1234`." - }, - "object": { + "type": { "type": "string", + "description": "The type of the event. Always `error`.", "enum": [ - "realtime.response" + "error" ], - "description": "The object type, must be `realtime.response`.", "x-stainless-const": true }, "status": { - "type": "string", - "enum": [ - "completed", - "cancelled", - "failed", - "incomplete", - "in_progress" - ], - "description": "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n" - }, - "status_details": { - "type": "object", - "description": "Additional details about the status.", - "properties": { - "type": { - "type": "string", - "enum": [ - "completed", - "cancelled", - "failed", - "incomplete" - ], - "description": "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n" - }, - "reason": { - "type": "string", - "enum": [ - "turn_detected", - "client_cancelled", - "max_output_tokens", - "content_filter" - ], - "description": "The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected` (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter` (the server-side safety filter activated and cut off the response).\n" - }, - "error": { - "type": "object", - "description": "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of error." - }, - "code": { - "type": "string", - "description": "Error code, if any." - } - } - } - } - }, - "output": { - "type": "array", - "description": "The list of output items generated by the response.", - "items": { - "$ref": "#/components/schemas/RealtimeConversationItem" - } - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "audio": { - "type": "object", - "description": "Configuration for audio output.", - "properties": { - "output": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats", - "description": "The format of the output audio." - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsShared", - "default": "alloy", - "description": "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for\nbest quality.\n" - } - } - } - } - }, - "usage": { - "type": "object", - "description": "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n", - "properties": { - "total_tokens": { - "type": "integer", - "description": "The total number of tokens in the Response including input and output \ntext and audio tokens.\n" - }, - "input_tokens": { - "type": "integer", - "description": "The number of input tokens used in the Response, including text and \naudio tokens.\n" - }, - "output_tokens": { - "type": "integer", - "description": "The number of output tokens sent in the Response, including text and \naudio tokens.\n" - }, - "input_token_details": { - "type": "object", - "description": "Details about the input tokens used in the Response. Cached tokens are tokens from previous turns in the conversation that are included as context for the current response. Cached tokens here are counted as a subset of input tokens, meaning input tokens will include cached and uncached tokens.", - "properties": { - "cached_tokens": { - "type": "integer", - "description": "The number of cached tokens used as input for the Response." - }, - "text_tokens": { - "type": "integer", - "description": "The number of text tokens used as input for the Response." - }, - "image_tokens": { - "type": "integer", - "description": "The number of image tokens used as input for the Response." - }, - "audio_tokens": { - "type": "integer", - "description": "The number of audio tokens used as input for the Response." - }, - "cached_tokens_details": { - "type": "object", - "description": "Details about the cached tokens used as input for the Response.", - "properties": { - "text_tokens": { - "type": "integer", - "description": "The number of cached text tokens used as input for the Response." - }, - "image_tokens": { - "type": "integer", - "description": "The number of cached image tokens used as input for the Response." - }, - "audio_tokens": { - "type": "integer", - "description": "The number of cached audio tokens used as input for the Response." - } - } - } - } - }, - "output_token_details": { - "type": "object", - "description": "Details about the output tokens used in the Response.", - "properties": { - "text_tokens": { - "type": "integer", - "description": "The number of text tokens used in the Response." - }, - "audio_tokens": { - "type": "integer", - "description": "The number of audio tokens used in the Response." - } - } - } - } + "type": "integer", + "description": "The HTTP status code associated with a WebSocket protocol error." }, - "conversation_id": { - "description": "Which conversation the response is added to, determined by the `conversation`\nfield in the `response.create` event. If `auto`, the response will be added to\nthe default conversation and the value of `conversation_id` will be an id like\n`conv_1234`. If `none`, the response will not be added to any conversation and\nthe value of `conversation_id` will be `null`. If responses are being triggered\nautomatically by VAD the response will be added to the default conversation\n", - "type": "string" + "sequence_number": { + "type": "integer", + "description": "The sequence number of an error emitted by the response stream." }, - "output_modalities": { - "type": "array", - "description": "The set of modalities the model used to respond, currently the only possible values are\n`[\\\"audio\\\"]`, `[\\\"text\\\"]`. Audio output always include a text transcript. Setting the\noutput to mode `text` will disable audio output from the model.\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] - } + "error": { + "$ref": "#/components/schemas/ErrorPayload", + "description": "Details about the error." }, - "max_output_tokens": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string", - "enum": [ - "inf" - ], - "x-stainless-const": true - } - ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls, that was used in this response.\n" + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present when the\noriginating `response.create` event supplied a `stream_id`.\n" } + }, + "required": [ + "type", + "error" + ], + "x-oaiMeta": { + "name": "error", + "group": "responses", + "example": "{\n \"type\": \"error\",\n \"status\": 400,\n \"stream_id\": \"agent_1\",\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"code\": \"websocket_stream_limit_reached\",\n \"message\": \"This WebSocket connection has reached its stream limit.\",\n \"param\": \"stream_id\"\n }\n}\n" } }, - "RealtimeResponseCreateParams": { - "type": "object", - "description": "Create a new Realtime response with these parameters", - "properties": { - "output_modalities": { - "type": "array", - "description": "The set of modalities the model used to respond, currently the only possible values are\n`[\\\"audio\\\"]`, `[\\\"text\\\"]`. Audio output always include a text transcript. Setting the\noutput to mode `text` will disable audio output from the model.\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] - } - }, - "instructions": { - "type": "string", - "description": "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n" + "ResponsesClientEvent": { + "discriminator": { + "propertyName": "type" + }, + "description": "Client events accepted by the Responses WebSocket server.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/ResponsesClientEventResponseCreate" }, - "audio": { + { + "$ref": "#/components/schemas/ResponseSteerEvent" + } + ] + }, + "ResponsesClientEventResponseCreate": { + "allOf": [ + { "type": "object", - "description": "Configuration for audio input and output.", "properties": { - "output": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats", - "description": "The format of the output audio." - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", - "default": "alloy", - "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with\nan `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed\nduring the session once the model has responded with audio at least once.\nWe recommend `marin` and `cedar` for best quality.\n" - } - } - } - } - }, - "tools": { - "type": "array", - "description": "Tools available to the model.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeFunctionTool" - }, - { - "$ref": "#/components/schemas/MCPTool" - } - ] - } - }, - "tool_choice": { - "description": "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ToolChoiceOptions" - }, - { - "$ref": "#/components/schemas/ToolChoiceFunction" - }, - { - "$ref": "#/components/schemas/ToolChoiceMCP" - } - ], - "default": "auto" - }, - "parallel_tool_calls": { - "type": "boolean", - "description": "Whether the model may call multiple tools in parallel. Only supported by\nreasoning Realtime models such as `gpt-realtime-2`.\n" - }, - "reasoning": { - "$ref": "#/components/schemas/RealtimeReasoning" - }, - "max_output_tokens": { - "oneOf": [ - { - "type": "integer" - }, - { + "type": { "type": "string", "enum": [ - "inf" + "response.create" ], + "description": "The type of the client event. Always `response.create`.\n", "x-stainless-const": true - } - ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" - }, - "conversation": { - "description": "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which\nwill not add items to default conversation.\n", - "oneOf": [ - { - "type": "string" }, - { + "generate": { + "type": "boolean", + "description": "Whether to generate output for this response. Defaults to true when omitted.\nSet to false to prepare request state without model output; the response\nID can be used as previous_response_id on a later turn.\n" + }, + "stream_id": { "type": "string", - "default": "auto", - "enum": [ - "auto", - "none" - ] + "minLength": 1, + "maxLength": 256, + "pattern": "^[A-Za-z0-9_.-]+$", + "description": "The WebSocket lane for this response. Requests with the same\n`stream_id` are processed FIFO, and events for the response echo the\nsame `stream_id`.\n\n`stream_id` controls routing; `previous_response_id` controls\nconversation lineage, so a new lane can fork from a response created\non another lane.\n" } + }, + "required": [ + "type" ] }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "prompt": { - "$ref": "#/components/schemas/Prompt" - }, - "input": { - "type": "array", - "description": "Input items to include in the prompt for the model. Using this field\ncreates a new context for this Response instead of using the default\nconversation. An empty array `[]` will clear the context for this Response.\nNote that this can include references to items that previously appeared in the session\nusing their id.\n", - "items": { - "$ref": "#/components/schemas/RealtimeConversationItem" - } + { + "$ref": "#/components/schemas/CreateResponse" } + ], + "description": "Client event for creating a response over a persistent WebSocket connection.\nThis payload uses the same top-level fields as `POST /v1/responses`, plus\nWebSocket-only envelope metadata.\n\nNotes:\n- `stream` is implicit over WebSocket and should not be sent.\n- `background` is not supported over WebSocket.\n- `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.\n", + "x-oaiMeta": { + "example": "{\n \"type\": \"response.create\",\n \"stream_id\": \"agent_1\",\n \"model\": \"gpt-6-astra\",\n \"input\": \"Say hello.\"\n}\n" } }, - "RealtimeServerEvent": { + "ResponsesServerEvent": { "discriminator": { "propertyName": "type" }, - "description": "A realtime server event.\n", + "description": "Server events emitted by the Responses WebSocket server.\n", "anyOf": [ { - "$ref": "#/components/schemas/RealtimeServerEventConversationCreated" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemCreated" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemDeleted" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionCompleted" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionDelta" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionFailed" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemRetrieved" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemTruncated" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventError" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferCleared" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferCommitted" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferDtmfEventReceived" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStarted" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStopped" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventRateLimitsUpdated" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventResponseAudioDelta" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventResponseAudioDone" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventResponseAudioTranscriptDelta" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventResponseAudioTranscriptDone" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventResponseContentPartAdded" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventResponseContentPartDone" - }, - { - "$ref": "#/components/schemas/RealtimeServerEventResponseCreated" + "title": "ResponseAudioWsDelta", + "description": "Emitted when there is a partial audio response.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseAudioDeltaEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseDone" + "title": "ResponseAudioWsDone", + "description": "Emitted when the audio response is complete.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseAudioDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDelta" + "title": "ResponseAudioTranscriptWsDelta", + "description": "Emitted when there is a partial transcript of audio.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseAudioTranscriptDeltaEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDone" + "title": "ResponseAudioTranscriptWsDone", + "description": "Emitted when the full audio transcript is completed.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseAudioTranscriptDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseOutputItemAdded" + "title": "ResponseCodeInterpreterCallCodeWsDelta", + "description": "Emitted when a partial code snippet is streamed by the code interpreter.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseOutputItemDone" + "title": "ResponseCodeInterpreterCallCodeWsDone", + "description": "Emitted when the code snippet is finalized by the code interpreter.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseTextDelta" + "title": "ResponseCodeInterpreterCallWsCompleted", + "description": "Emitted when the code interpreter call is completed.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCompletedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseTextDone" + "title": "ResponseCodeInterpreterCallInWsProgress", + "description": "Emitted when a code interpreter call is in progress.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallInProgressEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventSessionCreated" + "title": "ResponseCodeInterpreterCallWsInterpreting", + "description": "Emitted when the code interpreter is actively interpreting the code snippet.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventSessionUpdated" + "title": "ResponseCompactionWsCompacting", + "description": "Emitted when new summary content is sampled for a compaction trigger. Contains no summary content.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCompactionCompactingStreamingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventOutputAudioBufferStarted" + "title": "ResponseWsCompleted", + "description": "Emitted when the model response is complete.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCompletedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventOutputAudioBufferStopped" + "title": "ResponseContentPartWsAdded", + "description": "Emitted when a new content part is added.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseContentPartAddedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventOutputAudioBufferCleared" + "title": "ResponseContentPartWsDone", + "description": "Emitted when a content part is done.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseContentPartDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemAdded" + "title": "ResponseWsCreated", + "description": "An event that is emitted when a response is created.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCreatedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemDone" + "title": "ResponseFileSearchCallWsCompleted", + "description": "Emitted when a file search call is completed (results found).", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseFileSearchCallCompletedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventInputAudioBufferTimeoutTriggered" + "title": "ResponseFileSearchCallInWsProgress", + "description": "Emitted when a file search call is initiated.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseFileSearchCallInProgressEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment" + "title": "ResponseFileSearchCallWsSearching", + "description": "Emitted when a file search is currently searching.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseFileSearchCallSearchingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventMCPListToolsInProgress" + "title": "ResponseFunctionCallArgumentsWsDelta", + "description": "Emitted when there is a partial function-call arguments delta.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventMCPListToolsCompleted" + "title": "ResponseFunctionCallArgumentsWsDone", + "description": "Emitted when function-call arguments are finalized.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventMCPListToolsFailed" + "title": "ResponseShellCallCommandWsAdded", + "description": "A streaming event that indicated a shell command was added to a tool call.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseShellCallCommandAddedStreamingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta" + "title": "ResponseShellCallCommandWsDelta", + "description": "A streaming event that indicated a shell command was incrementally updated.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone" + "title": "ResponseShellCallCommandWsDone", + "description": "A streaming event that indicated a shell command was completed.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseShellCallCommandDoneStreamingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallInProgress" + "title": "ResponseShellCallOutputContentWsDelta", + "description": "A streaming event that indicated shell call output was incrementally added.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent", + "x-stainless-skip": [ + "go" + ] + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallCompleted" + "title": "ResponseShellCallOutputContentWsDone", + "description": "A streaming event that indicated shell call output was completed.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, { - "$ref": "#/components/schemas/RealtimeServerEventResponseMCPCallFailed" - } - ] - }, - "RealtimeServerEventConversationCreated": { - "type": "object", - "description": "Returned when a conversation is created. Emitted right after session creation.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.created" - ], - "description": "The event type, must be `conversation.created`.", - "x-stainless-const": true - }, - "conversation": { - "type": "object", - "description": "The conversation resource.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the conversation." + "title": "ResponseInWsProgress", + "description": "Emitted when the response is in progress.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseInProgressEvent" }, - "object": { - "type": "string", - "description": "The object type, must be `realtime.conversation`." + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } - } - } - }, - "required": [ - "event_id", - "type", - "conversation" - ], - "x-oaiMeta": { - "name": "conversation.created", - "group": "realtime", - "example": "{\n \"event_id\": \"event_9101\",\n \"type\": \"conversation.created\",\n \"conversation\": {\n \"id\": \"conv_001\",\n \"object\": \"realtime.conversation\"\n }\n}\n" - } - }, - "RealtimeServerEventConversationItemAdded": { - "type": "object", - "description": "Sent by the server when an Item is added to the default Conversation. This can happen in several cases:\n- When the client sends a `conversation.item.create` event.\n- When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer.\n- When the model is generating a Response. In this case the `conversation.item.added` event will be sent when the model starts generating a specific Item, and thus it will not yet have any content (and `status` will be `in_progress`).\n\nThe event will include the full content of the Item (except when model is generating a Response) except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if necessary.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.added" - ], - "description": "The event type, must be `conversation.item.added`.", - "x-stainless-const": true + ] }, - "previous_item_id": { - "anyOf": [ + { + "title": "ResponseWsFailed", + "description": "An event that is emitted when a response fails.\n", + "allOf": [ { - "type": "string", - "description": "The ID of the item that precedes this one, if any. This is used to\nmaintain ordering when items are inserted.\n" + "$ref": "#/components/schemas/ResponseFailedEvent" }, { - "type": "null" + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } ] }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" - } - }, - "required": [ - "event_id", - "type", - "item" - ], - "x-oaiMeta": { - "name": "conversation.item.added", - "group": "realtime", - "example": "{\n \"type\": \"conversation.item.added\",\n \"event_id\": \"event_C9G8pjSJCfRNEhMEnYAVy\",\n \"previous_item_id\": null,\n \"item\": {\n \"id\": \"item_C9G8pGVKYnaZu8PH5YQ9O\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"hi\"\n }\n ]\n }\n}\n" - } - }, - "RealtimeServerEventConversationItemCreated": { - "type": "object", - "description": "Returned when a conversation item is created. There are several scenarios that produce this event:\n - The server is generating a Response, which if successful will produce\n either one or two Items, which will be of type `message`\n (role `assistant`) or type `function_call`.\n - The input audio buffer has been committed, either by the client or the\n server (in `server_vad` mode). The server will take the content of the\n input audio buffer and add it to a new user message Item.\n - The client has sent a `conversation.item.create` event to add a new Item\n to the Conversation.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.created" - ], - "description": "The event type, must be `conversation.item.created`.", - "x-stainless-const": true - }, - "previous_item_id": { - "anyOf": [ + { + "title": "ResponseWsIncomplete", + "description": "An event that is emitted when a response finishes as incomplete.\n\nOver WebSocket, steering can finish a response with\n`response.incomplete_details.reason` set to `steered`, followed automatically\nby a successor `response.created` that commits the queued steering input.\n", + "allOf": [ { - "type": "string", - "description": "The ID of the preceding item in the Conversation context, allows the\nclient to understand the order of the conversation. Can be `null` if the\nitem has no predecessor.\n" + "$ref": "#/components/schemas/ResponseIncompleteEvent" }, { - "type": "null" + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } ] }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" - } - }, - "required": [ - "event_id", - "type", - "item" - ], - "x-oaiMeta": { - "name": "conversation.item.created", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1920\",\n \"type\": \"conversation.item.created\",\n \"previous_item_id\": \"msg_002\",\n \"item\": {\n \"id\": \"msg_003\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"user\",\n \"content\": []\n }\n}\n" - } - }, - "RealtimeServerEventConversationItemDeleted": { - "type": "object", - "description": "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.deleted" - ], - "description": "The event type, must be `conversation.item.deleted`.", - "x-stainless-const": true - }, - "item_id": { - "type": "string", - "description": "The ID of the item that was deleted." - } - }, - "required": [ - "event_id", - "type", - "item_id" - ], - "x-oaiMeta": { - "name": "conversation.item.deleted", - "group": "realtime", - "example": "{\n \"event_id\": \"event_2728\",\n \"type\": \"conversation.item.deleted\",\n \"item_id\": \"msg_005\"\n}\n" - } - }, - "RealtimeServerEventConversationItemDone": { - "type": "object", - "description": "Returned when a conversation item is finalized.\n\nThe event will include the full content of the Item except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if needed.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.done" - ], - "description": "The event type, must be `conversation.item.done`.", - "x-stainless-const": true - }, - "previous_item_id": { - "anyOf": [ + { + "title": "ResponseOutputItemWsAdded", + "description": "Emitted when a new output item is added.", + "allOf": [ { - "type": "string", - "description": "The ID of the item that precedes this one, if any. This is used to\nmaintain ordering when items are inserted.\n" + "$ref": "#/components/schemas/ResponseOutputItemAddedEvent" }, { - "type": "null" + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } ] }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" - } - }, - "required": [ - "event_id", - "type", - "item" - ], - "x-oaiMeta": { - "name": "conversation.item.done", - "group": "realtime", - "example": "{\n \"type\": \"conversation.item.done\",\n \"event_id\": \"event_CCXLgMZPo3qioWCeQa4WH\",\n \"previous_item_id\": \"item_CCXLecNJVIVR2HUy3ABLj\",\n \"item\": {\n \"id\": \"item_CCXLfxmM5sXVJVz4mCa2S\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_audio\",\n \"transcript\": \"Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?\"\n }\n ]\n }\n}\n" - } - }, - "RealtimeServerEventConversationItemInputAudioTranscriptionCompleted": { - "type": "object", - "description": "This event is the output of audio transcription for user audio written to the\nuser audio buffer. Transcription begins when the input audio buffer is\ncommitted by the client or server (when VAD is enabled). Transcription runs\nasynchronously with Response creation, so this event may come before or after\nthe Response events.\n\nRealtime API models accept audio natively, and thus input transcription is a\nseparate process run on a separate ASR (Automatic Speech Recognition) model.\nThe transcript may diverge somewhat from the model's interpretation, and\nshould be treated as a rough guide.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.input_audio_transcription.completed" - ], - "description": "The event type, must be\n`conversation.item.input_audio_transcription.completed`.\n", - "x-stainless-const": true - }, - "item_id": { - "type": "string", - "description": "The ID of the item containing the audio that is being transcribed." - }, - "content_index": { - "type": "integer", - "description": "The index of the content part containing the audio." - }, - "transcript": { - "type": "string", - "description": "The transcribed text." - }, - "languages": { - "type": "array", - "description": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n", - "items": { - "$ref": "#/components/schemas/TranscriptionLanguage" - } - }, - "logprobs": { - "anyOf": [ + { + "title": "ResponseOutputItemWsDone", + "description": "Emitted when an output item is marked done.", + "allOf": [ { - "type": "array", - "description": "The log probabilities of the transcription.", - "items": { - "$ref": "#/components/schemas/LogProbProperties" - } + "$ref": "#/components/schemas/ResponseOutputItemDoneEvent" }, { - "type": "null" + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } ] }, - "usage": { - "type": "object", - "description": "Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing.", - "oneOf": [ + { + "title": "ResponseReasoningSummaryPartWsAdded", + "description": "Emitted when a new reasoning summary part is added.", + "allOf": [ { - "$ref": "#/components/schemas/TranscriptTextUsageTokens", - "title": "Token Usage" + "$ref": "#/components/schemas/ResponseReasoningSummaryPartAddedEvent" }, { - "$ref": "#/components/schemas/TranscriptTextUsageDuration", - "title": "Duration Usage" + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } ] - } - }, - "required": [ - "event_id", - "type", - "item_id", - "content_index", - "transcript", - "usage" - ], - "x-oaiMeta": { - "name": "conversation.item.input_audio_transcription.completed", - "group": "realtime", - "example": "{\n \"type\": \"conversation.item.input_audio_transcription.completed\",\n \"event_id\": \"event_CCXGRvtUVrax5SJAnNOWZ\",\n \"item_id\": \"item_CCXGQ4e1ht4cOraEYcuR2\",\n \"content_index\": 0,\n \"transcript\": \"Hey, can you hear me?\",\n \"usage\": {\n \"type\": \"tokens\",\n \"total_tokens\": 22,\n \"input_tokens\": 13,\n \"input_token_details\": {\n \"text_tokens\": 0,\n \"audio_tokens\": 13\n },\n \"output_tokens\": 9\n }\n}\n" - } - }, - "RealtimeServerEventConversationItemInputAudioTranscriptionDelta": { - "type": "object", - "description": "Returned when the text value of an input audio transcription content part is updated with incremental transcription results.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.input_audio_transcription.delta" - ], - "description": "The event type, must be `conversation.item.input_audio_transcription.delta`.", - "x-stainless-const": true - }, - "item_id": { - "type": "string", - "description": "The ID of the item containing the audio that is being transcribed." - }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." - }, - "delta": { - "type": "string", - "description": "The text delta." }, - "logprobs": { - "anyOf": [ + { + "title": "ResponseReasoningSummaryPartWsDone", + "description": "Emitted when a reasoning summary part is completed.", + "allOf": [ { - "type": "array", - "description": "The log probabilities of the transcription. These can be enabled by configurating the session with `\"include\": [\"item.input_audio_transcription.logprobs\"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription.", - "items": { - "$ref": "#/components/schemas/LogProbProperties" - } + "$ref": "#/components/schemas/ResponseReasoningSummaryPartDoneEvent" }, { - "type": "null" + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } ] - } - }, - "required": [ - "event_id", - "type", - "item_id" - ], - "x-oaiMeta": { - "name": "conversation.item.input_audio_transcription.delta", - "group": "realtime", - "example": "{\n \"type\": \"conversation.item.input_audio_transcription.delta\",\n \"event_id\": \"event_CCXGRxsAimPAs8kS2Wc7Z\",\n \"item_id\": \"item_CCXGQ4e1ht4cOraEYcuR2\",\n \"content_index\": 0,\n \"delta\": \"Hey\",\n \"obfuscation\": \"aLxx0jTEciOGe\"\n}\n" - } - }, - "RealtimeServerEventConversationItemInputAudioTranscriptionFailed": { - "type": "object", - "description": "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.input_audio_transcription.failed" - ], - "description": "The event type, must be\n`conversation.item.input_audio_transcription.failed`.\n", - "x-stainless-const": true - }, - "item_id": { - "type": "string", - "description": "The ID of the user message item." - }, - "content_index": { - "type": "integer", - "description": "The index of the content part containing the audio." }, - "error": { - "type": "object", - "description": "Details of the transcription error.", - "properties": { - "type": { - "type": "string", - "description": "The type of error." - }, - "code": { - "type": "string", - "description": "Error code, if any." - }, - "message": { - "type": "string", - "description": "A human-readable error message." + { + "title": "ResponseReasoningSummaryTextWsDelta", + "description": "Emitted when a delta is added to a reasoning summary text.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseReasoningSummaryTextDeltaEvent" }, - "param": { - "type": "string", - "description": "Parameter related to the error, if any." + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } - } - } - }, - "required": [ - "event_id", - "type", - "item_id", - "content_index", - "error" - ], - "x-oaiMeta": { - "name": "conversation.item.input_audio_transcription.failed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_2324\",\n \"type\": \"conversation.item.input_audio_transcription.failed\",\n \"item_id\": \"msg_003\",\n \"content_index\": 0,\n \"error\": {\n \"type\": \"transcription_error\",\n \"code\": \"audio_unintelligible\",\n \"message\": \"The audio could not be transcribed.\",\n \"param\": null\n }\n}\n" - } - }, - "RealtimeServerEventConversationItemInputAudioTranscriptionSegment": { - "type": "object", - "description": "Returned when an input audio transcription segment is identified for an item.", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.input_audio_transcription.segment" - ], - "description": "The event type, must be `conversation.item.input_audio_transcription.segment`.", - "x-stainless-const": true - }, - "item_id": { - "type": "string", - "description": "The ID of the item containing the input audio content." - }, - "content_index": { - "type": "integer", - "description": "The index of the input audio content part within the item." - }, - "text": { - "type": "string", - "description": "The text for this segment." - }, - "id": { - "type": "string", - "description": "The segment identifier." - }, - "speaker": { - "type": "string", - "description": "The detected speaker label for this segment." - }, - "start": { - "type": "number", - "format": "double", - "description": "Start time of the segment in seconds." - }, - "end": { - "type": "number", - "format": "double", - "description": "End time of the segment in seconds." - } - }, - "required": [ - "event_id", - "type", - "item_id", - "content_index", - "text", - "id", - "speaker", - "start", - "end" - ], - "x-oaiMeta": { - "name": "conversation.item.input_audio_transcription.segment", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6501\",\n \"type\": \"conversation.item.input_audio_transcription.segment\",\n \"item_id\": \"msg_011\",\n \"content_index\": 0,\n \"text\": \"hello\",\n \"id\": \"seg_0001\",\n \"speaker\": \"spk_1\",\n \"start\": 0.0,\n \"end\": 0.4\n}\n" - } - }, - "RealtimeServerEventConversationItemRetrieved": { - "type": "object", - "description": "Returned when a conversation item is retrieved with `conversation.item.retrieve`. This is provided as a way to fetch the server's representation of an item, for example to get access to the post-processed audio data after noise cancellation and VAD. It includes the full content of the Item, including audio data.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.retrieved" - ], - "description": "The event type, must be `conversation.item.retrieved`.", - "x-stainless-const": true - }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" - } - }, - "required": [ - "event_id", - "type", - "item" - ], - "x-oaiMeta": { - "name": "conversation.item.retrieved", - "group": "realtime", - "example": "{\n \"type\": \"conversation.item.retrieved\",\n \"event_id\": \"event_CCXGSizgEppa2d4XbKA7K\",\n \"item\": {\n \"id\": \"item_CCXGRxbY0n6WE4EszhF5w\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"audio\",\n \"transcript\": \"Yes, I can hear you loud and clear. How can I help you today?\",\n \"audio\": \"8//2//v/9//q/+//+P/s...\",\n \"format\": \"pcm16\"\n }\n ]\n }\n}\n" - } - }, - "RealtimeServerEventConversationItemTruncated": { - "type": "object", - "description": "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "conversation.item.truncated" - ], - "description": "The event type, must be `conversation.item.truncated`.", - "x-stainless-const": true - }, - "item_id": { - "type": "string", - "description": "The ID of the assistant message item that was truncated." - }, - "content_index": { - "type": "integer", - "description": "The index of the content part that was truncated." - }, - "audio_end_ms": { - "type": "integer", - "description": "The duration up to which the audio was truncated, in milliseconds.\n" - } - }, - "required": [ - "event_id", - "type", - "item_id", - "content_index", - "audio_end_ms" - ], - "x-oaiMeta": { - "name": "conversation.item.truncated", - "group": "realtime", - "example": "{\n \"event_id\": \"event_2526\",\n \"type\": \"conversation.item.truncated\",\n \"item_id\": \"msg_004\",\n \"content_index\": 0,\n \"audio_end_ms\": 1500\n}\n" - } - }, - "RealtimeServerEventError": { - "type": "object", - "description": "Returned when an error occurs, which could be a client problem or a server\nproblem. Most errors are recoverable and the session will stay open, we\nrecommend to implementors to monitor and log error messages by default.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + ] }, - "type": { - "type": "string", - "enum": [ - "error" - ], - "description": "The event type, must be `error`.", - "x-stainless-const": true + { + "title": "ResponseReasoningSummaryTextWsDone", + "description": "Emitted when a reasoning summary text is completed.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseReasoningSummaryTextDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "error": { - "type": "object", - "description": "Details of the error.", - "required": [ - "type", - "message" - ], - "properties": { - "type": { - "type": "string", - "description": "The type of error (e.g., \"invalid_request_error\", \"server_error\").\n" + { + "title": "ResponseReasoningTextWsDelta", + "description": "Emitted when a delta is added to a reasoning text.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseReasoningTextDeltaEvent" }, - "code": { - "anyOf": [ - { + { + "type": "object", + "properties": { + "stream_id": { "type": "string", - "description": "Error code, if any." - }, - { - "type": "null" + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" } - ] - }, - "message": { - "type": "string", - "description": "A human-readable error message." + } + } + ] + }, + { + "title": "ResponseReasoningTextWsDone", + "description": "Emitted when a reasoning text is completed.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseReasoningTextDoneEvent" }, - "param": { - "anyOf": [ - { + { + "type": "object", + "properties": { + "stream_id": { "type": "string", - "description": "Parameter related to the error, if any." - }, - { - "type": "null" + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" } - ] + } + } + ] + }, + { + "title": "ResponseRefusalWsDelta", + "description": "Emitted when there is a partial refusal text.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseRefusalDeltaEvent" }, - "event_id": { - "anyOf": [ - { + { + "type": "object", + "properties": { + "stream_id": { "type": "string", - "description": "The event_id of the client event that caused the error, if applicable.\n" - }, - { - "type": "null" + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" } - ] + } } - } - } - }, - "required": [ - "event_id", - "type", - "error" - ], - "x-oaiMeta": { - "name": "error", - "group": "realtime", - "example": "{\n \"event_id\": \"event_890\",\n \"type\": \"error\",\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"code\": \"invalid_event\",\n \"message\": \"The 'type' field is missing.\",\n \"param\": null,\n \"event_id\": \"event_567\"\n }\n}\n" - } - }, - "RealtimeServerEventInputAudioBufferCleared": { - "type": "object", - "description": "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "input_audio_buffer.cleared" - ], - "description": "The event type, must be `input_audio_buffer.cleared`.", - "x-stainless-const": true - } - }, - "required": [ - "event_id", - "type" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.cleared", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1314\",\n \"type\": \"input_audio_buffer.cleared\"\n}\n" - } - }, - "RealtimeServerEventInputAudioBufferCommitted": { - "type": "object", - "description": "Returned when an input audio buffer is committed, either by the client or\nautomatically in server VAD mode. The `item_id` property is the ID of the user\nmessage item that will be created, thus a `conversation.item.created` event\nwill also be sent to the client.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "input_audio_buffer.committed" - ], - "description": "The event type, must be `input_audio_buffer.committed`.", - "x-stainless-const": true + ] }, - "previous_item_id": { - "anyOf": [ + { + "title": "ResponseRefusalWsDone", + "description": "Emitted when refusal text is finalized.", + "allOf": [ { - "type": "string", - "description": "The ID of the preceding item after which the new item will be inserted.\nCan be `null` if the item has no predecessor.\n" + "$ref": "#/components/schemas/ResponseRefusalDoneEvent" }, { - "type": "null" + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } } ] }, - "item_id": { - "type": "string", - "description": "The ID of the user message item that will be created." - } - }, - "required": [ - "event_id", - "type", - "item_id" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.committed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1121\",\n \"type\": \"input_audio_buffer.committed\",\n \"previous_item_id\": \"msg_001\",\n \"item_id\": \"msg_002\"\n}\n" - } - }, - "RealtimeServerEventInputAudioBufferDtmfEventReceived": { - "type": "object", - "description": "**SIP Only:** Returned when an DTMF event is received. A DTMF event is a message that\nrepresents a telephone keypad press (0–9, *, #, A–D). The `event` property\nis the keypad that the user press. The `received_at` is the UTC Unix Timestamp\nthat the server received the event.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "input_audio_buffer.dtmf_event_received" - ], - "description": "The event type, must be `input_audio_buffer.dtmf_event_received`.", - "x-stainless-const": true + { + "title": "ResponseTextWsDelta", + "description": "Emitted when there is an additional text delta.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseTextDeltaEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "event": { - "type": "string", - "description": "The telephone keypad that was pressed by the user." + { + "title": "ResponseTextWsDone", + "description": "Emitted when text content is finalized.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseTextDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "received_at": { - "type": "integer", - "description": "UTC Unix Timestamp when DTMF Event was received by server.\n" - } - }, - "required": [ - "type", - "event", - "received_at" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.dtmf_event_received", - "group": "realtime", - "example": "{\n \"type\":\" input_audio_buffer.dtmf_event_received\",\n \"event\": \"9\",\n \"received_at\": 1763605109,\n}\n" - } - }, - "RealtimeServerEventInputAudioBufferSpeechStarted": { - "type": "object", - "description": "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "title": "ResponseWebSearchCallWsCompleted", + "description": "Emitted when a web search call is completed.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseWebSearchCallCompletedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "type": { - "type": "string", - "enum": [ - "input_audio_buffer.speech_started" - ], - "description": "The event type, must be `input_audio_buffer.speech_started`.", - "x-stainless-const": true + { + "title": "ResponseWebSearchCallInWsProgress", + "description": "Emitted when a web search call is initiated.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseWebSearchCallInProgressEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "audio_start_ms": { - "type": "integer", - "description": "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n" + { + "title": "ResponseWebSearchCallWsSearching", + "description": "Emitted when a web search call is executing.", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseWebSearchCallSearchingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "item_id": { - "type": "string", - "description": "The ID of the user message item that will be created when speech stops.\n" - } - }, - "required": [ - "event_id", - "type", - "audio_start_ms", - "item_id" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.speech_started", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1516\",\n \"type\": \"input_audio_buffer.speech_started\",\n \"audio_start_ms\": 1000,\n \"item_id\": \"msg_003\"\n}\n" - } - }, - "RealtimeServerEventInputAudioBufferSpeechStopped": { - "type": "object", - "description": "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "title": "ResponseImageGenCallWsCompleted", + "description": "Emitted when an image generation tool call has completed and the final image is available.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseImageGenCallCompletedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "type": { - "type": "string", - "enum": [ - "input_audio_buffer.speech_stopped" - ], - "description": "The event type, must be `input_audio_buffer.speech_stopped`.", - "x-stainless-const": true + { + "title": "ResponseImageGenCallWsGenerating", + "description": "Emitted when an image generation tool call is actively generating an image (intermediate state).\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseImageGenCallGeneratingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "audio_end_ms": { - "type": "integer", - "description": "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n" + { + "title": "ResponseImageGenCallInWsProgress", + "description": "Emitted when an image generation tool call is in progress.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseImageGenCallInProgressEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "item_id": { - "type": "string", - "description": "The ID of the user message item that will be created." - } - }, - "required": [ - "event_id", - "type", - "audio_end_ms", - "item_id" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.speech_stopped", - "group": "realtime", - "example": "{\n \"event_id\": \"event_1718\",\n \"type\": \"input_audio_buffer.speech_stopped\",\n \"audio_end_ms\": 2000,\n \"item_id\": \"msg_003\"\n}\n" - } - }, - "RealtimeServerEventInputAudioBufferTimeoutTriggered": { - "type": "object", - "description": "Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured\nwith `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that\nthere hasn't been any speech detected for the configured duration.\n\nThe `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last\nmodel response up to the triggering time, as an offset from the beginning of audio written\nto the input audio buffer. This means it demarcates the segment of audio that was silent and\nthe difference between the start and end values will roughly match the configured timeout.\n\nThe empty audio will be committed to the conversation as an `input_audio` item (there will be a\n`input_audio_buffer.committed` event) and a model response will be generated. There may be speech\nthat didn't trigger VAD but is still detected by the model, so the model may respond with\nsomething relevant to the conversation or a prompt to continue speaking.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "title": "ResponseImageGenCallPartialWsImage", + "description": "Emitted when a partial image is available during image generation streaming.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseImageGenCallPartialImageEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "type": { - "type": "string", - "enum": [ - "input_audio_buffer.timeout_triggered" - ], - "description": "The event type, must be `input_audio_buffer.timeout_triggered`.", - "x-stainless-const": true + { + "title": "ResponseMcpCallArgumentsWsDelta", + "description": "Emitted when there is a delta (partial update) to the arguments of an MCP tool call.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMCPCallArgumentsDeltaEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "audio_start_ms": { - "type": "integer", - "description": "Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response." + { + "title": "ResponseMcpCallArgumentsWsDone", + "description": "Emitted when the arguments for an MCP tool call are finalized.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMCPCallArgumentsDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "audio_end_ms": { - "type": "integer", - "description": "Millisecond offset of audio written to the input audio buffer at the time the timeout was triggered." + { + "title": "ResponseMcpCallWsCompleted", + "description": "Emitted when an MCP tool call has completed successfully.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMCPCallCompletedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "item_id": { - "type": "string", - "description": "The ID of the item associated with this segment." - } - }, - "required": [ - "event_id", - "type", - "audio_start_ms", - "audio_end_ms", - "item_id" - ], - "x-oaiMeta": { - "name": "input_audio_buffer.timeout_triggered", - "group": "realtime", - "example": "{\n \"type\":\"input_audio_buffer.timeout_triggered\",\n \"event_id\":\"event_CEKKrf1KTGvemCPyiJTJ2\",\n \"audio_start_ms\":13216,\n \"audio_end_ms\":19232,\n \"item_id\":\"item_CEKKrWH0GiwN0ET97NUZc\"\n}\n" - } - }, - "RealtimeServerEventMCPListToolsCompleted": { - "type": "object", - "description": "Returned when listing MCP tools has completed for an item.", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "title": "ResponseMcpCallWsFailed", + "description": "Emitted when an MCP tool call has failed.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMCPCallFailedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "type": { - "type": "string", - "enum": [ - "mcp_list_tools.completed" - ], - "description": "The event type, must be `mcp_list_tools.completed`.", - "x-stainless-const": true + { + "title": "ResponseMcpCallInWsProgress", + "description": "Emitted when an MCP tool call is in progress.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMCPCallInProgressEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "item_id": { - "type": "string", - "description": "The ID of the MCP list tools item." - } - }, - "required": [ - "event_id", - "type", - "item_id" - ], - "x-oaiMeta": { - "name": "mcp_list_tools.completed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6102\",\n \"type\": \"mcp_list_tools.completed\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" - } - }, - "RealtimeServerEventMCPListToolsFailed": { - "type": "object", - "description": "Returned when listing MCP tools has failed for an item.", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "title": "ResponseMcpListToolsWsCompleted", + "description": "Emitted when the list of available MCP tools has been successfully retrieved.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMCPListToolsCompletedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "type": { - "type": "string", - "enum": [ - "mcp_list_tools.failed" - ], - "description": "The event type, must be `mcp_list_tools.failed`.", - "x-stainless-const": true + { + "title": "ResponseMcpListToolsWsFailed", + "description": "Emitted when the attempt to list available MCP tools has failed.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMCPListToolsFailedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "item_id": { - "type": "string", - "description": "The ID of the MCP list tools item." - } - }, - "required": [ - "event_id", - "type", - "item_id" - ], - "x-oaiMeta": { - "name": "mcp_list_tools.failed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6103\",\n \"type\": \"mcp_list_tools.failed\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" - } - }, - "RealtimeServerEventMCPListToolsInProgress": { - "type": "object", - "description": "Returned when listing MCP tools is in progress for an item.", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "title": "ResponseMcpListToolsInWsProgress", + "description": "Emitted when the system is in the process of retrieving the list of available MCP tools.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMCPListToolsInProgressEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "type": { - "type": "string", - "enum": [ - "mcp_list_tools.in_progress" - ], - "description": "The event type, must be `mcp_list_tools.in_progress`.", - "x-stainless-const": true + { + "title": "ResponseOutputTextAnnotationWsAdded", + "description": "Emitted when an annotation is added to output text content.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseOutputTextAnnotationAddedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "item_id": { - "type": "string", - "description": "The ID of the MCP list tools item." - } - }, - "required": [ - "event_id", - "type", - "item_id" - ], - "x-oaiMeta": { - "name": "mcp_list_tools.in_progress", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6101\",\n \"type\": \"mcp_list_tools.in_progress\",\n \"item_id\": \"mcp_list_tools_001\"\n}\n" - } - }, - "RealtimeServerEventOutputAudioBufferCleared": { - "type": "object", - "description": "**WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. This happens either in VAD\nmode when the user has interrupted (`input_audio_buffer.speech_started`),\nor when the client has emitted the `output_audio_buffer.clear` event to manually\ncut off the current audio response.\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "title": "ResponseWsQueued", + "description": "Emitted when a response is queued and waiting to be processed.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseQueuedEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "type": { - "type": "string", - "enum": [ - "output_audio_buffer.cleared" - ], - "description": "The event type, must be `output_audio_buffer.cleared`.", - "x-stainless-const": true + { + "title": "ResponseCustomToolCallInputWsDelta", + "description": "Event representing a delta (partial update) to the input of a custom tool call.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCustomToolCallInputDeltaEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "response_id": { - "type": "string", - "description": "The unique ID of the response that produced the audio." - } - }, - "required": [ - "event_id", - "type", - "response_id" - ], - "x-oaiMeta": { - "name": "output_audio_buffer.cleared", - "group": "realtime", - "example": "{\n \"event_id\": \"event_abc123\",\n \"type\": \"output_audio_buffer.cleared\",\n \"response_id\": \"resp_abc123\"\n}\n" - } - }, - "RealtimeServerEventOutputAudioBufferStarted": { - "type": "object", - "description": "**WebRTC/SIP Only:** Emitted when the server begins streaming audio to the client. This event is\nemitted after an audio content part has been added (`response.content_part.added`)\nto the response.\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "title": "ResponseCustomToolCallInputWsDone", + "description": "Event indicating that input for a custom tool call is complete.\n", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseCustomToolCallInputDoneEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] }, - "type": { - "type": "string", - "enum": [ - "output_audio_buffer.started" - ], - "description": "The event type, must be `output_audio_buffer.started`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseWsError" }, - "response_id": { - "type": "string", - "description": "The unique ID of the response that produced the audio." - } - }, - "required": [ - "event_id", - "type", - "response_id" - ], - "x-oaiMeta": { - "name": "output_audio_buffer.started", - "group": "realtime", - "example": "{\n \"event_id\": \"event_abc123\",\n \"type\": \"output_audio_buffer.started\",\n \"response_id\": \"resp_abc123\"\n}\n" - } - }, - "RealtimeServerEventOutputAudioBufferStopped": { - "type": "object", - "description": "**WebRTC/SIP Only:** Emitted when the output audio buffer has been completely drained on the server,\nand no more audio is forthcoming. This event is emitted after the full response\ndata has been sent to the client (`response.done`).\n[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "$ref": "#/components/schemas/ResponseSteerAcceptedEvent" }, - "type": { - "type": "string", - "enum": [ - "output_audio_buffer.stopped" - ], - "description": "The event type, must be `output_audio_buffer.stopped`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ResponseSteerPendingEvent" }, - "response_id": { - "type": "string", - "description": "The unique ID of the response that produced the audio." + { + "$ref": "#/components/schemas/ResponseSteerFailedEvent" } - }, - "required": [ - "event_id", - "type", - "response_id" - ], - "x-oaiMeta": { - "name": "output_audio_buffer.stopped", - "group": "realtime", - "example": "{\n \"event_id\": \"event_abc123\",\n \"type\": \"output_audio_buffer.stopped\",\n \"response_id\": \"resp_abc123\"\n}\n" - } + ] }, - "RealtimeServerEventRateLimitsUpdated": { - "type": "object", - "description": "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "rate_limits.updated" - ], - "description": "The event type, must be `rate_limits.updated`.", - "x-stainless-const": true + "ResponsesWebSocketStreamEvent": { + "allOf": [ + { + "anyOf": [ + { + "$ref": "#/components/schemas/ResponseAudioDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseAudioDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseAudioTranscriptDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseAudioTranscriptDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent" + }, + { + "$ref": "#/components/schemas/ResponseCompactionCompactingStreamingEvent" + }, + { + "$ref": "#/components/schemas/ResponseCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseContentPartAddedEvent" + }, + { + "$ref": "#/components/schemas/ResponseContentPartDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseCreatedEvent" + }, + { + "$ref": "#/components/schemas/ResponseFileSearchCallCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseFileSearchCallInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseFileSearchCallSearchingEvent" + }, + { + "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseShellCallCommandAddedStreamingEvent" + }, + { + "$ref": "#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent" + }, + { + "$ref": "#/components/schemas/ResponseShellCallCommandDoneStreamingEvent" + }, + { + "$ref": "#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent", + "x-stainless-skip": [ + "go" + ] + }, + { + "$ref": "#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent" + }, + { + "$ref": "#/components/schemas/ResponseInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseFailedEvent" + }, + { + "$ref": "#/components/schemas/ResponseIncompleteEvent" + }, + { + "$ref": "#/components/schemas/ResponseOutputItemAddedEvent" + }, + { + "$ref": "#/components/schemas/ResponseOutputItemDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseReasoningSummaryPartAddedEvent" + }, + { + "$ref": "#/components/schemas/ResponseReasoningSummaryPartDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseReasoningSummaryTextDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseReasoningSummaryTextDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseReasoningTextDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseReasoningTextDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseRefusalDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseRefusalDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseTextDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseTextDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseWebSearchCallCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseWebSearchCallInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseWebSearchCallSearchingEvent" + }, + { + "$ref": "#/components/schemas/ResponseImageGenCallCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseImageGenCallGeneratingEvent" + }, + { + "$ref": "#/components/schemas/ResponseImageGenCallInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseImageGenCallPartialImageEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPCallArgumentsDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPCallArgumentsDoneEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPCallCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPCallFailedEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPCallInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPListToolsCompletedEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPListToolsFailedEvent" + }, + { + "$ref": "#/components/schemas/ResponseMCPListToolsInProgressEvent" + }, + { + "$ref": "#/components/schemas/ResponseOutputTextAnnotationAddedEvent" + }, + { + "$ref": "#/components/schemas/ResponseQueuedEvent" + }, + { + "$ref": "#/components/schemas/ResponseCustomToolCallInputDeltaEvent" + }, + { + "$ref": "#/components/schemas/ResponseCustomToolCallInputDoneEvent" + } + ] }, - "rate_limits": { - "type": "array", - "description": "List of rate limit information.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "requests", - "tokens" - ], - "description": "The name of the rate limit (`requests`, `tokens`).\n" - }, - "limit": { - "type": "integer", - "description": "The maximum allowed value for the rate limit." - }, - "remaining": { - "type": "integer", - "description": "The remaining value before the limit is reached." - }, - "reset_seconds": { - "type": "number", - "description": "Seconds until the rate limit resets." - } + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" } } } - }, - "required": [ - "event_id", - "type", - "rate_limits" - ], - "x-oaiMeta": { - "name": "rate_limits.updated", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5758\",\n \"type\": \"rate_limits.updated\",\n \"rate_limits\": [\n {\n \"name\": \"requests\",\n \"limit\": 1000,\n \"remaining\": 999,\n \"reset_seconds\": 60\n },\n {\n \"name\": \"tokens\",\n \"limit\": 50000,\n \"remaining\": 49950,\n \"reset_seconds\": 60\n }\n ]\n}\n" - } + ] }, - "RealtimeServerEventResponseAudioDelta": { + "Role": { "type": "object", - "description": "Returned when the model-generated audio is updated.", + "description": "Details about a role that can be assigned through the public Roles API.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { + "object": { "type": "string", "enum": [ - "response.output_audio.delta" + "role" ], - "description": "The event type, must be `response.output_audio.delta`.", + "description": "Always `role`.", "x-stainless-const": true }, - "response_id": { + "id": { "type": "string", - "description": "The ID of the response." + "description": "Identifier for the role." }, - "item_id": { + "name": { "type": "string", - "description": "The ID of the item." + "description": "Unique name for the role." }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "description": { + "description": "Optional description of the role.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." + "permissions": { + "type": "array", + "description": "Permissions granted by the role.", + "items": { + "type": "string" + } }, - "delta": { + "resource_type": { "type": "string", - "description": "Base64-encoded audio data delta." + "description": "Resource type the role is bound to (for example `api.organization` or `api.project`)." + }, + "predefined_role": { + "type": "boolean", + "description": "Whether the role is predefined and managed by OpenAI." } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "content_index", - "delta" + "object", + "id", + "name", + "description", + "permissions", + "resource_type", + "predefined_role" ], "x-oaiMeta": { - "name": "response.output_audio.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4950\",\n \"type\": \"response.output_audio.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Base64EncodedAudioDelta\"\n}\n" + "name": "The role object", + "example": "{\n \"object\": \"role\",\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"description\": \"Allows managing organization groups\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false\n}\n" } }, - "RealtimeServerEventResponseAudioDone": { + "RoleDeletedResource": { "type": "object", - "description": "Returned when the model-generated audio is done. Also emitted when a Response\nis interrupted, incomplete, or cancelled.\n", + "description": "Confirmation payload returned after deleting a role.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { + "object": { "type": "string", "enum": [ - "response.output_audio.done" + "role.deleted" ], - "description": "The event type, must be `response.output_audio.done`.", + "description": "Always `role.deleted`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { + "id": { "type": "string", - "description": "The ID of the item." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "description": "Identifier of the deleted role." }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." + "deleted": { + "type": "boolean", + "description": "Whether the role was deleted." } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "content_index" + "object", + "id", + "deleted" ], "x-oaiMeta": { - "name": "response.output_audio.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5152\",\n \"type\": \"response.output_audio.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0\n}\n" + "name": "Role deletion confirmation", + "example": "{\n \"object\": \"role.deleted\",\n \"id\": \"role_01J1F8ROLE01\",\n \"deleted\": true\n}\n" } }, - "RealtimeServerEventResponseAudioTranscriptDelta": { + "RoleListResource": { "type": "object", - "description": "Returned when the model-generated transcription of audio output is updated.\n", + "description": "Paginated list of roles assigned to a principal.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { + "object": { "type": "string", "enum": [ - "response.output_audio_transcript.delta" + "list" ], - "description": "The event type, must be `response.output_audio_transcript.delta`.", + "description": "Always `list`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the item." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "data": { + "type": "array", + "description": "Role assignments returned in the current page.", + "items": { + "$ref": "#/components/schemas/AssignedRoleDetails" + } }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." + "has_more": { + "type": "boolean", + "description": "Whether additional assignments are available when paginating." }, - "delta": { - "type": "string", - "description": "The transcript delta." + "next": { + "description": "Cursor to fetch the next page of results, or `null` when there are no more assignments.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "content_index", - "delta" + "object", + "data", + "has_more", + "next" ], "x-oaiMeta": { - "name": "response.output_audio_transcript.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4546\",\n \"type\": \"response.output_audio_transcript.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Hello, how can I a\"\n}\n" + "name": "Assigned role list", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false,\n \"description\": \"Allows managing organization groups\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {},\n \"assignment_sources\": null\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" } }, - "RealtimeServerEventResponseAudioTranscriptDone": { + "RunCompletionUsage": { + "anyOf": [ + { + "type": "object", + "description": "Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).", + "properties": { + "completion_tokens": { + "type": "integer", + "description": "Number of completion tokens used over the course of the run." + }, + "prompt_tokens": { + "type": "integer", + "description": "Number of prompt tokens used over the course of the run." + }, + "total_tokens": { + "type": "integer", + "description": "Total number of tokens used (prompt + completion)." + } + }, + "required": [ + "prompt_tokens", + "completion_tokens", + "total_tokens" + ] + }, + { + "type": "null" + } + ] + }, + "RunGraderRequest": { "type": "object", - "description": "Returned when the model-generated transcription of audio output is done\nstreaming. Also emitted when a Response is interrupted, incomplete, or\ncancelled.\n", + "title": "RunGraderRequest", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "response.output_audio_transcript.done" - ], - "description": "The event type, must be `response.output_audio_transcript.done`.", - "x-stainless-const": true - }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the item." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "grader": { + "type": "object", + "description": "The grader used for the fine-tuning job.", + "oneOf": [ + { + "$ref": "#/components/schemas/GraderStringCheck" + }, + { + "$ref": "#/components/schemas/GraderTextSimilarity" + }, + { + "$ref": "#/components/schemas/GraderPython" + }, + { + "$ref": "#/components/schemas/GraderScoreModel" + }, + { + "$ref": "#/components/schemas/GraderMulti" + } + ] }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." + "item": { + "type": "object", + "description": "The dataset item provided to the grader. This will be used to populate\nthe `item` namespace. See [the guide](https://developers.openai.com/api/docs/guides/graders) for more details.\n" }, - "transcript": { + "model_sample": { "type": "string", - "description": "The final transcript of the audio." + "description": "The model sample to be evaluated. This value will be used to populate\nthe `sample` namespace. See [the guide](https://developers.openai.com/api/docs/guides/graders) for more details.\nThe `output_json` variable will be populated if the model sample is a\nvalid JSON string.\n" } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "content_index", - "transcript" - ], - "x-oaiMeta": { - "name": "response.output_audio_transcript.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4748\",\n \"type\": \"response.output_audio_transcript.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_008\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"transcript\": \"Hello, how can I assist you today?\"\n}\n" - } + "grader", + "model_sample" + ] }, - "RealtimeServerEventResponseContentPartAdded": { + "RunGraderResponse": { "type": "object", - "description": "Returned when a new content part is added to an assistant message item during\nresponse generation.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, - "type": { - "type": "string", - "enum": [ - "response.content_part.added" - ], - "description": "The event type, must be `response.content_part.added`.", - "x-stainless-const": true - }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the item to which the content part was added." + "reward": { + "type": "number" }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "metadata": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "errors": { + "type": "object", + "properties": { + "formula_parse_error": { + "type": "boolean" + }, + "sample_parse_error": { + "type": "boolean" + }, + "truncated_observation_error": { + "type": "boolean" + }, + "unresponsive_reward_error": { + "type": "boolean" + }, + "invalid_variable_error": { + "type": "boolean" + }, + "other_error": { + "type": "boolean" + }, + "python_grader_server_error": { + "type": "boolean" + }, + "python_grader_server_error_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "python_grader_runtime_error": { + "type": "boolean" + }, + "python_grader_runtime_error_details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "model_grader_server_error": { + "type": "boolean" + }, + "model_grader_refusal_error": { + "type": "boolean" + }, + "model_grader_parse_error": { + "type": "boolean" + }, + "model_grader_server_error_details": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "formula_parse_error", + "sample_parse_error", + "truncated_observation_error", + "unresponsive_reward_error", + "invalid_variable_error", + "other_error", + "python_grader_server_error", + "python_grader_server_error_type", + "python_grader_runtime_error", + "python_grader_runtime_error_details", + "model_grader_server_error", + "model_grader_refusal_error", + "model_grader_parse_error", + "model_grader_server_error_details" + ] + }, + "execution_time": { + "type": "number" + }, + "scores": { + "type": "object", + "additionalProperties": {} + }, + "token_usage": { + "anyOf": [ + { + "type": "object", + "properties": { + "prompt_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + }, + "completion_tokens": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] + }, + "cached_tokens": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "prompt_tokens", + "total_tokens" + ] + }, + { + "type": "null" + } + ] + }, + "sampled_model_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "name", + "type", + "errors", + "execution_time", + "scores", + "token_usage", + "sampled_model_name" + ] }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." + "sub_rewards": { + "type": "object", + "additionalProperties": {} }, - "part": { + "model_grader_token_usage_per_model": { "type": "object", - "description": "The content part that was added.", - "properties": { - "type": { - "type": "string", - "enum": [ - "audio", - "text" - ], - "description": "The content type (\"text\", \"audio\")." - }, - "text": { - "type": "string", - "description": "The text content (if type is \"text\")." - }, - "audio": { - "type": "string", - "description": "Base64-encoded audio data (if type is \"audio\")." - }, - "transcript": { - "type": "string", - "description": "The transcript of the audio (if type is \"audio\")." - } - } + "additionalProperties": {} } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "content_index", - "part" - ], - "x-oaiMeta": { - "name": "response.content_part.added", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3738\",\n \"type\": \"response.content_part.added\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"text\",\n \"text\": \"\"\n }\n}\n" - } + "reward", + "metadata", + "sub_rewards", + "model_grader_token_usage_per_model" + ] }, - "RealtimeServerEventResponseContentPartDone": { + "RunObject": { "type": "object", - "description": "Returned when a content part is done streaming in an assistant message item.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n", + "title": "A run on a thread", + "description": "Represents an execution run on a [thread](https://developers.openai.com/api/docs/assistants/migration).", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" }, - "type": { + "object": { + "description": "The object type, which is always `thread.run`.", "type": "string", "enum": [ - "response.content_part.done" + "thread.run" ], - "description": "The event type, must be `response.content_part.done`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." + "created_at": { + "description": "The Unix timestamp (in seconds) for when the run was created.", + "type": "integer", + "format": "unixtime" }, - "item_id": { - "type": "string", - "description": "The ID of the item." + "thread_id": { + "description": "The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) that was executed on as a part of this run.", + "type": "string" }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "assistant_id": { + "description": "The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for execution of this run.", + "type": "string" }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." + "status": { + "description": "The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.", + "type": "string", + "enum": [ + "queued", + "in_progress", + "requires_action", + "cancelling", + "cancelled", + "failed", + "completed", + "incomplete", + "expired" + ] }, - "part": { - "type": "object", - "description": "The content part that is done.", + "required_action": { + "type": [ + "object", + "null" + ], + "description": "Details on the action required to continue the run. Will be `null` if no action is required.", "properties": { "type": { + "description": "For now, this is always `submit_tool_outputs`.", "type": "string", "enum": [ - "audio", - "text" + "submit_tool_outputs" ], - "description": "The content type (\"text\", \"audio\")." - }, - "text": { - "type": "string", - "description": "The text content (if type is \"text\")." + "x-stainless-const": true }, - "audio": { + "submit_tool_outputs": { + "type": "object", + "description": "Details on the tool outputs needed for this run to continue.", + "properties": { + "tool_calls": { + "type": "array", + "description": "A list of the relevant tool calls.", + "items": { + "$ref": "#/components/schemas/RunToolCallObject" + } + } + }, + "required": [ + "tool_calls" + ] + } + }, + "required": [ + "type", + "submit_tool_outputs" + ] + }, + "last_error": { + "type": [ + "object", + "null" + ], + "description": "The last error associated with this run. Will be `null` if there are no errors.", + "properties": { + "code": { "type": "string", - "description": "Base64-encoded audio data (if type is \"audio\")." + "description": "One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.", + "enum": [ + "server_error", + "rate_limit_exceeded", + "invalid_prompt" + ] }, - "transcript": { + "message": { "type": "string", - "description": "The transcript of the audio (if type is \"audio\")." + "description": "A human-readable description of the error." } - } - } - }, - "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "content_index", - "part" - ], - "x-oaiMeta": { - "name": "response.content_part.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3940\",\n \"type\": \"response.content_part.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"text\",\n \"text\": \"Sure, I can help with that.\"\n }\n}\n" - } - }, - "RealtimeServerEventResponseCreated": { - "type": "object", - "description": "Returned when a new Response is created. The first event of response creation,\nwhere the response is in an initial state of `in_progress`.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + }, + "required": [ + "code", + "message" + ] }, - "type": { - "type": "string", - "enum": [ - "response.created" + "expires_at": { + "description": "The Unix timestamp (in seconds) for when the run will expire.", + "type": [ + "integer", + "null" ], - "description": "The event type, must be `response.created`.", - "x-stainless-const": true + "format": "unixtime" }, - "response": { - "$ref": "#/components/schemas/RealtimeResponse" - } - }, - "required": [ - "event_id", - "type", - "response" - ], - "x-oaiMeta": { - "name": "response.created", - "group": "realtime", - "example": "{\n \"type\": \"response.created\",\n \"event_id\": \"event_C9G8pqbTEddBSIxbBN6Os\",\n \"response\": {\n \"object\": \"realtime.response\",\n \"id\": \"resp_C9G8p7IH2WxLbkgPNouYL\",\n \"status\": \"in_progress\",\n \"status_details\": null,\n \"output\": [],\n \"conversation_id\": \"conv_C9G8mmBkLhQJwCon3hoJN\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"max_output_tokens\": \"inf\",\n \"audio\": {\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"marin\"\n }\n },\n \"usage\": null,\n \"metadata\": null\n },\n}\n" - } - }, - "RealtimeServerEventResponseDone": { - "type": "object", - "description": "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n\nClients should check the `status` field of the Response to determine if it was successful\n(`completed`) or if there was another outcome: `cancelled`, `failed`, or `incomplete`.\n\nA response will contain all output items that were generated during the response, excluding\nany audio content.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "started_at": { + "description": "The Unix timestamp (in seconds) for when the run was started.", + "type": [ + "integer", + "null" + ], + "format": "unixtime" }, - "type": { - "type": "string", - "enum": [ - "response.done" + "cancelled_at": { + "description": "The Unix timestamp (in seconds) for when the run was cancelled.", + "type": [ + "integer", + "null" ], - "description": "The event type, must be `response.done`.", - "x-stainless-const": true + "format": "unixtime" }, - "response": { - "$ref": "#/components/schemas/RealtimeResponse" - } - }, - "required": [ - "event_id", - "type", - "response" - ], - "x-oaiMeta": { - "name": "response.done", - "group": "realtime", - "example": "{\n \"type\": \"response.done\",\n \"event_id\": \"event_CCXHxcMy86rrKhBLDdqCh\",\n \"response\": {\n \"object\": \"realtime.response\",\n \"id\": \"resp_CCXHw0UJld10EzIUXQCNh\",\n \"status\": \"completed\",\n \"status_details\": null,\n \"output\": [\n {\n \"id\": \"item_CCXHwGjjDUfOXbiySlK7i\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_audio\",\n \"transcript\": \"Loud and clear! I can hear you perfectly. How can I help you today?\"\n }\n ]\n }\n ],\n \"conversation_id\": \"conv_CCXHsurMKcaVxIZvaCI5m\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"max_output_tokens\": \"inf\",\n \"audio\": {\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"alloy\"\n }\n },\n \"usage\": {\n \"total_tokens\": 253,\n \"input_tokens\": 132,\n \"output_tokens\": 121,\n \"input_token_details\": {\n \"text_tokens\": 119,\n \"audio_tokens\": 13,\n \"image_tokens\": 0,\n \"cached_tokens\": 64,\n \"cached_tokens_details\": {\n \"text_tokens\": 64,\n \"audio_tokens\": 0,\n \"image_tokens\": 0\n }\n },\n \"output_token_details\": {\n \"text_tokens\": 30,\n \"audio_tokens\": 91\n }\n },\n \"metadata\": null\n }\n}\n" - } - }, - "RealtimeServerEventResponseFunctionCallArgumentsDelta": { - "type": "object", - "description": "Returned when the model-generated function call arguments are updated.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "failed_at": { + "description": "The Unix timestamp (in seconds) for when the run failed.", + "type": [ + "integer", + "null" + ], + "format": "unixtime" }, - "type": { - "type": "string", - "enum": [ - "response.function_call_arguments.delta" + "completed_at": { + "description": "The Unix timestamp (in seconds) for when the run was completed.", + "type": [ + "integer", + "null" ], - "description": "The event type, must be `response.function_call_arguments.delta`.\n", - "x-stainless-const": true + "format": "unixtime" }, - "response_id": { - "type": "string", - "description": "The ID of the response." + "incomplete_details": { + "description": "Details on why the run is incomplete. Will be `null` if the run is not incomplete.", + "type": [ + "object", + "null" + ], + "properties": { + "reason": { + "description": "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.", + "type": "string", + "enum": [ + "max_completion_tokens", + "max_prompt_tokens" + ] + } + } }, - "item_id": { - "type": "string", - "description": "The ID of the function call item." + "model": { + "description": "The model that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run.", + "type": "string" }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "instructions": { + "description": "The instructions that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run.", + "type": "string" }, - "call_id": { - "type": "string", - "description": "The ID of the function call." + "tools": { + "description": "The list of tools that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run.", + "default": [], + "type": "array", + "maxItems": 20, + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AssistantToolsCode" + }, + { + "$ref": "#/components/schemas/AssistantToolsFileSearch" + }, + { + "$ref": "#/components/schemas/AssistantToolsFunction" + } + ] + } }, - "delta": { - "type": "string", - "description": "The arguments delta as a JSON string." - } - }, - "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "call_id", - "delta" - ], - "x-oaiMeta": { - "name": "response.function_call_arguments.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5354\",\n \"type\": \"response.function_call_arguments.delta\",\n \"response_id\": \"resp_002\",\n \"item_id\": \"fc_001\",\n \"output_index\": 0,\n \"call_id\": \"call_001\",\n \"delta\": \"{\\\"location\\\": \\\"San\\\"\"\n}\n" - } - }, - "RealtimeServerEventResponseFunctionCallArgumentsDone": { - "type": "object", - "description": "Returned when the model-generated function call arguments are done streaming.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "metadata": { + "$ref": "#/components/schemas/Metadata" }, - "type": { - "type": "string", - "enum": [ - "response.function_call_arguments.done" - ], - "description": "The event type, must be `response.function_call_arguments.done`.\n", - "x-stainless-const": true + "usage": { + "$ref": "#/components/schemas/RunCompletionUsage" }, - "response_id": { - "type": "string", - "description": "The ID of the response." + "temperature": { + "description": "The sampling temperature used for this run. If not set, defaults to 1.", + "type": [ + "number", + "null" + ] }, - "item_id": { - "type": "string", - "description": "The ID of the function call item." + "top_p": { + "description": "The nucleus sampling value used for this run. If not set, defaults to 1.", + "type": [ + "number", + "null" + ] }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." + "max_prompt_tokens": { + "type": [ + "integer", + "null" + ], + "description": "The maximum number of prompt tokens specified to have been used over the course of the run.\n", + "minimum": 256 }, - "call_id": { - "type": "string", - "description": "The ID of the function call." + "max_completion_tokens": { + "type": [ + "integer", + "null" + ], + "description": "The maximum number of completion tokens specified to have been used over the course of the run.\n", + "minimum": 256 }, - "name": { - "type": "string", - "description": "The name of the function that was called." + "truncation_strategy": { + "anyOf": [ + { + "$ref": "#/components/schemas/TruncationObject" + }, + { + "type": "null" + } + ] }, - "arguments": { - "type": "string", - "description": "The final arguments as a JSON string." + "tool_choice": { + "anyOf": [ + { + "$ref": "#/components/schemas/AssistantsApiToolChoiceOption" + }, + { + "type": "null" + } + ] + }, + "parallel_tool_calls": { + "$ref": "#/components/schemas/ParallelToolCalls" + }, + "response_format": { + "anyOf": [ + { + "$ref": "#/components/schemas/AssistantsApiResponseFormatOption" + }, + { + "type": "null" + } + ] } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "call_id", - "name", - "arguments" + "id", + "object", + "created_at", + "thread_id", + "assistant_id", + "status", + "required_action", + "last_error", + "expires_at", + "started_at", + "cancelled_at", + "failed_at", + "completed_at", + "model", + "instructions", + "tools", + "metadata", + "usage", + "incomplete_details", + "max_prompt_tokens", + "max_completion_tokens", + "truncation_strategy", + "tool_choice", + "parallel_tool_calls", + "response_format" ], "x-oaiMeta": { - "name": "response.function_call_arguments.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5556\",\n \"type\": \"response.function_call_arguments.done\",\n \"response_id\": \"resp_002\",\n \"item_id\": \"fc_001\",\n \"output_index\": 0,\n \"call_id\": \"call_001\",\n \"name\": \"get_weather\",\n \"arguments\": \"{\\\"location\\\": \\\"San Francisco\\\"}\"\n}\n" + "name": "The run object", + "beta": true, + "example": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1698107661,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699073476,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699073498,\n \"last_error\": null,\n \"model\": \"gpt-4.1\",\n \"instructions\": \"You are a helpful assistant.\",\n \"tools\": [{\"type\": \"file_search\"}, {\"type\": \"code_interpreter\"}],\n \"metadata\": {},\n \"incomplete_details\": null,\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\"\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true,\n \"required_action\": null\n}\n" } }, - "RealtimeServerEventResponseMCPCallArgumentsDelta": { + "RunStepCompletionUsage": { + "anyOf": [ + { + "type": "object", + "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", + "properties": { + "completion_tokens": { + "type": "integer", + "description": "Number of completion tokens used over the course of the run step." + }, + "prompt_tokens": { + "type": "integer", + "description": "Number of prompt tokens used over the course of the run step." + }, + "total_tokens": { + "type": "integer", + "description": "Total number of tokens used (prompt + completion)." + } + }, + "required": [ + "prompt_tokens", + "completion_tokens", + "total_tokens" + ] + }, + { + "type": "null" + } + ] + }, + "RunStepDeltaObject": { "type": "object", - "description": "Returned when MCP tool call arguments are updated during response generation.", + "title": "Run step delta object", + "description": "Represents a run step delta i.e. any changed fields on a run step during streaming.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "id": { + "description": "The identifier of the run step, which can be referenced in API endpoints.", + "type": "string" }, - "type": { + "object": { + "description": "The object type, which is always `thread.run.step.delta`.", "type": "string", "enum": [ - "response.mcp_call_arguments.delta" + "thread.run.step.delta" ], - "description": "The event type, must be `response.mcp_call_arguments.delta`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." - }, "delta": { - "type": "string", - "description": "The JSON-encoded arguments delta." - }, - "obfuscation": { - "anyOf": [ - { - "type": "string", - "description": "If present, indicates the delta text was obfuscated." - }, - { - "type": "null" + "description": "The delta containing the fields that have changed on the run step.", + "type": "object", + "properties": { + "step_details": { + "type": "object", + "description": "The details of the run step.", + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsMessageCreationObject" + }, + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsObject" + } + ] } - ] + } } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", + "id", + "object", "delta" ], "x-oaiMeta": { - "name": "response.mcp_call_arguments.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6201\",\n \"type\": \"response.mcp_call_arguments.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"mcp_call_001\",\n \"output_index\": 0,\n \"delta\": \"{\\\"partial\\\":true}\"\n}\n" + "name": "The run step delta object", + "beta": true, + "example": "{\n \"id\": \"step_123\",\n \"object\": \"thread.run.step.delta\",\n \"delta\": {\n \"step_details\": {\n \"type\": \"tool_calls\",\n \"tool_calls\": [\n {\n \"index\": 0,\n \"id\": \"call_123\",\n \"type\": \"code_interpreter\",\n \"code_interpreter\": { \"input\": \"\", \"outputs\": [] }\n }\n ]\n }\n }\n}\n" } }, - "RealtimeServerEventResponseMCPCallArgumentsDone": { + "RunStepDeltaStepDetailsMessageCreationObject": { + "title": "Message creation", "type": "object", - "description": "Returned when MCP tool call arguments are finalized during response generation.", + "description": "Details of the message creation by the run step.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { + "description": "Always `message_creation`.", "type": "string", "enum": [ - "response.mcp_call_arguments.done" + "message_creation" ], - "description": "The event type, must be `response.mcp_call_arguments.done`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." - }, - "arguments": { - "type": "string", - "description": "The final JSON-encoded arguments string." + "message_creation": { + "type": "object", + "properties": { + "message_id": { + "type": "string", + "description": "The ID of the message that was created by this run step." + } + } } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "arguments" - ], - "x-oaiMeta": { - "name": "response.mcp_call_arguments.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6202\",\n \"type\": \"response.mcp_call_arguments.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"mcp_call_001\",\n \"output_index\": 0,\n \"arguments\": \"{\\\"q\\\":\\\"docs\\\"}\"\n}\n" - } + "type" + ] }, - "RealtimeServerEventResponseMCPCallCompleted": { + "RunStepDeltaStepDetailsToolCallsCodeObject": { + "title": "Code interpreter tool call", "type": "object", - "description": "Returned when an MCP tool call has completed successfully.", + "description": "Details of the Code Interpreter tool call the run step was involved in.", "properties": { - "event_id": { + "index": { + "type": "integer", + "description": "The index of the tool call in the tool calls array." + }, + "id": { "type": "string", - "description": "The unique ID of the server event." + "description": "The ID of the tool call." }, "type": { "type": "string", + "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call.", "enum": [ - "response.mcp_call.completed" + "code_interpreter" ], - "description": "The event type, must be `response.mcp_call.completed`.", "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item." + "code_interpreter": { + "type": "object", + "description": "The Code Interpreter tool call definition.", + "properties": { + "input": { + "type": "string", + "description": "The input to the Code Interpreter tool call." + }, + "outputs": { + "type": "array", + "description": "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.", + "items": { + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject" + }, + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObject" + } + ] + } + } + } } }, "required": [ - "event_id", - "type", - "output_index", - "item_id" - ], - "x-oaiMeta": { - "name": "response.mcp_call.completed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6302\",\n \"type\": \"response.mcp_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" - } + "index", + "type" + ] }, - "RealtimeServerEventResponseMCPCallFailed": { + "RunStepDeltaStepDetailsToolCallsCodeOutputImageObject": { + "title": "Code interpreter image output", "type": "object", - "description": "Returned when an MCP tool call has failed.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "index": { + "type": "integer", + "description": "The index of the output in the outputs array." }, "type": { + "description": "Always `image`.", "type": "string", "enum": [ - "response.mcp_call.failed" + "image" ], - "description": "The event type, must be `response.mcp_call.failed`.", "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item." + "image": { + "type": "object", + "properties": { + "file_id": { + "description": "The [file](https://developers.openai.com/api/reference/resources/files) ID of the image.", + "type": "string" + } + } } }, "required": [ - "event_id", - "type", - "output_index", - "item_id" - ], - "x-oaiMeta": { - "name": "response.mcp_call.failed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6303\",\n \"type\": \"response.mcp_call.failed\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" - } + "index", + "type" + ] }, - "RealtimeServerEventResponseMCPCallInProgress": { + "RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject": { + "title": "Code interpreter log output", "type": "object", - "description": "Returned when an MCP tool call has started and is in progress.", + "description": "Text output from the Code Interpreter tool call as part of a run step.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "index": { + "type": "integer", + "description": "The index of the output in the outputs array." }, "type": { + "description": "Always `logs`.", "type": "string", "enum": [ - "response.mcp_call.in_progress" + "logs" ], - "description": "The event type, must be `response.mcp_call.in_progress`.", "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." - }, - "item_id": { + "logs": { "type": "string", - "description": "The ID of the MCP tool call item." + "description": "The text output from the Code Interpreter tool call." } }, "required": [ - "event_id", - "type", - "output_index", - "item_id" - ], - "x-oaiMeta": { - "name": "response.mcp_call.in_progress", - "group": "realtime", - "example": "{\n \"event_id\": \"event_6301\",\n \"type\": \"response.mcp_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"mcp_call_001\"\n}\n" - } + "index", + "type" + ] }, - "RealtimeServerEventResponseOutputItemAdded": { + "RunStepDeltaStepDetailsToolCallsFileSearchObject": { + "title": "File search tool call", "type": "object", - "description": "Returned when a new Item is created during Response generation.", "properties": { - "event_id": { + "index": { + "type": "integer", + "description": "The index of the tool call in the tool calls array." + }, + "id": { "type": "string", - "description": "The unique ID of the server event." + "description": "The ID of the tool call object." }, "type": { "type": "string", + "description": "The type of tool call. This is always going to be `file_search` for this type of tool call.", "enum": [ - "response.output_item.added" + "file_search" ], - "description": "The event type, must be `response.output_item.added`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the Response to which the item belongs." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the Response." - }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" + "file_search": { + "type": "object", + "description": "For now, this is always going to be an empty object.", + "x-oaiTypeLabel": "map" } }, "required": [ - "event_id", + "index", "type", - "response_id", - "output_index", - "item" - ], - "x-oaiMeta": { - "name": "response.output_item.added", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3334\",\n \"type\": \"response.output_item.added\",\n \"response_id\": \"resp_001\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_007\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"in_progress\",\n \"role\": \"assistant\",\n \"content\": []\n }\n}\n" - } + "file_search" + ] }, - "RealtimeServerEventResponseOutputItemDone": { + "RunStepDeltaStepDetailsToolCallsFunctionObject": { "type": "object", - "description": "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n", + "title": "Function tool call", "properties": { - "event_id": { + "index": { + "type": "integer", + "description": "The index of the tool call in the tool calls array." + }, + "id": { "type": "string", - "description": "The unique ID of the server event." + "description": "The ID of the tool call object." }, "type": { "type": "string", + "description": "The type of tool call. This is always going to be `function` for this type of tool call.", "enum": [ - "response.output_item.done" + "function" ], - "description": "The event type, must be `response.output_item.done`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the Response to which the item belongs." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the Response." - }, - "item": { - "$ref": "#/components/schemas/RealtimeConversationItem" + "function": { + "type": "object", + "description": "The definition of the function that was called.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments passed to the function." + }, + "output": { + "anyOf": [ + { + "type": "string", + "description": "The output of the function. This will be `null` if the outputs have not been [submitted](https://developers.openai.com/api/docs/assistants/migration) yet." + }, + { + "type": "null" + } + ] + } + } } }, "required": [ - "event_id", - "type", - "response_id", - "output_index", - "item" - ], - "x-oaiMeta": { - "name": "response.output_item.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_3536\",\n \"type\": \"response.output_item.done\",\n \"response_id\": \"resp_001\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_007\",\n \"object\": \"realtime.item\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Sure, I can help with that.\"\n }\n ]\n }\n}\n" - } + "index", + "type" + ] }, - "RealtimeServerEventResponseTextDelta": { + "RunStepDeltaStepDetailsToolCallsObject": { + "title": "Tool calls", "type": "object", - "description": "Returned when the text value of an \"output_text\" content part is updated.", + "description": "Details of the tool call.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { + "description": "Always `tool_calls`.", "type": "string", "enum": [ - "response.output_text.delta" + "tool_calls" ], - "description": "The event type, must be `response.output_text.delta`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the item." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." - }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." - }, - "delta": { - "type": "string", - "description": "The text delta." + "tool_calls": { + "type": "array", + "description": "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject" + }, + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject" + }, + { + "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject" + } + ] + } } }, "required": [ - "event_id", - "type", - "response_id", - "item_id", - "output_index", - "content_index", - "delta" - ], - "x-oaiMeta": { - "name": "response.output_text.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4142\",\n \"type\": \"response.output_text.delta\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"Sure, I can h\"\n}\n" - } + "type" + ] }, - "RealtimeServerEventResponseTextDone": { + "RunStepDetailsMessageCreationObject": { + "title": "Message creation", "type": "object", - "description": "Returned when the text value of an \"output_text\" content part is done streaming. Also\nemitted when a Response is interrupted, incomplete, or cancelled.\n", + "description": "Details of the message creation by the run step.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { + "description": "Always `message_creation`.", "type": "string", "enum": [ - "response.output_text.done" + "message_creation" ], - "description": "The event type, must be `response.output_text.done`.", "x-stainless-const": true }, - "response_id": { - "type": "string", - "description": "The ID of the response." - }, - "item_id": { - "type": "string", - "description": "The ID of the item." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response." - }, - "content_index": { - "type": "integer", - "description": "The index of the content part in the item's content array." - }, - "text": { - "type": "string", - "description": "The final text content." + "message_creation": { + "type": "object", + "properties": { + "message_id": { + "type": "string", + "description": "The ID of the message that was created by this run step." + } + }, + "required": [ + "message_id" + ] } }, "required": [ - "event_id", "type", - "response_id", - "item_id", - "output_index", - "content_index", - "text" - ], - "x-oaiMeta": { - "name": "response.output_text.done", - "group": "realtime", - "example": "{\n \"event_id\": \"event_4344\",\n \"type\": \"response.output_text.done\",\n \"response_id\": \"resp_001\",\n \"item_id\": \"msg_007\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"Sure, I can help with that.\"\n}\n" - } + "message_creation" + ] }, - "RealtimeServerEventSessionCreated": { + "RunStepDetailsToolCallsCodeObject": { + "title": "Code Interpreter tool call", "type": "object", - "description": "Returned when a Session is created. Emitted automatically when a new\nconnection is established as the first server event. This event will contain\nthe default Session configuration.\n", + "description": "Details of the Code Interpreter tool call the run step was involved in.", "properties": { - "event_id": { + "id": { "type": "string", - "description": "The unique ID of the server event." + "description": "The ID of the tool call." }, "type": { "type": "string", + "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call.", "enum": [ - "session.created" + "code_interpreter" ], - "description": "The event type, must be `session.created`.", "x-stainless-const": true }, - "session": { - "description": "The session configuration.", - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeSessionCreateResponseGA" + "code_interpreter": { + "type": "object", + "description": "The Code Interpreter tool call definition.", + "required": [ + "input", + "outputs" + ], + "properties": { + "input": { + "type": "string", + "description": "The input to the Code Interpreter tool call." }, - { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA" + "outputs": { + "type": "array", + "description": "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.", + "items": { + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject" + }, + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject" + } + ] + } } - ] + } } }, "required": [ - "event_id", + "id", "type", - "session" - ], - "x-oaiMeta": { - "name": "session.created", - "group": "realtime", - "example": "{\n \"type\": \"session.created\",\n \"event_id\": \"event_C9G5RJeJ2gF77mV7f2B1j\",\n \"session\": {\n \"type\": \"realtime\",\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9G5QPteg4UIbotdKLoYQ\",\n \"model\": \"gpt-realtime-2025-08-28\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"instructions\": \"Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.\",\n \"tools\": [],\n \"tool_choice\": \"auto\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": null,\n \"prompt\": null,\n \"expires_at\": 1756324625,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": null,\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200,\n \"idle_timeout_ms\": null,\n \"create_response\": true,\n \"interrupt_response\": true\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"marin\",\n \"speed\": 1\n }\n },\n \"include\": null\n },\n}\n" - } + "code_interpreter" + ] }, - "RealtimeServerEventSessionUpdated": { + "RunStepDetailsToolCallsCodeOutputImageObject": { + "title": "Code Interpreter image output", "type": "object", - "description": "Returned when a session is updated with a `session.update` event, unless\nthere is an error.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { + "description": "Always `image`.", "type": "string", "enum": [ - "session.updated" + "image" ], - "description": "The event type, must be `session.updated`.", "x-stainless-const": true }, - "session": { - "description": "The session configuration.", - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeSessionCreateResponseGA" - }, - { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA" + "image": { + "type": "object", + "properties": { + "file_id": { + "description": "The [file](https://developers.openai.com/api/reference/resources/files) ID of the image.", + "type": "string" } + }, + "required": [ + "file_id" ] } }, "required": [ - "event_id", "type", - "session" - ], - "x-oaiMeta": { - "name": "session.updated", - "group": "realtime", - "example": "{\n \"type\": \"session.updated\",\n \"event_id\": \"event_C9G8mqI3IucaojlVKE8Cs\",\n \"session\": {\n \"type\": \"realtime\",\n \"object\": \"realtime.session\",\n \"id\": \"sess_C9G8l3zp50uFv4qgxfJ8o\",\n \"model\": \"gpt-realtime-2025-08-28\",\n \"output_modalities\": [\n \"audio\"\n ],\n \"instructions\": \"Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"display_color_palette\",\n \"description\": \"\\nCall this function when a user asks for a color palette.\\n\",\n \"parameters\": {\n \"type\": \"object\",\n \"strict\": true,\n \"properties\": {\n \"theme\": {\n \"type\": \"string\",\n \"description\": \"Description of the theme for the color scheme.\"\n },\n \"colors\": {\n \"type\": \"array\",\n \"description\": \"Array of five hex color codes based on the theme.\",\n \"items\": {\n \"type\": \"string\",\n \"description\": \"Hex color code\"\n }\n }\n },\n \"required\": [\n \"theme\",\n \"colors\"\n ]\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": null,\n \"prompt\": null,\n \"expires_at\": 1756324832,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": null,\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200,\n \"idle_timeout_ms\": null,\n \"create_response\": true,\n \"interrupt_response\": true\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"marin\",\n \"speed\": 1\n }\n },\n \"include\": null\n },\n}\n" - } + "image" + ] }, - "RealtimeServerEventTranscriptionSessionUpdated": { + "RunStepDetailsToolCallsCodeOutputLogsObject": { + "title": "Code Interpreter log output", "type": "object", - "description": "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n", + "description": "Text output from the Code Interpreter tool call as part of a run step.", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { + "description": "Always `logs`.", "type": "string", "enum": [ - "transcription_session.updated" + "logs" ], - "description": "The event type, must be `transcription_session.updated`.", "x-stainless-const": true }, - "session": { - "$ref": "#/components/schemas/RealtimeTranscriptionSessionCreateResponse" + "logs": { + "type": "string", + "description": "The text output from the Code Interpreter tool call." } }, "required": [ - "event_id", "type", - "session" - ], - "x-oaiMeta": { - "name": "transcription_session.updated", - "group": "realtime", - "example": "{\n \"event_id\": \"event_5678\",\n \"type\": \"transcription_session.updated\",\n \"session\": {\n \"id\": \"sess_001\",\n \"object\": \"realtime.transcription_session\",\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"prompt\": \"\",\n \"language\": \"\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500,\n \"create_response\": true,\n // \"interrupt_response\": false -- this will NOT be returned\n },\n \"input_audio_noise_reduction\": {\n \"type\": \"near_field\"\n },\n \"include\": [\n \"item.input_audio_transcription.avg_logprob\",\n ],\n }\n}\n" - } + "logs" + ] }, - "RealtimeSession": { + "RunStepDetailsToolCallsFileSearchObject": { + "title": "File search tool call", "type": "object", - "description": "Realtime session object for the beta interface.", "properties": { "id": { "type": "string", - "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" - }, - "object": { - "type": "string", - "enum": [ - "realtime.session" - ], - "description": "The object type. Always `realtime.session`." - }, - "modalities": { - "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", - "items": { - "type": "string", - "default": [ - "text", - "audio" - ], - "enum": [ - "text", - "audio" - ] - } - }, - "model": { - "description": "The Realtime model used for this session.\n", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-realtime", - "gpt-realtime-1.5", - "gpt-realtime-2025-08-28", - "gpt-4o-realtime-preview", - "gpt-4o-realtime-preview-2024-10-01", - "gpt-4o-realtime-preview-2024-12-17", - "gpt-4o-realtime-preview-2025-06-03", - "gpt-4o-mini-realtime-preview", - "gpt-4o-mini-realtime-preview-2024-12-17", - "gpt-realtime-mini", - "gpt-realtime-mini-2025-10-06", - "gpt-realtime-mini-2025-12-15", - "gpt-audio-1.5", - "gpt-audio-mini", - "gpt-audio-mini-2025-10-06", - "gpt-audio-mini-2025-12-15" - ] - } - ] - }, - "instructions": { - "type": "string", - "description": "The default system instructions (i.e. system message) prepended to model\ncalls. This field allows the client to guide the model on desired\nresponses. The model can be instructed on response content and format,\n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good\nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion\ninto your voice\", \"laugh frequently\"). The instructions are not\nguaranteed to be followed by the model, but they provide guidance to the\nmodel on the desired behavior.\n\n\nNote that the server sets default instructions which will be used if this\nfield is not set and are visible in the `session.created` event at the\nstart of the session.\n" - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsShared", - "description": "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n" - }, - "input_audio_format": { - "type": "string", - "default": "pcm16", - "enum": [ - "pcm16", - "g711_ulaw", - "g711_alaw" - ], - "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n" + "description": "The ID of the tool call object." }, - "output_audio_format": { + "type": { "type": "string", - "default": "pcm16", + "description": "The type of tool call. This is always going to be `file_search` for this type of tool call.", "enum": [ - "pcm16", - "g711_ulaw", - "g711_alaw" + "file_search" ], - "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, output audio is sampled at a rate of 24kHz.\n" - }, - "input_audio_transcription": { - "anyOf": [ - { - "allOf": [ - { - "$ref": "#/components/schemas/AudioTranscriptionResponse" - } - ], - "description": "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n" - }, - { - "type": "null" - } - ] - }, - "turn_detection": { - "$ref": "#/components/schemas/RealtimeTurnDetection" + "x-stainless-const": true }, - "input_audio_noise_reduction": { + "file_search": { "type": "object", - "default": null, - "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", + "description": "For now, this is always going to be an empty object.", + "x-oaiTypeLabel": "map", "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - } - }, - "speed": { - "type": "number", - "default": 1, - "maximum": 1.5, - "minimum": 0.25, - "description": "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n" - }, - "tracing": { - "anyOf": [ - { - "title": "Tracing Configuration", - "description": "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", - "oneOf": [ - { - "type": "string", - "default": "auto", - "description": "Default tracing mode for the session.\n", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "object", - "title": "Tracing Configuration", - "description": "Granular configuration for tracing.\n", - "properties": { - "workflow_name": { - "type": "string", - "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n" - }, - "group_id": { - "type": "string", - "description": "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n" - }, - "metadata": { - "type": "object", - "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n" - } - } - } - ] - }, - { - "type": "null" - } - ] - }, - "tools": { - "type": "array", - "description": "Tools (functions) available to the model.", - "items": { - "$ref": "#/components/schemas/RealtimeFunctionTool" - } - }, - "tool_choice": { - "type": "string", - "default": "auto", - "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n" - }, - "temperature": { - "type": "number", - "default": 0.8, - "description": "Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance.\n" - }, - "max_response_output_tokens": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "string", - "enum": [ - "inf" - ], - "x-stainless-const": true - } - ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Expiration timestamp for the session, in seconds since epoch." - }, - "prompt": { - "anyOf": [ - { - "$ref": "#/components/schemas/Prompt" + "ranking_options": { + "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject" }, - { - "type": "null" - } - ] - }, - "include": { - "anyOf": [ - { + "results": { "type": "array", + "description": "The results of the file search.", "items": { - "type": "string", - "enum": [ - "item.input_audio_transcription.logprobs" - ] - }, - "description": "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" - }, - { - "type": "null" + "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject" + } } - ] + } } - } + }, + "required": [ + "id", + "type", + "file_search" + ] }, - "RealtimeSessionCreateRequest": { + "RunStepDetailsToolCallsFileSearchRankingOptionsObject": { + "title": "File search tool call ranking options", "type": "object", - "description": "A new Realtime session configuration, with an ephemeral key. Default TTL\nfor keys is one minute.\n", + "description": "The ranking options for the file search.", "properties": { - "client_secret": { - "type": "object", - "description": "Ephemeral key returned by the API.", - "properties": { - "value": { - "type": "string", - "description": "Ephemeral key usable in client environments to authenticate connections\nto the Realtime API. Use this in client-side environments rather than\na standard API token, which should only be used server-side.\n" - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Timestamp for when the token expires. Currently, all tokens expire\nafter one minute.\n" - } - }, - "required": [ - "value", - "expires_at" - ] - }, - "modalities": { - "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] - } - }, - "instructions": { - "type": "string", - "description": "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n" - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", - "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with an\n`id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed during\nthe session once the model has responded with audio at least once.\n" + "ranker": { + "$ref": "#/components/schemas/FileSearchRanker" }, - "input_audio_format": { + "score_threshold": { + "type": "number", + "description": "The score threshold for the file search. All values must be a floating point number between 0 and 1.", + "minimum": 0, + "maximum": 1 + } + }, + "required": [ + "ranker", + "score_threshold" + ] + }, + "RunStepDetailsToolCallsFileSearchResultObject": { + "title": "File search tool call result", + "type": "object", + "description": "A result instance of the file search.", + "x-oaiTypeLabel": "map", + "properties": { + "file_id": { "type": "string", - "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" + "description": "The ID of the file that result was found in." }, - "output_audio_format": { + "file_name": { "type": "string", - "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" - }, - "input_audio_transcription": { - "type": "object", - "description": "Configuration for input audio transcription, defaults to off and can be\nset to `null` to turn off once on. Input audio transcription is not native\nto the model, since the model consumes audio directly. Transcription runs\nasynchronously and should be treated as rough guidance\nrather than the representation understood by the model.\n", - "properties": { - "model": { - "type": "string", - "description": "The model to use for transcription.\n" - } - } + "description": "The name of the file that result was found in." }, - "speed": { + "score": { "type": "number", - "default": 1, - "maximum": 1.5, - "minimum": 0.25, - "description": "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n" - }, - "tracing": { - "title": "Tracing Configuration", - "description": "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", - "oneOf": [ - { - "type": "string", - "default": "auto", - "description": "Default tracing mode for the session.\n", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "object", - "title": "Tracing Configuration", - "description": "Granular configuration for tracing.\n", - "properties": { - "workflow_name": { - "type": "string", - "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n" - }, - "group_id": { - "type": "string", - "description": "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n" - }, - "metadata": { - "type": "object", - "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n" - } - } - } - ] - }, - "turn_detection": { - "type": "object", - "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n", - "properties": { - "type": { - "type": "string", - "description": "Type of turn detection, only `server_vad` is currently supported.\n" - }, - "threshold": { - "type": "number", - "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" - }, - "prefix_padding_ms": { - "type": "integer", - "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" - }, - "silence_duration_ms": { - "type": "integer", - "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" - } - } + "description": "The score of the result. All values must be a floating point number between 0 and 1.", + "minimum": 0, + "maximum": 1 }, - "tools": { + "content": { "type": "array", - "description": "Tools (functions) available to the model.", + "description": "The content of the result that was found. The content is only included if requested via the include query parameter.", "items": { "type": "object", "properties": { "type": { "type": "string", + "description": "The type of the content.", "enum": [ - "function" + "text" ], - "description": "The type of the tool, i.e. `function`.", "x-stainless-const": true }, - "name": { - "type": "string", - "description": "The name of the function." - }, - "description": { + "text": { "type": "string", - "description": "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n" - }, - "parameters": { - "type": "object", - "description": "Parameters of the function in JSON Schema." + "description": "The text content of the file." } } } - }, - "tool_choice": { + } + }, + "required": [ + "file_id", + "file_name", + "score" + ] + }, + "RunStepDetailsToolCallsFunctionObject": { + "type": "object", + "title": "Function tool call", + "properties": { + "id": { "type": "string", - "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n" + "description": "The ID of the tool call object." }, - "temperature": { - "type": "number", - "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n" + "type": { + "type": "string", + "description": "The type of tool call. This is always going to be `function` for this type of tool call.", + "enum": [ + "function" + ], + "x-stainless-const": true }, - "max_response_output_tokens": { - "oneOf": [ - { - "type": "integer" + "function": { + "type": "object", + "description": "The definition of the function that was called.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." }, - { + "arguments": { "type": "string", - "enum": [ - "inf" - ], - "x-stainless-const": true + "description": "The arguments passed to the function." + }, + "output": { + "anyOf": [ + { + "type": "string", + "description": "The output of the function. This will be `null` if the outputs have not been [submitted](https://developers.openai.com/api/docs/assistants/migration) yet." + }, + { + "type": "null" + } + ] } - ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" - }, - "truncation": { - "$ref": "#/components/schemas/RealtimeTruncation" - }, - "prompt": { - "$ref": "#/components/schemas/Prompt" + }, + "required": [ + "name", + "arguments", + "output" + ] } }, "required": [ - "client_secret" - ], - "x-oaiMeta": { - "name": "The session object", - "group": "realtime", - "example": "{\n \"id\": \"sess_001\",\n \"object\": \"realtime.session\",\n \"model\": \"gpt-realtime-2025-08-25\",\n \"modalities\": [\"audio\", \"text\"],\n \"instructions\": \"You are a friendly assistant.\",\n \"voice\": \"alloy\",\n \"input_audio_format\": \"pcm16\",\n \"output_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"whisper-1\"\n },\n \"turn_detection\": null,\n \"tools\": [],\n \"tool_choice\": \"none\",\n \"temperature\": 0.7,\n \"speed\": 1.1,\n \"tracing\": \"auto\",\n \"max_response_output_tokens\": 200,\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"client_secret\": {\n \"value\": \"ek_abc123\",\n \"expires_at\": 1234567890\n }\n}\n" - } + "id", + "type", + "function" + ] }, - "RealtimeSessionCreateRequestGA": { + "RunStepDetailsToolCallsObject": { + "title": "Tool calls", "type": "object", - "title": "Realtime session configuration", - "description": "Realtime session object configuration.", + "description": "Details of the tool call.", "properties": { "type": { + "description": "Always `tool_calls`.", "type": "string", - "description": "The type of session to create. Always `realtime` for the Realtime API.\n", "enum": [ - "realtime" + "tool_calls" ], "x-stainless-const": true }, - "output_modalities": { + "tool_calls": { "type": "array", - "description": "The set of modalities the model can respond with. It defaults to `[\"audio\"]`, indicating\nthat the model will respond with audio plus a transcript. `[\"text\"]` can be used to make\nthe model respond with text only. It is not possible to request both `text` and `audio` at the same time.\n", - "default": [ - "audio" - ], + "description": "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n", "items": { - "type": "string", - "enum": [ - "text", - "audio" + "oneOf": [ + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeObject" + }, + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchObject" + }, + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsFunctionObject" + } ] } + } + }, + "required": [ + "type", + "tool_calls" + ] + }, + "RunStepObject": { + "type": "object", + "title": "Run steps", + "description": "Represents a step in execution of a run.\n", + "properties": { + "id": { + "description": "The identifier of the run step, which can be referenced in API endpoints.", + "type": "string" }, - "model": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "gpt-realtime", - "gpt-realtime-1.5", - "gpt-realtime-2", - "gpt-realtime-2.1", - "gpt-realtime-2.1-mini", - "gpt-realtime-2025-08-28", - "gpt-4o-realtime-preview", - "gpt-4o-realtime-preview-2024-10-01", - "gpt-4o-realtime-preview-2024-12-17", - "gpt-4o-realtime-preview-2025-06-03", - "gpt-4o-mini-realtime-preview", - "gpt-4o-mini-realtime-preview-2024-12-17", - "gpt-realtime-mini", - "gpt-realtime-mini-2025-10-06", - "gpt-realtime-mini-2025-12-15", - "gpt-audio-1.5", - "gpt-audio-mini", - "gpt-audio-mini-2025-10-06", - "gpt-audio-mini-2025-12-15" - ] - } + "object": { + "description": "The object type, which is always `thread.run.step`.", + "type": "string", + "enum": [ + "thread.run.step" ], - "description": "The Realtime model used for this session.\n" + "x-stainless-const": true }, - "instructions": { - "type": "string", - "description": "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n" + "created_at": { + "description": "The Unix timestamp (in seconds) for when the run step was created.", + "type": "integer", + "format": "unixtime" }, - "audio": { - "type": "object", - "description": "Configuration for input and output audio.\n", - "properties": { - "input": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats", - "description": "The format of the input audio." - }, - "transcription": { - "description": "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n", - "$ref": "#/components/schemas/AudioTranscription" - }, - "noise_reduction": { - "type": "object", - "default": null, - "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", - "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - } - }, - "turn_detection": { - "$ref": "#/components/schemas/RealtimeTurnDetection" - } - } - }, - "output": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats", - "description": "The format of the output audio." - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsOrCustomVoice", - "default": "alloy", - "description": "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with\nan `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed\nduring the session once the model has responded with audio at least once.\nWe recommend `marin` and `cedar` for best quality.\n" - }, - "speed": { - "type": "number", - "default": 1, - "maximum": 1.5, - "minimum": 0.25, - "description": "The speed of the model's spoken response as a multiple of the original speed.\n1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.\n\nThis parameter is a post-processing adjustment to the audio after it is generated, it's\nalso possible to prompt the model to speak faster or slower.\n" - } - } - } - } + "assistant_id": { + "description": "The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) associated with the run step.", + "type": "string" }, - "include": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "item.input_audio_transcription.logprobs" - ] - }, - "description": "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" + "thread_id": { + "description": "The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) that was run.", + "type": "string" }, - "tracing": { - "title": "Tracing Configuration", - "default": null, - "description": "Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", - "nullable": true, + "run_id": { + "description": "The ID of the [run](https://developers.openai.com/api/docs/assistants/migration) that this run step is a part of.", + "type": "string" + }, + "type": { + "description": "The type of run step, which can be either `message_creation` or `tool_calls`.", + "type": "string", + "enum": [ + "message_creation", + "tool_calls" + ] + }, + "status": { + "description": "The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.", + "type": "string", + "enum": [ + "in_progress", + "cancelled", + "failed", + "completed", + "expired" + ] + }, + "step_details": { + "type": "object", + "description": "The details of the run step.", "oneOf": [ { - "type": "string", - "title": "auto", - "default": "auto", - "description": "Enables tracing and sets default values for tracing configuration options. Always `auto`.\n", - "enum": [ - "auto" - ], - "x-stainless-const": true + "$ref": "#/components/schemas/RunStepDetailsMessageCreationObject" }, + { + "$ref": "#/components/schemas/RunStepDetailsToolCallsObject" + } + ] + }, + "last_error": { + "anyOf": [ { "type": "object", - "title": "Tracing Configuration", - "description": "Granular configuration for tracing.\n", + "description": "The last error associated with this run step. Will be `null` if there are no errors.", "properties": { - "workflow_name": { + "code": { "type": "string", - "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the Traces Dashboard.\n" + "description": "One of `server_error` or `rate_limit_exceeded`.", + "enum": [ + "server_error", + "rate_limit_exceeded" + ] }, - "group_id": { + "message": { "type": "string", - "description": "The group id to attach to this trace to enable filtering and\ngrouping in the Traces Dashboard.\n" - }, - "metadata": { - "type": "object", - "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the Traces Dashboard.\n" + "description": "A human-readable description of the error." } - } + }, + "required": [ + "code", + "message" + ] + }, + { + "type": "null" } ] }, - "tools": { - "type": "array", - "description": "Tools available to the model.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeFunctionTool" - }, - { - "$ref": "#/components/schemas/MCPTool" - } - ] - } - }, - "tool_choice": { - "description": "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n", - "oneOf": [ + "expired_at": { + "anyOf": [ { - "$ref": "#/components/schemas/ToolChoiceOptions" + "description": "The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.", + "type": "integer", + "format": "unixtime" }, { - "$ref": "#/components/schemas/ToolChoiceFunction" + "type": "null" + } + ] + }, + "cancelled_at": { + "anyOf": [ + { + "description": "The Unix timestamp (in seconds) for when the run step was cancelled.", + "type": "integer", + "format": "unixtime" }, { - "$ref": "#/components/schemas/ToolChoiceMCP" + "type": "null" } - ], - "default": "auto" - }, - "parallel_tool_calls": { - "type": "boolean", - "description": "Whether the model may call multiple tools in parallel. Only supported by\nreasoning Realtime models such as `gpt-realtime-2`.\n" + ] }, - "reasoning": { - "$ref": "#/components/schemas/RealtimeReasoning" + "failed_at": { + "anyOf": [ + { + "description": "The Unix timestamp (in seconds) for when the run step failed.", + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ] }, - "max_output_tokens": { - "oneOf": [ + "completed_at": { + "anyOf": [ { - "type": "integer" + "description": "The Unix timestamp (in seconds) for when the run step completed.", + "type": "integer", + "format": "unixtime" }, { - "type": "string", - "enum": [ - "inf" - ], - "x-stainless-const": true + "type": "null" } - ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" + ] }, - "truncation": { - "$ref": "#/components/schemas/RealtimeTruncation" + "metadata": { + "$ref": "#/components/schemas/Metadata" }, - "prompt": { - "$ref": "#/components/schemas/Prompt" + "usage": { + "$ref": "#/components/schemas/RunStepCompletionUsage" } }, "required": [ - "type" - ] + "id", + "object", + "created_at", + "assistant_id", + "thread_id", + "run_id", + "type", + "status", + "step_details", + "last_error", + "expired_at", + "cancelled_at", + "failed_at", + "completed_at", + "metadata", + "usage" + ], + "x-oaiMeta": { + "name": "The run step object", + "beta": true, + "example": "{\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"metadata\": {}\n}\n" + } }, - "RealtimeSessionCreateResponse": { - "type": "object", - "title": "Realtime session configuration object", - "description": "A Realtime session configuration object.\n", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" - }, - "object": { - "type": "string", - "description": "The object type. Always `realtime.session`." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Expiration timestamp for the session, in seconds since epoch." - }, - "include": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "item.input_audio_transcription.logprobs" - ] - }, - "description": "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" - }, - "model": { - "type": "string", - "description": "The Realtime model used for this session." - }, - "output_modalities": { - "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] - } - }, - "instructions": { - "type": "string", - "description": "The default system instructions (i.e. system message) prepended to model\ncalls. This field allows the client to guide the model on desired\nresponses. The model can be instructed on response content and format,\n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good\nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion\ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed\nto be followed by the model, but they provide guidance to the model on the\ndesired behavior.\n\nNote that the server sets default instructions which will be used if this\nfield is not set and are visible in the `session.created` event at the\nstart of the session.\n" - }, - "audio": { + "RunStepStreamEvent": { + "oneOf": [ + { "type": "object", - "description": "Configuration for input and output audio for the session.\n", "properties": { - "input": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats" - }, - "transcription": { - "description": "Configuration for input audio transcription.\n", - "$ref": "#/components/schemas/AudioTranscriptionResponse" - }, - "noise_reduction": { - "type": "object", - "description": "Configuration for input audio noise reduction.\n", - "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - } - }, - "turn_detection": { - "type": "object", - "description": "Configuration for turn detection.\n", - "properties": { - "type": { - "type": "string", - "description": "Type of turn detection, only `server_vad` is currently supported.\n" - }, - "threshold": { - "type": "number" - }, - "prefix_padding_ms": { - "type": "integer" - }, - "silence_duration_ms": { - "type": "integer" - } - } - } - } - }, - "output": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats" - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsShared" - }, - "speed": { - "type": "number" - } - } + "event": { + "type": "string", + "enum": [ + "thread.run.step.created" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is created.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" } }, - "tracing": { - "title": "Tracing Configuration", - "description": "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", - "oneOf": [ - { + { + "type": "object", + "properties": { + "event": { "type": "string", - "default": "auto", - "description": "Default tracing mode for the session.\n", "enum": [ - "auto" + "thread.run.step.in_progress" ], "x-stainless-const": true }, - { - "type": "object", - "title": "Tracing Configuration", - "description": "Granular configuration for tracing.\n", - "properties": { - "workflow_name": { - "type": "string", - "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n" - }, - "group_id": { - "type": "string", - "description": "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n" - }, - "metadata": { - "type": "object", - "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n" - } - } + "data": { + "$ref": "#/components/schemas/RunStepObject" } - ] + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` state.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" + } }, - "turn_detection": { + { "type": "object", - "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n", "properties": { - "type": { + "event": { "type": "string", - "description": "Type of turn detection, only `server_vad` is currently supported.\n" - }, - "threshold": { - "type": "number", - "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" - }, - "prefix_padding_ms": { - "type": "integer", - "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + "enum": [ + "thread.run.step.delta" + ], + "x-stainless-const": true }, - "silence_duration_ms": { - "type": "integer", - "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" + "data": { + "$ref": "#/components/schemas/RunStepDeltaObject" } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when parts of a [run step](https://developers.openai.com/api/docs/assistants/migration) are being streamed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step delta](https://developers.openai.com/api/docs/assistants/migration)" } }, - "tools": { - "type": "array", - "description": "Tools (functions) available to the model.", - "items": { - "$ref": "#/components/schemas/RealtimeFunctionTool" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.step.completed" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is completed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" } }, - "tool_choice": { - "type": "string", - "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.step.failed" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) fails.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" + } }, - "max_output_tokens": { - "oneOf": [ - { - "type": "integer" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.step.cancelled" + ], + "x-stainless-const": true }, - { + "data": { + "$ref": "#/components/schemas/RunStepObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is cancelled.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" + } + }, + { + "type": "object", + "properties": { + "event": { "type": "string", "enum": [ - "inf" + "thread.run.step.expired" ], "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunStepObject" } + }, + "required": [ + "event", + "data" ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" + "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) expires.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" + } } - }, - "x-oaiMeta": { - "name": "The session object", - "group": "realtime", - "example": "{\n \"id\": \"sess_001\",\n \"object\": \"realtime.session\",\n \"expires_at\": 1742188264,\n \"model\": \"gpt-realtime\",\n \"output_modalities\": [\"audio\"],\n \"instructions\": \"You are a friendly assistant.\",\n \"tools\": [],\n \"tool_choice\": \"none\",\n \"max_output_tokens\": \"inf\",\n \"tracing\": \"auto\",\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"transcription\": { \"model\": \"whisper-1\" },\n \"noise_reduction\": null,\n \"turn_detection\": null\n },\n \"output\": {\n \"format\": {\n \"type\": \"audio/pcm\",\n \"rate\": 24000\n },\n \"voice\": \"alloy\",\n \"speed\": 1.0\n }\n }\n}\n" - } + ] }, - "RealtimeSessionCreateResponseGA": { - "type": "object", - "title": "Realtime session configuration object", - "description": "A Realtime session configuration object.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of session to create. Always `realtime` for the Realtime API.\n", - "enum": [ - "realtime" - ], - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" - }, - "object": { - "type": "string", - "description": "The object type. Always `realtime.session`.", - "enum": [ - "realtime.session" + "RunStreamEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.created" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": [ + "event", + "data" ], - "x-stainless-const": true - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Expiration timestamp for the session, in seconds since epoch." + "description": "Occurs when a new [run](https://developers.openai.com/api/docs/assistants/migration) is created.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" + } }, - "output_modalities": { - "type": "array", - "description": "The set of modalities the model can respond with. It defaults to `[\"audio\"]`, indicating\nthat the model will respond with audio plus a transcript. `[\"text\"]` can be used to make\nthe model respond with text only. It is not possible to request both `text` and `audio` at the same time.\n", - "default": [ - "audio" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.queued" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": [ + "event", + "data" ], - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `queued` status.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" } }, - "model": { - "anyOf": [ - { - "type": "string" - }, - { + { + "type": "object", + "properties": { + "event": { "type": "string", "enum": [ - "gpt-realtime", - "gpt-realtime-1.5", - "gpt-realtime-2", - "gpt-realtime-2.1", - "gpt-realtime-2.1-mini", - "gpt-realtime-2025-08-28", - "gpt-4o-realtime-preview", - "gpt-4o-realtime-preview-2024-10-01", - "gpt-4o-realtime-preview-2024-12-17", - "gpt-4o-realtime-preview-2025-06-03", - "gpt-4o-mini-realtime-preview", - "gpt-4o-mini-realtime-preview-2024-12-17", - "gpt-realtime-mini", - "gpt-realtime-mini-2025-10-06", - "gpt-realtime-mini-2025-12-15", - "gpt-audio-1.5", - "gpt-audio-mini", - "gpt-audio-mini-2025-10-06", - "gpt-audio-mini-2025-12-15" - ] + "thread.run.in_progress" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunObject" } + }, + "required": [ + "event", + "data" ], - "description": "The Realtime model used for this session.\n" - }, - "instructions": { - "type": "string", - "description": "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n" + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` status.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" + } }, - "audio": { + { "type": "object", - "description": "Configuration for input and output audio.\n", "properties": { - "input": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats", - "description": "The format of the input audio." - }, - "transcription": { - "description": "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n", - "$ref": "#/components/schemas/AudioTranscriptionResponse" - }, - "noise_reduction": { - "type": "object", - "default": null, - "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", - "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - } - }, - "turn_detection": { - "$ref": "#/components/schemas/RealtimeTurnDetection" - } - } + "event": { + "type": "string", + "enum": [ + "thread.run.requires_action" + ], + "x-stainless-const": true }, - "output": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats", - "description": "The format of the output audio." - }, - "voice": { - "$ref": "#/components/schemas/VoiceIdsShared", - "default": "alloy", - "description": "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for\nbest quality.\n" - }, - "speed": { - "type": "number", - "default": 1, - "maximum": 1.5, - "minimum": 0.25, - "description": "The speed of the model's spoken response as a multiple of the original speed.\n1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.\n\nThis parameter is a post-processing adjustment to the audio after it is generated, it's\nalso possible to prompt the model to speak faster or slower.\n" - } - } + "data": { + "$ref": "#/components/schemas/RunObject" } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `requires_action` status.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" } }, - "include": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "item.input_audio_transcription.logprobs" - ] + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.completed" + ], + "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunObject" + } }, - "description": "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) is completed.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" + } }, - "tracing": { - "anyOf": [ - { - "title": "Tracing Configuration", - "default": null, - "description": "Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n", - "oneOf": [ - { - "type": "string", - "title": "auto", - "default": "auto", - "description": "Enables tracing and sets default values for tracing configuration options. Always `auto`.\n", - "enum": [ - "auto" - ], - "x-stainless-const": true - }, - { - "type": "object", - "title": "Tracing Configuration", - "description": "Granular configuration for tracing.\n", - "properties": { - "workflow_name": { - "type": "string", - "description": "The name of the workflow to attach to this trace. This is used to\nname the trace in the Traces Dashboard.\n" - }, - "group_id": { - "type": "string", - "description": "The group id to attach to this trace to enable filtering and\ngrouping in the Traces Dashboard.\n" - }, - "metadata": { - "type": "object", - "description": "The arbitrary metadata to attach to this trace to enable\nfiltering in the Traces Dashboard.\n" - } - } - } - ] + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.incomplete" + ], + "x-stainless-const": true }, - { - "type": "null" + "data": { + "$ref": "#/components/schemas/RunObject" } - ] - }, - "tools": { - "type": "array", - "description": "Tools available to the model.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/RealtimeFunctionTool" - }, - { - "$ref": "#/components/schemas/MCPTool" - } - ] + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) ends with status `incomplete`.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" } }, - "tool_choice": { - "description": "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ToolChoiceOptions" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.failed" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ToolChoiceFunction" + "data": { + "$ref": "#/components/schemas/RunObject" + } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) fails.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" + } + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "enum": [ + "thread.run.cancelling" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ToolChoiceMCP" + "data": { + "$ref": "#/components/schemas/RunObject" } + }, + "required": [ + "event", + "data" ], - "default": "auto" - }, - "reasoning": { - "$ref": "#/components/schemas/RealtimeReasoning" + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `cancelling` status.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" + } }, - "max_output_tokens": { - "oneOf": [ - { - "type": "integer" - }, - { + { + "type": "object", + "properties": { + "event": { "type": "string", "enum": [ - "inf" + "thread.run.cancelled" ], "x-stainless-const": true + }, + "data": { + "$ref": "#/components/schemas/RunObject" } + }, + "required": [ + "event", + "data" ], - "description": "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n" - }, - "truncation": { - "$ref": "#/components/schemas/RealtimeTruncation" + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) is cancelled.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" + } }, - "prompt": { - "$ref": "#/components/schemas/Prompt" - } - }, - "required": [ - "type", - "id", - "object" - ], - "x-oaiMeta": { - "name": "The session object", - "group": "realtime" - } - }, - "RealtimeTranscriptionSessionCreateRequest": { - "type": "object", - "title": "Realtime transcription session configuration", - "description": "Realtime transcription session object configuration.", - "properties": { - "turn_detection": { + { "type": "object", - "description": "Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\n", "properties": { - "type": { + "event": { "type": "string", - "description": "Type of turn detection. Only `server_vad` is currently supported for transcription sessions.\n", "enum": [ - "server_vad" - ] - }, - "threshold": { - "type": "number", - "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" - }, - "prefix_padding_ms": { - "type": "integer", - "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + "thread.run.expired" + ], + "x-stainless-const": true }, - "silence_duration_ms": { - "type": "integer", - "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" + "data": { + "$ref": "#/components/schemas/RunObject" } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) expires.", + "x-oaiMeta": { + "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" } + } + ] + }, + "RunToolCallObject": { + "type": "object", + "description": "Tool call objects", + "properties": { + "id": { + "type": "string", + "description": "The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](https://developers.openai.com/api/docs/assistants/migration) endpoint." }, - "input_audio_noise_reduction": { + "type": { + "type": "string", + "description": "The type of tool call the output is required for. For now, this is always `function`.", + "enum": [ + "function" + ], + "x-stainless-const": true + }, + "function": { "type": "object", - "default": null, - "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", + "description": "The function definition.", "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments that the model expects you to pass to the function." } - } - }, - "input_audio_format": { + }, + "required": [ + "name", + "arguments" + ] + } + }, + "required": [ + "id", + "type", + "function" + ] + }, + "ServiceTier": { + "anyOf": [ + { "type": "string", - "default": "pcm16", + "description": "Specifies the processing type used for serving the request.\n - 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'.\n - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\n - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.\n - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.\n - When not set, the default behavior is 'auto'.\n\n 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.\n", "enum": [ - "pcm16", - "g711_ulaw", - "g711_alaw" + "auto", + "default", + "flex", + "scale", + "priority", + "fast" ], - "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n" + "default": "auto" }, - "input_audio_transcription": { - "description": "Configuration for input audio transcription. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n", - "$ref": "#/components/schemas/AudioTranscription" + { + "type": "null" + } + ] + }, + "ServiceTierResponses": { + "anyOf": [ + { + "type": "string", + "description": "Specifies the processing type used for serving the request.\n - 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'.\n - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\n - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.\n - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.\n - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.\n - When not set, the default behavior is 'auto'.\n\n 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.\n", + "enum": [ + "auto", + "default", + "flex", + "scale", + "priority", + "fast", + "ultrafast" + ], + "default": "auto" }, - "include": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "item.input_audio_transcription.logprobs" - ] - }, - "description": "The set of items to include in the transcription. Current available items are:\n`item.input_audio_transcription.logprobs`\n" + { + "type": "null" } - } + ] }, - "RealtimeTranscriptionSessionCreateRequestGA": { + "SpeechAudioDeltaEvent": { "type": "object", - "title": "Realtime transcription session configuration", - "description": "Realtime transcription session object configuration.", + "description": "Emitted for each chunk of audio data generated during speech synthesis.", "properties": { "type": { "type": "string", - "description": "The type of session to create. Always `transcription` for transcription sessions.\n", + "description": "The type of the event. Always `speech.audio.delta`.\n", "enum": [ - "transcription" + "speech.audio.delta" ], "x-stainless-const": true }, "audio": { - "type": "object", - "description": "Configuration for input and output audio.\n", - "properties": { - "input": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats" - }, - "transcription": { - "description": "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n", - "$ref": "#/components/schemas/AudioTranscription" - }, - "noise_reduction": { - "type": "object", - "default": null, - "description": "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n", - "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - } - }, - "turn_detection": { - "$ref": "#/components/schemas/RealtimeTurnDetection" - } - } - } - } - }, - "include": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "item.input_audio_transcription.logprobs" - ] - }, - "description": "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" + "type": "string", + "description": "A chunk of Base64-encoded audio data.\n" } }, "required": [ - "type" - ] + "type", + "audio" + ], + "x-oaiMeta": { + "name": "Stream Event (speech.audio.delta)", + "group": "speech", + "example": "{\n \"type\": \"speech.audio.delta\",\n \"audio\": \"base64-encoded-audio-data\"\n}\n" + } }, - "RealtimeTranscriptionSessionCreateResponse": { + "SpeechAudioDoneEvent": { "type": "object", - "description": "A new Realtime transcription session configuration.\n\nWhen a session is created on the server via REST API, the session object\nalso contains an ephemeral key. Default TTL for keys is 10 minutes. This\nproperty is not present when a session is updated via the WebSocket API.\n", + "description": "Emitted when the speech synthesis is complete and all audio has been streamed.", "properties": { - "client_secret": { - "type": "object", - "description": "Ephemeral key returned by the API. Only present when the session is\ncreated on the server via REST API.\n", - "properties": { - "value": { - "type": "string", - "description": "Ephemeral key usable in client environments to authenticate connections\nto the Realtime API. Use this in client-side environments rather than\na standard API token, which should only be used server-side.\n" - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Timestamp for when the token expires. Currently, all tokens expire\nafter one minute.\n" - } - }, - "required": [ - "value", - "expires_at" - ] - }, - "modalities": { - "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] - } - }, - "input_audio_format": { + "type": { "type": "string", - "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n" - }, - "input_audio_transcription": { - "description": "Configuration of the transcription model.\n", - "$ref": "#/components/schemas/AudioTranscriptionResponse" + "description": "The type of the event. Always `speech.audio.done`.\n", + "enum": [ + "speech.audio.done" + ], + "x-stainless-const": true }, - "turn_detection": { + "usage": { "type": "object", - "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n", + "description": "Token usage statistics for the request.\n", "properties": { - "type": { - "type": "string", - "description": "Type of turn detection, only `server_vad` is currently supported.\n" - }, - "threshold": { - "type": "number", - "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" + "input_tokens": { + "type": "integer", + "description": "Number of input tokens in the prompt." }, - "prefix_padding_ms": { + "output_tokens": { "type": "integer", - "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" + "description": "Number of output tokens generated." }, - "silence_duration_ms": { + "total_tokens": { "type": "integer", - "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" + "description": "Total number of tokens used (input + output)." } - } + }, + "required": [ + "input_tokens", + "output_tokens", + "total_tokens" + ] } }, "required": [ - "client_secret" + "type", + "usage" ], "x-oaiMeta": { - "name": "The transcription session object", - "group": "realtime", - "example": "{\n \"id\": \"sess_BBwZc7cFV3XizEyKGDCGL\",\n \"object\": \"realtime.transcription_session\",\n \"expires_at\": 1742188264,\n \"modalities\": [\"audio\", \"text\"],\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200\n },\n \"input_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"language\": null,\n \"prompt\": \"\"\n },\n \"client_secret\": null\n}\n" + "name": "Stream Event (speech.audio.done)", + "group": "speech", + "example": "{\n \"type\": \"speech.audio.done\",\n \"usage\": {\n \"input_tokens\": 14,\n \"output_tokens\": 101,\n \"total_tokens\": 115\n }\n}\n" } }, - "RealtimeTranscriptionSessionCreateResponseGA": { + "SpendAlertNotificationChannel": { "type": "object", - "title": "Realtime transcription session configuration object", - "description": "A Realtime transcription session configuration object.\n", + "description": "Email notification settings for a spend alert.", "properties": { "type": { "type": "string", - "description": "The type of session. Always `transcription` for transcription sessions.\n", "enum": [ - "transcription" + "email" ], + "description": "The notification channel type. Currently only `email` is supported.", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" - }, - "object": { - "type": "string", - "description": "The object type. Always `realtime.transcription_session`." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Expiration timestamp for the session, in seconds since epoch." - }, - "include": { + "recipients": { "type": "array", + "description": "Email addresses that receive the spend alert notification.", "items": { - "type": "string", - "enum": [ - "item.input_audio_transcription.logprobs" - ] - }, - "description": "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n" + "type": "string" + } }, - "audio": { - "type": "object", - "description": "Configuration for input audio for the session.\n", - "properties": { - "input": { - "type": "object", - "properties": { - "format": { - "$ref": "#/components/schemas/RealtimeAudioFormats" - }, - "transcription": { - "description": "Configuration of the transcription model.\n", - "$ref": "#/components/schemas/AudioTranscriptionResponse" - }, - "noise_reduction": { - "type": "object", - "description": "Configuration for input audio noise reduction.\n", - "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - } - }, - "turn_detection": { - "description": "Configuration for turn detection. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.\n", - "anyOf": [ - { - "type": "object", - "description": "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.\n", - "properties": { - "type": { - "type": "string", - "description": "Type of turn detection, only `server_vad` is currently supported.\n" - }, - "threshold": { - "type": "number", - "description": "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" - }, - "prefix_padding_ms": { - "type": "integer", - "description": "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" - }, - "silence_duration_ms": { - "type": "integer", - "description": "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" - } - } - }, - { - "type": "null" - } - ] - } - } + "subject_prefix": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - } + ], + "description": "Optional subject prefix for alert emails." } }, "required": [ "type", - "id", - "object" - ], - "x-oaiMeta": { - "name": "The transcription session object", - "group": "realtime", - "example": "{\n \"id\": \"sess_BBwZc7cFV3XizEyKGDCGL\",\n \"type\": \"transcription\",\n \"object\": \"realtime.transcription_session\",\n \"expires_at\": 1742188264,\n \"include\": [\"item.input_audio_transcription.logprobs\"],\n \"audio\": {\n \"input\": {\n \"format\": \"pcm16\",\n \"transcription\": {\n \"model\": \"gpt-4o-transcribe\",\n \"language\": null,\n \"prompt\": \"\"\n },\n \"noise_reduction\": null,\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 200\n }\n }\n }\n}\n" - } + "recipients" + ] }, - "RealtimeTranslationClientEvent": { - "discriminator": { - "propertyName": "type" + "StaticChunkingStrategy": { + "type": "object", + "additionalProperties": false, + "properties": { + "max_chunk_size_tokens": { + "type": "integer", + "minimum": 100, + "maximum": 4096, + "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." + }, + "chunk_overlap_tokens": { + "type": "integer", + "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" + } + }, + "required": [ + "max_chunk_size_tokens", + "chunk_overlap_tokens" + ] + }, + "StaticChunkingStrategyRequestParam": { + "type": "object", + "title": "Static Chunking Strategy", + "description": "Customize your own chunking strategy by setting chunk size and chunk overlap.", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `static`.", + "enum": [ + "static" + ], + "x-stainless-const": true + }, + "static": { + "$ref": "#/components/schemas/StaticChunkingStrategy" + } + }, + "required": [ + "type", + "static" + ] + }, + "StaticChunkingStrategyResponseParam": { + "type": "object", + "title": "Static Chunking Strategy", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "Always `static`.", + "enum": [ + "static" + ], + "x-stainless-const": true + }, + "static": { + "$ref": "#/components/schemas/StaticChunkingStrategy" + } }, - "description": "A Realtime translation client event.\n", - "anyOf": [ + "required": [ + "type", + "static" + ] + }, + "StopConfiguration": { + "description": "Not supported with latest reasoning models `o3` and `o4-mini`.\n\nUp to 4 sequences where the API will stop generating further tokens. The\nreturned text will not contain the stop sequence.\n", + "default": null, + "oneOf": [ { - "$ref": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate" + "type": "string", + "default": "<|endoftext|>", + "example": "\n" }, { - "$ref": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend" + "type": "array", + "minItems": 1, + "maxItems": 4, + "items": { + "type": "string", + "example": "[\"\\n\"]" + } }, { - "$ref": "#/components/schemas/RealtimeTranslationClientEventSessionClose" + "type": "null" } ] }, - "RealtimeTranslationClientEventInputAudioBufferAppend": { + "SubmitToolOutputsRunRequest": { "type": "object", - "description": "Send this event to append audio bytes to the translation session input audio buffer.\n\nWebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono\nlittle-endian raw audio bytes. Unsupported websocket audio formats return a\nvalidation error because lower-quality audio materially degrades translation\nquality.\n\nTranslation consumes 200 ms engine frames. For best realtime behavior, append\naudio in 200 ms chunks. If a chunk is shorter, the server buffers it until it\nhas enough audio for one frame. If a chunk is longer, the server splits it into\n200 ms frames and enqueues them back-to-back.\n\nKeep appending silence while the session is active. If a client stops sending\naudio and later resumes, model time treats the resumed audio as contiguous with\nthe previous audio rather than as a real-world pause.\n", + "additionalProperties": false, "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, - "type": { - "type": "string", - "enum": [ - "session.input_audio_buffer.append" - ], - "description": "The event type, must be `session.input_audio_buffer.append`.", - "x-stainless-const": true + "tool_outputs": { + "description": "A list of tools for which the outputs are being submitted.", + "type": "array", + "items": { + "type": "object", + "properties": { + "tool_call_id": { + "type": "string", + "description": "The ID of the tool call in the `required_action` object within the run object the output is being submitted for." + }, + "output": { + "type": "string", + "description": "The output of the tool call to be submitted to continue the run." + } + } + } }, - "audio": { - "type": "string", - "description": "Base64-encoded 24 kHz PCM16 mono audio bytes." + "stream": { + "anyOf": [ + { + "type": "boolean", + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "audio" + "tool_outputs" + ] + }, + "TextResponseFormatConfiguration": { + "description": "An object specifying the format that the model must output.\n\nConfiguring `{ \"type\": \"json_schema\" }` enables Structured Outputs,\nwhich ensures the model will match your supplied JSON schema. Learn more in the\n[Structured Outputs guide](https://developers.openai.com/api/docs/guides/structured-outputs).\n\nThe default format is `{ \"type\": \"text\" }` with no additional options.\n\n**Not recommended for gpt-4o and newer models:**\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ResponseFormatText" + }, + { + "$ref": "#/components/schemas/TextResponseFormatJsonSchema" + }, + { + "$ref": "#/components/schemas/ResponseFormatJsonObject" + } ], - "x-oaiMeta": { - "name": "session.input_audio_buffer.append", - "group": "realtime", - "example": "{\n \"event_id\": \"event_456\",\n \"type\": \"session.input_audio_buffer.append\",\n \"audio\": \"Base64EncodedAudioData\"\n}\n" + "discriminator": { + "propertyName": "type" } }, - "RealtimeTranslationClientEventSessionClose": { + "TextResponseFormatJsonSchema": { + "x-openai-structured-output": "json_schema_default_strict", "type": "object", - "description": "Gracefully close the realtime translation session. The server flushes pending\ninput audio and emits any remaining translated output before closing the\nsession.\n", + "title": "JSON schema", + "description": "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs).\n", "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." - }, "type": { "type": "string", + "description": "The type of response format being defined. Always `json_schema`.", "enum": [ - "session.close" + "json_schema" ], - "description": "The event type, must be `session.close`.", "x-stainless-const": true + }, + "description": { + "type": "string", + "description": "A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n" + }, + "name": { + "type": "string", + "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n" + }, + "schema": { + "$ref": "#/components/schemas/ResponseFormatJsonSchemaSchema" + }, + "strict": { + "anyOf": [ + { + "type": "boolean", + "default": false, + "description": "Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](https://developers.openai.com/api/docs/guides/structured-outputs).\n" + }, + { + "type": "null" + } + ] } }, "required": [ - "type" - ], - "x-oaiMeta": { - "name": "session.close", - "group": "realtime", - "example": "{\n \"event_id\": \"event_789\",\n \"type\": \"session.close\"\n}\n" - } + "type", + "schema", + "name" + ] }, - "RealtimeTranslationClientEventSessionUpdate": { + "ThreadObject": { "type": "object", - "description": "Send this event to update the translation session configuration. Translation\nsessions support updates to `audio.output.language`, `audio.input.transcription`,\nand `audio.input.noise_reduction`.\n", + "title": "Thread", + "description": "Represents a thread that contains [messages](https://developers.openai.com/api/docs/assistants/migration).", "properties": { - "event_id": { - "type": "string", - "maxLength": 512, - "description": "Optional client-generated ID used to identify this event." + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" }, - "type": { + "object": { + "description": "The object type, which is always `thread`.", "type": "string", "enum": [ - "session.update" + "thread" ], - "description": "The event type, must be `session.update`.", "x-stainless-const": true }, - "session": { - "$ref": "#/components/schemas/RealtimeTranslationSessionUpdateRequest", - "description": "Translation session fields to update. The session `type` and `model` are set\nat creation and cannot be changed with `session.update`.\n" + "created_at": { + "description": "The Unix timestamp (in seconds) for when the thread was created.", + "type": "integer", + "format": "unixtime" + }, + "tool_resources": { + "anyOf": [ + { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", + "properties": { + "code_interpreter": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "file_search": { + "type": "object", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + } + } + }, + { + "type": "null" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" } }, "required": [ - "type", - "session" + "id", + "object", + "created_at", + "tool_resources", + "metadata" ], "x-oaiMeta": { - "name": "session.update", - "group": "realtime", - "example": "{\n \"type\": \"session.update\",\n \"session\": {\n \"audio\": {\n \"input\": {\n \"transcription\": {\n \"model\": \"gpt-realtime-whisper\"\n },\n \"noise_reduction\": null\n },\n \"output\": {\n \"language\": \"es\"\n }\n }\n }\n}\n" + "name": "The thread object", + "beta": true, + "example": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1698107661,\n \"metadata\": {},\n \"tool_resources\": {}\n}\n" } }, - "RealtimeTranslationClientSecretCreateRequest": { - "type": "object", - "title": "Realtime translation client secret creation request", - "description": "Create a translation session and client secret for the Realtime API.\n", - "properties": { - "expires_after": { + "ThreadStreamEvent": { + "oneOf": [ + { "type": "object", - "title": "Client secret expiration", - "description": "Configuration for the client secret expiration. Expiration refers to the time after which\na client secret will no longer be valid for creating sessions. The session itself may\ncontinue after that time once started. A secret can be used to create multiple sessions\nuntil it expires.\n", "properties": { - "anchor": { + "enabled": { + "type": "boolean", + "description": "Whether to enable input audio transcription." + }, + "event": { "type": "string", "enum": [ - "created_at" + "thread.created" ], - "description": "The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported.\n", - "default": "created_at", "x-stainless-const": true }, - "seconds": { - "type": "integer", - "format": "int64", - "description": "The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified.\n", - "minimum": 10, - "maximum": 7200, - "default": 600 + "data": { + "$ref": "#/components/schemas/ThreadObject" } + }, + "required": [ + "event", + "data" + ], + "description": "Occurs when a new [thread](https://developers.openai.com/api/docs/assistants/migration) is created.", + "x-oaiMeta": { + "dataDescription": "`data` is a [thread](https://developers.openai.com/api/docs/assistants/migration)" } - }, - "session": { - "$ref": "#/components/schemas/RealtimeTranslationSessionCreateRequest" } - }, - "required": [ - "session" ] }, - "RealtimeTranslationClientSecretCreateResponse": { + "ToggleCertificatesRequest": { "type": "object", - "title": "Realtime translation session and client secret", - "description": "Response from creating a translation session and client secret for the Realtime API.\n", "properties": { - "value": { - "type": "string", - "description": "The generated client secret value." - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Expiration timestamp for the client secret, in seconds since epoch." - }, - "session": { - "$ref": "#/components/schemas/RealtimeTranslationSession" + "certificate_ids": { + "type": "array", + "items": { + "type": "string", + "example": "cert_abc" + }, + "minItems": 1, + "maxItems": 10 } }, "required": [ - "value", - "expires_at", - "session" - ], - "x-oaiMeta": { - "name": "Translation session response object", - "group": "realtime", - "example": "{\n \"value\": \"ek_68af296e8e408191a1120ab6383263c2\",\n \"expires_at\": 1756310470,\n \"session\": {\n \"id\": \"sess_C9CiUVUzUzYIssh3ELY1d\",\n \"type\": \"translation\",\n \"expires_at\": 1756310470,\n \"model\": \"gpt-realtime-translate\",\n \"audio\": {\n \"input\": {\n \"transcription\": null,\n \"noise_reduction\": null\n },\n \"output\": {\n \"language\": \"es\"\n }\n }\n }\n}\n" - } + "certificate_ids" + ] }, - "RealtimeTranslationServerEvent": { + "Tool": { + "description": "A tool that can be used to generate a response.\n", "discriminator": { "propertyName": "type" }, - "description": "A Realtime translation server event.\n", - "anyOf": [ + "oneOf": [ { - "$ref": "#/components/schemas/RealtimeServerEventError" + "$ref": "#/components/schemas/FunctionTool" }, { - "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionCreated" + "$ref": "#/components/schemas/FileSearchTool" }, { - "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionUpdated" + "$ref": "#/components/schemas/ComputerTool" }, { - "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionClosed" + "$ref": "#/components/schemas/ComputerUsePreviewTool" }, { - "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta" + "$ref": "#/components/schemas/WebSearchTool" }, { - "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta" + "$ref": "#/components/schemas/MCPTool" }, { - "$ref": "#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta" - } - ] - }, - "RealtimeTranslationServerEventSessionClosed": { - "type": "object", - "description": "Returned when a realtime translation session is closed.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + "$ref": "#/components/schemas/CodeInterpreterTool" }, - "type": { - "type": "string", - "enum": [ - "session.closed" - ], - "description": "The event type, must be `session.closed`.", - "x-stainless-const": true - } - }, - "required": [ - "event_id", - "type" - ], - "x-oaiMeta": { - "name": "session.closed", - "group": "realtime", - "example": "{\n \"event_id\": \"event_987\",\n \"type\": \"session.closed\"\n}\n" - } - }, - "RealtimeTranslationServerEventSessionCreated": { - "type": "object", - "description": "Returned when a translation session is created. Emitted automatically when a\nnew connection is established as the first server event. This event contains\nthe default translation session configuration.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "$ref": "#/components/schemas/ProgrammaticToolCallingParam" }, - "type": { - "type": "string", - "enum": [ - "session.created" - ], - "description": "The event type, must be `session.created`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/ImageGenTool" }, - "session": { - "$ref": "#/components/schemas/RealtimeTranslationSession", - "description": "The translation session configuration." - } - }, - "required": [ - "event_id", - "type", - "session" - ], - "x-oaiMeta": { - "name": "session.created", - "group": "realtime", - "example": "{\n \"type\": \"session.created\",\n \"event_id\": \"event_123\",\n \"session\": {\n \"id\": \"sess_123\",\n \"type\": \"translation\",\n \"model\": \"gpt-realtime-translate\",\n \"expires_at\": 1714857600,\n \"audio\": {\n \"input\": {\n \"transcription\": {\n \"model\": \"gpt-realtime-whisper\",\n \"language\": \"en\"\n },\n \"noise_reduction\": {\n \"type\": \"near_field\"\n }\n },\n \"output\": {\n \"language\": \"fr\"\n }\n }\n }\n}\n" - } - }, - "RealtimeTranslationServerEventSessionInputTranscriptDelta": { - "type": "object", - "description": "Returned when optional source-language transcript text is available. This event\nis emitted only when `audio.input.transcription` is configured.\n\nTranscript deltas are append-only text fragments. Clients should not insert\nunconditional spaces between deltas.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." + { + "$ref": "#/components/schemas/LocalShellToolParam" }, - "type": { - "type": "string", - "enum": [ - "session.input_transcript.delta" - ], - "description": "The event type, must be `session.input_transcript.delta`.", - "x-stainless-const": true + { + "$ref": "#/components/schemas/FunctionShellToolParam" }, - "delta": { - "type": "string", - "description": "Append-only source-language transcript text." + { + "$ref": "#/components/schemas/CustomToolParam" }, - "elapsed_ms": { - "anyOf": [ - { - "type": "integer", - "description": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. It advances in 200 ms increments, but multiple transcript\ndeltas may share the same `elapsed_ms`. Treat it as alignment metadata,\nnot a unique transcript-delta identifier.\n" - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/NamespaceToolParam" + }, + { + "$ref": "#/components/schemas/ToolSearchToolParam" + }, + { + "$ref": "#/components/schemas/WebSearchPreviewTool" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolParam" } - }, - "required": [ - "event_id", - "type", - "delta" - ], - "x-oaiMeta": { - "name": "session.input_transcript.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_125\",\n \"type\": \"session.input_transcript.delta\",\n \"delta\": \" hear\",\n \"elapsed_ms\": 1200\n}\n" - } + ] }, - "RealtimeTranslationServerEventSessionOutputAudioDelta": { + "ToolChoiceAllowed": { "type": "object", - "description": "Returned when translated output audio is available. The `delta` contains a\nPCM16 audio chunk whose length can vary. Clients should decode and queue the\ncomplete delta instead of assuming a fixed byte or sample count.\n", + "title": "Allowed tools", + "description": "Constrains the tools available to the model to a pre-defined set.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "session.output_audio.delta" + "allowed_tools" ], - "description": "The event type, must be `session.output_audio.delta`.", + "description": "Allowed tool configuration type. Always `allowed_tools`.", "x-stainless-const": true }, - "delta": { - "type": "string", - "description": "Base64-encoded translated audio data." - }, - "sample_rate": { - "type": "integer", - "description": "Sample rate of the audio delta.", - "default": 24000 - }, - "channels": { - "type": "integer", - "description": "Number of audio channels.", - "default": 1 - }, - "format": { + "mode": { "type": "string", "enum": [ - "pcm16" + "auto", + "required" ], - "description": "Audio encoding for `delta`.", - "x-stainless-const": true + "description": "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n" }, - "elapsed_ms": { - "anyOf": [ - { - "type": "integer", - "description": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. Treat `elapsed_ms` as alignment metadata, not a unique\nevent identifier.\n" - }, - { - "type": "null" - } - ] + "tools": { + "type": "array", + "description": "A list of tool definitions that the model should be allowed to call.\n\nFor the Responses API, the list of tool definitions might look like:\n```json\n[\n { \"type\": \"function\", \"name\": \"get_weather\" },\n { \"type\": \"mcp\", \"server_label\": \"deepwiki\" },\n { \"type\": \"image_generation\" }\n]\n```\n", + "items": { + "type": "object", + "description": "A tool definition that the model should be allowed to call.\n", + "additionalProperties": true, + "x-oaiExpandable": false + } } }, "required": [ - "event_id", "type", - "delta" - ], - "x-oaiMeta": { - "name": "session.output_audio.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_123\",\n \"type\": \"session.output_audio.delta\",\n \"delta\": \"Base64EncodedAudioDelta\",\n \"sample_rate\": 24000,\n \"channels\": 1,\n \"format\": \"pcm16\",\n \"elapsed_ms\": 1200\n}\n" - } + "mode", + "tools" + ] }, - "RealtimeTranslationServerEventSessionOutputTranscriptDelta": { + "ToolChoiceCustom": { "type": "object", - "description": "Returned when translated transcript text is available.\n\nTranscript deltas are append-only text fragments. Clients should not insert\nunconditional spaces between deltas.\n", - "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, + "title": "Custom tool", + "description": "Use this option to force the model to call a specific custom tool.\n", + "properties": { "type": { "type": "string", "enum": [ - "session.output_transcript.delta" + "custom" ], - "description": "The event type, must be `session.output_transcript.delta`.", + "description": "For custom tool calling, the type is always `custom`.", "x-stainless-const": true }, - "delta": { + "name": { "type": "string", - "description": "Append-only transcript text for the translated output audio." - }, - "elapsed_ms": { - "anyOf": [ - { - "type": "integer", - "description": "Timing metadata for stream alignment, derived from the translation frame\nwhen available. It advances in 200 ms increments, but multiple transcript\ndeltas may share the same `elapsed_ms`. Treat it as alignment metadata,\nnot a unique transcript-delta identifier.\n" - }, - { - "type": "null" - } - ] + "description": "The name of the custom tool to call." } }, "required": [ - "event_id", "type", - "delta" - ], - "x-oaiMeta": { - "name": "session.output_transcript.delta", - "group": "realtime", - "example": "{\n \"event_id\": \"event_124\",\n \"type\": \"session.output_transcript.delta\",\n \"delta\": \" escuch\",\n \"elapsed_ms\": 1200\n}\n" - } + "name" + ] }, - "RealtimeTranslationServerEventSessionUpdated": { + "ToolChoiceFunction": { "type": "object", - "description": "Returned when a translation session is updated with a `session.update` event,\nunless there is an error.\n", + "title": "Function tool", + "description": "Use this option to force the model to call a specific function.\n", "properties": { - "event_id": { - "type": "string", - "description": "The unique ID of the server event." - }, "type": { "type": "string", "enum": [ - "session.updated" + "function" ], - "description": "The event type, must be `session.updated`.", + "description": "For function calling, the type is always `function`.", "x-stainless-const": true }, - "session": { - "$ref": "#/components/schemas/RealtimeTranslationSession", - "description": "The translation session configuration." + "name": { + "type": "string", + "description": "The name of the function to call." } }, "required": [ - "event_id", "type", - "session" - ], - "x-oaiMeta": { - "name": "session.updated", - "group": "realtime", - "example": "{\n \"type\": \"session.updated\",\n \"event_id\": \"event_124\",\n \"session\": {\n \"id\": \"sess_123\",\n \"type\": \"translation\",\n \"model\": \"gpt-realtime-translate\",\n \"expires_at\": 1714857600,\n \"audio\": {\n \"input\": {\n \"transcription\": {\n \"model\": \"gpt-realtime-whisper\",\n \"language\": \"en\"\n },\n \"noise_reduction\": {\n \"type\": \"near_field\"\n }\n },\n \"output\": {\n \"language\": \"es\"\n }\n }\n }\n}\n" - } + "name" + ] }, - "RealtimeTranslationSession": { + "ToolChoiceMCP": { "type": "object", - "title": "Realtime translation session", - "description": "A Realtime translation session. Translation sessions continuously translate input\naudio into the configured output language.\n", + "title": "MCP tool", + "description": "Use this option to force the model to call a specific tool on a remote MCP server.\n", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n" - }, "type": { "type": "string", "enum": [ - "translation" + "mcp" ], - "description": "The session type. Always `translation` for Realtime translation sessions.\n", + "description": "For MCP tools, the type is always `mcp`.", "x-stainless-const": true }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Expiration timestamp for the session, in seconds since epoch." - }, - "model": { + "server_label": { "type": "string", - "description": "The Realtime translation model used for this session. This field is set at\nsession creation and cannot be changed with `session.update`.\n" + "description": "The label of the MCP server to use.\n" }, - "audio": { - "type": "object", - "description": "Configuration for translation input and output audio.\n", - "properties": { - "input": { - "type": "object", - "properties": { - "transcription": { - "anyOf": [ - { - "type": "object", - "description": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n", - "properties": { - "model": { - "type": "string", - "description": "The transcription model used for source transcript deltas." - } - }, - "required": [ - "model" - ] - }, - { - "type": "null" - } - ] - }, - "noise_reduction": { - "anyOf": [ - { - "type": "object", - "description": "Optional input noise reduction.\n", - "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - }, - "required": [ - "type" - ] - }, - { - "type": "null" - } - ] - } - } + "name": { + "anyOf": [ + { + "type": "string", + "description": "The name of the tool to call on the server.\n" }, - "output": { - "type": "object", - "properties": { - "language": { - "type": "string", - "description": "Target language for translated output audio and transcript deltas.\n" - } - } + { + "type": "null" } - } + ] } }, "required": [ - "id", "type", - "expires_at", - "model", - "audio" - ], - "x-oaiMeta": { - "name": "The translation session object", - "group": "realtime", - "example": "{\n \"id\": \"sess_C9G5QPteg4UIbotdKLoYQ\",\n \"type\": \"translation\",\n \"expires_at\": 1756324625,\n \"model\": \"gpt-realtime-translate\",\n \"audio\": {\n \"input\": {\n \"transcription\": {\n \"model\": \"gpt-realtime-whisper\"\n },\n \"noise_reduction\": null\n },\n \"output\": {\n \"language\": \"es\"\n }\n }\n}\n" - } + "server_label" + ] }, - "RealtimeTranslationSessionCreateRequest": { - "type": "object", - "title": "Realtime translation session configuration", - "description": "Realtime translation session configuration. Translation sessions stream source\naudio in and translated audio plus transcript deltas out continuously.\n", - "properties": { - "model": { - "type": "string", - "description": "The Realtime translation model used for this session.\n" + "ToolChoiceOptions": { + "type": "string", + "title": "Tool choice mode", + "description": "Controls which (if any) tool is called by the model.\n\n`none` means the model will not call any tool and instead generates a message.\n\n`auto` means the model can pick between generating a message or calling one or\nmore tools.\n\n`required` means the model must call one or more tools.\n", + "enum": [ + "none", + "auto", + "required" + ] + }, + "ToolChoiceParam": { + "description": "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/ToolChoiceOptions" }, - "audio": { - "type": "object", - "description": "Configuration for translation input and output audio.\n", - "properties": { - "input": { - "type": "object", - "properties": { - "transcription": { - "anyOf": [ - { - "type": "object", - "description": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n", - "properties": { - "model": { - "type": "string", - "description": "The transcription model to use for source transcript deltas." - } - }, - "required": [ - "model" - ] - }, - { - "type": "null" - } - ] - }, - "noise_reduction": { - "anyOf": [ - { - "type": "object", - "description": "Optional input noise reduction. Set to `null` to disable it.\n", - "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - }, - "required": [ - "type" - ] - }, - { - "type": "null" - } - ] - } - } - }, - "output": { - "type": "object", - "properties": { - "language": { - "type": "string", - "description": "Target language for translated output audio and transcript deltas.\n" - } - } - } - } + { + "$ref": "#/components/schemas/ToolChoiceAllowed" + }, + { + "$ref": "#/components/schemas/ToolChoiceTypes" + }, + { + "$ref": "#/components/schemas/ToolChoiceFunction" + }, + { + "$ref": "#/components/schemas/ToolChoiceMCP" + }, + { + "$ref": "#/components/schemas/ToolChoiceCustom" + }, + { + "$ref": "#/components/schemas/SpecificProgrammaticToolCallingParam" + }, + { + "$ref": "#/components/schemas/SpecificApplyPatchParam" + }, + { + "$ref": "#/components/schemas/SpecificFunctionShellParam" } - }, - "required": [ - "model" ] }, - "RealtimeTranslationSessionUpdateRequest": { + "ToolChoiceTypes": { "type": "object", - "title": "Realtime translation session update", - "description": "Realtime translation session fields that can be updated with `session.update`.\n", + "title": "Hosted tool", + "description": "Indicates that the model should use a built-in tool to generate a response.\n[Learn more about built-in tools](https://developers.openai.com/api/docs/guides/tools).\n", "properties": { - "audio": { - "type": "object", - "description": "Configuration for translation input and output audio.\n", - "properties": { - "input": { - "type": "object", - "properties": { - "transcription": { - "anyOf": [ - { - "type": "object", - "description": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n", - "properties": { - "model": { - "type": "string", - "description": "The transcription model to use for source transcript deltas." - } - }, - "required": [ - "model" - ] - }, - { - "type": "null" - } - ] - }, - "noise_reduction": { - "anyOf": [ - { - "type": "object", - "description": "Optional input noise reduction. Set to `null` to disable it.\n", - "properties": { - "type": { - "$ref": "#/components/schemas/NoiseReductionType" - } - }, - "required": [ - "type" - ] - }, - { - "type": "null" - } - ] - } - } - }, - "output": { - "type": "object", - "properties": { - "language": { - "type": "string", - "description": "Target language for translated output audio and transcript deltas.\n" - } - } - } - } - } - } - }, - "RealtimeTruncation": { - "title": "Realtime Truncation Controls", - "description": "When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs.\n\nClients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.\n\nTruncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate.\n\nTruncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit.\n", - "oneOf": [ - { + "type": { "type": "string", - "description": "The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit.", + "description": "The type of hosted tool the model should to use. Learn more about\n[built-in tools](https://developers.openai.com/api/docs/guides/tools).\n\nAllowed values are:\n- `file_search`\n- `web_search_preview`\n- `computer`\n- `computer_use_preview`\n- `computer_use`\n- `code_interpreter`\n- `image_generation`\n", "enum": [ - "auto", - "disabled" - ] - }, - { - "type": "object", - "title": "Retention ratio truncation", - "description": "Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.", - "properties": { - "type": { - "type": "string", - "enum": [ - "retention_ratio" - ], - "description": "Use retention ratio truncation.", - "x-stainless-const": true - }, - "retention_ratio": { - "type": "number", - "description": "Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates.\n", - "minimum": 0, - "maximum": 1 - }, - "token_limits": { - "type": "object", - "description": "Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used.", - "properties": { - "post_instructions": { - "type": "integer", - "description": "Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens.", - "minimum": 0 - } - } - } - }, - "required": [ - "type", - "retention_ratio" + "file_search", + "web_search_preview", + "computer", + "computer_use_preview", + "computer_use", + "web_search_preview_2025_03_11", + "image_generation", + "code_interpreter" ] } + }, + "required": [ + "type" ] }, - "RealtimeTurnDetection": { - "anyOf": [ + "ToolSearchOutputTool": { + "description": "A tool definition returned by a tool search output.\n", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ { - "title": "Realtime Turn Detection", - "description": "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\n\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\n\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n\nFor `gpt-realtime-whisper` transcription sessions, turn detection must be\nset to `null`; VAD is not supported.\n", - "oneOf": [ - { - "type": "object", - "title": "Server VAD", - "description": "Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "default": "server_vad", - "const": "server_vad", - "description": "Type of turn detection, `server_vad` to turn on simple Server VAD.\n" - }, - "threshold": { - "type": "number", - "description": "Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n" - }, - "prefix_padding_ms": { - "type": "integer", - "description": "Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n" - }, - "silence_duration_ms": { - "type": "integer", - "description": "Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n" - }, - "create_response": { - "type": "boolean", - "default": true, - "description": "Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.\n\nIf both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.\n" - }, - "interrupt_response": { - "type": "boolean", - "default": true, - "description": "Whether or not to automatically interrupt (cancel) any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.\n\nIf both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.\n" - }, - "idle_timeout_ms": { - "anyOf": [ - { - "type": "integer", - "minimum": 5000, - "maximum": 30000, - "description": "Optional timeout after which a model response will be triggered automatically. This is\nuseful for situations in which a long pause from the user is unexpected, such as a phone\ncall. The model will effectively prompt the user to continue the conversation based\non the current context.\n\nThe timeout value will be applied after the last model response's audio has finished playing,\ni.e. it's set to the `response.done` time plus audio playback duration.\n\nAn `input_audio_buffer.timeout_triggered` event (plus events\nassociated with the Response) will be emitted when the timeout is reached.\nIdle timeout is currently only supported for `server_vad` mode.\n" - }, - { - "type": "null" - } - ] - } - } - }, - { - "type": "object", - "title": "Semantic VAD", - "description": "Server-side semantic turn detection which uses a model to determine when the user has finished speaking.", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "const": "semantic_vad", - "description": "Type of turn detection, `semantic_vad` to turn on Semantic VAD.\n" - }, - "eagerness": { - "type": "string", - "default": "auto", - "enum": [ - "low", - "medium", - "high", - "auto" - ], - "description": "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.\n" - }, - "create_response": { - "type": "boolean", - "default": true, - "description": "Whether or not to automatically generate a response when a VAD stop event occurs.\n" - }, - "interrupt_response": { - "type": "boolean", - "default": true, - "description": "Whether or not to automatically interrupt any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs.\n" - } - } - } - ], - "discriminator": { - "propertyName": "type" - } + "$ref": "#/components/schemas/FunctionTool" + }, + { + "$ref": "#/components/schemas/FileSearchTool" + }, + { + "$ref": "#/components/schemas/ComputerTool" + }, + { + "$ref": "#/components/schemas/ComputerUsePreviewTool" + }, + { + "$ref": "#/components/schemas/WebSearchTool" + }, + { + "$ref": "#/components/schemas/MCPTool" + }, + { + "$ref": "#/components/schemas/CodeInterpreterTool" + }, + { + "$ref": "#/components/schemas/ProgrammaticToolCallingParam" }, { - "type": "null" - } - ] - }, - "Reasoning": { - "type": "object", - "description": "Configuration options for\n[reasoning models](https://developers.openai.com/api/docs/guides/reasoning).\n", - "title": "Reasoning", - "properties": { - "mode": { - "$ref": "#/components/schemas/ReasoningModeEnum", - "description": "Controls the reasoning execution mode for the request.\n\nWhen returned on a response, this is the effective execution mode.\n" + "$ref": "#/components/schemas/ImageGenTool" }, - "effort": { - "$ref": "#/components/schemas/ReasoningEffort" + { + "$ref": "#/components/schemas/LocalShellToolParam" }, - "summary": { - "anyOf": [ - { - "type": "string", - "description": "A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n\n`concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.\n", - "enum": [ - "auto", - "concise", - "detailed" - ] - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/FunctionShellToolParam" }, - "context": { - "anyOf": [ - { - "type": "string", - "description": "Controls which reasoning items are rendered back to the model on later turns.\nIf omitted or set to `auto`, the model determines the context mode. The\n`gpt-5.6` model family defaults to `all_turns`; earlier models default to\n`current_turn`.\n\nWhen returned on a response, this is the effective reasoning context mode\nused for the response.\n", - "enum": [ - "auto", - "current_turn", - "all_turns" - ] - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/CustomToolParam" }, - "generate_summary": { - "anyOf": [ - { - "type": "string", - "deprecated": true, - "description": "**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n", - "enum": [ - "auto", - "concise", - "detailed" - ] - }, - { - "type": "null" - } - ] - } - } - }, - "ReasoningEffort": { - "anyOf": [ { - "type": "string", - "enum": [ - "none", - "minimal", - "low", - "medium", - "high", - "xhigh", - "max" - ], - "default": "medium", - "description": "Constrains effort on reasoning for reasoning models. Currently supported\nvalues are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.\nReducing reasoning effort can result in faster responses and fewer tokens\nused on reasoning in a response. Not all reasoning models support every\nvalue. See the\n[reasoning guide](https://developers.openai.com/api/docs/guides/reasoning)\nfor model-specific support.\n" + "$ref": "#/components/schemas/ToolSearchOutputNamespaceToolParam" }, { - "type": "null" + "$ref": "#/components/schemas/ToolSearchToolParam" + }, + { + "$ref": "#/components/schemas/WebSearchPreviewTool" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolParam" } ] }, - "ReasoningItem": { + "ToolsArray": { + "type": "array", + "description": "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](https://developers.openai.com/api/docs/guides/tools-web-search)\n or [file search](https://developers.openai.com/api/docs/guides/tools-file-search). Learn more about\n [built-in tools](https://developers.openai.com/api/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](https://developers.openai.com/api/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](https://developers.openai.com/api/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n", + "items": { + "$ref": "#/components/schemas/Tool" + } + }, + "TranscriptTextDeltaEvent": { "type": "object", - "description": "A description of the chain of thought used by a reasoning model while generating\na response. Be sure to include these items in your `input` to the Responses API\nfor subsequent turns of a conversation if you are manually\n[managing context](https://developers.openai.com/api/docs/guides/conversation-state).\n", - "title": "Reasoning", + "description": "Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.", "properties": { "type": { "type": "string", - "description": "The type of the object. Always `reasoning`.\n", + "description": "The type of the event. Always `transcript.text.delta`.\n", "enum": [ - "reasoning" + "transcript.text.delta" ], "x-stainless-const": true }, - "id": { + "delta": { "type": "string", - "description": "The unique identifier of the reasoning content.\n" - }, - "encrypted_content": { - "anyOf": [ - { - "type": "string", - "description": "The encrypted content of the reasoning item. This is populated by default\nfor reasoning items returned by `POST /v1/responses` and WebSocket\n`response.create` requests.\n\nWhen streaming, use the completed reasoning item and its\n`encrypted_content` from the `response.output_item.done` event in\nsubsequent requests. The `encrypted_content` in\n`response.output_item.added` may be incomplete. This is especially\nimportant when `store` is `false` or when using Zero Data Retention.\n" - }, - { - "type": "null" - } - ] - }, - "summary": { - "type": "array", - "description": "Reasoning summary content.\n", - "items": { - "$ref": "#/components/schemas/SummaryTextContent" - } + "description": "The text delta that was additionally transcribed.\n" }, - "content": { + "logprobs": { "type": "array", - "description": "Reasoning text content.\n", + "description": "The log probabilities of the delta. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`.\n", "items": { - "$ref": "#/components/schemas/ReasoningTextContent" + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "The token that was used to generate the log probability.\n" + }, + "logprob": { + "type": "number", + "description": "The log probability of the token.\n" + }, + "bytes": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "The bytes that were used to generate the log probability.\n" + } + } } }, - "status": { + "segment_id": { "type": "string", - "description": "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n", - "enum": [ - "in_progress", - "completed", - "incomplete" - ] + "description": "Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.\n" } }, "required": [ - "id", - "summary", - "type" - ] + "type", + "delta" + ], + "x-oaiMeta": { + "name": "Stream Event (transcript.text.delta)", + "group": "transcript", + "example": "{\n \"type\": \"transcript.text.delta\",\n \"delta\": \" wonderful\"\n}\n" + } }, - "Response": { - "title": "The response object", - "allOf": [ - { - "$ref": "#/components/schemas/ModelResponseProperties" + "TranscriptTextDoneEvent": { + "type": "object", + "description": "Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.", + "properties": { + "type": { + "type": "string", + "description": "The type of the event. Always `transcript.text.done`.\n", + "enum": [ + "transcript.text.done" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseProperties" + "text": { + "type": "string", + "description": "The text that was transcribed.\n" }, - { - "type": "object", - "properties": { - "service_tier": { - "$ref": "#/components/schemas/ServiceTierResponses" - }, - "truncation": { - "anyOf": [ - { - "type": "string", - "description": "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n", - "enum": [ - "auto", - "disabled" - ], - "default": "disabled" - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string", - "description": "Unique identifier for this Response.\n" - }, - "object": { - "type": "string", - "description": "The object type of this resource - always set to `response`.\n", - "enum": [ - "response" - ], - "x-stainless-const": true - }, - "status": { - "type": "string", - "description": "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n", - "enum": [ - "completed", - "failed", - "in_progress", - "cancelled", - "queued", - "incomplete" - ] - }, - "created_at": { - "type": "number", - "format": "unixtime", - "description": "Unix timestamp (in seconds) of when this Response was created.\n" - }, - "completed_at": { - "anyOf": [ - { - "type": "number", - "format": "unixtime", - "description": "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n" - }, - { - "type": "null" - } - ] - }, - "error": { - "$ref": "#/components/schemas/ResponseError" - }, - "incomplete_details": { - "anyOf": [ - { - "type": "object", - "description": "Details about why the response is incomplete.\n", - "properties": { - "reason": { - "type": "string", - "description": "The reason why the response is incomplete. `steered` means\nthe response stopped at a safe output boundary after a\nWebSocket `response.steer` event. The server can then create\na successor response automatically with the queued input.\n", - "enum": [ - "max_output_tokens", - "max_messages", - "content_filter", - "steered" - ] - } - } - }, - { - "type": "null" - } - ] - }, - "output": { - "type": "array", - "description": "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n", - "items": { - "$ref": "#/components/schemas/OutputItem" - } - }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/Reasoning" - }, - { - "type": "null" - } - ] - }, - "instructions": { - "anyOf": [ - { - "description": "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n", - "oneOf": [ - { - "type": "string", - "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n" - }, - { - "type": "array", - "title": "Input item list", - "description": "A list of one or many input items to the model, containing\ndifferent content types.\n", - "items": { - "$ref": "#/components/schemas/InputItem" - } - } - ] - }, - { - "type": "null" - } - ] - }, - "output_text": { - "anyOf": [ - { - "type": "string", - "description": "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n", - "x-oaiSupportedSDKs": [ - "python", - "javascript" - ] - }, - { - "type": "null" - } - ] - }, - "usage": { - "$ref": "#/components/schemas/ResponseUsage" - }, - "prompt_cache_options": { - "$ref": "#/components/schemas/PromptCacheOptions" - }, - "prompt_cache_diagnostics": { - "$ref": "#/components/schemas/PromptCacheDiagnostics" - }, - "moderation": { - "anyOf": [ - { - "$ref": "#/components/schemas/Moderation", - "description": "Moderation results for the response input and output, if moderated completions were requested.\n" - }, - { - "type": "null" - } - ] - }, - "parallel_tool_calls": { - "type": "boolean", - "description": "Whether to allow the model to run tool calls in parallel.\n", - "default": true - }, - "conversation": { - "anyOf": [ - { - "default": null, - "$ref": "#/components/schemas/ResponseConversation" - }, - { - "type": "null" - } - ] - }, - "max_output_tokens": { - "anyOf": [ - { - "description": "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning).\n", + "languages": { + "type": "array", + "description": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n", + "items": { + "$ref": "#/components/schemas/TranscriptionLanguage" + } + }, + "logprobs": { + "type": "array", + "description": "The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`.\n", + "items": { + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "The token that was used to generate the log probability.\n" + }, + "logprob": { + "type": "number", + "description": "The log probability of the token.\n" + }, + "bytes": { + "type": "array", + "items": { "type": "integer" }, - { - "type": "null" - } - ] - } - }, - "required": [ - "id", - "object", - "created_at", - "error", - "incomplete_details", - "instructions", - "model", - "tools", - "output", - "parallel_tool_calls", - "metadata", - "tool_choice", - "temperature", - "top_p" - ] - } - ], - "example": { - "id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41", - "object": "response", - "created_at": 1741476777, - "status": "completed", - "completed_at": 1741476778, - "error": null, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-6-astra", - "output": [ - { - "type": "message", - "id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.", - "annotations": [] + "description": "The bytes that were used to generate the log probability.\n" } - ] - } - ], - "parallel_tool_calls": true, - "previous_response_id": null, - "reasoning": { - "effort": null, - "summary": null, - "context": null - }, - "store": true, - "temperature": 1, - "text": { - "format": { - "type": "text" + } } }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", "usage": { - "input_tokens": 328, - "input_tokens_details": { - "cached_tokens": 0, - "cache_write_tokens": 0 - }, - "output_tokens": 52, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 380 - }, - "user": null, - "metadata": {} + "$ref": "#/components/schemas/TranscriptTextUsageTokens" + } + }, + "required": [ + "type", + "text" + ], + "x-oaiMeta": { + "name": "Stream Event (transcript.text.done)", + "group": "transcript", + "example": "{\n \"type\": \"transcript.text.done\",\n \"text\": \"I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.\",\n \"usage\": {\n \"type\": \"tokens\",\n \"input_tokens\": 14,\n \"input_token_details\": {\n \"text_tokens\": 10,\n \"audio_tokens\": 4\n },\n \"output_tokens\": 31,\n \"total_tokens\": 45\n }\n}\n" } }, - "ResponseAudioDeltaEvent": { + "TranscriptTextSegmentEvent": { "type": "object", - "description": "Emitted when there is a partial audio response.", + "description": "Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with `stream` set to `true` and `response_format` set to `diarized_json`.\n", "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.audio.delta`.\n", + "description": "The type of the event. Always `transcript.text.segment`.", "enum": [ - "response.audio.delta" + "transcript.text.segment" ], "x-stainless-const": true }, - "sequence_number": { - "type": "integer", - "description": "A sequence number for this chunk of the stream response.\n" + "id": { + "type": "string", + "description": "Unique identifier for the segment." + }, + "start": { + "type": "number", + "format": "double", + "description": "Start timestamp of the segment in seconds." + }, + "end": { + "type": "number", + "format": "double", + "description": "End timestamp of the segment in seconds." + }, + "text": { + "type": "string", + "description": "Transcript text for this segment." }, - "delta": { + "speaker": { "type": "string", - "description": "A chunk of Base64 encoded response audio bytes.\n" + "description": "Speaker label for this segment." } }, "required": [ "type", - "delta", - "sequence_number" + "id", + "start", + "end", + "text", + "speaker" ], "x-oaiMeta": { - "name": "response.audio.delta", - "group": "responses", - "example": "{\n \"type\": \"response.audio.delta\",\n \"response_id\": \"resp_123\",\n \"delta\": \"base64encoded...\",\n \"sequence_number\": 1\n}\n" + "name": "Stream Event (transcript.text.segment)", + "group": "transcript", + "example": "{\n \"type\": \"transcript.text.segment\",\n \"id\": \"seg_002\",\n \"start\": 5.2,\n \"end\": 12.8,\n \"text\": \"Hi, I need help with diarization.\",\n \"speaker\": \"A\"\n}\n" } }, - "ResponseAudioDoneEvent": { + "TranscriptTextUsageDuration": { "type": "object", - "description": "Emitted when the audio response is complete.", + "title": "Duration Usage", + "description": "Usage statistics for models billed by audio input duration.", "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.audio.done`.\n", "enum": [ - "response.audio.done" + "duration" ], + "description": "The type of the usage object. Always `duration` for this variant.", "x-stainless-const": true }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the delta.\n" + "seconds": { + "type": "number", + "format": "double", + "description": "Duration of the input audio in seconds." } }, "required": [ "type", - "sequence_number", - "response_id" - ], - "x-oaiMeta": { - "name": "response.audio.done", - "group": "responses", - "example": "{\n \"type\": \"response.audio.done\",\n \"response_id\": \"resp-123\",\n \"sequence_number\": 1\n}\n" - } + "seconds" + ] }, - "ResponseAudioTranscriptDeltaEvent": { + "TranscriptTextUsageTokens": { "type": "object", - "description": "Emitted when there is a partial transcript of audio.", + "title": "Token Usage", + "description": "Usage statistics for models billed by token usage.", "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.audio.transcript.delta`.\n", "enum": [ - "response.audio.transcript.delta" + "tokens" ], + "description": "The type of the usage object. Always `tokens` for this variant.", "x-stainless-const": true }, - "delta": { - "type": "string", - "description": "The partial transcript of the audio response.\n" + "input_tokens": { + "type": "integer", + "description": "Number of input tokens billed for this request." }, - "sequence_number": { + "input_token_details": { + "type": "object", + "description": "Details about the input tokens billed for this request.", + "properties": { + "text_tokens": { + "type": "integer", + "description": "Number of text tokens billed for this request." + }, + "audio_tokens": { + "type": "integer", + "description": "Number of audio tokens billed for this request." + } + } + }, + "output_tokens": { "type": "integer", - "description": "The sequence number of this event." + "description": "Number of output tokens generated." + }, + "total_tokens": { + "type": "integer", + "description": "Total number of tokens used (input + output)." } }, "required": [ "type", - "response_id", - "delta", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.audio.transcript.delta", - "group": "responses", - "example": "{\n \"type\": \"response.audio.transcript.delta\",\n \"response_id\": \"resp_123\",\n \"delta\": \" ... partial transcript ... \",\n \"sequence_number\": 1\n}\n" - } + "input_tokens", + "output_tokens", + "total_tokens" + ] }, - "ResponseAudioTranscriptDoneEvent": { + "TranscriptionChunkingStrategy": { "type": "object", - "description": "Emitted when the full audio transcript is completed.", - "properties": { - "type": { + "description": "Controls how the audio is cut into chunks. When set to `\"auto\"`, the\nserver first normalizes loudness and then uses voice activity detection (VAD) to\nchoose boundaries. `server_vad` object can be provided to tweak VAD detection\nparameters manually. If unset, the audio is transcribed as a single block. ", + "oneOf": [ + { "type": "string", - "description": "The type of the event. Always `response.audio.transcript.done`.\n", "enum": [ - "response.audio.transcript.done" + "auto" ], + "description": "Automatically set chunking parameters based on the audio. Must be set to `\"auto\"`.\n", "x-stainless-const": true }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + { + "$ref": "#/components/schemas/VadConfig" } - }, - "required": [ - "type", - "response_id", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.audio.transcript.done", - "group": "responses", - "example": "{\n \"type\": \"response.audio.transcript.done\",\n \"response_id\": \"resp_123\",\n \"sequence_number\": 1\n}\n" - } + ] }, - "ResponseCodeInterpreterCallCodeDeltaEvent": { + "TranscriptionDiarizedSegment": { "type": "object", - "description": "Emitted when a partial code snippet is streamed by the code interpreter.", + "description": "A segment of diarized transcript text with speaker metadata.", "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.code_interpreter_call_code.delta`.", + "description": "The type of the segment. Always `transcript.text.segment`.\n", "enum": [ - "response.code_interpreter_call_code.delta" + "transcript.text.segment" ], "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response for which the code is being streamed." - }, - "item_id": { + "id": { "type": "string", - "description": "The unique identifier of the code interpreter tool call item." + "description": "Unique identifier for the segment." }, - "delta": { + "start": { + "type": "number", + "format": "double", + "description": "Start timestamp of the segment in seconds." + }, + "end": { + "type": "number", + "format": "double", + "description": "End timestamp of the segment in seconds." + }, + "text": { "type": "string", - "description": "The partial code snippet being streamed by the code interpreter." + "description": "Transcript text for this segment." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event, used to order streaming events." + "speaker": { + "type": "string", + "description": "Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...).\n" } }, "required": [ "type", - "output_index", - "item_id", - "delta", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.code_interpreter_call_code.delta", - "group": "responses", - "example": "{\n \"type\": \"response.code_interpreter_call_code.delta\",\n \"output_index\": 0,\n \"item_id\": \"ci_12345\",\n \"delta\": \"print('Hello, world')\",\n \"sequence_number\": 1\n}\n" - } + "id", + "start", + "end", + "text", + "speaker" + ] }, - "ResponseCodeInterpreterCallCodeDoneEvent": { + "TranscriptionInclude": { + "type": "string", + "enum": [ + "logprobs" + ] + }, + "TranscriptionLanguage": { "type": "object", - "description": "Emitted when the code snippet is finalized by the code interpreter.", + "description": "A language detected in transcribed audio.", "properties": { - "type": { + "code": { "type": "string", - "description": "The type of the event. Always `response.code_interpreter_call_code.done`.", - "enum": [ - "response.code_interpreter_call_code.done" - ], - "x-stainless-const": true + "description": "The code of a language detected in the audio." + } + }, + "required": [ + "code" + ] + }, + "TranscriptionSegment": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Unique identifier of the segment." }, - "output_index": { + "seek": { "type": "integer", - "description": "The index of the output item in the response for which the code is finalized." + "description": "Seek offset of the segment." }, - "item_id": { + "start": { + "type": "number", + "format": "double", + "description": "Start time of the segment in seconds." + }, + "end": { + "type": "number", + "format": "double", + "description": "End time of the segment in seconds." + }, + "text": { "type": "string", - "description": "The unique identifier of the code interpreter tool call item." + "description": "Text content of the segment." }, - "code": { + "tokens": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "Array of token IDs for the text content." + }, + "temperature": { + "type": "number", + "format": "float", + "description": "Temperature parameter used for generating the segment." + }, + "avg_logprob": { + "type": "number", + "format": "float", + "description": "Average logprob of the segment. If the value is lower than -1, consider the logprobs failed." + }, + "compression_ratio": { + "type": "number", + "format": "float", + "description": "Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed." + }, + "no_speech_prob": { + "type": "number", + "format": "float", + "description": "Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent." + } + }, + "required": [ + "id", + "seek", + "start", + "end", + "text", + "tokens", + "temperature", + "avg_logprob", + "compression_ratio", + "no_speech_prob" + ] + }, + "TranscriptionWord": { + "type": "object", + "properties": { + "word": { "type": "string", - "description": "The final code snippet output by the code interpreter." + "description": "The text content of the word." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event, used to order streaming events." + "start": { + "type": "number", + "format": "double", + "description": "Start time of the word in seconds." + }, + "end": { + "type": "number", + "format": "double", + "description": "End time of the word in seconds." } }, "required": [ - "type", - "output_index", - "item_id", - "code", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.code_interpreter_call_code.done", - "group": "responses", - "example": "{\n \"type\": \"response.code_interpreter_call_code.done\",\n \"output_index\": 3,\n \"item_id\": \"ci_12345\",\n \"code\": \"print('done')\",\n \"sequence_number\": 1\n}\n" - } + "word", + "start", + "end" + ] }, - "ResponseCodeInterpreterCallCompletedEvent": { + "TruncationObject": { "type": "object", - "description": "Emitted when the code interpreter call is completed.", + "title": "Thread Truncation Controls", + "description": "Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.", "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.code_interpreter_call.completed`.", + "description": "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.", "enum": [ - "response.code_interpreter_call.completed" - ], - "x-stainless-const": true - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response for which the code interpreter call is completed." + "auto", + "last_messages" + ] }, - "item_id": { + "last_messages": { + "anyOf": [ + { + "type": "integer", + "description": "The number of most recent messages from the thread when constructing the context for the run.", + "minimum": 1 + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type" + ] + }, + "UpdateGroupBody": { + "type": "object", + "description": "Request payload for updating the details of an existing group.", + "properties": { + "name": { "type": "string", - "description": "The unique identifier of the code interpreter tool call item." - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event, used to order streaming events." + "description": "New display name for the group.", + "minLength": 1, + "maxLength": 255 } }, "required": [ - "type", - "output_index", - "item_id", - "sequence_number" + "name" ], "x-oaiMeta": { - "name": "response.code_interpreter_call.completed", - "group": "responses", - "example": "{\n \"type\": \"response.code_interpreter_call.completed\",\n \"output_index\": 5,\n \"item_id\": \"ci_12345\",\n \"sequence_number\": 1\n}\n" + "example": "{\n \"name\": \"Escalations\"\n}\n" } }, - "ResponseCodeInterpreterCallInProgressEvent": { + "UpdateOrganizationDataRetentionBody": { "type": "object", - "description": "Emitted when a code interpreter call is in progress.", + "description": "Parameters for updating organization data retention controls.", "properties": { - "type": { + "retention_type": { "type": "string", - "description": "The type of the event. Always `response.code_interpreter_call.in_progress`.", "enum": [ - "response.code_interpreter_call.in_progress" + "zero_data_retention", + "modified_abuse_monitoring", + "enhanced_zero_data_retention", + "enhanced_modified_abuse_monitoring" ], - "x-stainless-const": true - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response for which the code interpreter call is in progress." - }, - "item_id": { + "description": "The desired organization data retention type." + } + }, + "required": [ + "retention_type" + ] + }, + "UpdateProjectDataRetentionBody": { + "type": "object", + "description": "Parameters for updating project data retention controls.", + "properties": { + "retention_type": { "type": "string", - "description": "The unique identifier of the code interpreter tool call item." + "enum": [ + "organization_default", + "none", + "zero_data_retention", + "modified_abuse_monitoring", + "enhanced_zero_data_retention", + "enhanced_modified_abuse_monitoring" + ], + "description": "The desired project data retention type." + } + }, + "required": [ + "retention_type" + ] + }, + "UpdateProjectServiceAccountBody": { + "type": "object", + "description": "Parameters for updating a project service account.", + "properties": { + "name": { + "type": "string", + "description": "The updated service account name." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event, used to order streaming events." + "role": { + "type": "string", + "enum": [ + "member", + "owner" + ], + "description": "The updated service account role." + } + } + }, + "UpdateVectorStoreFileAttributesRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "attributes": { + "$ref": "#/components/schemas/VectorStoreFileAttributes" } }, "required": [ - "type", - "output_index", - "item_id", - "sequence_number" + "attributes" ], "x-oaiMeta": { - "name": "response.code_interpreter_call.in_progress", - "group": "responses", - "example": "{\n \"type\": \"response.code_interpreter_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"ci_12345\",\n \"sequence_number\": 1\n}\n" + "name": "Update vector store file attributes request" } }, - "ResponseCodeInterpreterCallInterpretingEvent": { + "UpdateVectorStoreRequest": { "type": "object", - "description": "Emitted when the code interpreter is actively interpreting the code snippet.", + "additionalProperties": false, "properties": { - "type": { + "name": { + "description": "The name of the vector store.", + "type": [ + "string", + "null" + ] + }, + "expires_after": { + "allOf": [ + { + "$ref": "#/components/schemas/VectorStoreExpirationAfter" + }, + { + "nullable": true + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + } + } + }, + "UpdateVoiceConsentRequest": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { "type": "string", - "description": "The type of the event. Always `response.code_interpreter_call.interpreting`.", - "enum": [ - "response.code_interpreter_call.interpreting" - ], - "x-stainless-const": true + "description": "The updated label for this consent recording." + } + }, + "required": [ + "name" + ] + }, + "Upload": { + "type": "object", + "title": "Upload", + "description": "The Upload object can accept byte chunks in the form of Parts.\n", + "properties": { + "id": { + "type": "string", + "description": "The Upload unique identifier, which can be referenced in API endpoints." }, - "output_index": { + "created_at": { "type": "integer", - "description": "The index of the output item in the response for which the code interpreter is interpreting code." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the Upload was created." + }, + "filename": { + "type": "string", + "description": "The name of the file to be uploaded." + }, + "bytes": { + "type": "integer", + "description": "The intended number of bytes to be uploaded." + }, + "purpose": { + "type": "string", + "description": "The intended purpose of the file. [Please refer here](https://developers.openai.com/api/reference/resources/files#%28resource%29%20files%20%3E%20%28model%29%20file_object%20%3E%20%28schema%29%20%3E%20%28property%29%20purpose) for acceptable values." }, - "item_id": { + "status": { "type": "string", - "description": "The unique identifier of the code interpreter tool call item." + "description": "The status of the Upload.", + "enum": [ + "pending", + "completed", + "cancelled", + "expired" + ] }, - "sequence_number": { + "expires_at": { "type": "integer", - "description": "The sequence number of this event, used to order streaming events." - } - }, - "required": [ - "type", - "output_index", - "item_id", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.code_interpreter_call.interpreting", - "group": "responses", - "example": "{\n \"type\": \"response.code_interpreter_call.interpreting\",\n \"output_index\": 4,\n \"item_id\": \"ci_12345\",\n \"sequence_number\": 1\n}\n" - } - }, - "ResponseCompletedEvent": { - "type": "object", - "description": "Emitted when the model response is complete.", - "properties": { - "type": { + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the Upload will expire." + }, + "object": { "type": "string", - "description": "The type of the event. Always `response.completed`.\n", + "description": "The object type, which is always \"upload\".", "enum": [ - "response.completed" + "upload" ], "x-stainless-const": true }, - "response": { - "$ref": "#/components/schemas/Response", - "description": "Properties of the completed response.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number for this event." + "file": { + "description": "The ready File object after the Upload is completed.", + "anyOf": [ + { + "$ref": "#/components/schemas/OpenAIFile" + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "response", - "sequence_number" + "bytes", + "created_at", + "expires_at", + "filename", + "id", + "purpose", + "status" ], "x-oaiMeta": { - "name": "response.completed", - "group": "responses", - "example": "{\n \"type\": \"response.completed\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"created_at\": 1740855869,\n \"status\": \"completed\",\n \"completed_at\": 1740855870,\n \"error\": null,\n \"incomplete_details\": null,\n \"input\": [],\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"id\": \"msg_123\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 0,\n \"output_tokens\": 0,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 0\n },\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" + "name": "The upload object", + "example": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"completed\",\n \"expires_at\": 1719127296,\n \"file\": {\n \"id\": \"file-xyz321\",\n \"object\": \"file\",\n \"bytes\": 2147483648,\n \"created_at\": 1719186911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"processed\"\n }\n}\n" } }, - "ResponseConfigurationUpdate": { + "UploadCertificateRequest": { "type": "object", - "description": "A configuration update that applies to subsequent responses until it is\nreplaced by another configuration update.\n", "properties": { - "id": { + "name": { "type": "string", - "description": "The unique ID of the configuration update item.", - "example": "cnfu_123" + "description": "An optional name for the certificate" }, - "type": { + "certificate": { "type": "string", - "enum": [ - "configuration_update" - ], - "description": "The item type. Always `configuration_update`.", - "default": "configuration_update", - "x-stainless-const": true - }, - "reasoning": { - "type": "object", - "description": "The reasoning configuration applied by this update.", - "properties": { - "effort": { - "$ref": "#/components/schemas/ReasoningEffort", - "description": "The reasoning effort used for subsequent responses until another\nconfiguration update replaces it.\n" - } - } + "description": "The certificate content in PEM format" } }, "required": [ - "id", - "type" + "certificate" ] }, - "ResponseConfigurationUpdateItemParam": { + "UploadPart": { "type": "object", - "description": "An update to the conversation's response configuration. The configuration\nremains in effect for subsequent responses until it is replaced by another\nconfiguration update.\n", + "title": "UploadPart", + "description": "The upload Part represents a chunk of bytes we can add to an Upload object.\n", "properties": { "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of the configuration update item.", - "example": "cnfu_123" - }, - { - "type": "null" - } - ] + "type": "string", + "description": "The upload Part unique identifier, which can be referenced in API endpoints." }, - "type": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the Part was created." + }, + "upload_id": { + "type": "string", + "description": "The ID of the Upload object that this Part was added to." + }, + "object": { "type": "string", + "description": "The object type, which is always `upload.part`.", "enum": [ - "configuration_update" + "upload.part" ], - "description": "The item type. Always `configuration_update`.", - "default": "configuration_update", "x-stainless-const": true - }, - "reasoning": { - "type": "object", - "description": "Updates to reasoning configuration. Only effort is supported.", - "properties": { - "effort": { - "$ref": "#/components/schemas/ReasoningEffort", - "description": "The reasoning effort to use for subsequent responses until another\nconfiguration update replaces it.\n" - } - } } }, "required": [ - "type" - ] + "created_at", + "id", + "object", + "upload_id" + ], + "x-oaiMeta": { + "name": "The upload part object", + "example": "{\n \"id\": \"part_def456\",\n \"object\": \"upload.part\",\n \"created_at\": 1719186911,\n \"upload_id\": \"upload_abc123\"\n}\n" + } }, - "ResponseContentPartAddedEvent": { + "UsageAudioSpeechesResult": { "type": "object", - "description": "Emitted when a new content part is added.", + "description": "The aggregated audio speeches usage details of the specific time bucket.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.content_part.added`.\n", "enum": [ - "response.content_part.added" + "organization.usage.audio_speeches.result" ], "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the output item that the content part was added to.\n" - }, - "output_index": { + "characters": { "type": "integer", - "description": "The index of the output item that the content part was added to.\n" + "description": "The number of characters processed." }, - "content_index": { + "num_model_requests": { "type": "integer", - "description": "The index of the content part that was added.\n" + "description": "The count of requests made to the model." }, - "part": { - "$ref": "#/components/schemas/OutputContent", - "description": "The content part that was added.\n" + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + }, + { + "type": "null" + } + ] }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "user_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "api_key_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "model": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "item_id", - "output_index", - "content_index", - "part", - "sequence_number" + "object", + "characters", + "num_model_requests" ], "x-oaiMeta": { - "name": "response.content_part.added", - "group": "responses", - "example": "{\n \"type\": \"response.content_part.added\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"output_text\",\n \"text\": \"\",\n \"annotations\": []\n },\n \"sequence_number\": 1\n}\n" + "name": "Audio speeches usage object", + "example": "{\n \"object\": \"organization.usage.audio_speeches.result\",\n \"characters\": 45,\n \"num_model_requests\": 1,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"tts-1\"\n}\n" } }, - "ResponseContentPartDoneEvent": { + "UsageAudioTranscriptionsResult": { "type": "object", - "description": "Emitted when a content part is done.", + "description": "The aggregated audio transcriptions usage details of the specific time bucket.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.content_part.done`.\n", "enum": [ - "response.content_part.done" + "organization.usage.audio_transcriptions.result" ], "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the output item that the content part was added to.\n" - }, - "output_index": { + "seconds": { "type": "integer", - "description": "The index of the output item that the content part was added to.\n" + "format": "int64", + "description": "The number of seconds processed." }, - "content_index": { + "num_model_requests": { "type": "integer", - "description": "The index of the content part that is done.\n" + "description": "The count of requests made to the model." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + }, + { + "type": "null" + } + ] }, - "part": { - "$ref": "#/components/schemas/OutputContent", - "description": "The content part that is done.\n" + "user_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "api_key_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "model": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "item_id", - "output_index", - "content_index", - "part", - "sequence_number" + "object", + "seconds", + "num_model_requests" ], "x-oaiMeta": { - "name": "response.content_part.done", - "group": "responses", - "example": "{\n \"type\": \"response.content_part.done\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"sequence_number\": 1,\n \"part\": {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": []\n }\n}\n" + "name": "Audio transcriptions usage object", + "example": "{\n \"object\": \"organization.usage.audio_transcriptions.result\",\n \"seconds\": 10,\n \"num_model_requests\": 1,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"tts-1\"\n}\n" } }, - "ResponseCreatedEvent": { + "UsageCodeInterpreterSessionsResult": { "type": "object", - "description": "An event that is emitted when a response is created.\n", + "description": "The aggregated code interpreter sessions usage details of the specific time bucket.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.created`.\n", "enum": [ - "response.created" + "organization.usage.code_interpreter_sessions.result" ], "x-stainless-const": true }, - "response": { - "$ref": "#/components/schemas/Response", - "description": "The response that was created.\n" - }, - "sequence_number": { + "num_sessions": { "type": "integer", - "description": "The sequence number for this event." + "description": "The number of code interpreter sessions." + }, + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "response", - "sequence_number" + "object", + "num_sessions" ], "x-oaiMeta": { - "name": "response.created", - "group": "responses", - "example": "{\n \"type\": \"response.created\",\n \"response\": {\n \"id\": \"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c\",\n \"object\": \"response\",\n \"created_at\": 1741487325,\n \"status\": \"in_progress\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" + "name": "Code interpreter sessions usage object", + "example": "{\n \"object\": \"organization.usage.code_interpreter_sessions.result\",\n \"num_sessions\": 1,\n \"project_id\": \"proj_abc\"\n}\n" } }, - "ResponseCustomToolCallInputDeltaEvent": { - "title": "ResponseCustomToolCallInputDelta", + "UsageCompletionsResult": { "type": "object", - "description": "Event representing a delta (partial update) to the input of a custom tool call.\n", + "description": "The aggregated completions usage details of the specific time bucket.", "properties": { - "type": { + "api_source": { + "description": "When grouped by `api_source`, `agents_api` identifies attributed Agents API activity and `unlabeled` includes all records without published source attribution, including historical and unknown origins. Unlabeled does not imply direct API usage. Without source grouping, this field is null.", + "anyOf": [ + { + "type": "string", + "enum": [ + "agents_api", + "unlabeled" + ] + }, + { + "type": "null" + } + ] + }, + "object": { "type": "string", "enum": [ - "response.custom_tool_call_input.delta" + "organization.usage.completions.result" ], - "description": "The event type identifier.", "x-stainless-const": true }, - "sequence_number": { + "input_tokens": { "type": "integer", - "description": "The sequence number of this event." + "description": "The aggregated number of input tokens used, including cached and cache-write tokens. This includes text, audio, and image tokens. For customers subscribed to Scale Tier, this includes Scale Tier tokens." }, - "output_index": { + "input_cached_tokens": { "type": "integer", - "description": "The index of the output this delta applies to." + "description": "The aggregated number of cached input tokens used across text, audio, and image inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens." }, - "item_id": { - "type": "string", - "description": "Unique identifier for the API item associated with this event." + "input_cache_write_tokens": { + "type": "integer", + "description": "The aggregated number of input tokens written to the cache across 30-minute and 12-hour retention periods." }, - "delta": { - "type": "string", - "description": "The incremental input data (delta) for the custom tool call." - } - }, - "required": [ - "type", - "output_index", - "item_id", - "delta", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.custom_tool_call_input.delta", - "group": "responses", - "example": "{\n \"type\": \"response.custom_tool_call_input.delta\",\n \"output_index\": 0,\n \"item_id\": \"ctc_1234567890abcdef\",\n \"delta\": \"partial input text\"\n}\n" - } - }, - "ResponseCustomToolCallInputDoneEvent": { - "title": "ResponseCustomToolCallInputDone", - "type": "object", - "description": "Event indicating that input for a custom tool call is complete.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "response.custom_tool_call_input.done" - ], - "description": "The event type identifier.", - "x-stainless-const": true + "input_cache_write_30m_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of input tokens written to the cache with a 30-minute retention period. May be absent or null for older responses." + }, + { + "type": "null" + } + ] }, - "sequence_number": { + "input_cache_write_12h_tokens": { "type": "integer", - "description": "The sequence number of this event." + "description": "The aggregated number of input tokens written to the cache with a 12-hour retention period." }, - "output_index": { + "input_uncached_tokens": { "type": "integer", - "description": "The index of the output this event applies to." + "description": "The aggregated number of uncached input tokens used across text, audio, and image inputs, excluding cache-write tokens." }, - "item_id": { - "type": "string", - "description": "Unique identifier for the API item associated with this event." + "output_tokens": { + "type": "integer", + "description": "The aggregated number of output tokens used across text, audio, and image outputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens." }, - "input": { - "type": "string", - "description": "The complete input data for the custom tool call." - } - }, - "required": [ - "type", - "output_index", - "item_id", - "input", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.custom_tool_call_input.done", - "group": "responses", - "example": "{\n \"type\": \"response.custom_tool_call_input.done\",\n \"output_index\": 0,\n \"item_id\": \"ctc_1234567890abcdef\",\n \"input\": \"final complete input text\"\n}\n" - } - }, - "ResponseError": { - "anyOf": [ - { - "type": "object", - "description": "An error object returned when the model fails to generate a Response.\n", - "properties": { - "code": { - "$ref": "#/components/schemas/ResponseErrorCode" + "input_text_tokens": { + "type": "integer", + "description": "The aggregated number of uncached text input tokens used, excluding cache-write tokens." + }, + "output_text_tokens": { + "type": "integer", + "description": "The aggregated number of text output tokens used." + }, + "input_cached_text_tokens": { + "type": "integer", + "description": "The aggregated number of cached text input tokens used." + }, + "input_audio_tokens": { + "type": "integer", + "description": "The aggregated number of uncached audio input tokens used." + }, + "input_cached_audio_tokens": { + "type": "integer", + "description": "The aggregated number of cached audio input tokens used." + }, + "output_audio_tokens": { + "type": "integer", + "description": "The aggregated number of audio output tokens used." + }, + "input_image_tokens": { + "type": "integer", + "description": "The aggregated number of uncached image input tokens used." + }, + "input_cached_image_tokens": { + "type": "integer", + "description": "The aggregated number of cached image input tokens used." + }, + "output_image_tokens": { + "type": "integer", + "description": "The aggregated number of image output tokens used." + }, + "num_model_requests": { + "type": "integer", + "description": "The count of requests made to the model." + }, + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." }, - "message": { + { + "type": "null" + } + ] + }, + "user_id": { + "anyOf": [ + { "type": "string", - "description": "A human-readable description of the error.\n" + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." }, - "misalignment": { - "$ref": "#/components/schemas/MisalignmentErrorDetailsResource" + { + "type": "null" } - }, - "required": [ - "code", - "message" ] }, - { - "type": "null" - } - ] - }, - "ResponseErrorCode": { - "type": "string", - "description": "The error code for the response.\n", - "enum": [ - "server_error", - "rate_limit_exceeded", - "invalid_prompt", - "data_residency_mismatch", - "bio_policy", - "misalignment_policy_violation", - "vector_store_timeout", - "invalid_image", - "invalid_image_format", - "invalid_base64_image", - "invalid_image_url", - "image_too_large", - "image_too_small", - "image_parse_error", - "image_content_policy_violation", - "invalid_image_mode", - "image_file_too_large", - "unsupported_image_media_type", - "empty_image_file", - "failed_to_download_image", - "image_file_not_found" - ] - }, - "ResponseErrorEvent": { - "type": "object", - "description": "Emitted when an error occurs.", - "properties": { - "type": { - "type": "string", - "description": "The type of the event. Always `error`.\n", - "enum": [ - "error" - ], - "x-stainless-const": true + "api_key_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + }, + { + "type": "null" + } + ] }, - "code": { + "model": { "anyOf": [ { "type": "string", - "description": "The error code.\n" + "description": "When `group_by=model`, this field provides the model name of the grouped usage result." }, { "type": "null" } ] }, - "message": { - "type": "string", - "description": "The error message.\n" + "batch": { + "anyOf": [ + { + "type": "boolean", + "description": "When `group_by=batch`, this field tells whether the grouped usage result is batch or not." + }, + { + "type": "null" + } + ] }, - "param": { + "service_tier": { "anyOf": [ { "type": "string", - "description": "The error parameter.\n" + "description": "When `group_by=service_tier`, this field provides the service tier of the grouped usage result." }, { "type": "null" } ] - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." } }, "required": [ - "type", - "code", - "message", - "param", - "sequence_number" + "object", + "input_tokens", + "output_tokens", + "num_model_requests" ], "x-oaiMeta": { - "name": "error", - "group": "responses", - "example": "{\n \"type\": \"error\",\n \"code\": \"ERR_SOMETHING\",\n \"message\": \"Something went wrong\",\n \"param\": null,\n \"sequence_number\": 1\n}\n" + "name": "Completions usage object", + "example": "{\n \"object\": \"organization.usage.completions.result\",\n \"input_tokens\": 5000,\n \"input_cached_tokens\": 1800,\n \"input_cache_write_tokens\": 200,\n \"input_cache_write_30m_tokens\": 150,\n \"input_cache_write_12h_tokens\": 50,\n \"input_uncached_tokens\": 3000,\n \"output_tokens\": 1000,\n \"input_text_tokens\": 2500,\n \"output_text_tokens\": 800,\n \"input_cached_text_tokens\": 1500,\n \"input_audio_tokens\": 300,\n \"input_cached_audio_tokens\": 100,\n \"output_audio_tokens\": 100,\n \"input_image_tokens\": 200,\n \"input_cached_image_tokens\": 200,\n \"output_image_tokens\": 100,\n \"num_model_requests\": 5,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"gpt-6-astra\",\n \"batch\": false,\n \"service_tier\": \"default\"\n}\n" } }, - "ResponseFailedEvent": { + "UsageEmbeddingsResult": { "type": "object", - "description": "An event that is emitted when a response fails.\n", + "description": "The aggregated embeddings usage details of the specific time bucket.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.failed`.\n", "enum": [ - "response.failed" + "organization.usage.embeddings.result" ], "x-stainless-const": true }, - "sequence_number": { + "input_tokens": { "type": "integer", - "description": "The sequence number of this event." + "description": "The aggregated number of input tokens used." }, - "response": { - "$ref": "#/components/schemas/Response", - "description": "The response that failed.\n" + "num_model_requests": { + "type": "integer", + "description": "The count of requests made to the model." + }, + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "user_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "api_key_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "model": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "response", - "sequence_number" + "object", + "input_tokens", + "num_model_requests" ], "x-oaiMeta": { - "name": "response.failed", - "group": "responses", - "example": "{\n \"type\": \"response.failed\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"created_at\": 1740855869,\n \"status\": \"failed\",\n \"completed_at\": null,\n \"error\": {\n \"code\": \"server_error\",\n \"message\": \"The model failed to generate a response.\"\n },\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n }\n}\n" + "name": "Embeddings usage object", + "example": "{\n \"object\": \"organization.usage.embeddings.result\",\n \"input_tokens\": 20,\n \"num_model_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"text-embedding-ada-002-v2\"\n}\n" } }, - "ResponseFileSearchCallCompletedEvent": { + "UsageFileSearchCallsResult": { "type": "object", - "description": "Emitted when a file search call is completed (results found).", + "description": "The aggregated file search calls usage details of the specific time bucket.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.file_search_call.completed`.\n", "enum": [ - "response.file_search_call.completed" + "organization.usage.file_searches.result" ], "x-stainless-const": true }, - "output_index": { + "num_requests": { "type": "integer", - "description": "The index of the output item that the file search call is initiated.\n" + "description": "The count of file search calls." }, - "item_id": { - "type": "string", - "description": "The ID of the output item that the file search call is initiated.\n" + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + }, + { + "type": "null" + } + ] }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "user_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "api_key_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "vector_store_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "output_index", - "item_id", - "sequence_number" + "object", + "num_requests" ], "x-oaiMeta": { - "name": "response.file_search_call.completed", - "group": "responses", - "example": "{\n \"type\": \"response.file_search_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"fs_123\",\n \"sequence_number\": 1\n}\n" + "name": "File search calls usage object", + "example": "{\n \"object\": \"organization.usage.file_searches.result\",\n \"num_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"vector_store_id\": \"vs_abc\"\n}\n" } }, - "ResponseFileSearchCallInProgressEvent": { + "UsageImagesResult": { "type": "object", - "description": "Emitted when a file search call is initiated.", + "description": "The aggregated images usage details of the specific time bucket.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.file_search_call.in_progress`.\n", "enum": [ - "response.file_search_call.in_progress" + "organization.usage.images.result" ], "x-stainless-const": true }, - "output_index": { + "images": { "type": "integer", - "description": "The index of the output item that the file search call is initiated.\n" - }, - "item_id": { - "type": "string", - "description": "The ID of the output item that the file search call is initiated.\n" + "description": "The number of images processed." }, - "sequence_number": { + "num_model_requests": { "type": "integer", - "description": "The sequence number of this event." + "description": "The count of requests made to the model." + }, + "source": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`." + }, + { + "type": "null" + } + ] + }, + "size": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=size`, this field provides the image size of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "user_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "api_key_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "model": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "output_index", - "item_id", - "sequence_number" + "object", + "images", + "num_model_requests" ], "x-oaiMeta": { - "name": "response.file_search_call.in_progress", - "group": "responses", - "example": "{\n \"type\": \"response.file_search_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"fs_123\",\n \"sequence_number\": 1\n}\n" + "name": "Images usage object", + "example": "{\n \"object\": \"organization.usage.images.result\",\n \"images\": 2,\n \"num_model_requests\": 2,\n \"size\": \"1024x1024\",\n \"source\": \"image.generation\",\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"dall-e-3\"\n}\n" } }, - "ResponseFileSearchCallSearchingEvent": { + "UsageModerationsResult": { "type": "object", - "description": "Emitted when a file search is currently searching.", + "description": "The aggregated moderations usage details of the specific time bucket.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.file_search_call.searching`.\n", "enum": [ - "response.file_search_call.searching" + "organization.usage.moderations.result" ], "x-stainless-const": true }, - "output_index": { + "input_tokens": { "type": "integer", - "description": "The index of the output item that the file search call is searching.\n" - }, - "item_id": { - "type": "string", - "description": "The ID of the output item that the file search call is initiated.\n" + "description": "The aggregated number of input tokens used." }, - "sequence_number": { + "num_model_requests": { "type": "integer", - "description": "The sequence number of this event." - } - }, - "required": [ - "type", - "output_index", - "item_id", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.file_search_call.searching", - "group": "responses", - "example": "{\n \"type\": \"response.file_search_call.searching\",\n \"output_index\": 0,\n \"item_id\": \"fs_123\",\n \"sequence_number\": 1\n}\n" - } - }, - "ResponseFormatJsonObject": { - "type": "object", - "title": "JSON object", - "description": "JSON object response format. An older method of generating JSON responses.\nUsing `json_schema` is recommended for models that support it. Note that the\nmodel will not generate JSON without a system or user message instructing it\nto do so.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of response format being defined. Always `json_object`.", - "enum": [ - "json_object" - ], - "x-stainless-const": true - } - }, - "required": [ - "type" - ] - }, - "ResponseFormatJsonSchema": { - "type": "object", - "title": "JSON schema", - "description": "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs).\n", - "properties": { - "type": { - "type": "string", - "description": "The type of response format being defined. Always `json_schema`.", - "enum": [ - "json_schema" - ], - "x-stainless-const": true + "description": "The count of requests made to the model." }, - "json_schema": { - "type": "object", - "title": "JSON schema", - "description": "Structured Outputs configuration options, including a JSON Schema.\n", - "properties": { - "description": { + "project_id": { + "anyOf": [ + { "type": "string", - "description": "A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n" + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." }, - "name": { + { + "type": "null" + } + ] + }, + "user_id": { + "anyOf": [ + { "type": "string", - "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n" + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." }, - "schema": { - "$ref": "#/components/schemas/ResponseFormatJsonSchemaSchema" + { + "type": "null" + } + ] + }, + "api_key_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." }, - "strict": { - "anyOf": [ - { - "type": "boolean", - "default": false, - "description": "Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](https://developers.openai.com/api/docs/guides/structured-outputs).\n" - }, - { - "type": "null" - } - ] + { + "type": "null" + } + ] + }, + "model": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + }, + { + "type": "null" } - }, - "required": [ - "name" ] } }, "required": [ - "type", - "json_schema" - ] - }, - "ResponseFormatJsonSchemaSchema": { - "type": "object", - "title": "JSON schema", - "description": "The schema for the response format, described as a JSON Schema object.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n", - "additionalProperties": true - }, - "ResponseFormatText": { - "type": "object", - "title": "Text", - "description": "Default response format. Used to generate text responses.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of response format being defined. Always `text`.", - "enum": [ - "text" - ], - "x-stainless-const": true - } - }, - "required": [ - "type" - ] + "object", + "input_tokens", + "num_model_requests" + ], + "x-oaiMeta": { + "name": "Moderations usage object", + "example": "{\n \"object\": \"organization.usage.moderations.result\",\n \"input_tokens\": 20,\n \"num_model_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"text-moderation\"\n}\n" + } }, - "ResponseFormatTextGrammar": { + "UsageResponse": { "type": "object", - "title": "Text grammar", - "description": "A custom grammar for the model to follow when generating text.\nLearn more in the [custom grammars guide](https://developers.openai.com/api/docs/guides/function-calling#context-free-grammars).\n", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of response format being defined. Always `grammar`.", "enum": [ - "grammar" + "page" ], "x-stainless-const": true }, - "grammar": { - "type": "string", - "description": "The custom grammar for the model to follow." + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UsageTimeBucket" + } + }, + "has_more": { + "type": "boolean" + }, + "next_page": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "grammar" + "object", + "data", + "has_more", + "next_page" ] }, - "ResponseFormatTextPython": { + "UsageTimeBucket": { "type": "object", - "title": "Python grammar", - "description": "Configure the model to generate valid Python code. See the\n[custom grammars guide](https://developers.openai.com/api/docs/guides/function-calling#context-free-grammars) for more details.\n", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of response format being defined. Always `python`.", "enum": [ - "python" + "bucket" ], "x-stainless-const": true + }, + "start_time": { + "type": "integer" + }, + "end_time": { + "type": "integer" + }, + "results": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/UsageCompletionsResult" + }, + { + "$ref": "#/components/schemas/UsageEmbeddingsResult" + }, + { + "$ref": "#/components/schemas/UsageModerationsResult" + }, + { + "$ref": "#/components/schemas/UsageImagesResult" + }, + { + "$ref": "#/components/schemas/UsageAudioSpeechesResult" + }, + { + "$ref": "#/components/schemas/UsageAudioTranscriptionsResult" + }, + { + "$ref": "#/components/schemas/UsageVectorStoresResult" + }, + { + "$ref": "#/components/schemas/UsageCodeInterpreterSessionsResult" + }, + { + "$ref": "#/components/schemas/UsageFileSearchCallsResult" + }, + { + "$ref": "#/components/schemas/UsageWebSearchCallsResult" + }, + { + "$ref": "#/components/schemas/CostsResult" + } + ], + "discriminator": { + "propertyName": "object" + } + } } }, "required": [ - "type" + "object", + "start_time", + "end_time", + "results" ] }, - "ResponseFunctionCallArgumentsDeltaEvent": { + "UsageVectorStoresResult": { "type": "object", - "description": "Emitted when there is a partial function-call arguments delta.", + "description": "The aggregated vector stores usage details of the specific time bucket.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.function_call_arguments.delta`.\n", "enum": [ - "response.function_call_arguments.delta" + "organization.usage.vector_stores.result" ], "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the output item that the function-call arguments delta is added to.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item that the function-call arguments delta is added to.\n" - }, - "sequence_number": { + "usage_bytes": { "type": "integer", - "description": "The sequence number of this event." + "description": "The vector stores usage in bytes." }, - "delta": { - "type": "string", - "description": "The function-call arguments delta that is added.\n" + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "item_id", - "output_index", - "delta", - "sequence_number" + "object", + "usage_bytes" ], "x-oaiMeta": { - "name": "response.function_call_arguments.delta", - "group": "responses", - "example": "{\n \"type\": \"response.function_call_arguments.delta\",\n \"item_id\": \"item-abc\",\n \"output_index\": 0,\n \"delta\": \"{ \\\"arg\\\":\"\n \"sequence_number\": 1\n}\n" + "name": "Vector stores usage object", + "example": "{\n \"object\": \"organization.usage.vector_stores.result\",\n \"usage_bytes\": 1024,\n \"project_id\": \"proj_abc\"\n}\n" } }, - "ResponseFunctionCallArgumentsDoneEvent": { + "UsageWebSearchCallsResult": { "type": "object", - "description": "Emitted when function-call arguments are finalized.", + "description": "The aggregated web search calls usage details of the specific time bucket.", "properties": { - "type": { + "api_source": { + "description": "When grouped by `api_source`, `agents_api` identifies attributed Agents API activity and `unlabeled` includes all records without published source attribution, including historical and unknown origins. Unlabeled does not imply direct API usage. Without source grouping, this field is null.", + "anyOf": [ + { + "type": "string", + "enum": [ + "agents_api", + "unlabeled" + ] + }, + { + "type": "null" + } + ] + }, + "object": { "type": "string", "enum": [ - "response.function_call_arguments.done" + "organization.usage.web_searches.result" ], "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the item." - }, - "output_index": { + "num_model_requests": { "type": "integer", - "description": "The index of the output item." + "description": "The count of model requests." }, - "sequence_number": { + "num_requests": { "type": "integer", - "description": "The sequence number of this event." + "description": "The count of web search calls." }, - "arguments": { - "type": "string", - "description": "The function-call arguments." + "project_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "user_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "api_key_id": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "model": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + }, + { + "type": "null" + } + ] + }, + "context_level": { + "anyOf": [ + { + "type": "string", + "description": "When `group_by=context_level`, this field provides the search context size of the grouped usage result." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "item_id", - "output_index", - "arguments", - "sequence_number" + "object", + "num_model_requests", + "num_requests" ], "x-oaiMeta": { - "name": "response.function_call_arguments.done", - "group": "responses", - "example": "{\n \"type\": \"response.function_call_arguments.done\",\n \"item_id\": \"item-abc\",\n \"output_index\": 1,\n \"arguments\": \"{ \\\"arg\\\": 123 }\",\n \"sequence_number\": 1\n}\n" + "name": "Web search calls usage object", + "example": "{\n \"object\": \"organization.usage.web_searches.result\",\n \"num_model_requests\": 2,\n \"num_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"gpt-6-astra\",\n \"context_level\": \"medium\"\n}\n" } }, - "ResponseImageGenCallCompletedEvent": { + "User": { "type": "object", - "title": "ResponseImageGenCallCompletedEvent", - "description": "Emitted when an image generation tool call has completed and the final image is available.\n", + "description": "Represents an individual `user` within an organization.", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "response.image_generation_call.completed" + "organization.user" ], - "description": "The type of the event. Always 'response.image_generation_call.completed'.", + "description": "The object type, which is always `organization.user`", "x-stainless-const": true }, - "output_index": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The name of the user" + }, + "email": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The email address of the user" + }, + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "`owner` or `reader`" + }, + "added_at": { "type": "integer", - "description": "The index of the output item in the response's output array." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the user was added." }, - "sequence_number": { + "is_default": { + "type": "boolean", + "description": "Whether this is the organization's default user." + }, + "created": { "type": "integer", - "description": "The sequence number of this event." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the user was created." }, - "item_id": { - "type": "string", - "description": "The unique identifier of the image generation item being processed." - } - }, - "required": [ - "type", - "output_index", - "item_id", - "sequence_number" + "user": { + "type": "object", + "description": "Nested user details.", + "properties": { + "object": { + "type": "string", + "enum": [ + "user" + ], + "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "email": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "picture": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "enabled": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "banned": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "banned_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "object", + "id" + ] + }, + "is_service_account": { + "type": "boolean", + "description": "Whether the user is a service account." + }, + "is_scale_tier_authorized_purchaser": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "Whether the user is an authorized purchaser for Scale Tier." + }, + "is_scim_managed": { + "type": "boolean", + "description": "Whether the user is managed through SCIM." + }, + "api_key_last_used_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ], + "description": "The Unix timestamp (in seconds) of the user's last API key usage." + }, + "technical_level": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The technical level metadata for the user." + }, + "developer_persona": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The developer persona metadata for the user." + }, + "projects": { + "anyOf": [ + { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "x-stainless-const": true + }, + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + } + } + } + }, + "required": [ + "object", + "data" + ] + }, + { + "type": "null" + } + ], + "description": "Projects associated with the user, if included." + } + }, + "required": [ + "object", + "id", + "added_at" ], "x-oaiMeta": { - "name": "response.image_generation_call.completed", - "group": "responses", - "example": "{\n \"type\": \"response.image_generation_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"item-123\",\n \"sequence_number\": 1\n}\n" + "name": "The user object", + "example": "{\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" } }, - "ResponseImageGenCallGeneratingEvent": { + "UserDeleteResponse": { "type": "object", - "title": "ResponseImageGenCallGeneratingEvent", - "description": "Emitted when an image generation tool call is actively generating an image (intermediate state).\n", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "response.image_generation_call.generating" + "organization.user.deleted" ], - "description": "The type of the event. Always 'response.image_generation_call.generating'.", "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response's output array." - }, - "item_id": { - "type": "string", - "description": "The unique identifier of the image generation item being processed." + "id": { + "type": "string" }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the image generation item being processed." + "deleted": { + "type": "boolean" } }, "required": [ - "type", - "output_index", - "item_id", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.image_generation_call.generating", - "group": "responses", - "example": "{\n \"type\": \"response.image_generation_call.generating\",\n \"output_index\": 0,\n \"item_id\": \"item-123\",\n \"sequence_number\": 0\n}\n" - } + "object", + "id", + "deleted" + ] }, - "ResponseImageGenCallInProgressEvent": { + "UserListResource": { "type": "object", - "title": "ResponseImageGenCallInProgressEvent", - "description": "Emitted when an image generation tool call is in progress.\n", + "description": "Paginated list of user objects returned when inspecting group membership.", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "response.image_generation_call.in_progress" + "list" ], - "description": "The type of the event. Always 'response.image_generation_call.in_progress'.", + "description": "Always `list`.", "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response's output array." + "data": { + "type": "array", + "description": "Users in the current page.", + "items": { + "$ref": "#/components/schemas/GroupUser" + } }, - "item_id": { - "type": "string", - "description": "The unique identifier of the image generation item being processed." + "has_more": { + "type": "boolean", + "description": "Whether more users are available when paginating." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the image generation item being processed." + "next": { + "description": "Cursor to fetch the next page of results, or `null` when no further users are available.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "output_index", - "item_id", - "sequence_number" + "object", + "data", + "has_more", + "next" ], "x-oaiMeta": { - "name": "response.image_generation_call.in_progress", - "group": "responses", - "example": "{\n \"type\": \"response.image_generation_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"item-123\",\n \"sequence_number\": 0\n}\n" + "name": "Group user list", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" } }, - "ResponseImageGenCallPartialImageEvent": { + "UserListResponse": { "type": "object", - "title": "ResponseImageGenCallPartialImageEvent", - "description": "Emitted when a partial image is available during image generation streaming.\n", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "response.image_generation_call.partial_image" + "list" ], - "description": "The type of the event. Always 'response.image_generation_call.partial_image'.", "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response's output array." - }, - "item_id": { - "type": "string", - "description": "The unique identifier of the image generation item being processed." - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the image generation item being processed." - }, - "partial_image_index": { - "type": "integer", - "description": "0-based index for the partial image (backend is 1-based, but this is 0-based for the user)." - }, - "partial_image_b64": { - "type": "string", - "description": "Base64-encoded partial image data, suitable for rendering as an image." - }, - "size": { - "type": "string", - "description": "The image size that was used." + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } }, - "quality": { - "type": "string", - "description": "The image quality that was used." + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] }, - "background": { - "type": "string", - "description": "The background setting that was used." + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] }, - "output_format": { - "type": "string", - "description": "The output format that was used." + "has_more": { + "type": "boolean" } }, "required": [ - "type", - "output_index", - "item_id", - "sequence_number", - "partial_image_index", - "partial_image_b64" - ], - "x-oaiMeta": { - "name": "response.image_generation_call.partial_image", - "group": "responses", - "example": "{\n \"type\": \"response.image_generation_call.partial_image\",\n \"output_index\": 0,\n \"item_id\": \"item-123\",\n \"sequence_number\": 0,\n \"partial_image_index\": 0,\n \"partial_image_b64\": \"...\"\n}\n" - } + "object", + "data", + "has_more" + ] }, - "ResponseInProgressEvent": { + "UserRoleAssignment": { "type": "object", - "description": "Emitted when the response is in progress.", + "description": "Role assignment linking a user to a role.", "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.in_progress`.\n", "enum": [ - "response.in_progress" + "user.role" ], + "description": "Always `user.role`.", "x-stainless-const": true }, - "response": { - "$ref": "#/components/schemas/Response", - "description": "The response that is in progress.\n" + "user": { + "$ref": "#/components/schemas/User" }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "role": { + "$ref": "#/components/schemas/Role" } }, "required": [ - "type", - "response", - "sequence_number" + "object", + "user", + "role" ], "x-oaiMeta": { - "name": "response.in_progress", - "group": "responses", - "example": "{\n \"type\": \"response.in_progress\",\n \"response\": {\n \"id\": \"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c\",\n \"object\": \"response\",\n \"created_at\": 1741487325,\n \"status\": \"in_progress\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" + "name": "The user role object", + "example": "{\n \"object\": \"user.role\",\n \"user\": {\n \"object\": \"organization.user\",\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711470000\n },\n \"role\": {\n \"object\": \"role\",\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"description\": \"Allows managing organization groups\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false\n }\n}\n" } }, - "ResponseIncompleteEvent": { + "UserRoleUpdateRequest": { "type": "object", - "description": "An event that is emitted when a response finishes as incomplete.\n\nOver WebSocket, steering can finish a response with\n`response.incomplete_details.reason` set to `steered`, followed automatically\nby a successor `response.created` that commits the queued steering input.\n", "properties": { - "type": { - "type": "string", - "description": "The type of the event. Always `response.incomplete`.\n", - "enum": [ - "response.incomplete" + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } ], - "x-stainless-const": true + "description": "`owner` or `reader`" }, - "response": { - "$ref": "#/components/schemas/Response", - "description": "The response that was incomplete.\n" + "role_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Role ID to assign to the user." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "technical_level": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Technical level metadata." + }, + "developer_persona": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Developer persona metadata." } - }, - "required": [ - "type", - "response", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.incomplete", - "group": "responses", - "example": "{\n \"type\": \"response.incomplete\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"created_at\": 1740855869,\n \"status\": \"incomplete\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": {\n \"reason\": \"max_tokens\"\n },\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" } }, - "ResponseItemList": { + "VadConfig": { "type": "object", - "description": "A list of Response items.", + "additionalProperties": false, + "required": [ + "type" + ], "properties": { - "object": { + "type": { "type": "string", - "description": "The type of object returned, must be `list`.", "enum": [ - "list" + "server_vad" ], - "x-stainless-const": true - }, - "data": { - "type": "array", - "description": "A list of items used to generate this response.", - "items": { - "$ref": "#/components/schemas/ItemResource" - } + "description": "Must be set to `server_vad` to enable manual chunking using server side VAD." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more items available." + "prefix_padding_ms": { + "type": "integer", + "default": 300, + "description": "Amount of audio to include before the VAD detected speech (in \nmilliseconds).\n" }, - "first_id": { - "type": "string", - "description": "The ID of the first item in the list." + "silence_duration_ms": { + "type": "integer", + "default": 200, + "description": "Duration of silence to detect speech stop (in milliseconds).\nWith shorter values the model will respond more quickly, \nbut may jump in on short pauses from the user.\n" }, - "last_id": { - "type": "string", - "description": "The ID of the last item in the list." + "threshold": { + "type": "number", + "default": 0.5, + "description": "Sensitivity threshold (0.0 to 1.0) for voice activity detection. A \nhigher threshold will require louder audio to activate the model, and \nthus might perform better in noisy environments.\n" } - }, - "required": [ - "object", - "data", - "has_more", - "first_id", - "last_id" - ], - "x-oaiMeta": { - "name": "The input item list", - "group": "responses", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"msg_abc123\",\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Tell me a three sentence bedtime story about a unicorn.\"\n }\n ]\n }\n ],\n \"first_id\": \"msg_abc123\",\n \"last_id\": \"msg_abc123\",\n \"has_more\": false\n}\n" } }, - "ResponseLogProb": { + "ValidateGraderRequest": { "type": "object", - "description": "A logprob is the logarithmic probability that the model assigns to producing \na particular token at a given position in the sequence. Less-negative (higher) \nlogprob values indicate greater model confidence in that token choice.\n", + "title": "ValidateGraderRequest", "properties": { - "token": { - "description": "A possible text token.", - "type": "string" - }, - "logprob": { - "description": "The log probability of this token.\n", - "type": "number" - }, - "top_logprobs": { - "description": "The log probabilities of up to 20 of the most likely tokens.\n", - "type": "array", - "items": { - "type": "object", - "properties": { - "token": { - "description": "A possible text token.", - "type": "string" - }, - "logprob": { - "description": "The log probability of this token.", - "type": "number" - } + "grader": { + "type": "object", + "description": "The grader used for the fine-tuning job.", + "oneOf": [ + { + "$ref": "#/components/schemas/GraderStringCheck" + }, + { + "$ref": "#/components/schemas/GraderTextSimilarity" + }, + { + "$ref": "#/components/schemas/GraderPython" + }, + { + "$ref": "#/components/schemas/GraderScoreModel" + }, + { + "$ref": "#/components/schemas/GraderMulti" } - } + ] } }, "required": [ - "token", - "logprob" + "grader" ] }, - "ResponseMCPCallArgumentsDeltaEvent": { + "ValidateGraderResponse": { "type": "object", - "title": "ResponseMCPCallArgumentsDeltaEvent", - "description": "Emitted when there is a delta (partial update) to the arguments of an MCP tool call.\n", + "title": "ValidateGraderResponse", "properties": { - "type": { - "type": "string", - "enum": [ - "response.mcp_call_arguments.delta" - ], - "description": "The type of the event. Always 'response.mcp_call_arguments.delta'.", - "x-stainless-const": true - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response's output array." - }, - "item_id": { - "type": "string", - "description": "The unique identifier of the MCP tool call item being processed." - }, - "delta": { - "type": "string", - "description": "A JSON string containing the partial update to the arguments for the MCP tool call.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "grader": { + "type": "object", + "description": "The grader used for the fine-tuning job.", + "oneOf": [ + { + "$ref": "#/components/schemas/GraderStringCheck" + }, + { + "$ref": "#/components/schemas/GraderTextSimilarity" + }, + { + "$ref": "#/components/schemas/GraderPython" + }, + { + "$ref": "#/components/schemas/GraderScoreModel" + }, + { + "$ref": "#/components/schemas/GraderMulti" + } + ] } - }, - "required": [ - "type", - "output_index", - "item_id", - "delta", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.mcp_call_arguments.delta", - "group": "responses", - "example": "{\n \"type\": \"response.mcp_call_arguments.delta\",\n \"output_index\": 0,\n \"item_id\": \"item-abc\",\n \"delta\": \"{\",\n \"sequence_number\": 1\n}\n" } }, - "ResponseMCPCallArgumentsDoneEvent": { + "VectorStoreExpirationAfter": { "type": "object", - "title": "ResponseMCPCallArgumentsDoneEvent", - "description": "Emitted when the arguments for an MCP tool call are finalized.\n", + "title": "Vector store expiration policy", + "description": "The expiration policy for a vector store.", "properties": { - "type": { + "anchor": { + "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.", "type": "string", "enum": [ - "response.mcp_call_arguments.done" + "last_active_at" ], - "description": "The type of the event. Always 'response.mcp_call_arguments.done'.", "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response's output array." - }, - "item_id": { - "type": "string", - "description": "The unique identifier of the MCP tool call item being processed." - }, - "arguments": { - "type": "string", - "description": "A JSON string containing the finalized arguments for the MCP tool call.\n" - }, - "sequence_number": { + "days": { + "description": "The number of days after the anchor time that the vector store will expire.", "type": "integer", - "description": "The sequence number of this event." + "minimum": 1, + "maximum": 365 } }, "required": [ - "type", - "output_index", - "item_id", - "arguments", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.mcp_call_arguments.done", - "group": "responses", - "example": "{\n \"type\": \"response.mcp_call_arguments.done\",\n \"output_index\": 0,\n \"item_id\": \"item-abc\",\n \"arguments\": \"{\\\"arg1\\\": \\\"value1\\\", \\\"arg2\\\": \\\"value2\\\"}\",\n \"sequence_number\": 1\n}\n" - } + "anchor", + "days" + ] + }, + "VectorStoreFileAttributes": { + "anyOf": [ + { + "type": "object", + "description": "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard. Keys are strings\nwith a maximum length of 64 characters. Values are strings with a maximum\nlength of 512 characters, booleans, or numbers.\n", + "maxProperties": 16, + "propertyNames": { + "type": "string", + "maxLength": 64 + }, + "additionalProperties": { + "oneOf": [ + { + "type": "string", + "maxLength": 512 + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + }, + "x-oaiTypeLabel": "map" + }, + { + "type": "null" + } + ] }, - "ResponseMCPCallCompletedEvent": { + "VectorStoreFileBatchObject": { "type": "object", - "title": "ResponseMCPCallCompletedEvent", - "description": "Emitted when an MCP tool call has completed successfully.\n", + "title": "Vector store file batch", + "description": "A batch of files attached to a vector store.", "properties": { - "type": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `vector_store.file_batch`.", "type": "string", "enum": [ - "response.mcp_call.completed" + "vector_store.file_batch" ], - "description": "The type of the event. Always 'response.mcp_call.completed'.", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item that completed." - }, - "output_index": { + "created_at": { + "description": "The Unix timestamp (in seconds) for when the vector store files batch was created.", "type": "integer", - "description": "The index of the output item that completed." + "format": "unixtime" }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "vector_store_id": { + "description": "The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to.", + "type": "string" + }, + "status": { + "description": "The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.", + "type": "string", + "enum": [ + "in_progress", + "completed", + "cancelled", + "failed" + ] + }, + "file_counts": { + "type": "object", + "properties": { + "in_progress": { + "description": "The number of files that are currently being processed.", + "type": "integer" + }, + "completed": { + "description": "The number of files that have been processed.", + "type": "integer" + }, + "failed": { + "description": "The number of files that have failed to process.", + "type": "integer" + }, + "cancelled": { + "description": "The number of files that where cancelled.", + "type": "integer" + }, + "total": { + "description": "The total number of files.", + "type": "integer" + } + }, + "required": [ + "in_progress", + "completed", + "cancelled", + "failed", + "total" + ] } }, "required": [ - "type", - "item_id", - "output_index", - "sequence_number" + "id", + "object", + "created_at", + "vector_store_id", + "status", + "file_counts" ], "x-oaiMeta": { - "name": "response.mcp_call.completed", - "group": "responses", - "example": "{\n \"type\": \"response.mcp_call.completed\",\n \"sequence_number\": 1,\n \"item_id\": \"mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90\",\n \"output_index\": 0\n}\n" + "name": "The vector store files batch object", + "beta": true, + "example": "{\n \"id\": \"vsfb_123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 100\n }\n}\n" } }, - "ResponseMCPCallFailedEvent": { + "VectorStoreFileContentResponse": { "type": "object", - "title": "ResponseMCPCallFailedEvent", - "description": "Emitted when an MCP tool call has failed.\n", + "description": "Represents the parsed content of a vector store file.", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "response.mcp_call.failed" + "vector_store.file_content.page" ], - "description": "The type of the event. Always 'response.mcp_call.failed'.", + "description": "The object type, which is always `vector_store.file_content.page`", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item that failed." + "data": { + "type": "array", + "description": "Parsed content of the file.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The content type (currently only `\"text\"`)" + }, + "text": { + "type": "string", + "description": "The text content" + } + } + } }, - "output_index": { - "type": "integer", - "description": "The index of the output item that failed." + "has_more": { + "type": "boolean", + "description": "Indicates if there are more content pages to fetch." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "next_page": { + "anyOf": [ + { + "type": "string", + "description": "The token for the next page, if any." + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "item_id", - "output_index", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.mcp_call.failed", - "group": "responses", - "example": "{\n \"type\": \"response.mcp_call.failed\",\n \"sequence_number\": 1,\n \"item_id\": \"mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90\",\n \"output_index\": 0\n}\n" - } + "object", + "data", + "has_more", + "next_page" + ] }, - "ResponseMCPCallInProgressEvent": { + "VectorStoreFileObject": { "type": "object", - "title": "ResponseMCPCallInProgressEvent", - "description": "Emitted when an MCP tool call is in progress.\n", + "title": "Vector store files", + "description": "A list of files attached to a vector store.", "properties": { - "type": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `vector_store.file`.", "type": "string", "enum": [ - "response.mcp_call.in_progress" + "vector_store.file" ], - "description": "The type of the event. Always 'response.mcp_call.in_progress'.", "x-stainless-const": true }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "usage_bytes": { + "description": "The total vector store usage in bytes. Note that this may be different from the original file size.", + "type": "integer" }, - "output_index": { + "created_at": { + "description": "The Unix timestamp (in seconds) for when the vector store file was created.", "type": "integer", - "description": "The index of the output item in the response's output array." + "format": "unixtime" }, - "item_id": { - "type": "string", - "description": "The unique identifier of the MCP tool call item being processed." - } - }, - "required": [ - "type", - "output_index", - "item_id", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.mcp_call.in_progress", - "group": "responses", - "example": "{\n \"type\": \"response.mcp_call.in_progress\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90\"\n}\n" - } - }, - "ResponseMCPListToolsCompletedEvent": { - "type": "object", - "title": "ResponseMCPListToolsCompletedEvent", - "description": "Emitted when the list of available MCP tools has been successfully retrieved.\n", - "properties": { - "type": { + "vector_store_id": { + "description": "The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to.", + "type": "string" + }, + "status": { + "description": "The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.", "type": "string", "enum": [ - "response.mcp_list_tools.completed" - ], - "description": "The type of the event. Always 'response.mcp_list_tools.completed'.", - "x-stainless-const": true + "in_progress", + "completed", + "cancelled", + "failed" + ] }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item that produced this output." + "last_error": { + "anyOf": [ + { + "type": "object", + "description": "The last error associated with this vector store file. Will be `null` if there are no errors.", + "properties": { + "code": { + "type": "string", + "description": "One of `server_error`, `unsupported_file`, or `invalid_file`.", + "enum": [ + "server_error", + "unsupported_file", + "invalid_file" + ] + }, + "message": { + "type": "string", + "description": "A human-readable description of the error." + } + }, + "required": [ + "code", + "message" + ] + }, + { + "type": "null" + } + ] }, - "output_index": { - "type": "integer", - "description": "The index of the output item that was processed." + "chunking_strategy": { + "type": "object", + "description": "The strategy used to chunk the file.", + "oneOf": [ + { + "$ref": "#/components/schemas/StaticChunkingStrategyResponseParam" + }, + { + "$ref": "#/components/schemas/OtherChunkingStrategyResponseParam" + } + ] }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "attributes": { + "$ref": "#/components/schemas/VectorStoreFileAttributes" } }, "required": [ - "type", - "item_id", - "output_index", - "sequence_number" + "id", + "object", + "usage_bytes", + "created_at", + "vector_store_id", + "status", + "last_error" ], "x-oaiMeta": { - "name": "response.mcp_list_tools.completed", - "group": "responses", - "example": "{\n \"type\": \"response.mcp_list_tools.completed\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90\"\n}\n" + "name": "The vector store file object", + "beta": true, + "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"usage_bytes\": 1234,\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"static\": {\n \"max_chunk_size_tokens\": 800,\n \"chunk_overlap_tokens\": 400\n }\n }\n}\n" } }, - "ResponseMCPListToolsFailedEvent": { + "VectorStoreObject": { "type": "object", - "title": "ResponseMCPListToolsFailedEvent", - "description": "Emitted when the attempt to list available MCP tools has failed.\n", + "title": "Vector store", + "description": "A vector store is a collection of processed files can be used by the `file_search` tool.", "properties": { - "type": { + "id": { + "description": "The identifier, which can be referenced in API endpoints.", + "type": "string" + }, + "object": { + "description": "The object type, which is always `vector_store`.", "type": "string", "enum": [ - "response.mcp_list_tools.failed" + "vector_store" ], - "description": "The type of the event. Always 'response.mcp_list_tools.failed'.", "x-stainless-const": true }, - "item_id": { + "created_at": { + "description": "The Unix timestamp (in seconds) for when the vector store was created.", + "type": "integer", + "format": "unixtime" + }, + "name": { + "description": "The name of the vector store.", + "type": "string" + }, + "usage_bytes": { + "description": "The total number of bytes used by the files in the vector store.", + "type": "integer" + }, + "file_counts": { + "type": "object", + "properties": { + "in_progress": { + "description": "The number of files that are currently being processed.", + "type": "integer" + }, + "completed": { + "description": "The number of files that have been successfully processed.", + "type": "integer" + }, + "failed": { + "description": "The number of files that have failed to process.", + "type": "integer" + }, + "cancelled": { + "description": "The number of files that were cancelled.", + "type": "integer" + }, + "total": { + "description": "The total number of files.", + "type": "integer" + } + }, + "required": [ + "in_progress", + "completed", + "failed", + "cancelled", + "total" + ] + }, + "status": { + "description": "The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.", "type": "string", - "description": "The ID of the MCP tool call item that failed." + "enum": [ + "expired", + "in_progress", + "completed" + ] }, - "output_index": { - "type": "integer", - "description": "The index of the output item that failed." + "expires_after": { + "$ref": "#/components/schemas/VectorStoreExpirationAfter" }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "expires_at": { + "anyOf": [ + { + "description": "The Unix timestamp (in seconds) for when the vector store will expire.", + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ] + }, + "last_active_at": { + "anyOf": [ + { + "description": "The Unix timestamp (in seconds) for when the vector store was last active.", + "type": "integer", + "format": "unixtime" + }, + { + "type": "null" + } + ] + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" } }, "required": [ - "type", - "item_id", - "output_index", - "sequence_number" + "id", + "object", + "usage_bytes", + "created_at", + "status", + "last_active_at", + "name", + "file_counts", + "metadata" ], "x-oaiMeta": { - "name": "response.mcp_list_tools.failed", - "group": "responses", - "example": "{\n \"type\": \"response.mcp_list_tools.failed\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90\"\n}\n" + "name": "The vector store object", + "example": "{\n \"id\": \"vs_123\",\n \"object\": \"vector_store\",\n \"created_at\": 1698107661,\n \"usage_bytes\": 123456,\n \"last_active_at\": 1698107661,\n \"name\": \"my_vector_store\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"cancelled\": 0,\n \"failed\": 0,\n \"total\": 100\n },\n \"metadata\": {}\n}\n" } }, - "ResponseMCPListToolsInProgressEvent": { + "VectorStoreSearchRequest": { "type": "object", - "title": "ResponseMCPListToolsInProgressEvent", - "description": "Emitted when the system is in the process of retrieving the list of available MCP tools.\n", + "additionalProperties": false, "properties": { - "type": { - "type": "string", - "enum": [ - "response.mcp_list_tools.in_progress" - ], - "description": "The type of the event. Always 'response.mcp_list_tools.in_progress'.", - "x-stainless-const": true + "query": { + "description": "A query string for a search", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string", + "description": "A list of queries to search for.", + "minItems": 1 + } + } + ] }, - "item_id": { - "type": "string", - "description": "The ID of the MCP tool call item that is being processed." + "rewrite_query": { + "description": "Whether to rewrite the natural language query for vector search.", + "type": "boolean", + "default": false }, - "output_index": { + "max_num_results": { + "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive.", "type": "integer", - "description": "The index of the output item that is being processed." + "default": 10, + "minimum": 1, + "maximum": 50 }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." - } - }, - "required": [ - "type", - "item_id", - "output_index", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.mcp_list_tools.in_progress", - "group": "responses", - "example": "{\n \"type\": \"response.mcp_list_tools.in_progress\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90\"\n}\n" - } - }, - "ResponseModalities": { - "anyOf": [ - { - "type": "array", - "description": "Output types that you would like the model to generate.\nMost models are capable of generating text, which is the default:\n\n`[\"text\"]`\n\nThe `gpt-4o-audio-preview` model can also be used to\n[generate audio](https://developers.openai.com/api/docs/guides/audio). To request that this model generate\nboth text and audio responses, you can use:\n\n`[\"text\", \"audio\"]`\n", - "items": { - "type": "string", - "enum": [ - "text", - "audio" - ] - } + "filters": { + "description": "A filter to apply based on file attributes.", + "oneOf": [ + { + "$ref": "#/components/schemas/ComparisonFilter" + }, + { + "$ref": "#/components/schemas/CompoundFilter" + } + ] }, - { - "type": "null" + "ranking_options": { + "description": "Ranking options for search.", + "type": "object", + "additionalProperties": false, + "properties": { + "ranker": { + "description": "Enable re-ranking; set to `none` to disable, which can help reduce latency.", + "type": "string", + "enum": [ + "none", + "auto", + "default-2024-11-15" + ], + "default": "auto" + }, + "score_threshold": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 0 + } + } } - ] + }, + "required": [ + "query" + ], + "x-oaiMeta": { + "name": "Vector store search request" + } }, - "ResponseOutputItemAddedEvent": { + "VectorStoreSearchResultContentObject": { "type": "object", - "description": "Emitted when a new output item is added.", + "additionalProperties": false, "properties": { "type": { + "description": "The type of content.", "type": "string", - "description": "The type of the event. Always `response.output_item.added`.\n", "enum": [ - "response.output_item.added" - ], - "x-stainless-const": true - }, - "output_index": { - "type": "integer", - "description": "The index of the output item that was added.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event.\n" + "text" + ] }, - "item": { - "$ref": "#/components/schemas/OutputItem", - "description": "The output item that was added. For reasoning items, `encrypted_content`\nmay be incomplete while the item is in progress. Use the reasoning item\nfrom the corresponding `response.output_item.done` event when passing it\nas input to a subsequent request.\n" + "text": { + "description": "The text content returned from search.", + "type": "string" } }, "required": [ "type", - "output_index", - "item", - "sequence_number" + "text" ], "x-oaiMeta": { - "name": "response.output_item.added", - "group": "responses", - "example": "{\n \"type\": \"response.output_item.added\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_123\",\n \"status\": \"in_progress\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": []\n },\n \"sequence_number\": 1\n}\n" + "name": "Vector store search result content object" } }, - "ResponseOutputItemDoneEvent": { + "VectorStoreSearchResultItem": { "type": "object", - "description": "Emitted when an output item is marked done.", + "additionalProperties": false, "properties": { - "type": { + "file_id": { "type": "string", - "description": "The type of the event. Always `response.output_item.done`.\n", - "enum": [ - "response.output_item.done" - ], - "x-stainless-const": true + "description": "The ID of the vector store file." }, - "output_index": { - "type": "integer", - "description": "The index of the output item that was marked done.\n" + "filename": { + "type": "string", + "description": "The name of the vector store file." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event.\n" + "score": { + "type": "number", + "description": "The similarity score for the result.", + "minimum": 0, + "maximum": 1 }, - "item": { - "$ref": "#/components/schemas/OutputItem", - "description": "The output item that was marked done.\n" + "attributes": { + "$ref": "#/components/schemas/VectorStoreFileAttributes" + }, + "content": { + "type": "array", + "description": "Content chunks from the file.", + "items": { + "$ref": "#/components/schemas/VectorStoreSearchResultContentObject" + } } }, "required": [ - "type", - "output_index", - "item", - "sequence_number" + "file_id", + "filename", + "score", + "attributes", + "content" ], "x-oaiMeta": { - "name": "response.output_item.done", - "group": "responses", - "example": "{\n \"type\": \"response.output_item.done\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_123\",\n \"status\": \"completed\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": []\n }\n ]\n },\n \"sequence_number\": 1\n}\n" + "name": "Vector store search result item" } }, - "ResponseOutputTextAnnotationAddedEvent": { + "VectorStoreSearchResultsPage": { "type": "object", - "title": "ResponseOutputTextAnnotationAddedEvent", - "description": "Emitted when an annotation is added to output text content.\n", + "additionalProperties": false, "properties": { - "type": { + "object": { "type": "string", "enum": [ - "response.output_text.annotation.added" + "vector_store.search_results.page" ], - "description": "The type of the event. Always 'response.output_text.annotation.added'.", + "description": "The object type, which is always `vector_store.search_results.page`", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The unique identifier of the item to which the annotation is being added." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item in the response's output array." - }, - "content_index": { - "type": "integer", - "description": "The index of the content part within the output item." + "search_query": { + "type": "array", + "items": { + "type": "string", + "description": "The query used for this search.", + "minItems": 1 + } }, - "annotation_index": { - "type": "integer", - "description": "The index of the annotation within the content part." + "data": { + "type": "array", + "description": "The list of search result items.", + "items": { + "$ref": "#/components/schemas/VectorStoreSearchResultItem" + } }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event." + "has_more": { + "type": "boolean", + "description": "Indicates if there are more results to fetch." }, - "annotation": { + "next_page": { "anyOf": [ { - "$ref": "#/components/schemas/Annotation" + "type": "string", + "description": "The token for the next page, if any." }, { "type": "null" } - ], - "description": "The annotation object being added. (See annotation schema for details.)" + ] } }, "required": [ - "type", - "item_id", - "output_index", - "content_index", - "annotation_index", - "annotation", - "sequence_number" + "object", + "search_query", + "data", + "has_more", + "next_page" ], "x-oaiMeta": { - "name": "response.output_text.annotation.added", - "group": "responses", - "example": "{\n \"type\": \"response.output_text.annotation.added\",\n \"item_id\": \"item-abc\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"annotation_index\": 0,\n \"annotation\": {\n \"type\": \"file_citation\",\n \"file_id\": \"file-abc\",\n \"index\": 0,\n \"filename\": \"example.txt\"\n },\n \"sequence_number\": 1\n}\n" + "name": "Vector store search results page" } }, - "ResponsePromptVariables": { + "Verbosity": { "anyOf": [ { - "type": "object", - "title": "Prompt Variables", - "description": "Optional map of values to substitute in for variables in your\nprompt. The substitution values can either be strings, or other\nResponse input types like images or files.\n", - "x-oaiExpandable": true, - "x-oaiTypeLabel": "map", - "additionalProperties": { - "x-oaiExpandable": true, - "x-oaiTypeLabel": "map", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/components/schemas/InputTextContent" - }, - { - "$ref": "#/components/schemas/InputImageContent" - }, - { - "$ref": "#/components/schemas/InputFileContent" - } - ] - } + "type": "string", + "enum": [ + "low", + "medium", + "high" + ], + "default": "medium", + "description": "Constrains the verbosity of the model's response. Lower values will result in\nmore concise responses, while higher values will result in more verbose responses.\nCurrently supported values are `low`, `medium`, and `high`. The default is\n`medium`.\n" }, { "type": "null" } ] }, - "ResponseProperties": { + "VoiceConsentDeletedResource": { "type": "object", + "additionalProperties": false, "properties": { - "previous_response_id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n" - }, - { - "type": "null" - } - ] - }, - "model": { - "description": "Model ID used to generate the response, like `gpt-6-astra`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models)\nto browse and compare available models.\n", - "$ref": "#/components/schemas/ModelIdsResponses" - }, - "background": { - "anyOf": [ - { - "type": "boolean", - "description": "Whether to run the model response in the background.\n[Learn more](https://developers.openai.com/api/docs/guides/background).\n", - "default": false - }, - { - "type": "null" - } - ] - }, - "max_tool_calls": { - "anyOf": [ - { - "description": "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n", - "type": "integer" - }, - { - "type": "null" - } - ] - }, - "text": { - "$ref": "#/components/schemas/ResponseTextParam" - }, - "tools": { - "$ref": "#/components/schemas/ToolsArray" - }, - "tool_choice": { - "$ref": "#/components/schemas/ToolChoiceParam" + "id": { + "type": "string", + "description": "The consent recording identifier.", + "example": "cons_1234" }, - "prompt": { - "$ref": "#/components/schemas/Prompt" - } - } - }, - "ResponseQueuedEvent": { - "type": "object", - "title": "ResponseQueuedEvent", - "description": "Emitted when a response is queued and waiting to be processed.\n", - "properties": { - "type": { + "object": { "type": "string", "enum": [ - "response.queued" + "audio.voice_consent" ], - "description": "The type of the event. Always 'response.queued'.", "x-stainless-const": true }, - "response": { - "$ref": "#/components/schemas/Response", - "description": "The full response object that is queued." - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number for this event." + "deleted": { + "type": "boolean" } }, "required": [ - "type", - "response", - "sequence_number" + "id", + "object", + "deleted" ], "x-oaiMeta": { - "name": "response.queued", - "group": "responses", - "example": "{\n \"type\": \"response.queued\",\n \"response\": {\n \"id\": \"res_123\",\n \"status\": \"queued\",\n \"created_at\": \"2021-01-01T00:00:00Z\",\n \"updated_at\": \"2021-01-01T00:00:00Z\"\n },\n \"sequence_number\": 1\n}\n" + "name": "The voice consent deletion object", + "example": "{\n \"object\": \"audio.voice_consent\",\n \"id\": \"cons_1234\",\n \"deleted\": true\n}\n" } }, - "ResponseReasoningSummaryPartAddedEvent": { + "VoiceConsentListResource": { "type": "object", - "description": "Emitted when a new reasoning summary part is added.", + "additionalProperties": false, "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.reasoning_summary_part.added`.\n", "enum": [ - "response.reasoning_summary_part.added" + "list" ], "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the item this summary part is associated with.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item this summary part is associated with.\n" - }, - "summary_index": { - "type": "integer", - "description": "The index of the summary part within the reasoning summary.\n" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VoiceConsentResource" + } }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event.\n" + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] }, - "part": { - "type": "object", - "description": "The summary part that was added.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of the summary part. Always `summary_text`.", - "enum": [ - "summary_text" - ], - "x-stainless-const": true + "last_id": { + "anyOf": [ + { + "type": "string" }, - "text": { - "type": "string", - "description": "The text of the summary part." + { + "type": "null" } - }, - "required": [ - "type", - "text" ] + }, + "has_more": { + "type": "boolean" } }, "required": [ - "type", - "item_id", - "output_index", - "summary_index", - "part", - "sequence_number" + "object", + "data", + "has_more" ], "x-oaiMeta": { - "name": "response.reasoning_summary_part.added", - "group": "responses", - "example": "{\n \"type\": \"response.reasoning_summary_part.added\",\n \"item_id\": \"rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476\",\n \"output_index\": 0,\n \"summary_index\": 0,\n \"part\": {\n \"type\": \"summary_text\",\n \"text\": \"\"\n },\n \"sequence_number\": 1\n}\n" + "name": "The voice consent list object", + "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"audio.voice_consent\",\n \"id\": \"cons_1234\",\n \"name\": \"John Doe\",\n \"language\": \"en-US\",\n \"created_at\": 1734220800\n }\n ],\n \"first_id\": \"cons_1234\",\n \"last_id\": \"cons_1234\",\n \"has_more\": false\n}\n" } }, - "ResponseReasoningSummaryPartDoneEvent": { + "VoiceConsentResource": { "type": "object", - "description": "Emitted when a reasoning summary part is completed.", + "title": "Voice consent", + "description": "A consent recording used to authorize creation of a custom voice.", + "additionalProperties": false, "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.reasoning_summary_part.done`.\n", + "description": "The object type, which is always `audio.voice_consent`.", "enum": [ - "response.reasoning_summary_part.done" + "audio.voice_consent" ], "x-stainless-const": true }, - "item_id": { + "id": { "type": "string", - "description": "The ID of the item this summary part is associated with.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item this summary part is associated with.\n" + "description": "The consent recording identifier.", + "example": "cons_1234" }, - "summary_index": { - "type": "integer", - "description": "The index of the summary part within the reasoning summary.\n" + "name": { + "type": "string", + "description": "The label provided when the consent recording was uploaded." }, - "status": { + "language": { "type": "string", - "description": "The completion status of the summary part. Omitted when the part completed\nnormally and set to `incomplete` when generation was interrupted.\n", - "enum": [ - "incomplete" - ] + "description": "The BCP 47 language tag for the consent phrase (for example, `en-US`)." }, - "sequence_number": { + "created_at": { "type": "integer", - "description": "The sequence number of this event.\n" - }, - "part": { - "type": "object", - "description": "The completed summary part.\n", - "properties": { - "type": { - "type": "string", - "description": "The type of the summary part. Always `summary_text`.", - "enum": [ - "summary_text" - ], - "x-stainless-const": true - }, - "text": { - "type": "string", - "description": "The text of the summary part." - } - }, - "required": [ - "type", - "text" - ] + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the consent recording was created." } }, "required": [ - "type", - "item_id", - "output_index", - "summary_index", - "part", - "sequence_number" + "object", + "id", + "name", + "language", + "created_at" ], "x-oaiMeta": { - "name": "response.reasoning_summary_part.done", - "group": "responses", - "example": "{\n \"type\": \"response.reasoning_summary_part.done\",\n \"item_id\": \"rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476\",\n \"output_index\": 0,\n \"summary_index\": 0,\n \"part\": {\n \"type\": \"summary_text\",\n \"text\": \"**Responding to a greeting**\\n\\nThe user just said, \\\"Hello!\\\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \\\"Hello! How can I assist you today?\\\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!\"\n },\n \"sequence_number\": 1\n}\n" + "name": "The voice consent object", + "example": "{\n \"object\": \"audio.voice_consent\",\n \"id\": \"cons_1234\",\n \"name\": \"John Doe\",\n \"language\": \"en-US\",\n \"created_at\": 1734220800\n}\n" } }, - "ResponseReasoningSummaryTextDeltaEvent": { + "VoiceDeletedResource": { "type": "object", - "description": "Emitted when a delta is added to a reasoning summary text.", + "additionalProperties": false, "properties": { - "type": { - "type": "string", - "description": "The type of the event. Always `response.reasoning_summary_text.delta`.\n", - "enum": [ - "response.reasoning_summary_text.delta" - ], - "x-stainless-const": true - }, - "item_id": { + "id": { "type": "string", - "description": "The ID of the item this summary text delta is associated with.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item this summary text delta is associated with.\n" - }, - "summary_index": { - "type": "integer", - "description": "The index of the summary part within the reasoning summary.\n" + "description": "The voice identifier.", + "example": "voice_1234" }, - "delta": { + "object": { "type": "string", - "description": "The text delta that was added to the summary.\n" + "enum": [ + "audio.voice.deleted" + ], + "x-stainless-const": true, + "description": "The object type, which is always `audio.voice.deleted`." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event.\n" + "deleted": { + "type": "boolean", + "description": "Whether the voice was deleted." } }, "required": [ - "type", - "item_id", - "output_index", - "summary_index", - "delta", - "sequence_number" + "id", + "object", + "deleted" ], "x-oaiMeta": { - "name": "response.reasoning_summary_text.delta", - "group": "responses", - "example": "{\n \"type\": \"response.reasoning_summary_text.delta\",\n \"item_id\": \"rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476\",\n \"output_index\": 0,\n \"summary_index\": 0,\n \"delta\": \"**Responding to a greeting**\\n\\nThe user just said, \\\"Hello!\\\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \\\"Hello! How can I assist you today?\\\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!\",\n \"sequence_number\": 1\n}\n" + "name": "The voice deletion object", + "example": "{\n \"id\": \"voice_1234\",\n \"object\": \"audio.voice.deleted\",\n \"deleted\": true\n}\n" } }, - "ResponseReasoningSummaryTextDoneEvent": { + "VoiceIdsOrCustomVoice": { + "title": "Voice", + "description": "A built-in voice name or a custom voice reference.\n", + "anyOf": [ + { + "$ref": "#/components/schemas/VoiceIdsShared" + }, + { + "type": "object", + "description": "Custom voice reference.", + "additionalProperties": false, + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The custom voice ID, e.g. `voice_1234`.", + "example": "voice_1234" + } + } + } + ] + }, + "VoiceIdsShared": { + "example": "ash", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "alloy", + "ash", + "ballad", + "coral", + "echo", + "sage", + "shimmer", + "verse", + "marin", + "cedar" + ] + } + ] + }, + "VoiceResource": { "type": "object", - "description": "Emitted when a reasoning summary text is completed.", + "title": "Voice", + "description": "A custom voice that can be used for audio output. Voices created from text prompts are supported only in Live.", + "additionalProperties": false, "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.reasoning_summary_text.done`.\n", + "description": "The object type, which is always `audio.voice`.", "enum": [ - "response.reasoning_summary_text.done" + "audio.voice" ], "x-stainless-const": true }, - "item_id": { + "id": { "type": "string", - "description": "The ID of the item this summary text is associated with.\n" + "description": "The voice identifier, which can be referenced in API endpoints." }, - "output_index": { - "type": "integer", - "description": "The index of the output item this summary text is associated with.\n" + "type": { + "description": "How the voice was created.", + "type": "string", + "enum": [ + "audio_sample", + "prompt" + ] }, - "summary_index": { - "type": "integer", - "description": "The index of the summary part within the reasoning summary.\n" + "prompt": { + "type": "string", + "description": "The original text prompt used to create the voice. Present for prompt-generated voices with a stored prompt; omitted for audio-sample voices and older voices without a stored prompt." }, - "text": { + "name": { "type": "string", - "description": "The full text of the completed reasoning summary.\n" + "description": "The name of the voice." }, - "sequence_number": { + "created_at": { "type": "integer", - "description": "The sequence number of this event.\n" + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the voice was created." } }, "required": [ + "object", + "id", + "name", "type", - "item_id", - "output_index", - "summary_index", - "text", - "sequence_number" + "created_at" ], "x-oaiMeta": { - "name": "response.reasoning_summary_text.done", - "group": "responses", - "example": "{\n \"type\": \"response.reasoning_summary_text.done\",\n \"item_id\": \"rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476\",\n \"output_index\": 0,\n \"summary_index\": 0,\n \"text\": \"**Responding to a greeting**\\n\\nThe user just said, \\\"Hello!\\\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \\\"Hello! How can I assist you today?\\\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!\",\n \"sequence_number\": 1\n}\n" + "name": "The voice object", + "example": "{\n \"object\": \"audio.voice\",\n \"id\": \"voice_123abc\",\n \"name\": \"My new voice\",\n \"type\": \"audio_sample\",\n \"created_at\": 1734220800\n}\n" } }, - "ResponseReasoningTextDeltaEvent": { + "WebSearchActionFind": { "type": "object", - "description": "Emitted when a delta is added to a reasoning text.", + "title": "Find action", + "description": "Action type \"find_in_page\": Searches for a pattern within a loaded page.\n", "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.reasoning_text.delta`.\n", "enum": [ - "response.reasoning_text.delta" + "find_in_page" ], + "description": "The action type.\n", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the item this reasoning text delta is associated with.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item this reasoning text delta is associated with.\n" - }, - "content_index": { - "type": "integer", - "description": "The index of the reasoning content part this delta is associated with.\n" + "url": { + "anyOf": [ + { + "type": "string", + "format": "uri" + }, + { + "type": "null" + } + ], + "description": "The URL of the page searched for the pattern, when available.\n" }, - "delta": { + "pattern": { "type": "string", - "description": "The text delta that was added to the reasoning content.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event.\n" + "description": "The pattern or text to search for within the page.\n" } }, "required": [ "type", - "item_id", - "output_index", - "content_index", - "delta", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.reasoning_text.delta", - "group": "responses", - "example": "{\n \"type\": \"response.reasoning_text.delta\",\n \"item_id\": \"rs_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"The\",\n \"sequence_number\": 1\n}\n" - } + "pattern" + ] }, - "ResponseReasoningTextDoneEvent": { + "WebSearchActionOpenPage": { "type": "object", - "description": "Emitted when a reasoning text is completed.", + "title": "Open page action", + "description": "Action type \"open_page\" - Opens a specific URL from search results.\n", "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.reasoning_text.done`.\n", "enum": [ - "response.reasoning_text.done" + "open_page" ], + "description": "The action type.\n", "x-stainless-const": true }, - "item_id": { - "type": "string", - "description": "The ID of the item this reasoning text is associated with.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item this reasoning text is associated with.\n" - }, - "content_index": { - "type": "integer", - "description": "The index of the reasoning content part.\n" - }, - "text": { - "type": "string", - "description": "The full text of the completed reasoning content.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event.\n" + "url": { + "description": "The URL opened by the model.\n", + "anyOf": [ + { + "type": "string", + "format": "uri" + }, + { + "type": "null" + } + ] } }, "required": [ - "type", - "item_id", - "output_index", - "content_index", - "text", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.reasoning_text.done", - "group": "responses", - "example": "{\n \"type\": \"response.reasoning_text.done\",\n \"item_id\": \"rs_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"The user is asking...\",\n \"sequence_number\": 4\n}\n" - } + "type" + ] }, - "ResponseRefusalDeltaEvent": { + "WebSearchActionSearch": { "type": "object", - "description": "Emitted when there is a partial refusal text.", + "title": "Search action", + "description": "Action type \"search\" - Performs a web search query.\n", "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.refusal.delta`.\n", "enum": [ - "response.refusal.delta" + "search" ], + "description": "The action type.\n", "x-stainless-const": true }, - "item_id": { + "query": { "type": "string", - "description": "The ID of the output item that the refusal text is added to.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item that the refusal text is added to.\n" - }, - "content_index": { - "type": "integer", - "description": "The index of the content part that the refusal text is added to.\n" + "deprecated": true, + "description": "The search query.\n" }, - "delta": { - "type": "string", - "description": "The refusal text that is added.\n" + "queries": { + "type": "array", + "title": "Search queries", + "description": "The search queries.\n", + "items": { + "type": "string", + "description": "A search query.\n" + } }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event.\n" + "sources": { + "type": "array", + "title": "Web search sources", + "description": "The sources used in the search.\n", + "items": { + "type": "object", + "title": "Web search source", + "description": "A source used in the search.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "url" + ], + "description": "The type of source. Always `url`.\n", + "x-stainless-const": true + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL of the source.\n" + } + }, + "required": [ + "type", + "url" + ] + } } }, "required": [ - "type", - "item_id", - "output_index", - "content_index", - "delta", - "sequence_number" + "type" + ] + }, + "WebSearchApproximateLocation": { + "anyOf": [ + { + "type": "object", + "title": "Web search approximate location", + "description": "The approximate location of the user.\n", + "properties": { + "type": { + "type": "string", + "enum": [ + "approximate" + ], + "description": "The type of location approximation. Always `approximate`.", + "default": "approximate", + "x-stainless-const": true + }, + "country": { + "anyOf": [ + { + "type": "string", + "description": "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`." + }, + { + "type": "null" + } + ] + }, + "region": { + "anyOf": [ + { + "type": "string", + "description": "Free text input for the region of the user, e.g. `California`." + }, + { + "type": "null" + } + ] + }, + "city": { + "anyOf": [ + { + "type": "string", + "description": "Free text input for the city of the user, e.g. `San Francisco`." + }, + { + "type": "null" + } + ] + }, + "timezone": { + "anyOf": [ + { + "type": "string", + "description": "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`." + }, + { + "type": "null" + } + ] + } + } + }, + { + "type": "null" + } + ] + }, + "WebSearchContextSize": { + "type": "string", + "description": "High level guidance for the amount of context window space to use for the \nsearch. One of `low`, `medium`, or `high`. `medium` is the default.\n", + "enum": [ + "low", + "medium", + "high" ], - "x-oaiMeta": { - "name": "response.refusal.delta", - "group": "responses", - "example": "{\n \"type\": \"response.refusal.delta\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"refusal text so far\",\n \"sequence_number\": 1\n}\n" - } + "default": "medium" }, - "ResponseRefusalDoneEvent": { + "WebSearchLocation": { "type": "object", - "description": "Emitted when refusal text is finalized.", + "title": "Web search location", + "description": "Approximate location parameters for the search.", "properties": { - "type": { + "country": { "type": "string", - "description": "The type of the event. Always `response.refusal.done`.\n", - "enum": [ - "response.refusal.done" - ], - "x-stainless-const": true + "description": "The two-letter \n[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user,\ne.g. `US`.\n" }, - "item_id": { + "region": { "type": "string", - "description": "The ID of the output item that the refusal text is finalized.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item that the refusal text is finalized.\n" - }, - "content_index": { - "type": "integer", - "description": "The index of the content part that the refusal text is finalized.\n" + "description": "Free text input for the region of the user, e.g. `California`.\n" }, - "refusal": { + "city": { "type": "string", - "description": "The refusal text that is finalized.\n" + "description": "Free text input for the city of the user, e.g. `San Francisco`.\n" }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of this event.\n" + "timezone": { + "type": "string", + "description": "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) \nof the user, e.g. `America/Los_Angeles`.\n" } - }, - "required": [ - "type", - "item_id", - "output_index", - "content_index", - "refusal", - "sequence_number" - ], - "x-oaiMeta": { - "name": "response.refusal.done", - "group": "responses", - "example": "{\n \"type\": \"response.refusal.done\",\n \"item_id\": \"item-abc\",\n \"output_index\": 1,\n \"content_index\": 2,\n \"refusal\": \"final refusal text\",\n \"sequence_number\": 1\n}\n" } }, - "ResponseSteerAcceptedEvent": { + "WebSearchTool": { "type": "object", - "title": "ResponseSteerAcceptedEvent", - "description": "Emitted when steering input has been validated and queued. Acceptance means\nthe server owns the input, not that it has been applied. The successor's\n`response.created` event is the commit point. If accepted input cannot be\ncommitted, `response.steer.failed` returns it with the same steering ID.\n\nWhen the response stops for client-owned tool output or approval, the input\nremains queued and `response.steer.pending` is emitted after\n`response.completed`. Fill the pending event's `required_input` stubs with\nsaved results and send one matching explicit `response.create` per parent.\nDo not resend accepted input while it is still queued.\n", + "title": "Web search", + "description": "Search the Internet for sources related to the prompt. Learn more about the\n[web search tool](https://developers.openai.com/api/docs/guides/tools-web-search).\n", "properties": { "type": { "type": "string", "enum": [ - "response.steer.accepted" + "web_search", + "web_search_2025_08_26" ], - "description": "The event discriminator. Always `response.steer.accepted`.", - "x-stainless-const": true + "description": "The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.", + "default": "web_search" }, - "sequence_number": { - "type": "integer", - "description": "The sequence number for this event." + "external_web_access": { + "type": "boolean", + "default": true, + "description": "Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content." }, - "steer": { - "type": "object", - "description": "The accepted steering submission.", - "properties": { - "id": { - "type": "string", - "description": "The ID assigned to the steering submission." + "filters": { + "anyOf": [ + { + "type": "object", + "description": "Filters for the search.\n", + "properties": { + "allowed_domains": { + "anyOf": [ + { + "type": "array", + "title": "Allowed domains for the search.", + "description": "Allowed domains for the search. If not provided, all domains are allowed.\nSubdomains of the provided domains are allowed as well.\n\nExample: `[\"pubmed.ncbi.nlm.nih.gov\"]`\n", + "items": { + "type": "string", + "description": "Allowed domain for the search." + }, + "default": [] + }, + { + "type": "null" + } + ] + } + } }, - "previous_response_id": { - "type": "string", - "description": "The ID of the response being steered." + { + "type": "null" } - }, - "required": [ - "id", - "previous_response_id" ] }, - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present when\nthe target response's `response.create` event supplied a `stream_id`.\n" - } - }, - "required": [ - "type", - "sequence_number", - "steer" - ], - "x-oaiMeta": { - "name": "response.steer.accepted", - "group": "responses", - "example": "{\n \"type\": \"response.steer.accepted\",\n \"sequence_number\": 2,\n \"steer\": {\n \"id\": \"steer_456\",\n \"previous_response_id\": \"resp_123\"\n }\n}\n" - } - }, - "ResponseSteerErrorCode": { - "title": "ResponseSteerErrorCode", - "description": "A machine-readable steering error code. Clients should handle unknown\nvalues because additional codes may be introduced. Known values include:\n- `response_not_found`: The target response is not available on this connection.\n- `invalid_input`: The event or input failed validation.\n- `steering_not_supported`: The model or response execution mode does not support steering.\n- `too_many_pending_steers`: Too much steering input is pending for the response.\n- `response_already_completed`: The response completed and is no longer accepting steering input.\n- `response_not_active`: The response is no longer accepting steering input.\n- `successor_creation_failed`: The successor response could not be created.\n", - "anyOf": [ - { - "type": "string", - "enum": [ - "response_not_found", - "invalid_input", - "steering_not_supported", - "too_many_pending_steers", - "response_already_completed", - "response_not_active", - "successor_creation_failed" - ] + "user_location": { + "$ref": "#/components/schemas/WebSearchApproximateLocation", + "description": "The approximate location of the user. If omitted or null, defaults to the\nUnited States. To avoid this fallback, pass `{\"type\": \"approximate\"}` without\nlocation fields. To localize results, provide the relevant location fields.\n" }, - { - "type": "string" - } - ] - }, - "ResponseSteerEvent": { - "type": "object", - "title": "ResponseSteerEvent", - "additionalProperties": false, - "description": "Queues user input to steer a response on this WebSocket connection. Input\ncan contain text, images, and files. Steering is supported only for\nsingle-agent responses on models and execution modes that support steering.\nResponses bound to a conversation or using automatic compaction do not\nsupport steering.\n\nA `response.steer.accepted` event acknowledges that the server owns the\nqueued input, not that it has been applied. The successor's `response.created`\nevent is the commit point. Input that cannot be committed is returned in\n`response.steer.failed`.\n\nSteering may cause the active response to finish at a safe output boundary\nwith `response.incomplete` and `incomplete_details.reason` set to `steered`,\nfollowed automatically by a successor `response.created`. Normal completion\ncan also be followed by an automatic successor. Automatic successors inherit\nthe previous response's settings and continue from it with the queued input.\n\nIf the response stops for client-owned tool output or approval, accepted\nsteering input remains queued and `response.steer.pending` is emitted after\n`response.completed`. Fill the `required_input` stubs from that event with\nsaved tool results or approval decisions, and send one explicit\n`response.create` per parent with the same `previous_response_id` and\nWebSocket lane. Do not rerun tools or resend accepted steering input. The\nqueued input is prepended in submission order to that request's input, and\nthe explicit request retains its own settings.\n\nThis event accepts only `type`, `previous_response_id`, and `input`. Do not\nsend `stream_id`; the target response determines the WebSocket lane.\n", - "properties": { - "type": { + "search_context_size": { "type": "string", "enum": [ - "response.steer" + "low", + "medium", + "high" ], - "description": "The event discriminator. Always `response.steer`.", - "x-stainless-const": true - }, - "previous_response_id": { - "type": "string", - "description": "The ID of the response to steer on this WebSocket connection." - }, - "input": { - "$ref": "#/components/schemas/ResponseSteerInput" + "default": "medium", + "description": "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default." } }, "required": [ - "type", - "previous_response_id", - "input" - ], - "x-oaiMeta": { - "name": "response.steer", - "group": "responses", - "example": "{\n \"type\": \"response.steer\",\n \"previous_response_id\": \"resp_123\",\n \"input\": [\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Prioritize the database rollout.\"\n }\n ]\n }\n ]\n}\n" - } + "type" + ] }, - "ResponseSteerFailedEvent": { + "WebSearchToolCall": { "type": "object", - "title": "ResponseSteerFailedEvent", - "description": "Emitted when steering input is rejected or cannot be committed to a\nsuccessor response. Returns the original, uncommitted input so the client\ncan carry it into `response.create` when appropriate. Invalid input must\nbe corrected before retrying.\n\nFailures after acceptance include the same steering ID. Failures before an\nID is allocated omit `steer.id`. A lost connection or missing acknowledgement\nleaves the outcome unknown; it is not proof that the input was rejected.\n", + "title": "Web search tool call", + "description": "The results of a web search tool call. See the\n[web search guide](https://developers.openai.com/api/docs/guides/tools-web-search) for more information.\n", "properties": { + "id": { + "type": "string", + "description": "The unique ID of the web search tool call.\n" + }, "type": { "type": "string", "enum": [ - "response.steer.failed" + "web_search_call" ], - "description": "The event discriminator. Always `response.steer.failed`.", + "description": "The type of the web search tool call. Always `web_search_call`.\n", "x-stainless-const": true }, - "sequence_number": { - "type": "integer", - "description": "The sequence number for this event." + "status": { + "description": "The status of the web search tool call.\n", + "$ref": "#/components/schemas/WebSearchCallStatus" }, - "steer": { + "action": { "type": "object", - "description": "The steering submission that could not be committed.", - "properties": { - "id": { - "type": "string", - "description": "The ID assigned to the steering submission, if one was allocated.\n" + "description": "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n", + "oneOf": [ + { + "$ref": "#/components/schemas/WebSearchActionSearch" }, - "previous_response_id": { - "type": "string", - "description": "The ID of the response that was targeted for steering." + { + "$ref": "#/components/schemas/WebSearchActionOpenPage" }, - "input": { - "$ref": "#/components/schemas/ResponseSteerInput" + { + "$ref": "#/components/schemas/WebSearchActionFind" } - }, - "required": [ - "previous_response_id", - "input" - ] + ], + "discriminator": { + "propertyName": "type" + } + } + }, + "required": [ + "id", + "type", + "status" + ] + }, + "WebhookAgentEnvironmentExpired": { + "type": "object", + "title": "agent.environment.expired", + "description": "Sent when an agent environment expires and can no longer resume from a snapshot.\n", + "allOf": [ + { + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, - "error": { + { "type": "object", - "description": "Information about why the input could not be committed.", + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", + "description": "The event type. Always `agent.environment.expired`.", "enum": [ - "invalid_request_error" + "agent.environment.expired" ], - "description": "The error type. Always `invalid_request_error`.", "x-stainless-const": true }, - "code": { - "$ref": "#/components/schemas/ResponseSteerErrorCode" - }, - "message": { - "type": "string", - "description": "A human-readable description of the error." + "data": { + "$ref": "#/components/schemas/AgentEnvironmentEvent" } - }, - "required": [ - "type", - "code", - "message" - ] - }, - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event, when the target response is\navailable and its `response.create` event supplied a `stream_id`.\n" + } } - }, - "required": [ - "type", - "sequence_number", - "steer", - "error" ], "x-oaiMeta": { - "name": "response.steer.failed", - "group": "responses", - "example": "{\n \"type\": \"response.steer.failed\",\n \"sequence_number\": 5,\n \"steer\": {\n \"id\": \"steer_456\",\n \"previous_response_id\": \"resp_123\",\n \"input\": [\n {\n \"type\": \"message\",\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"input_text\",\n \"text\": \"Prioritize the database rollout.\"\n }\n ]\n }\n ]\n },\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"code\": \"successor_creation_failed\",\n \"message\": \"We couldn't start the next response. Send this steering input again with response.create.\"\n }\n}\n" + "name": "agent.environment.expired", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.environment.expired\",\n \"data\": {\"id\": \"ccarenv_123\"}\n}\n" } }, - "ResponseSteerInput": { - "title": "ResponseSteerInput", - "description": "Input to queue for a continuation of the response. Uses the same string or\ninput-item shape as `response.create.input`, with a non-empty array when\nsupplying input items.\n\nSteering accepts only messages with the `user` role. Each message may\ncontain only `type`, `role`, and `content`, with `content` as a string or an\narray of `input_text`, `input_image`, and `input_file` parts. The optional\n`type` must be `message`. Other roles, tool outputs, and item types are not\nsupported for steering.\n", - "oneOf": [ - { - "type": "string", - "title": "Text input", - "description": "A text input, equivalent to a message with the `user` role." - }, - { - "$ref": "#/components/schemas/ResponseSteerInputItemList" - } - ] - }, - "ResponseSteerInputItem": { - "title": "Response steer input item", - "anyOf": [ + "WebhookAgentEnvironmentFailed": { + "type": "object", + "title": "agent.environment.failed", + "description": "Sent when setup fails for a prewarmed OpenAI-hosted environment before it is attached to a session.\n", + "allOf": [ { - "$ref": "#/components/schemas/UserMessageItemParam" + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, { - "$ref": "#/components/schemas/FunctionCallOutputItemParam" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "ResponseSteerInputItemList": { - "type": "array", - "title": "Response steer input item list", - "description": "A non-empty list of message inputs to queue for the response.", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/ResponseSteerInputItem" - } - }, - "ResponseSteerPendingEvent": { - "type": "object", - "title": "ResponseSteerPendingEvent", - "description": "Emitted when accepted steering input remains queued after the target\nresponse completes. The server still owns the input. Do not resend it.\nThe successor's `response.created` event is the commit point.\n\nWhen `reason` is `waiting_for_required_input`, this event follows\n`response.completed` while the response waits for the tool results or\napproval decisions identified by `required_input`. Copy those stubs, fill\ntheir result fields using the ordinary `response.create` input schemas,\nand submit one continuation per parent with the same `previous_response_id`\nand WebSocket lane. Use saved results without rerunning tools. The queued\nsteering input is prepended in submission order to the continuation's\ninput. That explicit request retains its own settings.\n\nThis notification is emitted at most once per steering submission. Multiple\nsubmissions for the same parent can report the same required inputs; they\ndo not each require a separate continuation.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "response.steer.pending" - ], - "description": "The event discriminator. Always `response.steer.pending`.", - "x-stainless-const": true - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number for this event." - }, - "steer": { "type": "object", - "description": "The steering submission that remains queued.", + "required": [ + "type", + "data" + ], "properties": { - "id": { + "type": { "type": "string", - "description": "The ID assigned to the steering submission." + "description": "The event type. Always `agent.environment.failed`.", + "enum": [ + "agent.environment.failed" + ], + "x-stainless-const": true }, - "previous_response_id": { - "type": "string", - "description": "The ID of the response being steered." + "data": { + "$ref": "#/components/schemas/AgentEnvironmentEvent" } - }, - "required": [ - "id", - "previous_response_id" - ] - }, - "reason": { - "$ref": "#/components/schemas/ResponseSteerPendingReason" - }, - "required_input": { - "type": "array", - "minItems": 1, - "description": "Input stubs identifying outstanding client-owned tool results or\napproval decisions. Each stub contains identifying fields only; the\nclient supplies the result before including it in `response.create`.\n", - "items": { - "$ref": "#/components/schemas/ResponseSteerRequiredInput" } - }, - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present when\nthe target response's `response.create` event supplied a `stream_id`.\n" } - }, - "required": [ - "type", - "sequence_number", - "steer", - "reason", - "required_input" ], "x-oaiMeta": { - "name": "response.steer.pending", - "group": "responses", - "example": "{\n \"type\": \"response.steer.pending\",\n \"sequence_number\": 10,\n \"steer\": {\n \"id\": \"steer_456\",\n \"previous_response_id\": \"resp_123\"\n },\n \"reason\": \"waiting_for_required_input\",\n \"required_input\": [\n {\n \"type\": \"function_call_output\",\n \"call_id\": \"call_789\",\n \"name\": \"lookup\"\n }\n ]\n}\n" + "name": "agent.environment.failed", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.environment.failed\",\n \"data\": {\"id\": \"ccarenv_123\"}\n}\n" } }, - "ResponseSteerPendingReason": { - "title": "ResponseSteerPendingReason", - "description": "An extensible enum describing why accepted steering input is still queued.\nClients should handle unknown values because additional reasons may be\nintroduced. Known values include:\n- `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`.\n", - "anyOf": [ + "WebhookAgentEnvironmentReady": { + "type": "object", + "title": "agent.environment.ready", + "description": "Sent when a prewarmed OpenAI-hosted environment finishes setup before being attached to a session.\n", + "allOf": [ { - "type": "string", - "enum": [ - "waiting_for_required_input" - ] + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, - { - "type": "string" - } - ] - }, - "ResponseSteerRequiredInput": { - "title": "ResponseSteerRequiredInput", - "description": "An input stub identifying an outstanding client-owned tool result or\napproval decision. Copy the stub and fill the result fields using the\ncorresponding `response.create` input schema. Use saved results without\nrerunning the tool. The server does not supply results, approval decisions,\nor safety acknowledgements in these stubs.\n", - "oneOf": [ { "type": "object", - "title": "Required function tool call output", - "additionalProperties": false, - "description": "Supply `output` using the function tool call output input schema.\n", + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", + "description": "The event type. Always `agent.environment.ready`.", "enum": [ - "function_call_output" + "agent.environment.ready" ], "x-stainless-const": true }, - "call_id": { - "type": "string" - }, - "name": { - "type": "string" + "data": { + "$ref": "#/components/schemas/AgentEnvironmentEvent" } - }, - "required": [ - "type", - "call_id", - "name" - ] + } + } + ], + "x-oaiMeta": { + "name": "agent.environment.ready", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.environment.ready\",\n \"data\": {\"id\": \"ccarenv_123\"}\n}\n" + } + }, + "WebhookAgentEnvironmentSuspended": { + "type": "object", + "title": "agent.environment.suspended", + "description": "Sent when an agent environment is suspended and can resume from a snapshot.\n", + "allOf": [ + { + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, { "type": "object", - "title": "Required custom tool call output", - "additionalProperties": false, - "description": "Supply `output` using the custom tool call output input schema. The\noriginal custom tool call supplies the tool's name.\n", + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", + "description": "The event type. Always `agent.environment.suspended`.", "enum": [ - "custom_tool_call_output" + "agent.environment.suspended" ], "x-stainless-const": true }, - "call_id": { - "type": "string" + "data": { + "$ref": "#/components/schemas/AgentEnvironmentEvent" } - }, - "required": [ - "type", - "call_id" - ] + } + } + ], + "x-oaiMeta": { + "name": "agent.environment.suspended", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.environment.suspended\",\n \"data\": {\"id\": \"ccarenv_123\"}\n}\n" + } + }, + "WebhookAgentSessionActionRequired": { + "type": "object", + "title": "agent.session.action_required", + "description": "Sent when an agent session requires an action. Retrieve the session for action details.\n", + "allOf": [ + { + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, { "type": "object", - "title": "Required computer tool call output", - "additionalProperties": false, - "description": "Supply `output` using the computer tool call output input schema,\nincluding any required `acknowledged_safety_checks`.\n", + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", + "description": "The event type. Always `agent.session.action_required`.", "enum": [ - "computer_call_output" + "agent.session.action_required" ], "x-stainless-const": true }, - "call_id": { - "type": "string" + "data": { + "$ref": "#/components/schemas/AgentSessionActionRequiredPayloadResource" } - }, - "required": [ - "type", - "call_id" - ] + } + } + ], + "x-oaiMeta": { + "name": "agent.session.action_required", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.session.action_required\",\n \"data\": {\"id\": \"sess_123\", \"required_action\": {\"type\": \"function_call\"}}\n}\n" + } + }, + "WebhookAgentSessionCreated": { + "type": "object", + "title": "agent.session.created", + "description": "Sent when an agent session is created.\n", + "allOf": [ + { + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, { "type": "object", - "title": "Required shell tool call output", - "additionalProperties": false, - "description": "Supply `output` using the shell tool call output input schema. Each\noutput entry includes `stdout`, `stderr`, and `outcome`.\n", + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", + "description": "The event type. Always `agent.session.created`.", "enum": [ - "shell_call_output" + "agent.session.created" ], "x-stainless-const": true }, - "call_id": { - "type": "string" + "data": { + "$ref": "#/components/schemas/AgentSessionCreatedPayloadResource" } - }, - "required": [ - "type", - "call_id" - ] + } + } + ], + "x-oaiMeta": { + "name": "agent.session.created", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.session.created\",\n \"data\": {\"id\": \"sess_123\", \"environment_id\": \"ccarenv_123\", \"environment_type\": \"self_hosted\", \"connect\": {\"remote_url\": \"https://api.openai.com/v1/agents/api/connect/example\"}}\n}\n" + } + }, + "WebhookAgentSessionEnvelope": { + "type": "object", + "required": [ + "id", + "object", + "created_at" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the event." + }, + "object": { + "type": "string", + "description": "The object type. Always `event`.", + "enum": [ + "event" + ], + "x-stainless-const": true + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, when the event was created." + } + } + }, + "WebhookAgentSessionFailed": { + "type": "object", + "title": "agent.session.failed", + "description": "Sent when an agent session fails.\n", + "allOf": [ + { + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, { "type": "object", - "title": "Required apply patch tool call output", - "additionalProperties": false, - "description": "Supply `status` and optional `output` using the apply patch tool call\noutput input schema.\n", + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", + "description": "The event type. Always `agent.session.failed`.", "enum": [ - "apply_patch_call_output" + "agent.session.failed" ], "x-stainless-const": true }, - "call_id": { - "type": "string" + "data": { + "$ref": "#/components/schemas/AgentSessionEnvironmentPayloadResource" } - }, - "required": [ - "type", - "call_id" - ] + } + } + ], + "x-oaiMeta": { + "name": "agent.session.failed", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.session.failed\",\n \"data\": {\"id\": \"sess_123\", \"environment_type\": \"none\"}\n}\n" + } + }, + "WebhookAgentSessionIdle": { + "type": "object", + "title": "agent.session.idle", + "description": "Sent when an agent session becomes idle.\n", + "allOf": [ + { + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, { "type": "object", - "title": "Required tool search output", - "additionalProperties": false, - "description": "Supply `tools` using the tool search output input schema, retaining\n`execution: \"client\"`.\n", + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", + "description": "The event type. Always `agent.session.idle`.", "enum": [ - "tool_search_output" + "agent.session.idle" ], "x-stainless-const": true }, - "call_id": { - "type": "string" - }, - "execution": { - "type": "string", - "enum": [ - "client" - ], - "x-stainless-const": true + "data": { + "$ref": "#/components/schemas/AgentSessionEnvironmentPayloadResource" } - }, - "required": [ - "type", - "call_id", - "execution" - ] + } + } + ], + "x-oaiMeta": { + "name": "agent.session.idle", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.session.idle\",\n \"data\": {\"id\": \"sess_123\", \"environment_type\": \"none\"}\n}\n" + } + }, + "WebhookAgentSessionInProgress": { + "type": "object", + "title": "agent.session.in_progress", + "description": "Sent when an agent session enters the in-progress state.\n", + "allOf": [ + { + "$ref": "#/components/schemas/WebhookAgentSessionEnvelope" }, { "type": "object", - "title": "Required MCP approval response", - "additionalProperties": false, - "description": "Supply `approve` using the MCP approval response input schema. An\noptional `reason` can be supplied when denying the request. The original\napproval request identifies the tool and server.\n", + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", + "description": "The event type. Always `agent.session.in_progress`.", "enum": [ - "mcp_approval_response" + "agent.session.in_progress" ], "x-stainless-const": true }, - "approval_request_id": { - "type": "string" + "data": { + "$ref": "#/components/schemas/AgentSessionEnvironmentPayloadResource" } - }, - "required": [ - "type", - "approval_request_id" - ] + } } ], - "discriminator": { - "propertyName": "type" + "x-oaiMeta": { + "name": "agent.session.in_progress", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1719168000,\n \"type\": \"agent.session.in_progress\",\n \"data\": {\"id\": \"sess_123\", \"environment_id\": \"ccarenv_123\", \"environment_type\": \"openai_hosted\"}\n}\n" } }, - "ResponseStreamEvent": { - "description": "Event emitted while a response is streamed.", - "anyOf": [ - { - "$ref": "#/components/schemas/ResponseAudioDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseAudioDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseAudioTranscriptDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseAudioTranscriptDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent" - }, - { - "$ref": "#/components/schemas/ResponseCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseContentPartAddedEvent" - }, - { - "$ref": "#/components/schemas/ResponseContentPartDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseCreatedEvent" - }, - { - "$ref": "#/components/schemas/ResponseErrorEvent" - }, - { - "$ref": "#/components/schemas/ResponseFileSearchCallCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseFileSearchCallInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseFileSearchCallSearchingEvent" - }, - { - "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseShellCallCommandAddedStreamingEvent" - }, - { - "$ref": "#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent" - }, - { - "$ref": "#/components/schemas/ResponseShellCallCommandDoneStreamingEvent" - }, - { - "$ref": "#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent", - "x-stainless-skip": [ - "go" - ] - }, - { - "$ref": "#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent" - }, - { - "$ref": "#/components/schemas/ResponseInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseFailedEvent" + "WebhookBatchCancelled": { + "type": "object", + "title": "batch.cancelled", + "description": "Sent when a batch API request has been cancelled.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the batch API request was cancelled.\n" }, - { - "$ref": "#/components/schemas/ResponseIncompleteEvent" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" }, - { - "$ref": "#/components/schemas/ResponseOutputItemAddedEvent" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the batch API request.\n" + } + } }, - { - "$ref": "#/components/schemas/ResponseOutputItemDoneEvent" + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseReasoningSummaryPartAddedEvent" + "type": { + "type": "string", + "description": "The type of the event. Always `batch.cancelled`.\n", + "enum": [ + "batch.cancelled" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "batch.cancelled", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"batch.cancelled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"batch_abc123\"\n }\n}\n" + } + }, + "WebhookBatchCompleted": { + "type": "object", + "title": "batch.completed", + "description": "Sent when a batch API request has been completed.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the batch API request was completed.\n" }, - { - "$ref": "#/components/schemas/ResponseReasoningSummaryPartDoneEvent" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" }, - { - "$ref": "#/components/schemas/ResponseReasoningSummaryTextDeltaEvent" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the batch API request.\n" + } + } }, - { - "$ref": "#/components/schemas/ResponseReasoningSummaryTextDoneEvent" + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseReasoningTextDeltaEvent" + "type": { + "type": "string", + "description": "The type of the event. Always `batch.completed`.\n", + "enum": [ + "batch.completed" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "batch.completed", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"batch.completed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"batch_abc123\"\n }\n}\n" + } + }, + "WebhookBatchExpired": { + "type": "object", + "title": "batch.expired", + "description": "Sent when a batch API request has expired.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the batch API request expired.\n" }, - { - "$ref": "#/components/schemas/ResponseReasoningTextDoneEvent" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" }, - { - "$ref": "#/components/schemas/ResponseRefusalDeltaEvent" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the batch API request.\n" + } + } }, - { - "$ref": "#/components/schemas/ResponseRefusalDoneEvent" + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseTextDeltaEvent" + "type": { + "type": "string", + "description": "The type of the event. Always `batch.expired`.\n", + "enum": [ + "batch.expired" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "batch.expired", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"batch.expired\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"batch_abc123\"\n }\n}\n" + } + }, + "WebhookBatchFailed": { + "type": "object", + "title": "batch.failed", + "description": "Sent when a batch API request has failed.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the batch API request failed.\n" }, - { - "$ref": "#/components/schemas/ResponseTextDoneEvent" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" }, - { - "$ref": "#/components/schemas/ResponseWebSearchCallCompletedEvent" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the batch API request.\n" + } + } }, - { - "$ref": "#/components/schemas/ResponseWebSearchCallInProgressEvent" + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseWebSearchCallSearchingEvent" + "type": { + "type": "string", + "description": "The type of the event. Always `batch.failed`.\n", + "enum": [ + "batch.failed" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "batch.failed", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"batch.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"batch_abc123\"\n }\n}\n" + } + }, + "WebhookEvalRunCanceled": { + "type": "object", + "title": "eval.run.canceled", + "description": "Sent when an eval run has been canceled.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the eval run was canceled.\n" }, - { - "$ref": "#/components/schemas/ResponseImageGenCallCompletedEvent" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" }, - { - "$ref": "#/components/schemas/ResponseImageGenCallGeneratingEvent" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the eval run.\n" + } + } }, - { - "$ref": "#/components/schemas/ResponseImageGenCallInProgressEvent" + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseImageGenCallPartialImageEvent" + "type": { + "type": "string", + "description": "The type of the event. Always `eval.run.canceled`.\n", + "enum": [ + "eval.run.canceled" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "eval.run.canceled", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.canceled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" + } + }, + "WebhookEvalRunFailed": { + "type": "object", + "title": "eval.run.failed", + "description": "Sent when an eval run has failed.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the eval run failed.\n" }, - { - "$ref": "#/components/schemas/ResponseMCPCallArgumentsDeltaEvent" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" }, - { - "$ref": "#/components/schemas/ResponseMCPCallArgumentsDoneEvent" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the eval run.\n" + } + } }, - { - "$ref": "#/components/schemas/ResponseMCPCallCompletedEvent" + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseMCPCallFailedEvent" + "type": { + "type": "string", + "description": "The type of the event. Always `eval.run.failed`.\n", + "enum": [ + "eval.run.failed" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "eval.run.failed", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" + } + }, + "WebhookEvalRunSucceeded": { + "type": "object", + "title": "eval.run.succeeded", + "description": "Sent when an eval run has succeeded.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the eval run succeeded.\n" }, - { - "$ref": "#/components/schemas/ResponseMCPCallInProgressEvent" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" }, - { - "$ref": "#/components/schemas/ResponseMCPListToolsCompletedEvent" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the eval run.\n" + } + } }, - { - "$ref": "#/components/schemas/ResponseMCPListToolsFailedEvent" + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseMCPListToolsInProgressEvent" + "type": { + "type": "string", + "description": "The type of the event. Always `eval.run.succeeded`.\n", + "enum": [ + "eval.run.succeeded" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "eval.run.succeeded", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.succeeded\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" + } + }, + "WebhookFineTuningJobCancelled": { + "type": "object", + "title": "fine_tuning.job.cancelled", + "description": "Sent when a fine-tuning job has been cancelled.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.\n" }, - { - "$ref": "#/components/schemas/ResponseOutputTextAnnotationAddedEvent" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" }, - { - "$ref": "#/components/schemas/ResponseQueuedEvent" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the fine-tuning job.\n" + } + } }, - { - "$ref": "#/components/schemas/ResponseCustomToolCallInputDeltaEvent" + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ResponseCustomToolCallInputDoneEvent" + "type": { + "type": "string", + "description": "The type of the event. Always `fine_tuning.job.cancelled`.\n", + "enum": [ + "fine_tuning.job.cancelled" + ], + "x-stainless-const": true } + }, + "x-oaiMeta": { + "name": "fine_tuning.job.cancelled", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.cancelled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" + } + }, + "WebhookFineTuningJobFailed": { + "type": "object", + "title": "fine_tuning.job.failed", + "description": "Sent when a fine-tuning job has failed.\n", + "required": [ + "created_at", + "id", + "data", + "type" ], - "discriminator": { - "propertyName": "type" + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the fine-tuning job failed.\n" + }, + "id": { + "type": "string", + "description": "The unique ID of the event.\n" + }, + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the fine-tuning job.\n" + } + } + }, + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true + }, + "type": { + "type": "string", + "description": "The type of the event. Always `fine_tuning.job.failed`.\n", + "enum": [ + "fine_tuning.job.failed" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "fine_tuning.job.failed", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" } }, - "ResponseStreamOptions": { - "anyOf": [ - { - "description": "Options for streaming responses. Only set this when you set `stream: true`.\n", + "WebhookFineTuningJobSucceeded": { + "type": "object", + "title": "fine_tuning.job.succeeded", + "description": "Sent when a fine-tuning job has succeeded.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the fine-tuning job succeeded.\n" + }, + "id": { + "type": "string", + "description": "The unique ID of the event.\n" + }, + "data": { "type": "object", - "default": null, + "description": "Event data payload.\n", + "required": [ + "id" + ], "properties": { - "include_obfuscation": { - "type": "boolean", - "description": "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events to\nnormalize payload sizes as a mitigation to certain side-channel attacks.\nThese obfuscation fields are included by default, but add a small amount\nof overhead to the data stream. You can set `include_obfuscation` to\nfalse to optimize for bandwidth if you trust the network links between\nyour application and the OpenAI API.\n" + "id": { + "type": "string", + "description": "The unique ID of the fine-tuning job.\n" } } }, - { - "type": "null" - } - ] - }, - "ResponseTextDeltaEvent": { - "type": "object", - "description": "Emitted when there is an additional text delta.", - "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.output_text.delta`.\n", + "description": "The object of the event. Always `event`.\n", "enum": [ - "response.output_text.delta" + "event" ], "x-stainless-const": true }, - "item_id": { + "type": { "type": "string", - "description": "The ID of the output item that the text delta was added to.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item that the text delta was added to.\n" - }, - "content_index": { + "description": "The type of the event. Always `fine_tuning.job.succeeded`.\n", + "enum": [ + "fine_tuning.job.succeeded" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "fine_tuning.job.succeeded", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.succeeded\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" + } + }, + "WebhookLiveCallIncoming": { + "type": "object", + "title": "live.call.incoming", + "deprecated": true, + "description": "Deprecated: use `live.transport.incoming`. Retained for existing subscriptions\nduring migration; new subscriptions to this event are not allowed.\nSent when an incoming API SIP session is available for Live acceptance. The\nsame pending session can also emit `realtime.call.incoming`; the first\nsuccessful Realtime or Live accept endpoint selects the runtime surface.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { "type": "integer", - "description": "The index of the content part that the text delta was added to.\n" + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the event was created.\n" }, - "delta": { + "id": { "type": "string", - "description": "The text delta that was added.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number for this event." + "description": "The unique ID of the event.\n" }, - "logprobs": { - "type": "array", - "description": "The log probabilities of the tokens in the delta.\n", - "items": { - "$ref": "#/components/schemas/ResponseLogProb" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "session_id", + "sip_headers" + ], + "properties": { + "session_id": { + "type": "string", + "description": "The `live_...` ID of the pending SIP session. Pass this value unchanged\nto Live call controls and sideband connections. The corresponding\n`realtime.call.incoming` event uses a separate `rtc_...` call ID.\n" + }, + "sip_media_security": { + "description": "Media protection selected on the SIP leg during SDP negotiation. `srtp`\nindicates SRTP; `rtp` indicates unencrypted RTP. Omitted when unknown.\nThis does not describe SIP signaling security or confirm that media has\nflowed. Clients should handle unrecognized values as unknown.\n", + "anyOf": [ + { + "type": "string", + "enum": [ + "rtp", + "srtp" + ] + }, + { + "type": "string" + } + ] + }, + "sip_headers": { + "type": "array", + "description": "Headers from the SIP INVITE, excluding SIP authorization headers.\nRetained names, values, repeated entries, and order are preserved.\nTreat these values as untrusted call metadata.\n", + "items": { + "type": "object", + "description": "A header from the SIP Invite.\n", + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the SIP Header.\n" + }, + "value": { + "type": "string", + "description": "Value of the SIP Header.\n" + } + } + } + } } + }, + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true + }, + "type": { + "type": "string", + "description": "The type of the event. Always `live.call.incoming`.\n", + "enum": [ + "live.call.incoming" + ], + "x-stainless-const": true } }, - "required": [ - "type", - "item_id", - "output_index", - "content_index", - "delta", - "sequence_number", - "logprobs" - ], "x-oaiMeta": { - "name": "response.output_text.delta", - "group": "responses", - "example": "{\n \"type\": \"response.output_text.delta\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"In\",\n \"sequence_number\": 1\n}\n" + "name": "live.call.incoming", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"live.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"session_id\": \"live_u0_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_media_security\": \"srtp\",\n \"sip_headers\": [\n {\"name\": \"From\", \"value\": \";tag=abc123\"},\n {\"name\": \"To\", \"value\": \"\"},\n {\"name\": \"Call-ID\", \"value\": \"call-123@example.com\"}\n ]\n }\n}\n" } }, - "ResponseTextDoneEvent": { + "WebhookLiveTransportIncoming": { "type": "object", - "description": "Emitted when text content is finalized.", + "title": "live.transport.incoming", + "description": "Sent when an incoming API SIP session is available for Live acceptance. The\nsame pending session can also emit `realtime.call.incoming`; the first\nsuccessful Realtime or Live accept endpoint selects the runtime surface.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], "properties": { - "type": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the event was created.\n" + }, + "id": { "type": "string", - "description": "The type of the event. Always `response.output_text.done`.\n", + "description": "The unique ID of the event.\n" + }, + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "type", + "session_id", + "sip_headers" + ], + "properties": { + "type": { + "type": "string", + "description": "The incoming transport type. Always `sip`.", + "enum": [ + "sip" + ], + "x-stainless-const": true + }, + "session_id": { + "type": "string", + "description": "The `live_...` ID of the pending SIP session. Forward this value\nunchanged when accepting or rejecting the call through the Live API.\n" + }, + "sip_media_security": { + "description": "Media protection selected on the SIP leg during SDP negotiation. `srtp`\nindicates SRTP; `rtp` indicates unencrypted RTP. Omitted when unknown.\nThis does not describe SIP signaling security or confirm that media has\nflowed. Clients should handle unrecognized values as unknown.\n", + "anyOf": [ + { + "type": "string", + "enum": [ + "rtp", + "srtp" + ] + }, + { + "type": "string" + } + ] + }, + "sip_headers": { + "type": "array", + "description": "Headers from the SIP INVITE, excluding SIP authorization headers.\nRetained names, values, repeated entries, and order are preserved.\nTreat these values as untrusted call metadata.\n", + "items": { + "type": "object", + "description": "A header from the SIP Invite.\n", + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the SIP Header.\n" + }, + "value": { + "type": "string", + "description": "Value of the SIP Header.\n" + } + } + } + } + } + }, + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", "enum": [ - "response.output_text.done" + "event" ], "x-stainless-const": true }, - "item_id": { + "type": { "type": "string", - "description": "The ID of the output item that the text content is finalized.\n" - }, - "output_index": { - "type": "integer", - "description": "The index of the output item that the text content is finalized.\n" - }, - "content_index": { + "description": "The type of the event. Always `live.transport.incoming`.\n", + "enum": [ + "live.transport.incoming" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "live.transport.incoming", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"live.transport.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"type\": \"sip\",\n \"session_id\": \"live_u0_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_media_security\": \"srtp\",\n \"sip_headers\": [\n {\"name\": \"From\", \"value\": \";tag=abc123\"},\n {\"name\": \"To\", \"value\": \"\"},\n {\"name\": \"Call-ID\", \"value\": \"call-123@example.com\"}\n ]\n }\n}\n" + } + }, + "WebhookRealtimeCallIncoming": { + "type": "object", + "title": "realtime.call.incoming", + "description": "Sent when an incoming API SIP session is available for Realtime acceptance.\nThe same pending session can also emit `live.transport.incoming`; the first\nsuccessful Realtime or Live accept endpoint selects the runtime surface.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { "type": "integer", - "description": "The index of the content part that the text content is finalized.\n" + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the model response was completed.\n" }, - "text": { + "id": { "type": "string", - "description": "The text content that is finalized.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number for this event." + "description": "The unique ID of the event.\n" }, - "logprobs": { - "type": "array", - "description": "The log probabilities of the tokens in the delta.\n", - "items": { - "$ref": "#/components/schemas/ResponseLogProb" + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "call_id", + "sip_headers" + ], + "properties": { + "call_id": { + "type": "string", + "description": "The ID of the pending SIP call. Pass this value unchanged when\naccepting or rejecting the call through the Realtime API. For the\nLive API, use the `session_id` from `live.transport.incoming` instead.\n" + }, + "sip_media_security": { + "description": "Media protection selected on the SIP leg during SDP negotiation. `srtp`\nindicates SRTP; `rtp` indicates unencrypted RTP. Omitted when unknown.\nThis does not describe SIP signaling security or confirm that media has\nflowed. Clients should handle unrecognized values as unknown.\n", + "anyOf": [ + { + "type": "string", + "enum": [ + "rtp", + "srtp" + ] + }, + { + "type": "string" + } + ] + }, + "sip_headers": { + "type": "array", + "description": "Headers from the SIP INVITE, excluding SIP authorization headers.\nRetained names, values, repeated entries, and order are preserved.\nTreat these values as untrusted call metadata.\n", + "items": { + "type": "object", + "description": "A header from the SIP Invite.\n", + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the SIP Header.\n" + }, + "value": { + "type": "string", + "description": "Value of the SIP Header.\n" + } + } + } + } } + }, + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true + }, + "type": { + "type": "string", + "description": "The type of the event. Always `realtime.call.incoming`.\n", + "enum": [ + "realtime.call.incoming" + ], + "x-stainless-const": true } }, - "required": [ - "type", - "item_id", - "output_index", - "content_index", - "text", - "sequence_number", - "logprobs" - ], "x-oaiMeta": { - "name": "response.output_text.done", - "group": "responses", - "example": "{\n \"type\": \"response.output_text.done\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"sequence_number\": 1\n}\n" + "name": "realtime.call.incoming", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_u0_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_media_security\": \"srtp\",\n \"sip_headers\": [\n {\"name\": \"Max-Forwards\", \"value\": \"63\"},\n {\"name\": \"CSeq\", \"value\": \"851287 INVITE\"},\n {\"name\": \"Content-Type\", \"value\": \"application/sdp\"}\n ]\n }\n}\n" } }, - "ResponseTextParam": { + "WebhookResponseCancelled": { "type": "object", - "description": "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text)\n- [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs)\n", + "title": "response.cancelled", + "description": "Sent when a background response has been cancelled.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], "properties": { - "format": { - "$ref": "#/components/schemas/TextResponseFormatConfiguration" + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the model response was cancelled.\n" }, - "verbosity": { - "$ref": "#/components/schemas/Verbosity" + "id": { + "type": "string", + "description": "The unique ID of the event.\n" + }, + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the model response.\n" + } + } + }, + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true + }, + "type": { + "type": "string", + "description": "The type of the event. Always `response.cancelled`.\n", + "enum": [ + "response.cancelled" + ], + "x-stainless-const": true } + }, + "x-oaiMeta": { + "name": "response.cancelled", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"response.cancelled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"resp_abc123\"\n }\n}\n" } }, - "ResponseUsage": { + "WebhookResponseCompleted": { "type": "object", - "description": "Represents token usage details including input tokens, output tokens,\na breakdown of output tokens, and the total tokens used.\n", + "title": "response.completed", + "description": "Sent when a background response has been completed.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], "properties": { - "input_tokens": { + "created_at": { "type": "integer", - "description": "The number of input tokens." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the model response was completed.\n" }, - "input_tokens_details": { + "id": { + "type": "string", + "description": "The unique ID of the event.\n" + }, + "data": { "type": "object", - "description": "A detailed breakdown of the input tokens.", + "description": "Event data payload.\n", + "required": [ + "id" + ], "properties": { - "cached_tokens": { - "type": "integer", - "description": "The number of tokens that were retrieved from the cache.\n[More on prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).\n" - }, - "cache_write_tokens": { - "type": "integer", - "description": "The number of input tokens that were written to the cache." + "id": { + "type": "string", + "description": "The unique ID of the model response.\n" } - }, - "required": [ - "cached_tokens", - "cache_write_tokens" - ] + } }, - "output_tokens": { + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", + "enum": [ + "event" + ], + "x-stainless-const": true + }, + "type": { + "type": "string", + "description": "The type of the event. Always `response.completed`.\n", + "enum": [ + "response.completed" + ], + "x-stainless-const": true + } + }, + "x-oaiMeta": { + "name": "response.completed", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"response.completed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"resp_abc123\"\n }\n}\n" + } + }, + "WebhookResponseFailed": { + "type": "object", + "title": "response.failed", + "description": "Sent when a background response has failed.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], + "properties": { + "created_at": { "type": "integer", - "description": "The number of output tokens." + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the model response failed.\n" }, - "output_tokens_details": { + "id": { + "type": "string", + "description": "The unique ID of the event.\n" + }, + "data": { "type": "object", - "description": "A detailed breakdown of the output tokens.", + "description": "Event data payload.\n", + "required": [ + "id" + ], "properties": { - "reasoning_tokens": { - "type": "integer", - "description": "The number of reasoning tokens." + "id": { + "type": "string", + "description": "The unique ID of the model response.\n" } - }, - "required": [ - "reasoning_tokens" - ] + } }, - "total_tokens": { - "type": "integer", - "description": "The total number of tokens used." - } - }, - "required": [ - "input_tokens", - "input_tokens_details", - "output_tokens", - "output_tokens_details", - "total_tokens" - ] - }, - "ResponseWebSearchCallCompletedEvent": { - "type": "object", - "description": "Emitted when a web search call is completed.", - "properties": { - "type": { + "object": { "type": "string", - "description": "The type of the event. Always `response.web_search_call.completed`.\n", + "description": "The object of the event. Always `event`.\n", "enum": [ - "response.web_search_call.completed" + "event" ], "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item that the web search call is associated with.\n" - }, - "item_id": { + "type": { "type": "string", - "description": "Unique ID for the output item associated with the web search call.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the web search call being processed." + "description": "The type of the event. Always `response.failed`.\n", + "enum": [ + "response.failed" + ], + "x-stainless-const": true } }, - "required": [ - "type", - "output_index", - "item_id", - "sequence_number" - ], "x-oaiMeta": { - "name": "response.web_search_call.completed", - "group": "responses", - "example": "{\n \"type\": \"response.web_search_call.completed\",\n \"output_index\": 0,\n \"item_id\": \"ws_123\",\n \"sequence_number\": 0\n}\n" + "name": "response.failed", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"response.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"resp_abc123\"\n }\n}\n" } }, - "ResponseWebSearchCallInProgressEvent": { + "WebhookResponseIncomplete": { "type": "object", - "description": "Emitted when a web search call is initiated.", + "title": "response.incomplete", + "description": "Sent when a background response has been interrupted.\n", + "required": [ + "created_at", + "id", + "data", + "type" + ], "properties": { - "type": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) of when the model response was interrupted.\n" + }, + "id": { "type": "string", - "description": "The type of the event. Always `response.web_search_call.in_progress`.\n", + "description": "The unique ID of the event.\n" + }, + "data": { + "type": "object", + "description": "Event data payload.\n", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the model response.\n" + } + } + }, + "object": { + "type": "string", + "description": "The object of the event. Always `event`.\n", "enum": [ - "response.web_search_call.in_progress" + "event" ], "x-stainless-const": true }, - "output_index": { - "type": "integer", - "description": "The index of the output item that the web search call is associated with.\n" - }, - "item_id": { + "type": { "type": "string", - "description": "Unique ID for the output item associated with the web search call.\n" - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the web search call being processed." + "description": "The type of the event. Always `response.incomplete`.\n", + "enum": [ + "response.incomplete" + ], + "x-stainless-const": true } }, - "required": [ - "type", - "output_index", - "item_id", - "sequence_number" - ], "x-oaiMeta": { - "name": "response.web_search_call.in_progress", - "group": "responses", - "example": "{\n \"type\": \"response.web_search_call.in_progress\",\n \"output_index\": 0,\n \"item_id\": \"ws_123\",\n \"sequence_number\": 0\n}\n" + "name": "response.incomplete", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"response.incomplete\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"resp_abc123\"\n }\n}\n" } }, - "ResponseWebSearchCallSearchingEvent": { + "WebhookSafetyAlertCreated": { "type": "object", - "description": "Emitted when a web search call is executing.", + "title": "safety.alert.created", + "description": "Sent when an approved safety alert is available for an API project.", + "required": [ + "id", + "object", + "created_at", + "type", + "data" + ], "properties": { - "type": { + "id": { + "type": "string", + "description": "The unique ID of the webhook event." + }, + "object": { "type": "string", - "description": "The type of the event. Always `response.web_search_call.searching`.\n", "enum": [ - "response.web_search_call.searching" + "event" ], - "x-stainless-const": true + "x-stainless-const": true, + "description": "Always `event`." }, - "output_index": { + "created_at": { "type": "integer", - "description": "The index of the output item that the web search call is associated with.\n" + "format": "unixtime", + "description": "The Unix timestamp in seconds when the event was created." }, - "item_id": { + "type": { "type": "string", - "description": "Unique ID for the output item associated with the web search call.\n" + "enum": [ + "safety.alert.created" + ], + "x-stainless-const": true, + "description": "Always `safety.alert.created`." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the web search call being processed." + "data": { + "type": "object", + "additionalProperties": false, + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^alert_[0-9a-f]{32}$", + "description": "The safety alert ID to pass to `GET /v1/safety/alerts/{id}`." + } + } } }, - "required": [ - "type", - "output_index", - "item_id", - "sequence_number" - ], "x-oaiMeta": { - "name": "response.web_search_call.searching", - "group": "responses", - "example": "{\n \"type\": \"response.web_search_call.searching\",\n \"output_index\": 0,\n \"item_id\": \"ws_123\",\n \"sequence_number\": 0\n}\n" + "name": "safety.alert.created", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1787659200,\n \"type\": \"safety.alert.created\",\n \"data\": {\"id\": \"alert_0123456789abcdef0123456789abcdef\"}\n}\n" } }, - "ResponseWsError": { + "WebhookSafetyDeactivationIssued": { "type": "object", - "title": "ResponseWsError", - "description": "Emitted when an error occurs while processing a Responses WebSocket request.", + "title": "safety.deactivation_issued", + "description": "Sent when a deactivation is issued for a safety identifier in your organization.", + "required": [ + "id", + "object", + "created_at", + "type", + "data" + ], "properties": { - "type": { + "id": { + "type": "string", + "description": "The unique ID of the webhook event." + }, + "object": { "type": "string", - "description": "The type of the event. Always `error`.", "enum": [ - "error" + "event" ], - "x-stainless-const": true - }, - "status": { - "type": "integer", - "description": "The HTTP status code associated with a WebSocket protocol error." + "x-stainless-const": true, + "description": "Always `event`." }, - "sequence_number": { + "created_at": { "type": "integer", - "description": "The sequence number of an error emitted by the response stream." - }, - "error": { - "$ref": "#/components/schemas/ErrorPayload", - "description": "Details about the error." + "format": "unixtime", + "description": "The Unix timestamp in seconds when the event was created." }, - "stream_id": { + "type": { "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present when the\noriginating `response.create` event supplied a `stream_id`.\n" - } - }, - "required": [ - "type", - "error" - ], - "x-oaiMeta": { - "name": "error", - "group": "responses", - "example": "{\n \"type\": \"error\",\n \"status\": 400,\n \"stream_id\": \"agent_1\",\n \"error\": {\n \"type\": \"invalid_request_error\",\n \"code\": \"websocket_stream_limit_reached\",\n \"message\": \"This WebSocket connection has reached its stream limit.\",\n \"param\": \"stream_id\"\n }\n}\n" - } - }, - "ResponsesClientEvent": { - "discriminator": { - "propertyName": "type" - }, - "description": "Client events accepted by the Responses WebSocket server.\n", - "anyOf": [ - { - "$ref": "#/components/schemas/ResponsesClientEventResponseCreate" + "enum": [ + "safety.deactivation_issued" + ], + "x-stainless-const": true, + "description": "Always `safety.deactivation_issued`." }, - { - "$ref": "#/components/schemas/ResponseSteerEvent" - } - ] - }, - "ResponsesClientEventResponseCreate": { - "allOf": [ - { + "data": { "type": "object", + "additionalProperties": false, + "required": [ + "id" + ], "properties": { - "type": { - "type": "string", - "enum": [ - "response.create" - ], - "description": "The type of the client event. Always `response.create`.\n", - "x-stainless-const": true - }, - "stream_id": { + "id": { "type": "string", - "minLength": 1, - "maxLength": 256, - "pattern": "^[A-Za-z0-9_.-]+$", - "description": "The WebSocket lane for this response. Requests with the same\n`stream_id` are processed FIFO, and events for the response echo the\nsame `stream_id`.\n\n`stream_id` controls routing; `previous_response_id` controls\nconversation lineage, so a new lane can fork from a response created\non another lane.\n" + "description": "The safety case ID to pass to `GET /v1/safety/cases/{id}`." } - }, - "required": [ - "type" - ] - }, - { - "$ref": "#/components/schemas/CreateResponse" + } } - ], - "description": "Client event for creating a response over a persistent WebSocket connection.\nThis payload uses the same top-level fields as `POST /v1/responses`, plus\nWebSocket-only envelope metadata.\n\nNotes:\n- `stream` is implicit over WebSocket and should not be sent.\n- `background` is not supported over WebSocket.\n- `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.\n", + }, "x-oaiMeta": { - "example": "{\n \"type\": \"response.create\",\n \"stream_id\": \"agent_1\",\n \"model\": \"gpt-6-astra\",\n \"input\": \"Say hello.\"\n}\n" + "name": "safety.deactivation_issued", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1787659200,\n \"type\": \"safety.deactivation_issued\",\n \"data\": {\"id\": \"C-abc123\"}\n}\n" } }, - "ResponsesServerEvent": { - "discriminator": { - "propertyName": "type" - }, - "description": "Server events emitted by the Responses WebSocket server.\n", - "anyOf": [ - { - "title": "ResponseAudioWsDelta", - "description": "Emitted when there is a partial audio response.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseAudioDeltaEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] - }, - { - "title": "ResponseAudioWsDone", - "description": "Emitted when the audio response is complete.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseAudioDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] - }, - { - "title": "ResponseAudioTranscriptWsDelta", - "description": "Emitted when there is a partial transcript of audio.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseAudioTranscriptDeltaEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] - }, - { - "title": "ResponseAudioTranscriptWsDone", - "description": "Emitted when the full audio transcript is completed.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseAudioTranscriptDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] - }, - { - "title": "ResponseCodeInterpreterCallCodeWsDelta", - "description": "Emitted when a partial code snippet is streamed by the code interpreter.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] - }, - { - "title": "ResponseCodeInterpreterCallCodeWsDone", - "description": "Emitted when the code snippet is finalized by the code interpreter.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "WebhookSafetyOrgAlertCreated": { + "type": "object", + "title": "safety.org_alert.created", + "description": "Sent when an approved safety alert is available for an enterprise workspace.", + "required": [ + "id", + "object", + "created_at", + "type", + "data" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the webhook event." }, - { - "title": "ResponseCodeInterpreterCallWsCompleted", - "description": "Emitted when the code interpreter call is completed.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCompletedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "object": { + "type": "string", + "enum": [ + "event" + ], + "x-stainless-const": true, + "description": "Always `event`." }, - { - "title": "ResponseCodeInterpreterCallInWsProgress", - "description": "Emitted when a code interpreter call is in progress.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallInProgressEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp in seconds when the event was created." }, - { - "title": "ResponseCodeInterpreterCallWsInterpreting", - "description": "Emitted when the code interpreter is actively interpreting the code snippet.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "type": { + "type": "string", + "enum": [ + "safety.org_alert.created" + ], + "x-stainless-const": true, + "description": "Always `safety.org_alert.created`." }, - { - "title": "ResponseWsCompleted", - "description": "Emitted when the model response is complete.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseCompletedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "data": { + "type": "object", + "additionalProperties": false, + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^alert_[0-9a-f]{32}$", + "description": "The safety alert ID to pass to `GET /v1/safety/alerts/{id}`." } - ] + } + } + }, + "x-oaiMeta": { + "name": "safety.org_alert.created", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1787659200,\n \"type\": \"safety.org_alert.created\",\n \"data\": {\"id\": \"alert_0123456789abcdef0123456789abcdef\"}\n}\n" + } + }, + "WebhookSafetyWarningIssued": { + "type": "object", + "title": "safety.warning_issued", + "description": "Sent when a warning is issued for a safety identifier in your organization.", + "required": [ + "id", + "object", + "created_at", + "type", + "data" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the webhook event." }, - { - "title": "ResponseContentPartWsAdded", - "description": "Emitted when a new content part is added.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseContentPartAddedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "object": { + "type": "string", + "enum": [ + "event" + ], + "x-stainless-const": true, + "description": "Always `event`." }, - { - "title": "ResponseContentPartWsDone", - "description": "Emitted when a content part is done.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseContentPartDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp in seconds when the event was created." }, - { - "title": "ResponseWsCreated", - "description": "An event that is emitted when a response is created.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseCreatedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "type": { + "type": "string", + "enum": [ + "safety.warning_issued" + ], + "x-stainless-const": true, + "description": "Always `safety.warning_issued`." }, - { - "title": "ResponseFileSearchCallWsCompleted", - "description": "Emitted when a file search call is completed (results found).", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseFileSearchCallCompletedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "data": { + "type": "object", + "additionalProperties": false, + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The safety case ID to pass to `GET /v1/safety/cases/{id}`." } - ] - }, + } + } + }, + "x-oaiMeta": { + "name": "safety.warning_issued", + "group": "webhook-events", + "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1787659200,\n \"type\": \"safety.warning_issued\",\n \"data\": {\"id\": \"C-abc123\"}\n}\n" + } + }, + "_MisalignmentErrorType": { + "anyOf": [ { - "title": "ResponseFileSearchCallInWsProgress", - "description": "Emitted when a file search call is initiated.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseFileSearchCallInProgressEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "type": "string" }, { - "title": "ResponseFileSearchCallWsSearching", - "description": "Emitted when a file search is currently searching.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseFileSearchCallSearchingEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } + "type": "string", + "enum": [ + "potentially_unintended_data_transfer", + "potentially_unintended_data_access", + "potentially_unintended_destructive_activity", + "other" ] - }, - { - "title": "ResponseFunctionCallArgumentsWsDelta", - "description": "Emitted when there is a partial function-call arguments delta.", - "allOf": [ + } + ] + }, + "_MisalignmentSteer": { + "properties": { + "message": { + "type": "string", + "description": "The public continuation instruction." + } + }, + "type": "object", + "required": [ + "message" + ] + }, + "MisalignmentErrorDetailsResource": { + "properties": { + "review_target": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent" + "not": { + "pattern": "[^A-Za-z0-9._~:-]" + }, + "type": "string", + "maxLength": 96, + "minLength": 1, + "pattern": "^[A-Za-z0-9._~:-]+$", + "description": "An opaque target for explicitly continuing this review, or null when unavailable." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] }, - { - "title": "ResponseFunctionCallArgumentsWsDone", - "description": "Emitted when function-call arguments are finalized.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "error_type": { + "$ref": "#/components/schemas/_MisalignmentErrorType", + "description": "An optional classification; clients must accept additional values." }, - { - "title": "ResponseShellCallCommandWsAdded", - "description": "A streaming event that indicated a shell command was added to a tool call.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseShellCallCommandAddedStreamingEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "detailed_explanation": { + "type": "string", + "description": "The public explanation for this block." }, - { - "title": "ResponseShellCallCommandWsDelta", - "description": "A streaming event that indicated a shell command was incrementally updated.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "steer": { + "$ref": "#/components/schemas/_MisalignmentSteer", + "description": "An optional public continuation instruction." + } + }, + "type": "object", + "required": [] + }, + "ModerationInputType": { + "type": "string", + "enum": [ + "text", + "image" + ] + }, + "ModerationResultBody": { + "properties": { + "type": { + "type": "string", + "enum": [ + "moderation_result" + ], + "description": "The object type, which was always `moderation_result` for successful moderation results.", + "default": "moderation_result", + "x-stainless-const": true }, - { - "title": "ResponseShellCallCommandWsDone", - "description": "A streaming event that indicated a shell command was completed.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseShellCallCommandDoneStreamingEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "model": { + "type": "string", + "description": "The moderation model that produced this result." }, - { - "title": "ResponseShellCallOutputContentWsDelta", - "description": "A streaming event that indicated shell call output was incrementally added.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent", - "x-stainless-skip": [ - "go" - ] - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "flagged": { + "type": "boolean", + "description": "A boolean indicating whether the content was flagged by any category." }, - { - "title": "ResponseShellCallOutputContentWsDone", - "description": "A streaming event that indicated shell call output was completed.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "categories": { + "additionalProperties": { + "type": "boolean" + }, + "type": "object", + "description": "A dictionary of moderation categories to booleans, True if the input is flagged under this category.", + "x-oaiTypeLabel": "map" }, - { - "title": "ResponseInWsProgress", - "description": "Emitted when the response is in progress.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseInProgressEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "category_scores": { + "additionalProperties": { + "type": "number" + }, + "type": "object", + "description": "A dictionary of moderation categories to scores.", + "x-oaiTypeLabel": "map" }, - { - "title": "ResponseWsFailed", - "description": "An event that is emitted when a response fails.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseFailedEvent" + "category_applied_input_types": { + "additionalProperties": { + "items": { + "$ref": "#/components/schemas/ModerationInputType" }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "type": "array" + }, + "type": "object", + "description": "Which modalities of input are reflected by the score for each category.", + "x-oaiTypeLabel": "map" + } + }, + "type": "object", + "required": [ + "type", + "model", + "flagged", + "categories", + "category_scores", + "category_applied_input_types" + ], + "title": "Moderation result", + "description": "A moderation result produced for the response input or output." + }, + "PromptCacheTTLEnum": { + "type": "string", + "enum": [ + "30m" + ] + }, + "PromptCacheModeEnum": { + "type": "string", + "enum": [ + "implicit", + "explicit" + ] + }, + "PromptCacheOptionsParam": { + "properties": { + "ttl": { + "$ref": "#/components/schemas/PromptCacheTTLEnum", + "description": "The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer." }, - { - "title": "ResponseWsIncomplete", - "description": "An event that is emitted when a response finishes as incomplete.\n\nOver WebSocket, steering can finish a response with\n`response.incomplete_details.reason` set to `steered`, followed automatically\nby a successor `response.created` that commits the queued steering input.\n", - "allOf": [ + "mode": { + "$ref": "#/components/schemas/PromptCacheModeEnum", + "description": "Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching." + } + }, + "type": "object", + "required": [], + "title": "Prompt cache options", + "description": "Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details." + }, + "PromptCacheBreakpointParam": { + "properties": { + "mode": { + "type": "string", + "enum": [ + "explicit" + ], + "description": "The breakpoint mode. Always `explicit`.", + "default": "explicit", + "x-stainless-const": true + }, + "ttl": { + "type": "string", + "enum": [ + "30m", + "12h" + ], + "description": "The minimum lifetime of this cache breakpoint. Defaults to the request TTL." + } + }, + "type": "object", + "required": [ + "mode" + ], + "title": "Prompt cache breakpoint", + "description": "Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." + }, + "ModerationMode": { + "type": "string", + "enum": [ + "score", + "block" + ] + }, + "ModerationConfigParam": { + "properties": { + "mode": { + "$ref": "#/components/schemas/ModerationMode" + } + }, + "type": "object", + "required": [ + "mode" + ], + "description": "The moderation policy for the response input." + }, + "ModerationPolicyParam": { + "properties": { + "input": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseIncompleteEvent" + "$ref": "#/components/schemas/ModerationConfigParam", + "description": "The moderation policy for the response input." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] }, - { - "title": "ResponseOutputItemWsAdded", - "description": "Emitted when a new output item is added.", - "allOf": [ + "output": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseOutputItemAddedEvent" + "$ref": "#/components/schemas/ModerationConfigParam", + "description": "The moderation policy for the response output." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] + } + }, + "type": "object", + "required": [], + "description": "The policy to apply to moderated response input and output." + }, + "ModerationParam": { + "properties": { + "model": { + "type": "string", + "description": "The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'." }, - { - "title": "ResponseOutputItemWsDone", - "description": "Emitted when an output item is marked done.", - "allOf": [ + "policy": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseOutputItemDoneEvent" + "$ref": "#/components/schemas/ModerationPolicyParam", + "description": "The policy to apply to moderated response input and output." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] + } + }, + "type": "object", + "required": [ + "model" + ], + "description": "Configuration for running moderation on the input and output of this response." + }, + "SkillReferenceParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "skill_reference" + ], + "description": "References a skill created with the /v1/skills endpoint.", + "default": "skill_reference", + "x-stainless-const": true }, - { - "title": "ResponseReasoningSummaryPartWsAdded", - "description": "Emitted when a new reasoning summary part is added.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseReasoningSummaryPartAddedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "skill_id": { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The ID of the referenced skill." }, - { - "title": "ResponseReasoningSummaryPartWsDone", - "description": "Emitted when a reasoning summary part is completed.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseReasoningSummaryPartDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "version": { + "type": "string", + "description": "Optional skill version. Use a positive integer or 'latest'. Omit for default." + } + }, + "type": "object", + "required": [ + "type", + "skill_id" + ] + }, + "InlineSkillSourceParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "base64" + ], + "description": "The type of the inline skill source. Must be `base64`.", + "default": "base64", + "x-stainless-const": true }, - { - "title": "ResponseReasoningSummaryTextWsDelta", - "description": "Emitted when a delta is added to a reasoning summary text.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseReasoningSummaryTextDeltaEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "media_type": { + "type": "string", + "enum": [ + "application/zip" + ], + "description": "The media type of the inline skill payload. Must be `application/zip`.", + "default": "application/zip", + "x-stainless-const": true }, - { - "title": "ResponseReasoningSummaryTextWsDone", - "description": "Emitted when a reasoning summary text is completed.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseReasoningSummaryTextDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "data": { + "type": "string", + "maxLength": 70254592, + "minLength": 1, + "description": "Base64-encoded skill zip bundle." + } + }, + "type": "object", + "required": [ + "type", + "media_type", + "data" + ], + "description": "Inline skill payload" + }, + "InlineSkillParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "inline" + ], + "description": "Defines an inline skill for this request.", + "default": "inline", + "x-stainless-const": true }, - { - "title": "ResponseReasoningTextWsDelta", - "description": "Emitted when a delta is added to a reasoning text.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseReasoningTextDeltaEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "name": { + "type": "string", + "description": "The name of the skill." }, - { - "title": "ResponseReasoningTextWsDone", - "description": "Emitted when a reasoning text is completed.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseReasoningTextDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "description": { + "type": "string", + "description": "The description of the skill." + }, + "source": { + "$ref": "#/components/schemas/InlineSkillSourceParam", + "description": "Inline skill payload" + } + }, + "type": "object", + "required": [ + "type", + "name", + "description", + "source" + ] + }, + "ContainerNetworkPolicyDisabledParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "disabled" + ], + "description": "Disable outbound network access. Always `disabled`.", + "default": "disabled", + "x-stainless-const": true + } + }, + "type": "object", + "required": [ + "type" + ] + }, + "ContainerNetworkPolicyDomainSecretParam": { + "properties": { + "domain": { + "type": "string", + "minLength": 1, + "description": "The domain associated with the secret." + }, + "name": { + "type": "string", + "minLength": 1, + "description": "The name of the secret to inject for the domain." + }, + "value": { + "type": "string", + "maxLength": 10485760, + "minLength": 1, + "description": "The secret value to inject for the domain." + } + }, + "type": "object", + "required": [ + "domain", + "name", + "value" + ] + }, + "ContainerNetworkPolicyAllowlistParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "allowlist" + ], + "description": "Allow outbound network access only to specified domains. Always `allowlist`.", + "default": "allowlist", + "x-stainless-const": true + }, + "allowed_domains": { + "items": { + "type": "string" + }, + "type": "array", + "minItems": 1, + "description": "A list of allowed domains when type is `allowlist`." + }, + "domain_secrets": { + "items": { + "$ref": "#/components/schemas/ContainerNetworkPolicyDomainSecretParam" + }, + "type": "array", + "minItems": 1, + "description": "Optional domain-scoped secrets for allowlisted domains." + } + }, + "type": "object", + "required": [ + "type", + "allowed_domains" + ] + }, + "IncludeEnum": { + "type": "string", + "enum": [ + "file_search_call.results", + "web_search_call.results", + "web_search_call.action.sources", + "message.input_image.image_url", + "computer_call_output.output.image_url", + "code_interpreter_call.outputs", + "reasoning.encrypted_content", + "message.output_text.logprobs" + ], + "description": "Specify additional output data to include in the model response. Currently supported values are:\n- `web_search_call.results`: Include the search results of the web search tool call.\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program)." + }, + "MessageStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + }, + "MessageRole": { + "type": "string", + "enum": [ + "unknown", + "user", + "assistant", + "system", + "critic", + "discriminator", + "developer", + "tool" + ] + }, + "PromptCacheBreakpointConfig": { + "properties": { + "mode": { + "type": "string", + "enum": [ + "explicit" + ], + "description": "The breakpoint mode. Always `explicit`.", + "default": "explicit", + "x-stainless-const": true + }, + "ttl": { + "type": "string", + "enum": [ + "30m", + "12h" + ], + "description": "The minimum lifetime of this cache breakpoint. Defaults to the request TTL." + } + }, + "type": "object", + "required": [ + "mode" + ], + "title": "Prompt cache breakpoint", + "description": "Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." + }, + "InputTextContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "input_text" + ], + "description": "The type of the input item. Always `input_text`.", + "default": "input_text", + "x-stainless-const": true + }, + "text": { + "type": "string", + "description": "The text input to the model." + }, + "prompt_cache_breakpoint": { + "$ref": "#/components/schemas/PromptCacheBreakpointConfig" + } + }, + "type": "object", + "required": [ + "type", + "text" + ], + "title": "Input text", + "description": "A text input to the model." + }, + "FileCitationBody": { + "properties": { + "type": { + "type": "string", + "enum": [ + "file_citation" + ], + "description": "The type of the file citation. Always `file_citation`.", + "default": "file_citation", + "x-stainless-const": true + }, + "file_id": { + "type": "string", + "description": "The ID of the file." + }, + "index": { + "type": "integer", + "description": "The index in the output text at which to insert the file citation." + }, + "filename": { + "type": "string", + "description": "The filename of the file cited." + } + }, + "type": "object", + "required": [ + "type", + "file_id", + "index", + "filename" + ], + "title": "File citation", + "description": "A citation to a file." + }, + "UrlCitationBody": { + "properties": { + "type": { + "type": "string", + "enum": [ + "url_citation" + ], + "description": "The type of the URL citation. Always `url_citation`.", + "default": "url_citation", + "x-stainless-const": true + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL of the web resource." + }, + "start_index": { + "type": "integer", + "description": "The index of the first character of the URL citation in the message." + }, + "end_index": { + "type": "integer", + "description": "The index of the last character of the URL citation in the message." + }, + "title": { + "type": "string", + "description": "The title of the web resource." + } + }, + "type": "object", + "required": [ + "type", + "url", + "start_index", + "end_index", + "title" + ], + "title": "URL citation", + "description": "A citation for a web resource used to generate a model response." + }, + "ContainerFileCitationBody": { + "properties": { + "type": { + "type": "string", + "enum": [ + "container_file_citation" + ], + "description": "The type of the container file citation. Always `container_file_citation`.", + "default": "container_file_citation", + "x-stainless-const": true + }, + "container_id": { + "type": "string", + "description": "The ID of the container file." + }, + "file_id": { + "type": "string", + "description": "The ID of the file." }, - { - "title": "ResponseRefusalWsDelta", - "description": "Emitted when there is a partial refusal text.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseRefusalDeltaEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "start_index": { + "type": "integer", + "description": "The index of the first character of the container file citation in the message." }, - { - "title": "ResponseRefusalWsDone", - "description": "Emitted when refusal text is finalized.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseRefusalDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "end_index": { + "type": "integer", + "description": "The index of the last character of the container file citation in the message." }, + "filename": { + "type": "string", + "description": "The filename of the container file cited." + } + }, + "type": "object", + "required": [ + "type", + "container_id", + "file_id", + "start_index", + "end_index", + "filename" + ], + "title": "Container file citation", + "description": "A citation for a container file used to generate a model response." + }, + "Annotation": { + "oneOf": [ { - "title": "ResponseTextWsDelta", - "description": "Emitted when there is an additional text delta.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseTextDeltaEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "$ref": "#/components/schemas/FileCitationBody" }, { - "title": "ResponseTextWsDone", - "description": "Emitted when text content is finalized.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseTextDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "$ref": "#/components/schemas/UrlCitationBody" }, { - "title": "ResponseWebSearchCallWsCompleted", - "description": "Emitted when a web search call is completed.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseWebSearchCallCompletedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "$ref": "#/components/schemas/ContainerFileCitationBody" }, { - "title": "ResponseWebSearchCallInWsProgress", - "description": "Emitted when a web search call is initiated.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseWebSearchCallInProgressEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "$ref": "#/components/schemas/FilePath" + } + ], + "description": "An annotation that applies to a span of output text.", + "discriminator": { + "propertyName": "type" + } + }, + "TopLogProb": { + "properties": { + "token": { + "type": "string" }, - { - "title": "ResponseWebSearchCallWsSearching", - "description": "Emitted when a web search call is executing.", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseWebSearchCallSearchingEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "logprob": { + "type": "number" }, - { - "title": "ResponseImageGenCallWsCompleted", - "description": "Emitted when an image generation tool call has completed and the final image is available.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseImageGenCallCompletedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "bytes": { + "items": { + "type": "integer" + }, + "type": "array" + } + }, + "type": "object", + "required": [ + "token", + "logprob", + "bytes" + ], + "title": "Top log probability", + "description": "The top log probability of a token." + }, + "LogProb": { + "properties": { + "token": { + "type": "string" }, - { - "title": "ResponseImageGenCallWsGenerating", - "description": "Emitted when an image generation tool call is actively generating an image (intermediate state).\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseImageGenCallGeneratingEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "logprob": { + "type": "number" }, - { - "title": "ResponseImageGenCallInWsProgress", - "description": "Emitted when an image generation tool call is in progress.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseImageGenCallInProgressEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "bytes": { + "items": { + "type": "integer" + }, + "type": "array" }, - { - "title": "ResponseImageGenCallPartialWsImage", - "description": "Emitted when a partial image is available during image generation streaming.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseImageGenCallPartialImageEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "top_logprobs": { + "items": { + "$ref": "#/components/schemas/TopLogProb" + }, + "type": "array" + } + }, + "type": "object", + "required": [ + "token", + "logprob", + "bytes", + "top_logprobs" + ], + "title": "Log probability", + "description": "The log probability of a token." + }, + "OutputTextContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "output_text" + ], + "description": "The type of the output text. Always `output_text`.", + "default": "output_text", + "x-stainless-const": true }, - { - "title": "ResponseMcpCallArgumentsWsDelta", - "description": "Emitted when there is a delta (partial update) to the arguments of an MCP tool call.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseMCPCallArgumentsDeltaEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "text": { + "type": "string", + "description": "The text output from the model." }, - { - "title": "ResponseMcpCallArgumentsWsDone", - "description": "Emitted when the arguments for an MCP tool call are finalized.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseMCPCallArgumentsDoneEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "annotations": { + "items": { + "$ref": "#/components/schemas/Annotation" + }, + "type": "array", + "description": "The annotations of the text output." }, - { - "title": "ResponseMcpCallWsCompleted", - "description": "Emitted when an MCP tool call has completed successfully.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseMCPCallCompletedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "logprobs": { + "items": { + "$ref": "#/components/schemas/LogProb" + }, + "type": "array" + } + }, + "type": "object", + "required": [ + "type", + "text", + "annotations", + "logprobs" + ], + "title": "Output text", + "description": "A text output from the model." + }, + "TextContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "text" + ], + "default": "text", + "x-stainless-const": true }, - { - "title": "ResponseMcpCallWsFailed", - "description": "Emitted when an MCP tool call has failed.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseMCPCallFailedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "text": { + "type": "string" + } + }, + "type": "object", + "required": [ + "type", + "text" + ], + "title": "Text Content", + "description": "A text content." + }, + "SummaryTextContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "summary_text" + ], + "description": "The type of the object. Always `summary_text`.", + "default": "summary_text", + "x-stainless-const": true }, - { - "title": "ResponseMcpCallInWsProgress", - "description": "Emitted when an MCP tool call is in progress.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseMCPCallInProgressEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "text": { + "type": "string", + "description": "A summary of the reasoning output from the model so far." + } + }, + "type": "object", + "required": [ + "type", + "text" + ], + "title": "Summary text", + "description": "A summary text from the model." + }, + "ReasoningTextContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "reasoning_text" + ], + "description": "The type of the reasoning text. Always `reasoning_text`.", + "default": "reasoning_text", + "x-stainless-const": true }, - { - "title": "ResponseMcpListToolsWsCompleted", - "description": "Emitted when the list of available MCP tools has been successfully retrieved.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseMCPListToolsCompletedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "text": { + "type": "string", + "description": "The reasoning text from the model." + } + }, + "type": "object", + "required": [ + "type", + "text" + ], + "title": "Reasoning text", + "description": "Reasoning text from the model." + }, + "RefusalContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "refusal" + ], + "description": "The type of the refusal. Always `refusal`.", + "default": "refusal", + "x-stainless-const": true + }, + "refusal": { + "type": "string", + "description": "The refusal explanation from the model." + } + }, + "type": "object", + "required": [ + "type", + "refusal" + ], + "title": "Refusal", + "description": "A refusal from the model." + }, + "ImageDetail": { + "type": "string", + "enum": [ + "low", + "high", + "auto", + "original" + ] + }, + "InputImageContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "input_image" + ], + "description": "The type of the input item. Always `input_image`.", + "default": "input_image", + "x-stainless-const": true }, - { - "title": "ResponseMcpListToolsWsFailed", - "description": "Emitted when the attempt to list available MCP tools has failed.\n", - "allOf": [ + "image_url": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseMCPListToolsFailedEvent" + "type": "string", + "format": "uri", + "description": "The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] }, - { - "title": "ResponseMcpListToolsInWsProgress", - "description": "Emitted when the system is in the process of retrieving the list of available MCP tools.\n", - "allOf": [ + "file_id": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseMCPListToolsInProgressEvent" + "type": "string", + "description": "The ID of the file to be sent to the model." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] }, - { - "title": "ResponseOutputTextAnnotationWsAdded", - "description": "Emitted when an annotation is added to output text content.\n", - "allOf": [ - { - "$ref": "#/components/schemas/ResponseOutputTextAnnotationAddedEvent" - }, - { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } - } - ] + "detail": { + "$ref": "#/components/schemas/ImageDetail", + "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." }, - { - "title": "ResponseWsQueued", - "description": "Emitted when a response is queued and waiting to be processed.\n", - "allOf": [ + "prompt_cache_breakpoint": { + "$ref": "#/components/schemas/PromptCacheBreakpointConfig" + } + }, + "type": "object", + "required": [ + "type", + "detail" + ], + "title": "Input image", + "description": "An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision)." + }, + "ComputerScreenshotContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "computer_screenshot" + ], + "description": "Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.", + "default": "computer_screenshot", + "x-stainless-const": true + }, + "image_url": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseQueuedEvent" + "type": "string", + "format": "uri", + "description": "The URL of the screenshot image." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] }, - { - "title": "ResponseCustomToolCallInputWsDelta", - "description": "Event representing a delta (partial update) to the input of a custom tool call.\n", - "allOf": [ + "file_id": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseCustomToolCallInputDeltaEvent" + "type": "string", + "description": "The identifier of an uploaded file that contains the screenshot." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] }, - { - "title": "ResponseCustomToolCallInputWsDone", - "description": "Event indicating that input for a custom tool call is complete.\n", - "allOf": [ + "detail": { + "$ref": "#/components/schemas/ImageDetail", + "description": "The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." + }, + "prompt_cache_breakpoint": { + "$ref": "#/components/schemas/PromptCacheBreakpointConfig" + } + }, + "type": "object", + "required": [ + "type", + "image_url", + "file_id", + "detail" + ], + "title": "Computer screenshot", + "description": "A screenshot of a computer." + }, + "FileInputDetail": { + "type": "string", + "enum": [ + "auto", + "low", + "high" + ] + }, + "InputFileContent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "input_file" + ], + "description": "The type of the input item. Always `input_file`.", + "default": "input_file", + "x-stainless-const": true + }, + "file_id": { + "anyOf": [ { - "$ref": "#/components/schemas/ResponseCustomToolCallInputDoneEvent" + "type": "string", + "description": "The ID of the file to be sent to the model." }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "type": "null" } ] }, - { - "$ref": "#/components/schemas/ResponseWsError" + "filename": { + "type": "string", + "description": "The name of the file to be sent to the model." }, - { - "$ref": "#/components/schemas/ResponseSteerAcceptedEvent" + "file_data": { + "type": "string", + "description": "The content of the file to be sent to the model.\n" }, - { - "$ref": "#/components/schemas/ResponseSteerPendingEvent" + "prompt_cache_breakpoint": { + "$ref": "#/components/schemas/PromptCacheBreakpointConfig" }, - { - "$ref": "#/components/schemas/ResponseSteerFailedEvent" + "file_url": { + "type": "string", + "format": "uri", + "description": "The URL of the file to be sent to the model." + }, + "detail": { + "$ref": "#/components/schemas/FileInputDetail", + "description": "The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`." } + }, + "type": "object", + "required": [ + "type" + ], + "title": "Input file", + "description": "A file input to the model." + }, + "MessagePhase-2": { + "type": "string", + "enum": [ + "commentary", + "final_answer" ] }, - "ResponsesWebSocketStreamEvent": { - "allOf": [ - { + "Message": { + "properties": { + "type": { + "type": "string", + "enum": [ + "message" + ], + "description": "The type of the message. Always set to `message`.", + "default": "message", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the message." + }, + "status": { + "$ref": "#/components/schemas/MessageStatus", + "description": "The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API." + }, + "role": { + "$ref": "#/components/schemas/MessageRole", + "description": "The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`." + }, + "content": { + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/InputTextContent" + }, + { + "$ref": "#/components/schemas/OutputTextContent" + }, + { + "$ref": "#/components/schemas/TextContent" + }, + { + "$ref": "#/components/schemas/SummaryTextContent" + }, + { + "$ref": "#/components/schemas/ReasoningTextContent" + }, + { + "$ref": "#/components/schemas/RefusalContent" + }, + { + "$ref": "#/components/schemas/InputImageContent" + }, + { + "$ref": "#/components/schemas/ComputerScreenshotContent" + }, + { + "$ref": "#/components/schemas/InputFileContent" + } + ], + "description": "A content part that makes up an input or output item.", + "discriminator": { + "propertyName": "type" + } + }, + "type": "array", + "description": "The content of the message" + }, + "phase": { "anyOf": [ { - "$ref": "#/components/schemas/ResponseAudioDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseAudioDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseAudioTranscriptDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseAudioTranscriptDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent" - }, - { - "$ref": "#/components/schemas/ResponseCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseContentPartAddedEvent" - }, - { - "$ref": "#/components/schemas/ResponseContentPartDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseCreatedEvent" - }, - { - "$ref": "#/components/schemas/ResponseFileSearchCallCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseFileSearchCallInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseFileSearchCallSearchingEvent" - }, - { - "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseFunctionCallArgumentsDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseShellCallCommandAddedStreamingEvent" - }, - { - "$ref": "#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent" - }, - { - "$ref": "#/components/schemas/ResponseShellCallCommandDoneStreamingEvent" - }, - { - "$ref": "#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent", - "x-stainless-skip": [ - "go" - ] - }, - { - "$ref": "#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent" - }, - { - "$ref": "#/components/schemas/ResponseInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseFailedEvent" - }, - { - "$ref": "#/components/schemas/ResponseIncompleteEvent" - }, - { - "$ref": "#/components/schemas/ResponseOutputItemAddedEvent" - }, - { - "$ref": "#/components/schemas/ResponseOutputItemDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseReasoningSummaryPartAddedEvent" - }, - { - "$ref": "#/components/schemas/ResponseReasoningSummaryPartDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseReasoningSummaryTextDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseReasoningSummaryTextDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseReasoningTextDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseReasoningTextDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseRefusalDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseRefusalDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseTextDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseTextDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseWebSearchCallCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseWebSearchCallInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseWebSearchCallSearchingEvent" - }, - { - "$ref": "#/components/schemas/ResponseImageGenCallCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseImageGenCallGeneratingEvent" - }, - { - "$ref": "#/components/schemas/ResponseImageGenCallInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseImageGenCallPartialImageEvent" - }, - { - "$ref": "#/components/schemas/ResponseMCPCallArgumentsDeltaEvent" - }, - { - "$ref": "#/components/schemas/ResponseMCPCallArgumentsDoneEvent" - }, - { - "$ref": "#/components/schemas/ResponseMCPCallCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseMCPCallFailedEvent" - }, - { - "$ref": "#/components/schemas/ResponseMCPCallInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseMCPListToolsCompletedEvent" - }, - { - "$ref": "#/components/schemas/ResponseMCPListToolsFailedEvent" - }, - { - "$ref": "#/components/schemas/ResponseMCPListToolsInProgressEvent" - }, - { - "$ref": "#/components/schemas/ResponseOutputTextAnnotationAddedEvent" - }, - { - "$ref": "#/components/schemas/ResponseQueuedEvent" - }, - { - "$ref": "#/components/schemas/ResponseCustomToolCallInputDeltaEvent" + "$ref": "#/components/schemas/MessagePhase-2", + "description": "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages." }, { - "$ref": "#/components/schemas/ResponseCustomToolCallInputDoneEvent" + "type": "null" } ] + } + }, + "type": "object", + "required": [ + "type", + "id", + "status", + "role", + "content" + ], + "title": "Message", + "description": "A message to or from the model." + }, + "DirectToolCallCaller": { + "properties": { + "type": { + "type": "string", + "enum": [ + "direct" + ], + "default": "direct", + "x-stainless-const": true + } + }, + "type": "object", + "required": [ + "type" + ] + }, + "ProgramToolCallCaller": { + "properties": { + "type": { + "type": "string", + "enum": [ + "program" + ], + "default": "program", + "x-stainless-const": true + }, + "caller_id": { + "type": "string", + "description": "The call ID of the program item that produced this tool call." + } + }, + "type": "object", + "required": [ + "type", + "caller_id" + ] + }, + "ToolCallCaller": { + "oneOf": [ + { + "$ref": "#/components/schemas/DirectToolCallCaller" }, { - "type": "object", - "properties": { - "stream_id": { - "type": "string", - "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" - } - } + "$ref": "#/components/schemas/ProgramToolCallCaller" } + ], + "description": "The execution context that produced this tool call.", + "discriminator": { + "propertyName": "type" + } + }, + "FunctionCallStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" ] }, - "Role": { + "DirectToolCallCallerParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "direct" + ], + "description": "The caller type. Always `direct`.", + "default": "direct", + "x-stainless-const": true + } + }, "type": "object", - "description": "Details about a role that can be assigned through the public Roles API.", + "required": [ + "type" + ] + }, + "ProgramToolCallCallerParam": { "properties": { - "object": { + "type": { "type": "string", "enum": [ - "role" + "program" ], - "description": "Always `role`.", + "description": "The caller type. Always `program`.", + "default": "program", "x-stainless-const": true }, - "id": { + "caller_id": { "type": "string", - "description": "Identifier for the role." + "maxLength": 64, + "minLength": 1, + "description": "The call ID of the program item that produced this tool call." + } + }, + "type": "object", + "required": [ + "type", + "caller_id" + ] + }, + "ToolCallCallerParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/DirectToolCallCallerParam" }, - "name": { + { + "$ref": "#/components/schemas/ProgramToolCallCallerParam" + } + ], + "description": "The execution context that produced this tool call.", + "discriminator": { + "propertyName": "type" + } + }, + "FunctionCallOutputStatusEnum": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + }, + "WebSearchCallStatus": { + "type": "string", + "enum": [ + "in_progress", + "searching", + "completed", + "failed", + "incomplete" + ] + }, + "ImageGenToolCallModerationDetails": { + "properties": { + "moderation_stage": { "type": "string", - "description": "Unique name for the role." + "enum": [ + "input", + "output", + "unknown" + ], + "description": "The stage where moderation blocked the image generation call." }, - "description": { - "description": "Optional description of the role.", + "categories": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Public moderation categories. New category values may be added over time." + } + }, + "type": "object", + "required": [ + "moderation_stage", + "categories" + ] + }, + "ImageGenToolCallError": { + "properties": { + "code": { "anyOf": [ { - "type": "string" + "type": "string", + "description": "The error code." }, { "type": "null" } ] }, - "permissions": { - "type": "array", - "description": "Permissions granted by the role.", - "items": { - "type": "string" - } + "type": { + "type": "string", + "description": "The error type." }, - "resource_type": { + "message": { "type": "string", - "description": "Resource type the role is bound to (for example `api.organization` or `api.project`)." + "description": "A description of the error." }, - "predefined_role": { - "type": "boolean", - "description": "Whether the role is predefined and managed by OpenAI." + "param": { + "anyOf": [ + { + "type": "string", + "description": "The related request parameter." + }, + { + "type": "null" + } + ] + }, + "moderation_details": { + "$ref": "#/components/schemas/ImageGenToolCallModerationDetails", + "description": "Public details for a `moderation_blocked` error, when available." } }, + "type": "object", "required": [ - "object", - "id", - "name", - "description", - "permissions", - "resource_type", - "predefined_role" - ], - "x-oaiMeta": { - "name": "The role object", - "example": "{\n \"object\": \"role\",\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"description\": \"Allows managing organization groups\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false\n}\n" - } + "code", + "type", + "message", + "param" + ] }, - "RoleDeletedResource": { - "type": "object", - "description": "Confirmation payload returned after deleting a role.", + "ImageGenActionEnum": { + "type": "string", + "enum": [ + "generate", + "edit", + "auto" + ] + }, + "ImageBackground": { + "type": "string", + "enum": [ + "transparent", + "opaque", + "auto" + ] + }, + "ImageOutputFormat": { + "type": "string", + "enum": [ + "png", + "webp", + "jpeg" + ] + }, + "ImageGenToolCall": { "properties": { - "object": { + "type": { "type": "string", "enum": [ - "role.deleted" + "image_generation_call" ], - "description": "Always `role.deleted`.", + "description": "The type of the image generation call. Always `image_generation_call`.", "x-stainless-const": true }, "id": { "type": "string", - "description": "Identifier of the deleted role." + "description": "The unique ID of the image generation call." }, - "deleted": { - "type": "boolean", - "description": "Whether the role was deleted." - } - }, - "required": [ - "object", - "id", - "deleted" - ], - "x-oaiMeta": { - "name": "Role deletion confirmation", - "example": "{\n \"object\": \"role.deleted\",\n \"id\": \"role_01J1F8ROLE01\",\n \"deleted\": true\n}\n" - } - }, - "RoleListResource": { - "type": "object", - "description": "Paginated list of roles assigned to a principal.", - "properties": { - "object": { + "status": { "type": "string", "enum": [ - "list" + "in_progress", + "completed", + "generating", + "failed" ], - "description": "Always `list`.", - "x-stainless-const": true - }, - "data": { - "type": "array", - "description": "Role assignments returned in the current page.", - "items": { - "$ref": "#/components/schemas/AssignedRoleDetails" - } - }, - "has_more": { - "type": "boolean", - "description": "Whether additional assignments are available when paginating." + "description": "The status of the image generation call." }, - "next": { - "description": "Cursor to fetch the next page of results, or `null` when there are no more assignments.", + "result": { "anyOf": [ { - "type": "string" + "type": "string", + "description": "The generated image encoded in base64." }, { "type": "null" } ] - } - }, - "required": [ - "object", - "data", - "has_more", - "next" - ], - "x-oaiMeta": { - "name": "Assigned role list", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false,\n \"description\": \"Allows managing organization groups\",\n \"created_at\": 1711471533,\n \"updated_at\": 1711472599,\n \"created_by\": \"user_abc123\",\n \"created_by_user_obj\": {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n },\n \"metadata\": {},\n \"assignment_sources\": null\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" - } - }, - "RunCompletionUsage": { - "anyOf": [ - { - "type": "object", - "description": "Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).", - "properties": { - "completion_tokens": { - "type": "integer", - "description": "Number of completion tokens used over the course of the run." - }, - "prompt_tokens": { - "type": "integer", - "description": "Number of prompt tokens used over the course of the run." + }, + "error": { + "$ref": "#/components/schemas/ImageGenToolCallError", + "description": "Details of a moderation failure, when available." + }, + "size": { + "anyOf": [ + { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "1024x1024", + "1024x1536", + "1536x1024" + ] + } + ], + "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." }, - "total_tokens": { - "type": "integer", - "description": "Total number of tokens used (prompt + completion)." + { + "type": "null" } - }, - "required": [ - "prompt_tokens", - "completion_tokens", - "total_tokens" ] }, - { - "type": "null" - } - ] - }, - "RunGraderRequest": { - "type": "object", - "title": "RunGraderRequest", - "properties": { - "grader": { - "type": "object", - "description": "The grader used for the fine-tuning job.", - "oneOf": [ + "quality": { + "anyOf": [ { - "$ref": "#/components/schemas/GraderStringCheck" + "type": "string", + "enum": [ + "low", + "medium", + "high", + "xhigh", + "max", + "auto" + ], + "description": "The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`." }, { - "$ref": "#/components/schemas/GraderTextSimilarity" - }, + "type": "null" + } + ] + }, + "action": { + "anyOf": [ { - "$ref": "#/components/schemas/GraderPython" + "$ref": "#/components/schemas/ImageGenActionEnum", + "description": "The action used for image generation." }, { - "$ref": "#/components/schemas/GraderScoreModel" + "type": "null" + } + ], + "x-openai-go-optional-enum": true + }, + "background": { + "anyOf": [ + { + "$ref": "#/components/schemas/ImageBackground", + "description": "The background setting used for generation." }, { - "$ref": "#/components/schemas/GraderMulti" + "type": "null" } - ] - }, - "item": { - "type": "object", - "description": "The dataset item provided to the grader. This will be used to populate\nthe `item` namespace. See [the guide](https://developers.openai.com/api/docs/guides/graders) for more details.\n" - }, - "model_sample": { - "type": "string", - "description": "The model sample to be evaluated. This value will be used to populate\nthe `sample` namespace. See [the guide](https://developers.openai.com/api/docs/guides/graders) for more details.\nThe `output_json` variable will be populated if the model sample is a\nvalid JSON string.\n" - } - }, - "required": [ - "grader", - "model_sample" - ] - }, - "RunGraderResponse": { - "type": "object", - "properties": { - "reward": { - "type": "number" + ], + "x-openai-go-optional-enum": true }, - "metadata": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string" - }, - "errors": { - "type": "object", - "properties": { - "formula_parse_error": { - "type": "boolean" - }, - "sample_parse_error": { - "type": "boolean" - }, - "truncated_observation_error": { - "type": "boolean" - }, - "unresponsive_reward_error": { - "type": "boolean" - }, - "invalid_variable_error": { - "type": "boolean" - }, - "other_error": { - "type": "boolean" - }, - "python_grader_server_error": { - "type": "boolean" - }, - "python_grader_server_error_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "python_grader_runtime_error": { - "type": "boolean" - }, - "python_grader_runtime_error_details": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "model_grader_server_error": { - "type": "boolean" - }, - "model_grader_refusal_error": { - "type": "boolean" - }, - "model_grader_parse_error": { - "type": "boolean" - }, - "model_grader_server_error_details": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "formula_parse_error", - "sample_parse_error", - "truncated_observation_error", - "unresponsive_reward_error", - "invalid_variable_error", - "other_error", - "python_grader_server_error", - "python_grader_server_error_type", - "python_grader_runtime_error", - "python_grader_runtime_error_details", - "model_grader_server_error", - "model_grader_refusal_error", - "model_grader_parse_error", - "model_grader_server_error_details" - ] - }, - "execution_time": { - "type": "number" - }, - "scores": { - "type": "object", - "additionalProperties": {} - }, - "token_usage": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ] + "output_format": { + "anyOf": [ + { + "$ref": "#/components/schemas/ImageOutputFormat", + "description": "The output format used for generation." }, - "sampled_model_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + { + "type": "null" } - }, - "required": [ - "name", - "type", - "errors", - "execution_time", - "scores", - "token_usage", - "sampled_model_name" - ] - }, - "sub_rewards": { - "type": "object", - "additionalProperties": {} + ], + "x-openai-go-optional-enum": true }, - "model_grader_token_usage_per_model": { - "type": "object", - "additionalProperties": {} + "revised_prompt": { + "anyOf": [ + { + "type": "string", + "description": "The prompt that was used after any model prompt rewriting." + }, + { + "type": "null" + } + ] } }, + "type": "object", "required": [ - "reward", - "metadata", - "sub_rewards", - "model_grader_token_usage_per_model" + "type", + "id", + "status", + "result" + ], + "title": "Image generation call", + "description": "An image generation request made by the model." + }, + "ClickButtonType": { + "type": "string", + "enum": [ + "left", + "right", + "wheel", + "back", + "forward" ] }, - "RunObject": { - "type": "object", - "title": "A run on a thread", - "description": "Represents an execution run on a [thread](https://developers.openai.com/api/docs/assistants/migration).", + "ClickParam": { "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread.run`.", + "type": { "type": "string", "enum": [ - "thread.run" + "click" ], + "description": "Specifies the event type. For a click action, this property is always `click`.", + "default": "click", "x-stainless-const": true }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the run was created.", - "type": "integer", - "format": "unixtime" - }, - "thread_id": { - "description": "The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) that was executed on as a part of this run.", - "type": "string" + "button": { + "$ref": "#/components/schemas/ClickButtonType", + "description": "Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`." }, - "assistant_id": { - "description": "The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for execution of this run.", - "type": "string" + "x": { + "type": "integer", + "description": "The x-coordinate where the click occurred." }, - "status": { - "description": "The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.", - "type": "string", - "enum": [ - "queued", - "in_progress", - "requires_action", - "cancelling", - "cancelled", - "failed", - "completed", - "incomplete", - "expired" - ] + "y": { + "type": "integer", + "description": "The y-coordinate where the click occurred." }, - "required_action": { - "type": "object", - "description": "Details on the action required to continue the run. Will be `null` if no action is required.", - "nullable": true, - "properties": { - "type": { - "description": "For now, this is always `submit_tool_outputs`.", - "type": "string", - "enum": [ - "submit_tool_outputs" - ], - "x-stainless-const": true - }, - "submit_tool_outputs": { - "type": "object", - "description": "Details on the tool outputs needed for this run to continue.", - "properties": { - "tool_calls": { - "type": "array", - "description": "A list of the relevant tool calls.", - "items": { - "$ref": "#/components/schemas/RunToolCallObject" - } - } + "keys": { + "anyOf": [ + { + "items": { + "type": "string" }, - "required": [ - "tool_calls" - ] - } - }, - "required": [ - "type", - "submit_tool_outputs" - ] - }, - "last_error": { - "type": "object", - "description": "The last error associated with this run. Will be `null` if there are no errors.", - "nullable": true, - "properties": { - "code": { - "type": "string", - "description": "One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.", - "enum": [ - "server_error", - "rate_limit_exceeded", - "invalid_prompt" - ] + "type": "array", + "description": "The keys being held while clicking." }, - "message": { - "type": "string", - "description": "A human-readable description of the error." + { + "type": "null" } - }, - "required": [ - "code", - "message" ] + } + }, + "type": "object", + "required": [ + "type", + "button", + "x", + "y" + ], + "title": "Click", + "description": "A click action." + }, + "DoubleClickAction": { + "properties": { + "type": { + "type": "string", + "enum": [ + "double_click" + ], + "description": "Specifies the event type. For a double click action, this property is always set to `double_click`.", + "default": "double_click", + "x-stainless-const": true }, - "expires_at": { - "description": "The Unix timestamp (in seconds) for when the run will expire.", + "x": { "type": "integer", - "format": "unixtime", - "nullable": true + "description": "The x-coordinate where the double click occurred." }, - "started_at": { - "description": "The Unix timestamp (in seconds) for when the run was started.", + "y": { "type": "integer", - "format": "unixtime", - "nullable": true + "description": "The y-coordinate where the double click occurred." }, - "cancelled_at": { - "description": "The Unix timestamp (in seconds) for when the run was cancelled.", + "keys": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array", + "description": "The keys being held while double-clicking." + }, + { + "type": "null" + } + ] + } + }, + "type": "object", + "required": [ + "type", + "x", + "y", + "keys" + ], + "title": "DoubleClick", + "description": "A double click action." + }, + "CoordParam": { + "properties": { + "x": { "type": "integer", - "format": "unixtime", - "nullable": true + "description": "The x-coordinate." }, - "failed_at": { - "description": "The Unix timestamp (in seconds) for when the run failed.", + "y": { "type": "integer", - "format": "unixtime", - "nullable": true + "description": "The y-coordinate." + } + }, + "type": "object", + "required": [ + "x", + "y" + ], + "title": "Coordinate", + "description": "An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`." + }, + "DragParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "drag" + ], + "description": "Specifies the event type. For a drag action, this property is always set to `drag`.", + "default": "drag", + "x-stainless-const": true }, - "completed_at": { - "description": "The Unix timestamp (in seconds) for when the run was completed.", - "type": "integer", - "format": "unixtime", - "nullable": true + "path": { + "items": { + "$ref": "#/components/schemas/CoordParam" + }, + "type": "array", + "description": "An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg\n```\n[\n { x: 100, y: 200 },\n { x: 200, y: 300 }\n]\n```" }, - "incomplete_details": { - "description": "Details on why the run is incomplete. Will be `null` if the run is not incomplete.", - "type": "object", - "nullable": true, - "properties": { - "reason": { - "description": "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.", - "type": "string", - "enum": [ - "max_completion_tokens", - "max_prompt_tokens" - ] + "keys": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array", + "description": "The keys being held while dragging the mouse." + }, + { + "type": "null" } - } - }, - "model": { - "description": "The model that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run.", - "type": "string" - }, - "instructions": { - "description": "The instructions that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run.", - "type": "string" + ] + } + }, + "type": "object", + "required": [ + "type", + "path" + ], + "title": "Drag", + "description": "A drag action." + }, + "KeyPressAction": { + "properties": { + "type": { + "type": "string", + "enum": [ + "keypress" + ], + "description": "Specifies the event type. For a keypress action, this property is always set to `keypress`.", + "default": "keypress", + "x-stainless-const": true }, - "tools": { - "description": "The list of tools that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run.", - "default": [], - "type": "array", - "maxItems": 20, + "keys": { "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/AssistantToolsCode" - }, - { - "$ref": "#/components/schemas/AssistantToolsFileSearch" - }, - { - "$ref": "#/components/schemas/AssistantToolsFunction" - } - ] - } - }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "usage": { - "$ref": "#/components/schemas/RunCompletionUsage" - }, - "temperature": { - "description": "The sampling temperature used for this run. If not set, defaults to 1.", - "type": "number", - "nullable": true - }, - "top_p": { - "description": "The nucleus sampling value used for this run. If not set, defaults to 1.", - "type": "number", - "nullable": true + "type": "string", + "description": "One of the keys the model is requesting to be pressed." + }, + "type": "array", + "description": "The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key." + } + }, + "type": "object", + "required": [ + "type", + "keys" + ], + "title": "KeyPress", + "description": "A collection of keypresses the model would like to perform." + }, + "MoveParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "move" + ], + "description": "Specifies the event type. For a move action, this property is always set to `move`.", + "default": "move", + "x-stainless-const": true }, - "max_prompt_tokens": { + "x": { "type": "integer", - "nullable": true, - "description": "The maximum number of prompt tokens specified to have been used over the course of the run.\n", - "minimum": 256 + "description": "The x-coordinate to move to." }, - "max_completion_tokens": { + "y": { "type": "integer", - "nullable": true, - "description": "The maximum number of completion tokens specified to have been used over the course of the run.\n", - "minimum": 256 + "description": "The y-coordinate to move to." }, - "truncation_strategy": { - "allOf": [ + "keys": { + "anyOf": [ { - "$ref": "#/components/schemas/TruncationObject" + "items": { + "type": "string" + }, + "type": "array", + "description": "The keys being held while moving the mouse." }, { - "nullable": true + "type": "null" } ] + } + }, + "type": "object", + "required": [ + "type", + "x", + "y" + ], + "title": "Move", + "description": "A mouse move action." + }, + "ScreenshotParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "screenshot" + ], + "description": "Specifies the event type. For a screenshot action, this property is always set to `screenshot`.", + "default": "screenshot", + "x-stainless-const": true + } + }, + "type": "object", + "required": [ + "type" + ], + "title": "Screenshot", + "description": "A screenshot action." + }, + "ScrollParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "scroll" + ], + "description": "Specifies the event type. For a scroll action, this property is always set to `scroll`.", + "default": "scroll", + "x-stainless-const": true }, - "tool_choice": { - "allOf": [ + "x": { + "type": "integer", + "description": "The x-coordinate where the scroll occurred." + }, + "y": { + "type": "integer", + "description": "The y-coordinate where the scroll occurred." + }, + "scroll_x": { + "type": "integer", + "description": "The horizontal scroll distance." + }, + "scroll_y": { + "type": "integer", + "description": "The vertical scroll distance." + }, + "keys": { + "anyOf": [ { - "$ref": "#/components/schemas/AssistantsApiToolChoiceOption" + "items": { + "type": "string" + }, + "type": "array", + "description": "The keys being held while scrolling." }, { - "nullable": true + "type": "null" } ] - }, - "parallel_tool_calls": { - "$ref": "#/components/schemas/ParallelToolCalls" - }, - "response_format": { - "$ref": "#/components/schemas/AssistantsApiResponseFormatOption", - "nullable": true } }, + "type": "object", "required": [ - "id", - "object", - "created_at", - "thread_id", - "assistant_id", - "status", - "required_action", - "last_error", - "expires_at", - "started_at", - "cancelled_at", - "failed_at", - "completed_at", - "model", - "instructions", - "tools", - "metadata", - "usage", - "incomplete_details", - "max_prompt_tokens", - "max_completion_tokens", - "truncation_strategy", - "tool_choice", - "parallel_tool_calls", - "response_format" + "type", + "x", + "y", + "scroll_x", + "scroll_y" ], - "x-oaiMeta": { - "name": "The run object", - "beta": true, - "example": "{\n \"id\": \"run_abc123\",\n \"object\": \"thread.run\",\n \"created_at\": 1698107661,\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"status\": \"completed\",\n \"started_at\": 1699073476,\n \"expires_at\": null,\n \"cancelled_at\": null,\n \"failed_at\": null,\n \"completed_at\": 1699073498,\n \"last_error\": null,\n \"model\": \"gpt-5\",\n \"instructions\": null,\n \"tools\": [{\"type\": \"file_search\"}, {\"type\": \"code_interpreter\"}],\n \"metadata\": {},\n \"incomplete_details\": null,\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n },\n \"temperature\": 1.0,\n \"top_p\": 1.0,\n \"max_prompt_tokens\": 1000,\n \"max_completion_tokens\": 1000,\n \"truncation_strategy\": {\n \"type\": \"auto\",\n \"last_messages\": null\n },\n \"response_format\": \"auto\",\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": true\n}\n" - } - }, - "RunStepCompletionUsage": { - "anyOf": [ - { - "type": "object", - "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", - "properties": { - "completion_tokens": { - "type": "integer", - "description": "Number of completion tokens used over the course of the run step." - }, - "prompt_tokens": { - "type": "integer", - "description": "Number of prompt tokens used over the course of the run step." - }, - "total_tokens": { - "type": "integer", - "description": "Total number of tokens used (prompt + completion)." - } - }, - "required": [ - "prompt_tokens", - "completion_tokens", - "total_tokens" - ] - }, - { - "type": "null" - } - ] + "title": "Scroll", + "description": "A scroll action." }, - "RunStepDeltaObject": { - "type": "object", - "title": "Run step delta object", - "description": "Represents a run step delta i.e. any changed fields on a run step during streaming.\n", + "TypeParam": { "properties": { - "id": { - "description": "The identifier of the run step, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread.run.step.delta`.", + "type": { "type": "string", "enum": [ - "thread.run.step.delta" + "type" ], + "description": "Specifies the event type. For a type action, this property is always set to `type`.", + "default": "type", "x-stainless-const": true }, - "delta": { - "description": "The delta containing the fields that have changed on the run step.", - "type": "object", - "properties": { - "step_details": { - "type": "object", - "description": "The details of the run step.", - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsMessageCreationObject" - }, - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsObject" - } - ] - } - } + "text": { + "type": "string", + "description": "The text to type." } }, + "type": "object", "required": [ - "id", - "object", - "delta" + "type", + "text" ], - "x-oaiMeta": { - "name": "The run step delta object", - "beta": true, - "example": "{\n \"id\": \"step_123\",\n \"object\": \"thread.run.step.delta\",\n \"delta\": {\n \"step_details\": {\n \"type\": \"tool_calls\",\n \"tool_calls\": [\n {\n \"index\": 0,\n \"id\": \"call_123\",\n \"type\": \"code_interpreter\",\n \"code_interpreter\": { \"input\": \"\", \"outputs\": [] }\n }\n ]\n }\n }\n}\n" - } + "title": "Type", + "description": "An action to type in text." }, - "RunStepDeltaStepDetailsMessageCreationObject": { - "title": "Message creation", - "type": "object", - "description": "Details of the message creation by the run step.", + "WaitParam": { "properties": { "type": { - "description": "Always `message_creation`.", "type": "string", "enum": [ - "message_creation" + "wait" ], + "description": "Specifies the event type. For a wait action, this property is always set to `wait`.", + "default": "wait", "x-stainless-const": true + } + }, + "type": "object", + "required": [ + "type" + ], + "title": "Wait", + "description": "A wait action." + }, + "ComputerCallSafetyCheckParam": { + "properties": { + "id": { + "type": "string", + "description": "The ID of the pending safety check." }, - "message_creation": { - "type": "object", - "properties": { - "message_id": { + "code": { + "anyOf": [ + { "type": "string", - "description": "The ID of the message that was created by this run step." + "description": "The type of the pending safety check." + }, + { + "type": "null" } - } + ] + }, + "message": { + "anyOf": [ + { + "type": "string", + "description": "Details about the pending safety check." + }, + { + "type": "null" + } + ] } }, + "type": "object", "required": [ - "type" + "id" + ], + "description": "A pending safety check for the computer call." + }, + "ComputerCallOutputStatus": { + "type": "string", + "enum": [ + "completed", + "incomplete", + "failed" ] }, - "RunStepDeltaStepDetailsToolCallsCodeObject": { - "title": "Code interpreter tool call", - "type": "object", - "description": "Details of the Code Interpreter tool call the run step was involved in.", + "ToolSearchExecutionType": { + "type": "string", + "enum": [ + "server", + "client" + ] + }, + "ToolSearchCall": { "properties": { - "index": { - "type": "integer", - "description": "The index of the tool call in the tool calls array." + "type": { + "type": "string", + "enum": [ + "tool_search_call" + ], + "description": "The type of the item. Always `tool_search_call`.", + "default": "tool_search_call", + "x-stainless-const": true }, "id": { "type": "string", - "description": "The ID of the tool call." + "description": "The unique ID of the tool search call item." + }, + "call_id": { + "anyOf": [ + { + "type": "string", + "description": "The unique ID of the tool search call generated by the model." + }, + { + "type": "null" + } + ] + }, + "execution": { + "$ref": "#/components/schemas/ToolSearchExecutionType", + "description": "Whether tool search was executed by the server or by the client." + }, + "arguments": { + "description": "Arguments used for the tool search call." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatus", + "description": "The status of the tool search call item that was recorded." }, + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item." + } + }, + "type": "object", + "required": [ + "type", + "id", + "call_id", + "execution", + "arguments", + "status" + ] + }, + "CallableToolAllowedCaller": { + "type": "string", + "enum": [ + "direct", + "programmatic" + ] + }, + "FunctionTool": { + "properties": { "type": { "type": "string", - "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call.", "enum": [ - "code_interpreter" + "function" ], + "description": "The type of the function tool. Always `function`.", + "default": "function", "x-stainless-const": true }, - "code_interpreter": { - "type": "object", - "description": "The Code Interpreter tool call definition.", - "properties": { - "input": { + "name": { + "type": "string", + "description": "The name of the function to call." + }, + "async": { + "type": "boolean" + }, + "description": { + "anyOf": [ + { "type": "string", - "description": "The input to the Code Interpreter tool call." + "description": "A description of the function. Used by the model to determine whether or not to call the function." }, - "outputs": { - "type": "array", - "description": "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.", + { + "type": "null" + } + ] + }, + "parameters": { + "anyOf": [ + { + "additionalProperties": {}, + "type": "object", + "description": "A JSON schema object describing the parameters of the function.", + "x-oaiTypeLabel": "map" + }, + { + "type": "null" + } + ] + }, + "output_schema": { + "anyOf": [ + { + "additionalProperties": {}, + "type": "object", + "description": "A JSON schema object describing the JSON value encoded in string outputs for this function.", + "x-oaiTypeLabel": "map" + }, + { + "type": "null" + } + ] + }, + "strict": { + "anyOf": [ + { + "type": "boolean", + "description": "Whether strict parameter validation is enforced for this function tool." + }, + { + "type": "null" + } + ] + }, + "defer_loading": { + "type": "boolean", + "description": "Whether this function is deferred and loaded via tool search." + }, + "allowed_callers": { + "anyOf": [ + { "items": { - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject" - }, - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObject" - } - ] - } + "$ref": "#/components/schemas/CallableToolAllowedCaller" + }, + "type": "array", + "description": "The tool invocation context(s)." + }, + { + "type": "null" } - } + ] } }, + "type": "object", "required": [ - "index", - "type" + "type", + "name", + "strict", + "parameters" + ], + "title": "Function", + "description": "Defines a function in your own code the model can choose to call. Learn more about [function calling](https://developers.openai.com/api/docs/guides/function-calling).", + "x-openai-structured-output": "function" + }, + "RankerVersionType": { + "type": "string", + "enum": [ + "auto", + "default-2024-11-15" ] }, - "RunStepDeltaStepDetailsToolCallsCodeOutputImageObject": { - "title": "Code interpreter image output", + "HybridSearchOptions": { + "properties": { + "embedding_weight": { + "type": "number", + "description": "The weight of the embedding in the reciprocal ranking fusion." + }, + "text_weight": { + "type": "number", + "description": "The weight of the text in the reciprocal ranking fusion." + } + }, "type": "object", + "required": [ + "embedding_weight", + "text_weight" + ] + }, + "RankingOptions": { "properties": { - "index": { - "type": "integer", - "description": "The index of the output in the outputs array." + "ranker": { + "$ref": "#/components/schemas/RankerVersionType", + "description": "The ranker to use for the file search." + }, + "score_threshold": { + "type": "number", + "description": "The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results." + }, + "hybrid_search": { + "$ref": "#/components/schemas/HybridSearchOptions", + "description": "Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled." + } + }, + "type": "object", + "required": [] + }, + "Filters": { + "anyOf": [ + { + "$ref": "#/components/schemas/ComparisonFilter" }, + { + "$ref": "#/components/schemas/CompoundFilter" + } + ] + }, + "FileSearchTool": { + "properties": { "type": { - "description": "Always `image`.", "type": "string", "enum": [ - "image" + "file_search" ], + "description": "The type of the file search tool. Always `file_search`.", + "default": "file_search", "x-stainless-const": true }, - "image": { - "type": "object", - "properties": { - "file_id": { - "description": "The [file](https://developers.openai.com/api/reference/resources/files) ID of the image.", - "type": "string" + "vector_store_ids": { + "items": { + "type": "string" + }, + "type": "array", + "description": "The IDs of the vector stores to search." + }, + "max_num_results": { + "type": "integer", + "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive." + }, + "ranking_options": { + "$ref": "#/components/schemas/RankingOptions", + "description": "Ranking options for search." + }, + "filters": { + "anyOf": [ + { + "$ref": "#/components/schemas/Filters", + "description": "A filter to apply." + }, + { + "type": "null" } - } + ] } }, + "type": "object", "required": [ - "index", - "type" - ] + "type", + "vector_store_ids" + ], + "title": "File search", + "description": "A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://developers.openai.com/api/docs/guides/tools-file-search)." }, - "RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject": { - "title": "Code interpreter log output", - "type": "object", - "description": "Text output from the Code Interpreter tool call as part of a run step.", + "ComputerTool": { "properties": { - "index": { - "type": "integer", - "description": "The index of the output in the outputs array." - }, "type": { - "description": "Always `logs`.", "type": "string", "enum": [ - "logs" + "computer" ], + "description": "The type of the computer tool. Always `computer`.", + "default": "computer", "x-stainless-const": true - }, - "logs": { - "type": "string", - "description": "The text output from the Code Interpreter tool call." } }, + "type": "object", "required": [ - "index", "type" + ], + "title": "Computer", + "description": "A tool that controls a virtual computer. Learn more about the [computer tool](https://developers.openai.com/api/docs/guides/tools-computer-use)." + }, + "ComputerEnvironment": { + "type": "string", + "enum": [ + "windows", + "mac", + "linux", + "ubuntu", + "browser" ] }, - "RunStepDeltaStepDetailsToolCallsFileSearchObject": { - "title": "File search tool call", - "type": "object", + "ComputerUsePreviewTool": { "properties": { - "index": { - "type": "integer", - "description": "The index of the tool call in the tool calls array." - }, - "id": { - "type": "string", - "description": "The ID of the tool call object." - }, "type": { "type": "string", - "description": "The type of tool call. This is always going to be `file_search` for this type of tool call.", "enum": [ - "file_search" + "computer_use_preview" ], + "description": "The type of the computer use tool. Always `computer_use_preview`.", + "default": "computer_use_preview", "x-stainless-const": true }, - "file_search": { - "type": "object", - "description": "For now, this is always going to be an empty object.", - "x-oaiTypeLabel": "map" + "environment": { + "$ref": "#/components/schemas/ComputerEnvironment", + "description": "The type of computer environment to control." + }, + "display_width": { + "type": "integer", + "description": "The width of the computer display." + }, + "display_height": { + "type": "integer", + "description": "The height of the computer display." } }, + "type": "object", "required": [ - "index", "type", - "file_search" + "environment", + "display_width", + "display_height" + ], + "title": "Computer use preview", + "description": "A tool that controls a virtual computer. Learn more about the [computer tool](https://developers.openai.com/api/docs/guides/tools-computer-use)." + }, + "ContainerMemoryLimit": { + "type": "string", + "enum": [ + "1g", + "4g", + "16g", + "64g" ] }, - "RunStepDeltaStepDetailsToolCallsFunctionObject": { - "type": "object", - "title": "Function tool call", + "AutoCodeInterpreterToolParam": { "properties": { - "index": { - "type": "integer", - "description": "The index of the tool call in the tool calls array." - }, - "id": { - "type": "string", - "description": "The ID of the tool call object." - }, "type": { "type": "string", - "description": "The type of tool call. This is always going to be `function` for this type of tool call.", "enum": [ - "function" + "auto" ], + "description": "Always `auto`.", + "default": "auto", "x-stainless-const": true }, - "function": { - "type": "object", - "description": "The definition of the function that was called.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." + "file_ids": { + "items": { + "type": "string", + "example": "file-123" + }, + "type": "array", + "maxItems": 50, + "description": "An optional list of uploaded files to make available to your code." + }, + "memory_limit": { + "anyOf": [ + { + "$ref": "#/components/schemas/ContainerMemoryLimit", + "description": "The memory limit for the code interpreter container." }, - "arguments": { - "type": "string", - "description": "The arguments passed to the function." + { + "type": "null" + } + ] + }, + "network_policy": { + "oneOf": [ + { + "$ref": "#/components/schemas/ContainerNetworkPolicyDisabledParam" }, - "output": { - "anyOf": [ - { - "type": "string", - "description": "The output of the function. This will be `null` if the outputs have not been [submitted](https://developers.openai.com/api/docs/assistants/migration) yet." - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/ContainerNetworkPolicyAllowlistParam" } + ], + "description": "Network access policy for the container.", + "discriminator": { + "propertyName": "type" } } }, + "type": "object", "required": [ - "index", "type" - ] + ], + "title": "CodeInterpreterToolAuto", + "description": "Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on." }, - "RunStepDeltaStepDetailsToolCallsObject": { - "title": "Tool calls", - "type": "object", - "description": "Details of the tool call.", + "ProgrammaticToolCallingParam": { "properties": { "type": { - "description": "Always `tool_calls`.", "type": "string", "enum": [ - "tool_calls" + "programmatic_tool_calling" ], + "description": "The type of the tool. Always `programmatic_tool_calling`.", + "default": "programmatic_tool_calling", "x-stainless-const": true - }, - "tool_calls": { - "type": "array", - "description": "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject" - }, - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject" - }, - { - "$ref": "#/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject" - } - ] - } } }, + "type": "object", "required": [ "type" ] }, - "RunStepDetailsMessageCreationObject": { - "title": "Message creation", - "type": "object", - "description": "Details of the message creation by the run step.", + "InputFidelity": { + "type": "string", + "enum": [ + "high", + "low" + ], + "description": "Control how much effort the model will exert to match the style and features, especially facial features, of input images. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models." + }, + "LocalShellToolParam": { "properties": { "type": { - "description": "Always `message_creation`.", "type": "string", "enum": [ - "message_creation" + "local_shell" ], + "description": "The type of the local shell tool. Always `local_shell`.", + "default": "local_shell", "x-stainless-const": true - }, - "message_creation": { - "type": "object", - "properties": { - "message_id": { - "type": "string", - "description": "The ID of the message that was created by this run step." - } - }, - "required": [ - "message_id" - ] } }, + "type": "object", "required": [ - "type", - "message_creation" - ] + "type" + ], + "title": "Local shell tool", + "description": "A tool that allows the model to execute shell commands in a local environment." }, - "RunStepDetailsToolCallsCodeObject": { - "title": "Code Interpreter tool call", - "type": "object", - "description": "Details of the Code Interpreter tool call the run step was involved in.", + "ContainerAutoParam": { "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call." - }, "type": { "type": "string", - "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call.", "enum": [ - "code_interpreter" + "container_auto" ], + "description": "Automatically creates a container for this request", + "default": "container_auto", "x-stainless-const": true }, - "code_interpreter": { - "type": "object", - "description": "The Code Interpreter tool call definition.", - "required": [ - "input", - "outputs" - ], - "properties": { - "input": { - "type": "string", - "description": "The input to the Code Interpreter tool call." + "file_ids": { + "items": { + "type": "string", + "example": "file-123" + }, + "type": "array", + "maxItems": 50, + "description": "An optional list of uploaded files to make available to your code." + }, + "memory_limit": { + "anyOf": [ + { + "$ref": "#/components/schemas/ContainerMemoryLimit", + "description": "The memory limit for the container." }, - "outputs": { - "type": "array", - "description": "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.", - "items": { - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject" - }, - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject" - } - ] - } + { + "type": "null" + } + ] + }, + "network_policy": { + "oneOf": [ + { + "$ref": "#/components/schemas/ContainerNetworkPolicyDisabledParam" + }, + { + "$ref": "#/components/schemas/ContainerNetworkPolicyAllowlistParam" } - } - } - }, - "required": [ - "id", - "type", - "code_interpreter" - ] - }, - "RunStepDetailsToolCallsCodeOutputImageObject": { - "title": "Code Interpreter image output", - "type": "object", - "properties": { - "type": { - "description": "Always `image`.", - "type": "string", - "enum": [ - "image" ], - "x-stainless-const": true + "description": "Network access policy for the container.", + "discriminator": { + "propertyName": "type" + } }, - "image": { - "type": "object", - "properties": { - "file_id": { - "description": "The [file](https://developers.openai.com/api/reference/resources/files) ID of the image.", - "type": "string" + "skills": { + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/SkillReferenceParam" + }, + { + "$ref": "#/components/schemas/InlineSkillParam" + } + ], + "discriminator": { + "propertyName": "type" } }, - "required": [ - "file_id" - ] + "type": "array", + "maxItems": 200, + "description": "An optional list of skills referenced by id or inline data." } }, + "type": "object", "required": [ - "type", - "image" + "type" ] }, - "RunStepDetailsToolCallsCodeOutputLogsObject": { - "title": "Code Interpreter log output", - "type": "object", - "description": "Text output from the Code Interpreter tool call as part of a run step.", + "LocalSkillParam": { "properties": { - "type": { - "description": "Always `logs`.", + "name": { "type": "string", - "enum": [ - "logs" - ], - "x-stainless-const": true + "description": "The name of the skill." }, - "logs": { + "description": { "type": "string", - "description": "The text output from the Code Interpreter tool call." + "description": "The description of the skill." + }, + "path": { + "type": "string", + "description": "The path to the directory containing the skill." } }, + "type": "object", "required": [ - "type", - "logs" + "name", + "description", + "path" ] }, - "RunStepDetailsToolCallsFileSearchObject": { - "title": "File search tool call", - "type": "object", + "LocalEnvironmentParam": { "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call object." - }, "type": { "type": "string", - "description": "The type of tool call. This is always going to be `file_search` for this type of tool call.", "enum": [ - "file_search" + "local" ], + "description": "Use a local computer environment.", + "default": "local", "x-stainless-const": true }, - "file_search": { - "type": "object", - "description": "For now, this is always going to be an empty object.", - "x-oaiTypeLabel": "map", - "properties": { - "ranking_options": { - "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject" - }, - "results": { - "type": "array", - "description": "The results of the file search.", - "items": { - "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject" - } - } - } + "skills": { + "items": { + "$ref": "#/components/schemas/LocalSkillParam" + }, + "type": "array", + "maxItems": 200, + "description": "An optional list of skills." } }, - "required": [ - "id", - "type", - "file_search" - ] - }, - "RunStepDetailsToolCallsFileSearchRankingOptionsObject": { - "title": "File search tool call ranking options", "type": "object", - "description": "The ranking options for the file search.", - "properties": { - "ranker": { - "$ref": "#/components/schemas/FileSearchRanker" - }, - "score_threshold": { - "type": "number", - "description": "The score threshold for the file search. All values must be a floating point number between 0 and 1.", - "minimum": 0, - "maximum": 1 - } - }, "required": [ - "ranker", - "score_threshold" + "type" ] }, - "RunStepDetailsToolCallsFileSearchResultObject": { - "title": "File search tool call result", - "type": "object", - "description": "A result instance of the file search.", - "x-oaiTypeLabel": "map", + "ContainerReferenceParam": { "properties": { - "file_id": { + "type": { "type": "string", - "description": "The ID of the file that result was found in." + "enum": [ + "container_reference" + ], + "description": "References a container created with the /v1/containers endpoint", + "default": "container_reference", + "x-stainless-const": true }, - "file_name": { + "container_id": { "type": "string", - "description": "The name of the file that result was found in." - }, - "score": { - "type": "number", - "description": "The score of the result. All values must be a floating point number between 0 and 1.", - "minimum": 0, - "maximum": 1 - }, - "content": { - "type": "array", - "description": "The content of the result that was found. The content is only included if requested via the include query parameter.", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The type of the content.", - "enum": [ - "text" - ], - "x-stainless-const": true - }, - "text": { - "type": "string", - "description": "The text content of the file." - } - } - } + "description": "The ID of the referenced container.", + "example": "cntr_123" } }, + "type": "object", "required": [ - "file_id", - "file_name", - "score" + "type", + "container_id" ] }, - "RunStepDetailsToolCallsFunctionObject": { - "type": "object", - "title": "Function tool call", + "FunctionShellToolParam": { "properties": { - "id": { - "type": "string", - "description": "The ID of the tool call object." - }, "type": { "type": "string", - "description": "The type of tool call. This is always going to be `function` for this type of tool call.", "enum": [ - "function" + "shell" ], + "description": "The type of the shell tool. Always `shell`.", + "default": "shell", "x-stainless-const": true }, - "function": { - "type": "object", - "description": "The definition of the function that was called.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." - }, - "arguments": { - "type": "string", - "description": "The arguments passed to the function." - }, - "output": { - "anyOf": [ + "environment": { + "anyOf": [ + { + "oneOf": [ { - "type": "string", - "description": "The output of the function. This will be `null` if the outputs have not been [submitted](https://developers.openai.com/api/docs/assistants/migration) yet." + "$ref": "#/components/schemas/ContainerAutoParam" }, { - "type": "null" + "$ref": "#/components/schemas/LocalEnvironmentParam" + }, + { + "$ref": "#/components/schemas/ContainerReferenceParam" } - ] + ], + "discriminator": { + "propertyName": "type" + } + }, + { + "type": "null" + } + ] + }, + "allowed_callers": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/CallableToolAllowedCaller" + }, + "type": "array", + "minItems": 1, + "description": "The tool invocation context(s)." + }, + { + "type": "null" } - }, - "required": [ - "name", - "arguments", - "output" ] } }, + "type": "object", "required": [ - "id", - "type", - "function" - ] + "type" + ], + "title": "Shell tool", + "description": "A tool that allows the model to execute shell commands." }, - "RunStepDetailsToolCallsObject": { - "title": "Tool calls", - "type": "object", - "description": "Details of the tool call.", + "CustomTextFormatParam": { "properties": { "type": { - "description": "Always `tool_calls`.", "type": "string", "enum": [ - "tool_calls" + "text" ], + "description": "Unconstrained text format. Always `text`.", + "default": "text", "x-stainless-const": true - }, - "tool_calls": { - "type": "array", - "description": "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsCodeObject" - }, - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsFileSearchObject" - }, - { - "$ref": "#/components/schemas/RunStepDetailsToolCallsFunctionObject" - } - ] - } } }, + "type": "object", "required": [ - "type", - "tool_calls" + "type" + ], + "title": "Text format", + "description": "Unconstrained free-form text." + }, + "GrammarSyntax1": { + "type": "string", + "enum": [ + "lark", + "regex" ] }, - "RunStepObject": { - "type": "object", - "title": "Run steps", - "description": "Represents a step in execution of a run.\n", + "CustomGrammarFormatParam": { "properties": { - "id": { - "description": "The identifier of the run step, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `thread.run.step`.", + "type": { "type": "string", "enum": [ - "thread.run.step" + "grammar" ], + "description": "Grammar format. Always `grammar`.", + "default": "grammar", "x-stainless-const": true }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the run step was created.", - "type": "integer", - "format": "unixtime" - }, - "assistant_id": { - "description": "The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) associated with the run step.", - "type": "string" - }, - "thread_id": { - "description": "The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) that was run.", - "type": "string" - }, - "run_id": { - "description": "The ID of the [run](https://developers.openai.com/api/docs/assistants/migration) that this run step is a part of.", - "type": "string" + "syntax": { + "$ref": "#/components/schemas/GrammarSyntax1", + "description": "The syntax of the grammar definition. One of `lark` or `regex`." }, + "definition": { + "type": "string", + "description": "The grammar definition." + } + }, + "type": "object", + "required": [ + "type", + "syntax", + "definition" + ], + "title": "Grammar format", + "description": "A grammar defined by the user." + }, + "CustomToolParam": { + "properties": { "type": { - "description": "The type of run step, which can be either `message_creation` or `tool_calls`.", "type": "string", "enum": [ - "message_creation", - "tool_calls" - ] + "custom" + ], + "description": "The type of the custom tool. Always `custom`.", + "default": "custom", + "x-stainless-const": true }, - "status": { - "description": "The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.", + "name": { "type": "string", - "enum": [ - "in_progress", - "cancelled", - "failed", - "completed", - "expired" - ] + "description": "The name of the custom tool, used to identify it in tool calls." }, - "step_details": { - "type": "object", - "description": "The details of the run step.", + "async": { + "type": "boolean", + "description": "Whether the tool response can be returned asynchronously versus immediately returned on next response creation." + }, + "description": { + "type": "string", + "description": "Optional description of the custom tool, used to provide more context." + }, + "format": { "oneOf": [ { - "$ref": "#/components/schemas/RunStepDetailsMessageCreationObject" + "$ref": "#/components/schemas/CustomTextFormatParam" }, { - "$ref": "#/components/schemas/RunStepDetailsToolCallsObject" + "$ref": "#/components/schemas/CustomGrammarFormatParam" } - ] + ], + "description": "The input format for the custom tool. Default is unconstrained text.", + "discriminator": { + "propertyName": "type" + } }, - "last_error": { + "defer_loading": { + "type": "boolean", + "description": "Whether this tool should be deferred and discovered via tool search." + }, + "allowed_callers": { "anyOf": [ { - "type": "object", - "description": "The last error associated with this run step. Will be `null` if there are no errors.", - "properties": { - "code": { - "type": "string", - "description": "One of `server_error` or `rate_limit_exceeded`.", - "enum": [ - "server_error", - "rate_limit_exceeded" - ] - }, - "message": { - "type": "string", - "description": "A human-readable description of the error." - } + "items": { + "$ref": "#/components/schemas/CallableToolAllowedCaller" }, - "required": [ - "code", - "message" - ] + "type": "array", + "minItems": 1, + "description": "The tool invocation context(s)." }, { "type": "null" } ] + } + }, + "type": "object", + "required": [ + "type", + "name" + ], + "title": "Custom tool", + "description": "A custom tool that processes input using a specified format. Learn more about [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools)" + }, + "EmptyModelParam": { + "properties": {}, + "type": "object", + "required": [] + }, + "FunctionToolParam": { + "properties": { + "name": { + "type": "string", + "maxLength": 128, + "minLength": 1, + "pattern": "^[a-zA-Z0-9_-]+$" }, - "expired_at": { + "description": { "anyOf": [ { - "description": "The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.", - "type": "integer", - "format": "unixtime" + "type": "string" }, { "type": "null" } ] }, - "cancelled_at": { + "parameters": { "anyOf": [ { - "description": "The Unix timestamp (in seconds) for when the run step was cancelled.", - "type": "integer", - "format": "unixtime" + "$ref": "#/components/schemas/EmptyModelParam" }, { "type": "null" } ] }, - "failed_at": { + "strict": { "anyOf": [ { - "description": "The Unix timestamp (in seconds) for when the run step failed.", - "type": "integer", - "format": "unixtime" + "type": "boolean", + "description": "Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise." }, { "type": "null" } ] }, - "completed_at": { + "type": { + "type": "string", + "enum": [ + "function" + ], + "default": "function", + "x-stainless-const": true + }, + "async": { + "type": "boolean", + "description": "Whether the tool response can be returned asynchronously versus immediately returned on next response creation." + }, + "output_schema": { "anyOf": [ { - "description": "The Unix timestamp (in seconds) for when the run step completed.", - "type": "integer", - "format": "unixtime" + "additionalProperties": {}, + "type": "object", + "description": "A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.", + "x-oaiTypeLabel": "map" }, { "type": "null" } ] }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "defer_loading": { + "type": "boolean", + "description": "Whether this function should be deferred and discovered via tool search." }, - "usage": { - "$ref": "#/components/schemas/RunStepCompletionUsage" + "allowed_callers": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/CallableToolAllowedCaller" + }, + "type": "array", + "minItems": 1, + "description": "The tool invocation context(s)." + }, + { + "type": "null" + } + ] } }, + "type": "object", "required": [ - "id", - "object", - "created_at", - "assistant_id", - "thread_id", - "run_id", - "type", - "status", - "step_details", - "last_error", - "expired_at", - "cancelled_at", - "failed_at", - "completed_at", - "metadata", - "usage" + "name", + "type" ], - "x-oaiMeta": { - "name": "The run step object", - "beta": true, - "example": "{\n \"id\": \"step_abc123\",\n \"object\": \"thread.run.step\",\n \"created_at\": 1699063291,\n \"run_id\": \"run_abc123\",\n \"assistant_id\": \"asst_abc123\",\n \"thread_id\": \"thread_abc123\",\n \"type\": \"message_creation\",\n \"status\": \"completed\",\n \"cancelled_at\": null,\n \"completed_at\": 1699063291,\n \"expired_at\": null,\n \"failed_at\": null,\n \"last_error\": null,\n \"step_details\": {\n \"type\": \"message_creation\",\n \"message_creation\": {\n \"message_id\": \"msg_abc123\"\n }\n },\n \"usage\": {\n \"prompt_tokens\": 123,\n \"completion_tokens\": 456,\n \"total_tokens\": 579\n }\n}\n" - } + "x-openai-structured-output": "function" }, - "RunStepStreamEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.created" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is created.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.in_progress" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` state.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.delta" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunStepDeltaObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when parts of a [run step](https://developers.openai.com/api/docs/assistants/migration) are being streamed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step delta](https://developers.openai.com/api/docs/assistants/migration)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.completed" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" + "NamespaceToolParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "namespace" ], - "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is completed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" - } + "description": "The type of the tool. Always `namespace`.", + "default": "namespace", + "x-stainless-const": true }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.failed" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) fails.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" - } + "name": { + "type": "string", + "minLength": 1, + "description": "The namespace name used in tool calls (for example, `crm`)." }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.cancelled" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is cancelled.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" - } + "description": { + "type": "string", + "description": "A description of the namespace shown to the model." }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.step.expired" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunStepObject" + "tools": { + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/FunctionToolParam" + }, + { + "$ref": "#/components/schemas/CustomToolParam" + } + ], + "description": "A function or custom tool that belongs to a namespace.", + "discriminator": { + "propertyName": "type" } }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) expires.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)" - } + "type": "array", + "minItems": 1, + "description": "The function/custom tools available inside this namespace." } - ] + }, + "type": "object", + "required": [ + "type", + "name", + "description", + "tools" + ], + "title": "Namespace", + "description": "Groups function/custom tools under a shared namespace." }, - "RunStreamEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.created" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a new [run](https://developers.openai.com/api/docs/assistants/migration) is created.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.queued" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" + "ToolSearchToolParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "tool_search" ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `queued` status.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + "description": "The type of the tool. Always `tool_search`.", + "default": "tool_search", + "x-stainless-const": true }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.in_progress" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/RunObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` status.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + "execution": { + "$ref": "#/components/schemas/ToolSearchExecutionType", + "description": "Whether tool search is executed by the server or by the client." }, - { - "type": "object", - "properties": { - "event": { + "description": { + "anyOf": [ + { "type": "string", - "enum": [ - "thread.run.requires_action" - ], - "x-stainless-const": true + "description": "Description shown to the model for a client-executed tool search tool." }, - "data": { - "$ref": "#/components/schemas/RunObject" + { + "type": "null" } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `requires_action` status.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.completed" - ], - "x-stainless-const": true + "parameters": { + "anyOf": [ + { + "$ref": "#/components/schemas/EmptyModelParam", + "description": "Parameter schema for a client-executed tool search tool." }, - "data": { - "$ref": "#/components/schemas/RunObject" + { + "type": "null" } - }, - "required": [ - "event", - "data" + ] + } + }, + "type": "object", + "required": [ + "type" + ], + "title": "Tool search tool", + "description": "Hosted or BYOT tool search configuration for deferred tools." + }, + "ApproximateLocation": { + "properties": { + "type": { + "type": "string", + "enum": [ + "approximate" ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) is completed.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + "description": "The type of location approximation. Always `approximate`.", + "default": "approximate", + "x-stainless-const": true }, - { - "type": "object", - "properties": { - "event": { + "country": { + "anyOf": [ + { "type": "string", - "enum": [ - "thread.run.incomplete" - ], - "x-stainless-const": true + "description": "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`." }, - "data": { - "$ref": "#/components/schemas/RunObject" + { + "type": "null" } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) ends with status `incomplete`.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + ] }, - { - "type": "object", - "properties": { - "event": { + "region": { + "anyOf": [ + { "type": "string", - "enum": [ - "thread.run.failed" - ], - "x-stainless-const": true + "description": "Free text input for the region of the user, e.g. `California`." }, - "data": { - "$ref": "#/components/schemas/RunObject" + { + "type": "null" } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) fails.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + ] }, - { - "type": "object", - "properties": { - "event": { + "city": { + "anyOf": [ + { "type": "string", - "enum": [ - "thread.run.cancelling" - ], - "x-stainless-const": true + "description": "Free text input for the city of the user, e.g. `San Francisco`." }, - "data": { - "$ref": "#/components/schemas/RunObject" + { + "type": "null" } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `cancelling` status.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + ] }, - { - "type": "object", - "properties": { - "event": { + "timezone": { + "anyOf": [ + { "type": "string", - "enum": [ - "thread.run.cancelled" - ], - "x-stainless-const": true + "description": "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`." }, - "data": { - "$ref": "#/components/schemas/RunObject" + { + "type": "null" } - }, - "required": [ - "event", - "data" + ] + } + }, + "type": "object", + "required": [ + "type" + ] + }, + "SearchContextSize": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "SearchContentType": { + "type": "string", + "enum": [ + "text", + "image" + ] + }, + "WebSearchPreviewTool": { + "properties": { + "type": { + "type": "string", + "enum": [ + "web_search_preview", + "web_search_preview_2025_03_11" ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) is cancelled.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + "description": "The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.", + "default": "web_search_preview", + "x-stainless-const": true }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "enum": [ - "thread.run.expired" - ], - "x-stainless-const": true + "user_location": { + "anyOf": [ + { + "$ref": "#/components/schemas/ApproximateLocation", + "description": "The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{\"type\": \"approximate\"}` without location fields. To localize results, provide the relevant location fields." }, - "data": { - "$ref": "#/components/schemas/RunObject" + { + "type": "null" } + ] + }, + "search_context_size": { + "$ref": "#/components/schemas/SearchContextSize", + "description": "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default." + }, + "search_content_types": { + "items": { + "$ref": "#/components/schemas/SearchContentType" }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) expires.", - "x-oaiMeta": { - "dataDescription": "`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)" - } + "type": "array" } - ] - }, - "RunToolCallObject": { + }, "type": "object", - "description": "Tool call objects", + "required": [ + "type" + ], + "title": "Web search preview", + "description": "This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search)." + }, + "ApplyPatchToolParam": { "properties": { - "id": { + "type": { "type": "string", - "description": "The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](https://developers.openai.com/api/docs/assistants/migration) endpoint." + "enum": [ + "apply_patch" + ], + "description": "The type of the tool. Always `apply_patch`.", + "default": "apply_patch", + "x-stainless-const": true }, + "allowed_callers": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/CallableToolAllowedCaller" + }, + "type": "array", + "minItems": 1, + "description": "The tool invocation context(s)." + }, + { + "type": "null" + } + ] + } + }, + "type": "object", + "required": [ + "type" + ], + "title": "Apply patch tool", + "description": "Allows the assistant to create, delete, or update files using unified diffs." + }, + "ToolSearchOutput": { + "properties": { "type": { "type": "string", - "description": "The type of tool call the output is required for. For now, this is always `function`.", "enum": [ - "function" + "tool_search_output" ], + "description": "The type of the item. Always `tool_search_output`.", + "default": "tool_search_output", "x-stainless-const": true }, - "function": { - "type": "object", - "description": "The function definition.", - "properties": { - "name": { + "id": { + "type": "string", + "description": "The unique ID of the tool search output item." + }, + "call_id": { + "anyOf": [ + { "type": "string", - "description": "The name of the function." + "description": "The unique ID of the tool search call generated by the model." }, - "arguments": { - "type": "string", - "description": "The arguments that the model expects you to pass to the function." + { + "type": "null" } - }, - "required": [ - "name", - "arguments" ] + }, + "execution": { + "$ref": "#/components/schemas/ToolSearchExecutionType", + "description": "Whether tool search was executed by the server or by the client." + }, + "tools": { + "items": { + "$ref": "#/components/schemas/Tool" + }, + "type": "array", + "description": "The loaded tool definitions returned by tool search." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallOutputStatusEnum", + "description": "The status of the tool search output item that was recorded." + }, + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item." } }, + "type": "object", "required": [ - "id", "type", - "function" + "id", + "call_id", + "execution", + "tools", + "status" ] }, - "ServiceTier": { - "anyOf": [ - { + "AdditionalTools": { + "properties": { + "type": { "type": "string", - "description": "Specifies the processing type used for serving the request.\n - 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'.\n - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\n - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.\n - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.\n - When not set, the default behavior is 'auto'.\n\n 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.\n", "enum": [ - "auto", - "default", - "flex", - "scale", - "priority", - "fast" + "additional_tools" ], - "default": "auto" + "description": "The type of the item. Always `additional_tools`.", + "default": "additional_tools", + "x-stainless-const": true }, - { - "type": "null" + "id": { + "type": "string", + "description": "The unique ID of the additional tools item." + }, + "role": { + "$ref": "#/components/schemas/MessageRole", + "description": "The role that provided the additional tools." + }, + "tools": { + "items": { + "$ref": "#/components/schemas/Tool" + }, + "type": "array", + "description": "The additional tool definitions made available at this item." } + }, + "type": "object", + "required": [ + "type", + "id", + "role", + "tools" ] }, - "ServiceTierResponses": { - "anyOf": [ - { + "Program": { + "properties": { + "type": { "type": "string", - "description": "Specifies the processing type used for serving the request.\n - 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'.\n - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\n - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier.\n - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request.\n - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`.\n - When not set, the default behavior is 'auto'.\n\n 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.\n", "enum": [ - "auto", - "default", - "flex", - "scale", - "priority", - "fast", - "ultrafast" + "program" ], - "default": "auto" + "description": "The type of the item. Always `program`.", + "default": "program", + "x-stainless-const": true }, - { - "type": "null" + "id": { + "type": "string", + "description": "The unique ID of the program item." + }, + "call_id": { + "type": "string", + "description": "The stable call ID of the program item." + }, + "code": { + "type": "string", + "description": "The JavaScript source executed by programmatic tool calling." + }, + "fingerprint": { + "type": "string", + "description": "Opaque program replay fingerprint that must be round-tripped." } + }, + "type": "object", + "required": [ + "type", + "id", + "call_id", + "code", + "fingerprint" ] }, - "SpeechAudioDeltaEvent": { + "ProgramOutputStatus": { + "type": "string", + "enum": [ + "completed", + "incomplete" + ] + }, + "ProgramOutput": { + "properties": { + "type": { + "type": "string", + "enum": [ + "program_output" + ], + "description": "The type of the item. Always `program_output`.", + "default": "program_output", + "x-stainless-const": true + }, + "id": { + "type": "string", + "description": "The unique ID of the program output item." + }, + "call_id": { + "type": "string", + "description": "The call ID of the program item." + }, + "result": { + "type": "string", + "description": "The result produced by the program item." + }, + "status": { + "$ref": "#/components/schemas/ProgramOutputStatus", + "description": "The terminal status of the program output item." + } + }, "type": "object", - "description": "Emitted for each chunk of audio data generated during speech synthesis.", + "required": [ + "type", + "id", + "call_id", + "result", + "status" + ] + }, + "CompactionBody": { "properties": { "type": { "type": "string", - "description": "The type of the event. Always `speech.audio.delta`.\n", "enum": [ - "speech.audio.delta" + "compaction" ], + "description": "The type of the item. Always `compaction`.", + "default": "compaction", "x-stainless-const": true }, - "audio": { + "id": { "type": "string", - "description": "A chunk of Base64-encoded audio data.\n" + "description": "The unique ID of the compaction item." + }, + "encrypted_content": { + "type": "string", + "description": "The encrypted content that was produced by compaction." + }, + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item." } }, + "type": "object", "required": [ "type", - "audio" + "id", + "encrypted_content" ], - "x-oaiMeta": { - "name": "Stream Event (speech.audio.delta)", - "group": "speech", - "example": "{\n \"type\": \"speech.audio.delta\",\n \"audio\": \"base64-encoded-audio-data\"\n}\n" - } + "title": "Compaction item", + "description": "A compaction item generated by the [`v1/responses/compact` API](https://developers.openai.com/api/reference/resources/responses/methods/compact)." }, - "SpeechAudioDoneEvent": { - "type": "object", - "description": "Emitted when the speech synthesis is complete and all audio has been streamed.", + "CodeInterpreterOutputLogs": { "properties": { "type": { "type": "string", - "description": "The type of the event. Always `speech.audio.done`.\n", "enum": [ - "speech.audio.done" + "logs" ], + "description": "The type of the output. Always `logs`.", + "default": "logs", "x-stainless-const": true }, - "usage": { - "type": "object", - "description": "Token usage statistics for the request.\n", - "properties": { - "input_tokens": { - "type": "integer", - "description": "Number of input tokens in the prompt." - }, - "output_tokens": { - "type": "integer", - "description": "Number of output tokens generated." - }, - "total_tokens": { - "type": "integer", - "description": "Total number of tokens used (input + output)." - } - }, - "required": [ - "input_tokens", - "output_tokens", - "total_tokens" - ] + "logs": { + "type": "string", + "description": "The logs output from the code interpreter." } }, + "type": "object", "required": [ "type", - "usage" + "logs" ], - "x-oaiMeta": { - "name": "Stream Event (speech.audio.done)", - "group": "speech", - "example": "{\n \"type\": \"speech.audio.done\",\n \"usage\": {\n \"input_tokens\": 14,\n \"output_tokens\": 101,\n \"total_tokens\": 115\n }\n}\n" - } + "title": "Code interpreter output logs", + "description": "The logs output from the code interpreter." + }, + "CodeInterpreterOutputImage": { + "properties": { + "type": { + "type": "string", + "enum": [ + "image" + ], + "description": "The type of the output. Always `image`.", + "default": "image", + "x-stainless-const": true + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL of the image output from the code interpreter." + } + }, + "type": "object", + "required": [ + "type", + "url" + ], + "title": "Code interpreter output image", + "description": "The image output from the code interpreter." }, - "SpendAlertNotificationChannel": { - "type": "object", - "description": "Email notification settings for a spend alert.", + "LocalShellExecAction": { "properties": { "type": { "type": "string", "enum": [ - "email" + "exec" ], - "description": "The notification channel type. Currently only `email` is supported.", + "description": "The type of the local shell action. Always `exec`.", + "default": "exec", "x-stainless-const": true }, - "recipients": { - "type": "array", - "description": "Email addresses that receive the spend alert notification.", + "command": { "items": { "type": "string" - } + }, + "type": "array", + "description": "The command to run." }, - "subject_prefix": { + "timeout_ms": { "anyOf": [ { - "type": "string" + "type": "integer", + "description": "Optional timeout in milliseconds for the command." }, { "type": "null" } - ], - "description": "Optional subject prefix for alert emails." + ] + }, + "working_directory": { + "anyOf": [ + { + "type": "string", + "description": "Optional working directory to run the command in." + }, + { + "type": "null" + } + ] + }, + "env": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Environment variables to set for the command.", + "x-oaiTypeLabel": "map" + }, + "user": { + "anyOf": [ + { + "type": "string", + "description": "Optional user to run the command as." + }, + { + "type": "null" + } + ] } }, + "type": "object", "required": [ "type", - "recipients" - ] + "command", + "env" + ], + "title": "Local shell exec action", + "description": "Execute a shell command on the server." }, - "StaticChunkingStrategy": { - "type": "object", - "additionalProperties": false, + "FunctionShellAction": { "properties": { - "max_chunk_size_tokens": { - "type": "integer", - "minimum": 100, - "maximum": 4096, - "description": "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`." + "commands": { + "items": { + "type": "string", + "description": "A list of commands to run." + }, + "type": "array" }, - "chunk_overlap_tokens": { - "type": "integer", - "description": "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n" + "timeout_ms": { + "anyOf": [ + { + "type": "integer", + "description": "Optional timeout in milliseconds for the commands." + }, + { + "type": "null" + } + ] + }, + "max_output_length": { + "anyOf": [ + { + "type": "integer", + "description": "Optional maximum number of characters to return from each command." + }, + { + "type": "null" + } + ] } }, + "type": "object", "required": [ - "max_chunk_size_tokens", - "chunk_overlap_tokens" + "commands", + "timeout_ms", + "max_output_length" + ], + "title": "Shell exec action", + "description": "Execute a shell command." + }, + "FunctionShellCallStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" ] }, - "StaticChunkingStrategyRequestParam": { - "type": "object", - "title": "Static Chunking Strategy", - "description": "Customize your own chunking strategy by setting chunk size and chunk overlap.", - "additionalProperties": false, + "LocalEnvironmentResource": { "properties": { "type": { "type": "string", - "description": "Always `static`.", "enum": [ - "static" + "local" ], + "description": "The environment type. Always `local`.", + "default": "local", "x-stainless-const": true - }, - "static": { - "$ref": "#/components/schemas/StaticChunkingStrategy" } }, + "type": "object", "required": [ - "type", - "static" - ] + "type" + ], + "title": "Local Environment", + "description": "Represents the use of a local environment to perform shell actions." }, - "StaticChunkingStrategyResponseParam": { - "type": "object", - "title": "Static Chunking Strategy", - "additionalProperties": false, + "ContainerReferenceResource": { "properties": { "type": { "type": "string", - "description": "Always `static`.", "enum": [ - "static" + "container_reference" ], + "description": "The environment type. Always `container_reference`.", + "default": "container_reference", "x-stainless-const": true }, - "static": { - "$ref": "#/components/schemas/StaticChunkingStrategy" + "container_id": { + "type": "string" } }, - "required": [ - "type", - "static" - ] - }, - "StopConfiguration": { - "description": "Not supported with latest reasoning models `o3` and `o4-mini`.\n\nUp to 4 sequences where the API will stop generating further tokens. The\nreturned text will not contain the stop sequence.\n", - "default": null, - "nullable": true, - "oneOf": [ - { - "type": "string", - "default": "<|endoftext|>", - "example": "\n", - "nullable": true - }, - { - "type": "array", - "minItems": 1, - "maxItems": 4, - "items": { - "type": "string", - "example": "[\"\\n\"]" - } - } - ] - }, - "SubmitToolOutputsRunRequest": { "type": "object", - "additionalProperties": false, - "properties": { - "tool_outputs": { - "description": "A list of tools for which the outputs are being submitted.", - "type": "array", - "items": { - "type": "object", - "properties": { - "tool_call_id": { - "type": "string", - "description": "The ID of the tool call in the `required_action` object within the run object the output is being submitted for." - }, - "output": { - "type": "string", - "description": "The output of the tool call to be submitted to continue the run." - } - } - } - }, - "stream": { - "anyOf": [ - { - "type": "boolean", - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n" - }, - { - "type": "null" - } - ] - } - }, "required": [ - "tool_outputs" - ] - }, - "TextResponseFormatConfiguration": { - "description": "An object specifying the format that the model must output.\n\nConfiguring `{ \"type\": \"json_schema\" }` enables Structured Outputs,\nwhich ensures the model will match your supplied JSON schema. Learn more in the\n[Structured Outputs guide](https://developers.openai.com/api/docs/guides/structured-outputs).\n\nThe default format is `{ \"type\": \"text\" }` with no additional options.\n\n**Not recommended for gpt-4o and newer models:**\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ResponseFormatText" - }, - { - "$ref": "#/components/schemas/TextResponseFormatJsonSchema" - }, - { - "$ref": "#/components/schemas/ResponseFormatJsonObject" - } - ] + "type", + "container_id" + ], + "title": "Container Reference", + "description": "Represents a container created with /v1/containers." }, - "TextResponseFormatJsonSchema": { - "type": "object", - "title": "JSON schema", - "description": "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs).\n", + "FunctionShellCall": { "properties": { "type": { "type": "string", - "description": "The type of response format being defined. Always `json_schema`.", "enum": [ - "json_schema" + "shell_call" ], + "description": "The type of the item. Always `shell_call`.", + "default": "shell_call", "x-stainless-const": true }, - "description": { + "id": { "type": "string", - "description": "A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n" + "description": "The unique ID of the shell tool call. Populated when this item is returned via API." }, - "name": { + "call_id": { "type": "string", - "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n" - }, - "schema": { - "$ref": "#/components/schemas/ResponseFormatJsonSchemaSchema" + "description": "The unique ID of the shell tool call generated by the model." }, - "strict": { + "caller": { "anyOf": [ { - "type": "boolean", - "default": false, - "description": "Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](https://developers.openai.com/api/docs/guides/structured-outputs).\n" + "$ref": "#/components/schemas/ToolCallCaller", + "description": "The execution context that produced this tool call." }, { "type": "null" } ] - } - }, - "required": [ - "type", - "schema", - "name" - ] - }, - "ThreadObject": { - "type": "object", - "title": "Thread", - "description": "Represents a thread that contains [messages](https://developers.openai.com/api/docs/assistants/migration).", - "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" }, - "object": { - "description": "The object type, which is always `thread`.", - "type": "string", - "enum": [ - "thread" - ], - "x-stainless-const": true + "action": { + "$ref": "#/components/schemas/FunctionShellAction", + "description": "The shell commands and limits that describe how to run the tool call." }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the thread was created.", - "type": "integer", - "format": "unixtime" + "status": { + "$ref": "#/components/schemas/FunctionShellCallStatus", + "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`." }, - "tool_resources": { + "environment": { "anyOf": [ { - "type": "object", - "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n", - "properties": { - "code_interpreter": { - "type": "object", - "properties": { - "file_ids": { - "type": "array", - "description": "A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n", - "default": [], - "maxItems": 20, - "items": { - "type": "string" - } - } - } + "oneOf": [ + { + "$ref": "#/components/schemas/LocalEnvironmentResource" }, - "file_search": { - "type": "object", - "properties": { - "vector_store_ids": { - "type": "array", - "description": "The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n", - "maxItems": 1, - "items": { - "type": "string" - } - } - } + { + "$ref": "#/components/schemas/ContainerReferenceResource" } + ], + "discriminator": { + "propertyName": "type" } }, { @@ -61192,747 +84789,864 @@ } ] }, - "metadata": { - "$ref": "#/components/schemas/Metadata" + "created_by": { + "type": "string", + "description": "The ID of the entity that created this tool call." } }, + "type": "object", "required": [ + "type", "id", - "object", - "created_at", - "tool_resources", - "metadata" + "call_id", + "action", + "status", + "environment" ], - "x-oaiMeta": { - "name": "The thread object", - "beta": true, - "example": "{\n \"id\": \"thread_abc123\",\n \"object\": \"thread\",\n \"created_at\": 1698107661,\n \"metadata\": {}\n}\n" - } + "title": "Shell tool call", + "description": "A tool call that executes one or more shell commands in a managed environment." }, - "ThreadStreamEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether to enable input audio transcription." - }, - "event": { - "type": "string", - "enum": [ - "thread.created" - ], - "x-stainless-const": true - }, - "data": { - "$ref": "#/components/schemas/ThreadObject" - } - }, - "required": [ - "event", - "data" - ], - "description": "Occurs when a new [thread](https://developers.openai.com/api/docs/assistants/migration) is created.", - "x-oaiMeta": { - "dataDescription": "`data` is a [thread](https://developers.openai.com/api/docs/assistants/migration)" - } - } + "FunctionShellCallOutputStatusEnum": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" ] }, - "ToggleCertificatesRequest": { - "type": "object", + "FunctionShellCallOutputTimeoutOutcome": { "properties": { - "certificate_ids": { - "type": "array", - "items": { - "type": "string", - "example": "cert_abc" - }, - "minItems": 1, - "maxItems": 10 + "type": { + "type": "string", + "enum": [ + "timeout" + ], + "description": "The outcome type. Always `timeout`.", + "default": "timeout", + "x-stainless-const": true } }, + "type": "object", "required": [ - "certificate_ids" - ] + "type" + ], + "title": "Shell call timeout outcome", + "description": "Indicates that the shell call exceeded its configured time limit." }, - "Tool": { - "description": "A tool that can be used to generate a response.\n", - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/FunctionTool" - }, - { - "$ref": "#/components/schemas/FileSearchTool" - }, - { - "$ref": "#/components/schemas/ComputerTool" - }, - { - "$ref": "#/components/schemas/ComputerUsePreviewTool" - }, - { - "$ref": "#/components/schemas/WebSearchTool" + "FunctionShellCallOutputExitOutcome": { + "properties": { + "type": { + "type": "string", + "enum": [ + "exit" + ], + "description": "The outcome type. Always `exit`.", + "default": "exit", + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/MCPTool" + "exit_code": { + "type": "integer", + "description": "Exit code from the shell process." + } + }, + "type": "object", + "required": [ + "type", + "exit_code" + ], + "title": "Shell call exit outcome", + "description": "Indicates that the shell commands finished and returned an exit code." + }, + "FunctionShellCallOutputContent": { + "properties": { + "stdout": { + "type": "string", + "description": "The standard output that was captured." }, - { - "$ref": "#/components/schemas/CodeInterpreterTool" + "stderr": { + "type": "string", + "description": "The standard error output that was captured." }, - { - "$ref": "#/components/schemas/ProgrammaticToolCallingParam" + "outcome": { + "oneOf": [ + { + "$ref": "#/components/schemas/FunctionShellCallOutputTimeoutOutcome" + }, + { + "$ref": "#/components/schemas/FunctionShellCallOutputExitOutcome" + } + ], + "title": "Shell call outcome", + "description": "Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.", + "discriminator": { + "propertyName": "type" + } }, - { - "$ref": "#/components/schemas/ImageGenTool" + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item." + } + }, + "type": "object", + "required": [ + "stdout", + "stderr", + "outcome" + ], + "title": "Shell call output content", + "description": "The content of a shell tool call output that was emitted." + }, + "FunctionShellCallOutput": { + "properties": { + "type": { + "type": "string", + "enum": [ + "shell_call_output" + ], + "description": "The type of the shell call output. Always `shell_call_output`.", + "default": "shell_call_output", + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/LocalShellToolParam" + "id": { + "type": "string", + "description": "The unique ID of the shell call output. Populated when this item is returned via API." }, - { - "$ref": "#/components/schemas/FunctionShellToolParam" + "call_id": { + "type": "string", + "description": "The unique ID of the shell tool call generated by the model." }, - { - "$ref": "#/components/schemas/CustomToolParam" + "caller": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToolCallCaller", + "description": "The execution context that produced this tool call." + }, + { + "type": "null" + } + ] }, - { - "$ref": "#/components/schemas/NamespaceToolParam" + "status": { + "$ref": "#/components/schemas/FunctionShellCallOutputStatusEnum", + "description": "The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`." }, - { - "$ref": "#/components/schemas/ToolSearchToolParam" + "output": { + "items": { + "$ref": "#/components/schemas/FunctionShellCallOutputContent" + }, + "type": "array", + "description": "An array of shell call output contents" }, - { - "$ref": "#/components/schemas/WebSearchPreviewTool" + "max_output_length": { + "anyOf": [ + { + "type": "integer", + "description": "The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output." + }, + { + "type": "null" + } + ] }, - { - "$ref": "#/components/schemas/ApplyPatchToolParam" + "created_by": { + "type": "string", + "description": "The identifier of the actor that created the item." } + }, + "type": "object", + "required": [ + "type", + "id", + "call_id", + "status", + "output", + "max_output_length" + ], + "title": "Shell call output", + "description": "The output of a shell tool call that was emitted." + }, + "ApplyPatchCallStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed" ] }, - "ToolChoiceAllowed": { - "type": "object", - "title": "Allowed tools", - "description": "Constrains the tools available to the model to a pre-defined set.\n", + "ApplyPatchCreateFileOperation": { "properties": { "type": { "type": "string", "enum": [ - "allowed_tools" + "create_file" ], - "description": "Allowed tool configuration type. Always `allowed_tools`.", + "description": "Create a new file with the provided diff.", + "default": "create_file", "x-stainless-const": true }, - "mode": { + "path": { "type": "string", - "enum": [ - "auto", - "required" - ], - "description": "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n" + "description": "Path of the file to create." }, - "tools": { - "type": "array", - "description": "A list of tool definitions that the model should be allowed to call.\n\nFor the Responses API, the list of tool definitions might look like:\n```json\n[\n { \"type\": \"function\", \"name\": \"get_weather\" },\n { \"type\": \"mcp\", \"server_label\": \"deepwiki\" },\n { \"type\": \"image_generation\" }\n]\n```\n", - "items": { - "type": "object", - "description": "A tool definition that the model should be allowed to call.\n", - "additionalProperties": true, - "x-oaiExpandable": false - } + "diff": { + "type": "string", + "description": "Diff to apply." } }, + "type": "object", "required": [ "type", - "mode", - "tools" - ] + "path", + "diff" + ], + "title": "Apply patch create file operation", + "description": "Instruction describing how to create a file via the apply_patch tool." }, - "ToolChoiceCustom": { - "type": "object", - "title": "Custom tool", - "description": "Use this option to force the model to call a specific custom tool.\n", + "ApplyPatchDeleteFileOperation": { "properties": { "type": { "type": "string", "enum": [ - "custom" + "delete_file" ], - "description": "For custom tool calling, the type is always `custom`.", + "description": "Delete the specified file.", + "default": "delete_file", "x-stainless-const": true }, - "name": { + "path": { "type": "string", - "description": "The name of the custom tool to call." + "description": "Path of the file to delete." } }, + "type": "object", "required": [ "type", - "name" - ] + "path" + ], + "title": "Apply patch delete file operation", + "description": "Instruction describing how to delete a file via the apply_patch tool." }, - "ToolChoiceFunction": { - "type": "object", - "title": "Function tool", - "description": "Use this option to force the model to call a specific function.\n", + "ApplyPatchUpdateFileOperation": { "properties": { "type": { "type": "string", "enum": [ - "function" + "update_file" ], - "description": "For function calling, the type is always `function`.", + "description": "Update an existing file with the provided diff.", + "default": "update_file", "x-stainless-const": true }, - "name": { + "path": { "type": "string", - "description": "The name of the function to call." + "description": "Path of the file to update." + }, + "diff": { + "type": "string", + "description": "Diff to apply." } }, + "type": "object", "required": [ "type", - "name" - ] + "path", + "diff" + ], + "title": "Apply patch update file operation", + "description": "Instruction describing how to update a file via the apply_patch tool." }, - "ToolChoiceMCP": { - "type": "object", - "title": "MCP tool", - "description": "Use this option to force the model to call a specific tool on a remote MCP server.\n", + "ApplyPatchToolCall": { "properties": { "type": { "type": "string", "enum": [ - "mcp" + "apply_patch_call" ], - "description": "For MCP tools, the type is always `mcp`.", + "description": "The type of the item. Always `apply_patch_call`.", + "default": "apply_patch_call", "x-stainless-const": true }, - "server_label": { + "id": { "type": "string", - "description": "The label of the MCP server to use.\n" + "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API." }, - "name": { + "call_id": { + "type": "string", + "description": "The unique ID of the apply patch tool call generated by the model." + }, + "caller": { "anyOf": [ { - "type": "string", - "description": "The name of the tool to call on the server.\n" + "$ref": "#/components/schemas/ToolCallCaller", + "description": "The execution context that produced this tool call." }, { "type": "null" } ] + }, + "status": { + "$ref": "#/components/schemas/ApplyPatchCallStatus", + "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." + }, + "operation": { + "oneOf": [ + { + "$ref": "#/components/schemas/ApplyPatchCreateFileOperation" + }, + { + "$ref": "#/components/schemas/ApplyPatchDeleteFileOperation" + }, + { + "$ref": "#/components/schemas/ApplyPatchUpdateFileOperation" + } + ], + "title": "Apply patch operation", + "description": "One of the create_file, delete_file, or update_file operations applied via apply_patch.", + "discriminator": { + "propertyName": "type" + } + }, + "created_by": { + "type": "string", + "description": "The ID of the entity that created this tool call." } }, + "type": "object", "required": [ "type", - "server_label" - ] + "id", + "call_id", + "status", + "operation" + ], + "title": "Apply patch tool call", + "description": "A tool call that applies file diffs by creating, deleting, or updating files." }, - "ToolChoiceOptions": { + "ApplyPatchCallOutputStatus": { "type": "string", - "title": "Tool choice mode", - "description": "Controls which (if any) tool is called by the model.\n\n`none` means the model will not call any tool and instead generates a message.\n\n`auto` means the model can pick between generating a message or calling one or\nmore tools.\n\n`required` means the model must call one or more tools.\n", "enum": [ - "none", - "auto", - "required" + "completed", + "failed" ] }, - "ToolChoiceParam": { - "description": "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n", - "oneOf": [ - { - "$ref": "#/components/schemas/ToolChoiceOptions" - }, - { - "$ref": "#/components/schemas/ToolChoiceAllowed" - }, - { - "$ref": "#/components/schemas/ToolChoiceTypes" + "ApplyPatchToolCallOutput": { + "properties": { + "type": { + "type": "string", + "enum": [ + "apply_patch_call_output" + ], + "description": "The type of the item. Always `apply_patch_call_output`.", + "default": "apply_patch_call_output", + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/ToolChoiceFunction" + "id": { + "type": "string", + "description": "The unique ID of the apply patch tool call output. Populated when this item is returned via API." }, - { - "$ref": "#/components/schemas/ToolChoiceMCP" + "call_id": { + "type": "string", + "description": "The unique ID of the apply patch tool call generated by the model." }, - { - "$ref": "#/components/schemas/ToolChoiceCustom" + "caller": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToolCallCaller", + "description": "The execution context that produced this tool call." + }, + { + "type": "null" + } + ] }, - { - "$ref": "#/components/schemas/SpecificProgrammaticToolCallingParam" + "status": { + "$ref": "#/components/schemas/ApplyPatchCallOutputStatus", + "description": "The status of the apply patch tool call output. One of `completed` or `failed`." }, - { - "$ref": "#/components/schemas/SpecificApplyPatchParam" + "output": { + "anyOf": [ + { + "type": "string", + "description": "Optional textual output returned by the apply patch tool." + }, + { + "type": "null" + } + ] }, - { - "$ref": "#/components/schemas/SpecificFunctionShellParam" + "created_by": { + "type": "string", + "description": "The ID of the entity that created this tool call output." } - ] - }, - "ToolChoiceTypes": { + }, "type": "object", - "title": "Hosted tool", - "description": "Indicates that the model should use a built-in tool to generate a response.\n[Learn more about built-in tools](https://developers.openai.com/api/docs/guides/tools).\n", + "required": [ + "type", + "id", + "call_id", + "status" + ], + "title": "Apply patch tool call output", + "description": "The output emitted by an apply patch tool call." + }, + "MCPProtocolError": { "properties": { "type": { "type": "string", - "description": "The type of hosted tool the model should to use. Learn more about\n[built-in tools](https://developers.openai.com/api/docs/guides/tools).\n\nAllowed values are:\n- `file_search`\n- `web_search_preview`\n- `computer`\n- `computer_use_preview`\n- `computer_use`\n- `code_interpreter`\n- `image_generation`\n", "enum": [ - "file_search", - "web_search_preview", - "computer", - "computer_use_preview", - "computer_use", - "web_search_preview_2025_03_11", - "image_generation", - "code_interpreter" - ] + "mcp_protocol_error" + ], + "default": "mcp_protocol_error", + "x-stainless-const": true + }, + "code": { + "type": "integer" + }, + "message": { + "type": "string" } }, + "type": "object", "required": [ - "type" + "type", + "code", + "message" ] }, - "ToolsArray": { - "type": "array", - "description": "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](https://developers.openai.com/api/docs/guides/tools-web-search)\n or [file search](https://developers.openai.com/api/docs/guides/tools-file-search). Learn more about\n [built-in tools](https://developers.openai.com/api/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](https://developers.openai.com/api/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](https://developers.openai.com/api/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n", - "items": { - "$ref": "#/components/schemas/Tool" - } - }, - "TranscriptTextDeltaEvent": { - "type": "object", - "description": "Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.", + "MCPToolExecutionError": { "properties": { "type": { "type": "string", - "description": "The type of the event. Always `transcript.text.delta`.\n", "enum": [ - "transcript.text.delta" + "mcp_tool_execution_error" ], + "default": "mcp_tool_execution_error", "x-stainless-const": true }, - "delta": { + "content": {} + }, + "type": "object", + "required": [ + "type", + "content" + ] + }, + "HTTPError": { + "properties": { + "type": { "type": "string", - "description": "The text delta that was additionally transcribed.\n" + "enum": [ + "http_error" + ], + "default": "http_error", + "x-stainless-const": true }, - "logprobs": { - "type": "array", - "description": "The log probabilities of the delta. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`.\n", - "items": { - "type": "object", - "properties": { - "token": { - "type": "string", - "description": "The token that was used to generate the log probability.\n" - }, - "logprob": { - "type": "number", - "description": "The log probability of the token.\n" - }, - "bytes": { - "type": "array", - "items": { - "type": "integer" - }, - "description": "The bytes that were used to generate the log probability.\n" - } - } - } + "code": { + "type": "integer" }, - "segment_id": { - "type": "string", - "description": "Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.\n" + "message": { + "type": "string" } }, + "type": "object", "required": [ "type", - "delta" - ], - "x-oaiMeta": { - "name": "Stream Event (transcript.text.delta)", - "group": "transcript", - "example": "{\n \"type\": \"transcript.text.delta\",\n \"delta\": \" wonderful\"\n}\n" - } + "code", + "message" + ] }, - "TranscriptTextDoneEvent": { - "type": "object", - "description": "Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`.", + "MCPToolCallStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete", + "calling", + "failed" + ] + }, + "DetailEnum": { + "type": "string", + "enum": [ + "low", + "high", + "auto", + "original" + ] + }, + "FunctionCallItemStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + }, + "ComputerCallOutputItemParam": { "properties": { + "id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the computer tool call output.", + "example": "cuo_123" + }, + { + "type": "null" + } + ] + }, + "call_id": { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The ID of the computer tool call that produced the output." + }, "type": { "type": "string", - "description": "The type of the event. Always `transcript.text.done`.\n", "enum": [ - "transcript.text.done" + "computer_call_output" ], + "description": "The type of the computer tool call output. Always `computer_call_output`.", + "default": "computer_call_output", "x-stainless-const": true }, - "text": { - "type": "string", - "description": "The text that was transcribed.\n" - }, - "languages": { - "type": "array", - "description": "The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected.\n", - "items": { - "$ref": "#/components/schemas/TranscriptionLanguage" - } + "output": { + "$ref": "#/components/schemas/ComputerScreenshotImage" }, - "logprobs": { - "type": "array", - "description": "The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`.\n", - "items": { - "type": "object", - "properties": { - "token": { - "type": "string", - "description": "The token that was used to generate the log probability.\n" - }, - "logprob": { - "type": "number", - "description": "The log probability of the token.\n" + "acknowledged_safety_checks": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/ComputerCallSafetyCheckParam" }, - "bytes": { - "type": "array", - "items": { - "type": "integer" - }, - "description": "The bytes that were used to generate the log probability.\n" - } + "type": "array", + "description": "The safety checks reported by the API that have been acknowledged by the developer." + }, + { + "type": "null" + } + ] + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/FunctionCallItemStatus", + "description": "The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API." + }, + { + "type": "null" } - } - }, - "usage": { - "$ref": "#/components/schemas/TranscriptTextUsageTokens" + ] } }, + "type": "object", "required": [ + "call_id", "type", - "text" + "output" ], - "x-oaiMeta": { - "name": "Stream Event (transcript.text.done)", - "group": "transcript", - "example": "{\n \"type\": \"transcript.text.done\",\n \"text\": \"I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.\",\n \"usage\": {\n \"type\": \"tokens\",\n \"input_tokens\": 14,\n \"input_token_details\": {\n \"text_tokens\": 10,\n \"audio_tokens\": 4\n },\n \"output_tokens\": 31,\n \"total_tokens\": 45\n }\n}\n" - } + "title": "Computer tool call output", + "description": "The output of a computer tool call." }, - "TranscriptTextSegmentEvent": { - "type": "object", - "description": "Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with `stream` set to `true` and `response_format` set to `diarized_json`.\n", + "InputTextContentParam": { "properties": { "type": { "type": "string", - "description": "The type of the event. Always `transcript.text.segment`.", "enum": [ - "transcript.text.segment" + "input_text" ], + "description": "The type of the input item. Always `input_text`.", + "default": "input_text", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "Unique identifier for the segment." - }, - "start": { - "type": "number", - "format": "double", - "description": "Start timestamp of the segment in seconds." - }, - "end": { - "type": "number", - "format": "double", - "description": "End timestamp of the segment in seconds." - }, "text": { "type": "string", - "description": "Transcript text for this segment." + "maxLength": 10485760, + "description": "The text input to the model." }, - "speaker": { - "type": "string", - "description": "Speaker label for this segment." + "prompt_cache_breakpoint": { + "anyOf": [ + { + "$ref": "#/components/schemas/PromptCacheBreakpointParam" + }, + { + "type": "null" + } + ] } }, - "required": [ - "type", - "id", - "start", - "end", - "text", - "speaker" - ], - "x-oaiMeta": { - "name": "Stream Event (transcript.text.segment)", - "group": "transcript", - "example": "{\n \"type\": \"transcript.text.segment\",\n \"id\": \"seg_002\",\n \"start\": 5.2,\n \"end\": 12.8,\n \"text\": \"Hi, I need help with diarization.\",\n \"speaker\": \"A\"\n}\n" - } - }, - "TranscriptTextUsageDuration": { "type": "object", - "title": "Duration Usage", - "description": "Usage statistics for models billed by audio input duration.", - "properties": { - "type": { - "type": "string", - "enum": [ - "duration" - ], - "description": "The type of the usage object. Always `duration` for this variant.", - "x-stainless-const": true - }, - "seconds": { - "type": "number", - "format": "double", - "description": "Duration of the input audio in seconds." - } - }, "required": [ "type", - "seconds" - ] + "text" + ], + "title": "Input text", + "description": "A text input to the model." }, - "TranscriptTextUsageTokens": { - "type": "object", - "title": "Token Usage", - "description": "Usage statistics for models billed by token usage.", + "InputImageContentParamAutoParam": { "properties": { "type": { "type": "string", "enum": [ - "tokens" + "input_image" ], - "description": "The type of the usage object. Always `tokens` for this variant.", + "description": "The type of the input item. Always `input_image`.", + "default": "input_image", "x-stainless-const": true }, - "input_tokens": { - "type": "integer", - "description": "Number of input tokens billed for this request." + "image_url": { + "anyOf": [ + { + "type": "string", + "maxLength": 20971520, + "format": "uri", + "description": "The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL." + }, + { + "type": "null" + } + ] }, - "input_token_details": { - "type": "object", - "description": "Details about the input tokens billed for this request.", - "properties": { - "text_tokens": { - "type": "integer", - "description": "Number of text tokens billed for this request." + "file_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the file to be sent to the model.", + "example": "file-123" }, - "audio_tokens": { - "type": "integer", - "description": "Number of audio tokens billed for this request." + { + "type": "null" } - } + ] }, - "output_tokens": { - "type": "integer", - "description": "Number of output tokens generated." + "detail": { + "anyOf": [ + { + "$ref": "#/components/schemas/DetailEnum", + "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." + }, + { + "type": "null" + } + ] }, - "total_tokens": { - "type": "integer", - "description": "Total number of tokens used (input + output)." + "prompt_cache_breakpoint": { + "anyOf": [ + { + "$ref": "#/components/schemas/PromptCacheBreakpointParam" + }, + { + "type": "null" + } + ] } }, + "type": "object", "required": [ - "type", - "input_tokens", - "output_tokens", - "total_tokens" - ] + "type" + ], + "title": "Input image", + "description": "An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision)" }, - "TranscriptionChunkingStrategy": { - "type": "object", - "description": "Controls how the audio is cut into chunks. When set to `\"auto\"`, the\nserver first normalizes loudness and then uses voice activity detection (VAD) to\nchoose boundaries. `server_vad` object can be provided to tweak VAD detection\nparameters manually. If unset, the audio is transcribed as a single block. ", - "oneOf": [ - { - "type": "string", - "enum": [ - "auto" - ], - "default": [ - "auto" - ], - "description": "Automatically set chunking parameters based on the audio. Must be set to `\"auto\"`.\n", - "x-stainless-const": true - }, - { - "$ref": "#/components/schemas/VadConfig" - } + "FileDetailEnum": { + "type": "string", + "enum": [ + "auto", + "low", + "high" ] }, - "TranscriptionDiarizedSegment": { - "type": "object", - "description": "A segment of diarized transcript text with speaker metadata.", + "InputFileContentParam": { "properties": { "type": { "type": "string", - "description": "The type of the segment. Always `transcript.text.segment`.\n", "enum": [ - "transcript.text.segment" + "input_file" ], + "description": "The type of the input item. Always `input_file`.", + "default": "input_file", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "Unique identifier for the segment." + "file_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the file to be sent to the model.", + "example": "file-123" + }, + { + "type": "null" + } + ] }, - "start": { - "type": "number", - "format": "double", - "description": "Start timestamp of the segment in seconds." + "filename": { + "anyOf": [ + { + "type": "string", + "description": "The name of the file to be sent to the model." + }, + { + "type": "null" + } + ] }, - "end": { - "type": "number", - "format": "double", - "description": "End timestamp of the segment in seconds." + "file_data": { + "anyOf": [ + { + "type": "string", + "maxLength": 73400320, + "description": "The base64-encoded data of the file to be sent to the model." + }, + { + "type": "null" + } + ] }, - "text": { - "type": "string", - "description": "Transcript text for this segment." + "file_url": { + "anyOf": [ + { + "type": "string", + "format": "uri", + "description": "The URL of the file to be sent to the model." + }, + { + "type": "null" + } + ] }, - "speaker": { - "type": "string", - "description": "Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...).\n" + "detail": { + "$ref": "#/components/schemas/FileDetailEnum", + "description": "The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`." + }, + "prompt_cache_breakpoint": { + "anyOf": [ + { + "$ref": "#/components/schemas/PromptCacheBreakpointParam" + }, + { + "type": "null" + } + ] } }, - "required": [ - "type", - "id", - "start", - "end", - "text", - "speaker" - ] - }, - "TranscriptionInclude": { - "type": "string", - "enum": [ - "logprobs" - ], - "default": [] - }, - "TranscriptionLanguage": { "type": "object", - "description": "A language detected in transcribed audio.", - "properties": { - "code": { - "type": "string", - "description": "The code of a language detected in the audio." - } - }, "required": [ - "code" - ] + "type" + ], + "title": "Input file", + "description": "A file input to the model." }, - "TranscriptionSegment": { - "type": "object", + "FunctionCallOutputItemParam": { "properties": { "id": { - "type": "integer", - "description": "Unique identifier of the segment." - }, - "seek": { - "type": "integer", - "description": "Seek offset of the segment." - }, - "start": { - "type": "number", - "format": "double", - "description": "Start time of the segment in seconds." + "anyOf": [ + { + "type": "string", + "description": "The unique ID of the function tool call output. Populated when this item is returned via API.", + "example": "fc_123" + }, + { + "type": "null" + } + ] }, - "end": { - "type": "number", - "format": "double", - "description": "End time of the segment in seconds." + "call_id": { + "anyOf": [ + { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The unique ID of the function tool call generated by the model." + }, + { + "type": "null" + } + ] }, - "text": { + "type": { "type": "string", - "description": "Text content of the segment." - }, - "tokens": { - "type": "array", - "items": { - "type": "integer" - }, - "description": "Array of token IDs for the text content." - }, - "temperature": { - "type": "number", - "format": "float", - "description": "Temperature parameter used for generating the segment." - }, - "avg_logprob": { - "type": "number", - "format": "float", - "description": "Average logprob of the segment. If the value is lower than -1, consider the logprobs failed." - }, - "compression_ratio": { - "type": "number", - "format": "float", - "description": "Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed." + "enum": [ + "function_call_output" + ], + "description": "The type of the function tool call output. Always `function_call_output`.", + "default": "function_call_output", + "x-stainless-const": true }, - "no_speech_prob": { - "type": "number", - "format": "float", - "description": "Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent." - } - }, - "required": [ - "id", - "seek", - "start", - "end", - "text", - "tokens", - "temperature", - "avg_logprob", - "compression_ratio", - "no_speech_prob" - ] - }, - "TranscriptionWord": { - "type": "object", - "properties": { - "word": { - "type": "string", - "description": "The text content of the word." + "output": { + "oneOf": [ + { + "type": "string", + "maxLength": 10485760, + "description": "A JSON string of the output of the function tool call." + }, + { + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/InputTextContentParam" + }, + { + "$ref": "#/components/schemas/InputImageContentParamAutoParam" + }, + { + "$ref": "#/components/schemas/InputFileContentParam" + } + ], + "description": "A piece of message content, such as text, an image, or a file.", + "discriminator": { + "propertyName": "type" + } + }, + "type": "array", + "description": "An array of content outputs (text, image, file) for the function tool call." + } + ], + "description": "Text, image, or file output of the function tool call." }, - "start": { - "type": "number", - "format": "double", - "description": "Start time of the word in seconds." + "name": { + "anyOf": [ + { + "type": "string", + "maxLength": 128, + "minLength": 1, + "description": "The name of the tool that produced the output." + }, + { + "type": "null" + } + ] }, - "end": { - "type": "number", - "format": "double", - "description": "End time of the word in seconds." - } - }, - "required": [ - "word", - "start", - "end" - ] - }, - "TruncationObject": { - "type": "object", - "title": "Thread Truncation Controls", - "description": "Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.", - "properties": { - "type": { - "type": "string", - "description": "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.", - "enum": [ - "auto", - "last_messages" + "namespace": { + "anyOf": [ + { + "type": "string", + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9_-]+$", + "description": "The namespace of the tool that produced the output." + }, + { + "type": "null" + } ] }, - "last_messages": { + "caller": { "anyOf": [ { - "type": "integer", - "description": "The number of most recent messages from the thread when constructing the context for the run.", - "minimum": 1 + "$ref": "#/components/schemas/ToolCallCallerParam", + "description": "The execution context that produced this tool call." + }, + { + "type": "null" + } + ] + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/FunctionCallItemStatus", + "description": "The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API." }, { "type": "null" @@ -61940,324 +85654,512 @@ ] } }, + "type": "object", "required": [ - "type" - ] - }, - "UpdateGroupBody": { - "type": "object", - "description": "Request payload for updating the details of an existing group.", - "properties": { - "name": { - "type": "string", - "description": "New display name for the group.", - "minLength": 1, - "maxLength": 255 - } - }, - "required": [ - "name" + "type", + "output" ], - "x-oaiMeta": { - "example": "{\n \"name\": \"Escalations\"\n}\n" - } + "title": "Function tool call output", + "description": "The output of a function tool call." }, - "UpdateOrganizationDataRetentionBody": { - "type": "object", - "description": "Parameters for updating organization data retention controls.", + "FileCitationParam": { "properties": { - "retention_type": { + "type": { "type": "string", "enum": [ - "zero_data_retention", - "modified_abuse_monitoring", - "enhanced_zero_data_retention", - "enhanced_modified_abuse_monitoring" + "file_citation" ], - "description": "The desired organization data retention type." + "description": "The citation type. Always `file_citation`.", + "default": "file_citation", + "x-stainless-const": true + }, + "index": { + "type": "integer", + "minimum": 0, + "description": "The index of the file in the list of files." + }, + "file_id": { + "type": "string", + "description": "The ID of the file.", + "example": "file-123" + }, + "filename": { + "type": "string", + "description": "The filename of the file cited." } }, + "type": "object", "required": [ - "retention_type" + "type", + "index", + "file_id", + "filename" ] }, - "UpdateProjectDataRetentionBody": { - "type": "object", - "description": "Parameters for updating project data retention controls.", + "UrlCitationParam": { "properties": { - "retention_type": { + "type": { "type": "string", "enum": [ - "organization_default", - "none", - "zero_data_retention", - "modified_abuse_monitoring", - "enhanced_zero_data_retention", - "enhanced_modified_abuse_monitoring" + "url_citation" ], - "description": "The desired project data retention type." + "description": "The citation type. Always `url_citation`.", + "default": "url_citation", + "x-stainless-const": true + }, + "start_index": { + "type": "integer", + "minimum": 0, + "description": "The index of the first character of the citation in the message." + }, + "end_index": { + "type": "integer", + "minimum": 0, + "description": "The index of the last character of the citation in the message." + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL of the cited resource." + }, + "title": { + "type": "string", + "description": "The title of the cited resource." } }, + "type": "object", "required": [ - "retention_type" + "type", + "start_index", + "end_index", + "url", + "title" ] }, - "UpdateProjectServiceAccountBody": { - "type": "object", - "description": "Parameters for updating a project service account.", + "ContainerFileCitationParam": { "properties": { - "name": { - "type": "string", - "description": "The updated service account name." - }, - "role": { + "type": { "type": "string", "enum": [ - "member", - "owner" + "container_file_citation" ], - "description": "The updated service account role." - } - } - }, - "UpdateVectorStoreFileAttributesRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "attributes": { - "$ref": "#/components/schemas/VectorStoreFileAttributes" + "description": "The citation type. Always `container_file_citation`.", + "default": "container_file_citation", + "x-stainless-const": true + }, + "start_index": { + "type": "integer", + "minimum": 0, + "description": "The index of the first character of the citation in the message." + }, + "end_index": { + "type": "integer", + "minimum": 0, + "description": "The index of the last character of the citation in the message." + }, + "container_id": { + "type": "string", + "description": "The ID of the container.", + "example": "cntr_123" + }, + "file_id": { + "type": "string", + "description": "The ID of the container file.", + "example": "cfile_123" + }, + "filename": { + "type": "string", + "description": "The filename of the container file cited." } }, + "type": "object", "required": [ - "attributes" - ], - "x-oaiMeta": { - "name": "Update vector store file attributes request" - } + "type", + "start_index", + "end_index", + "container_id", + "file_id", + "filename" + ] }, - "UpdateVectorStoreRequest": { - "type": "object", - "additionalProperties": false, + "ToolSearchCallItemParam": { "properties": { - "name": { - "description": "The name of the vector store.", - "type": "string", - "nullable": true + "id": { + "anyOf": [ + { + "type": "string", + "description": "The unique ID of this tool search call.", + "example": "tsc_123" + }, + { + "type": "null" + } + ] }, - "expires_after": { - "allOf": [ + "call_id": { + "anyOf": [ { - "$ref": "#/components/schemas/VectorStoreExpirationAfter" + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The unique ID of the tool search call generated by the model." }, { - "nullable": true + "type": "null" } ] }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - } - } - }, - "UpdateVoiceConsentRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { + "type": { "type": "string", - "description": "The updated label for this consent recording." + "enum": [ + "tool_search_call" + ], + "description": "The item type. Always `tool_search_call`.", + "default": "tool_search_call", + "x-stainless-const": true + }, + "execution": { + "$ref": "#/components/schemas/ToolSearchExecutionType", + "description": "Whether tool search was executed by the server or by the client." + }, + "arguments": { + "$ref": "#/components/schemas/EmptyModelParam", + "description": "The arguments supplied to the tool search call." + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/FunctionCallItemStatus", + "description": "The status of the tool search call." + }, + { + "type": "null" + } + ] } }, + "type": "object", "required": [ - "name" + "type", + "arguments" ] }, - "Upload": { - "type": "object", - "title": "Upload", - "description": "The Upload object can accept byte chunks in the form of Parts.\n", + "ToolSearchOutputFunctionToolParam": { "properties": { - "id": { - "type": "string", - "description": "The Upload unique identifier, which can be referenced in API endpoints." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the Upload was created." - }, - "filename": { + "name": { "type": "string", - "description": "The name of the file to be uploaded." - }, - "bytes": { - "type": "integer", - "description": "The intended number of bytes to be uploaded." + "maxLength": 128, + "minLength": 1, + "pattern": "^(?![\\s\\S]*[\\r\\n])[a-zA-Z0-9_.-]+$", + "description": "The name of the loaded function tool." }, - "purpose": { - "type": "string", - "description": "The intended purpose of the file. [Please refer here](https://developers.openai.com/api/reference/resources/files#%28resource%29%20files%20%3E%20%28model%29%20file_object%20%3E%20%28schema%29%20%3E%20%28property%29%20purpose) for acceptable values." + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] }, - "status": { - "type": "string", - "description": "The status of the Upload.", - "enum": [ - "pending", - "completed", - "cancelled", - "expired" + "parameters": { + "anyOf": [ + { + "$ref": "#/components/schemas/EmptyModelParam" + }, + { + "type": "null" + } ] }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the Upload will expire." + "strict": { + "anyOf": [ + { + "type": "boolean", + "description": "Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise." + }, + { + "type": "null" + } + ] }, - "object": { + "type": { "type": "string", - "description": "The object type, which is always \"upload\".", "enum": [ - "upload" + "function" ], + "default": "function", "x-stainless-const": true }, - "file": { - "allOf": [ + "async": { + "type": "boolean", + "description": "Whether the tool response can be returned asynchronously versus immediately returned on next response creation." + }, + "output_schema": { + "anyOf": [ { - "$ref": "#/components/schemas/OpenAIFile" + "additionalProperties": {}, + "type": "object", + "description": "A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.", + "x-oaiTypeLabel": "map" + }, + { + "type": "null" + } + ] + }, + "defer_loading": { + "type": "boolean", + "description": "Whether this function should be deferred and discovered via tool search." + }, + "allowed_callers": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/CallableToolAllowedCaller" + }, + "type": "array", + "minItems": 1, + "description": "The tool invocation context(s)." }, { - "nullable": true, - "description": "The ready File object after the Upload is completed." + "type": "null" } ] } }, + "type": "object", "required": [ - "bytes", - "created_at", - "expires_at", - "filename", - "id", - "purpose", - "status" + "name", + "type" ], - "x-oaiMeta": { - "name": "The upload object", - "example": "{\n \"id\": \"upload_abc123\",\n \"object\": \"upload\",\n \"bytes\": 2147483648,\n \"created_at\": 1719184911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n \"status\": \"completed\",\n \"expires_at\": 1719127296,\n \"file\": {\n \"id\": \"file-xyz321\",\n \"object\": \"file\",\n \"bytes\": 2147483648,\n \"created_at\": 1719186911,\n \"filename\": \"training_examples.jsonl\",\n \"purpose\": \"fine-tune\",\n }\n}\n" - } + "x-openai-structured-output": "function" }, - "UploadCertificateRequest": { - "type": "object", + "ToolSearchOutputNamespaceToolParam": { "properties": { + "type": { + "type": "string", + "enum": [ + "namespace" + ], + "description": "The type of the tool. Always `namespace`.", + "default": "namespace", + "x-stainless-const": true + }, "name": { "type": "string", - "description": "An optional name for the certificate" + "minLength": 1, + "description": "The namespace name used in tool calls (for example, `crm`)." }, - "certificate": { + "description": { "type": "string", - "description": "The certificate content in PEM format" + "description": "A description of the namespace shown to the model." + }, + "tools": { + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/ToolSearchOutputFunctionToolParam" + }, + { + "$ref": "#/components/schemas/CustomToolParam" + } + ], + "description": "A function or custom tool loaded into a namespace by tool search.", + "discriminator": { + "propertyName": "type" + } + }, + "type": "array", + "minItems": 1, + "description": "The function/custom tools loaded inside this namespace." } }, + "type": "object", "required": [ - "certificate" - ] + "type", + "name", + "description", + "tools" + ], + "title": "Namespace", + "description": "Groups function/custom tools under a shared namespace." }, - "UploadPart": { - "type": "object", - "title": "UploadPart", - "description": "The upload Part represents a chunk of bytes we can add to an Upload object.\n", + "ToolSearchOutputItemParam": { "properties": { "id": { - "type": "string", - "description": "The upload Part unique identifier, which can be referenced in API endpoints." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the Part was created." + "anyOf": [ + { + "type": "string", + "description": "The unique ID of this tool search output.", + "example": "tso_123" + }, + { + "type": "null" + } + ] }, - "upload_id": { - "type": "string", - "description": "The ID of the Upload object that this Part was added to." + "call_id": { + "anyOf": [ + { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The unique ID of the tool search call generated by the model." + }, + { + "type": "null" + } + ] }, - "object": { + "type": { "type": "string", - "description": "The object type, which is always `upload.part`.", "enum": [ - "upload.part" + "tool_search_output" ], + "description": "The item type. Always `tool_search_output`.", + "default": "tool_search_output", "x-stainless-const": true + }, + "execution": { + "$ref": "#/components/schemas/ToolSearchExecutionType", + "description": "Whether tool search was executed by the server or by the client." + }, + "tools": { + "items": { + "$ref": "#/components/schemas/ToolSearchOutputTool" + }, + "type": "array", + "description": "The loaded tool definitions returned by the tool search output." + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/FunctionCallItemStatus", + "description": "The status of the tool search output." + }, + { + "type": "null" + } + ] } }, + "type": "object", "required": [ - "created_at", - "id", - "object", - "upload_id" - ], - "x-oaiMeta": { - "name": "The upload part object", - "example": "{\n \"id\": \"part_def456\",\n \"object\": \"upload.part\",\n \"created_at\": 1719186911,\n \"upload_id\": \"upload_abc123\"\n}\n" - } + "type", + "tools" + ] }, - "UsageAudioSpeechesResult": { - "type": "object", - "description": "The aggregated audio speeches usage details of the specific time bucket.", + "AdditionalToolsItemParam": { "properties": { - "object": { + "id": { + "anyOf": [ + { + "type": "string", + "description": "The unique ID of this additional tools item.", + "example": "at_123" + }, + { + "type": "null" + } + ] + }, + "type": { "type": "string", "enum": [ - "organization.usage.audio_speeches.result" + "additional_tools" ], + "description": "The item type. Always `additional_tools`.", + "default": "additional_tools", "x-stainless-const": true }, - "characters": { - "type": "integer", - "description": "The number of characters processed." - }, - "num_model_requests": { - "type": "integer", - "description": "The count of requests made to the model." + "role": { + "type": "string", + "enum": [ + "developer" + ], + "description": "The role that provided the additional tools. Only `developer` is supported.", + "default": "developer", + "x-stainless-const": true }, - "project_id": { + "tools": { + "items": { + "$ref": "#/components/schemas/Tool" + }, + "type": "array", + "description": "A list of additional tools made available at this item." + } + }, + "type": "object", + "required": [ + "type", + "role", + "tools" + ] + }, + "CompactionSummaryItemParam": { + "properties": { + "id": { "anyOf": [ { "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + "description": "The ID of the compaction item.", + "example": "cmp_123" }, { "type": "null" } ] }, - "user_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." - }, - { - "type": "null" - } - ] + "type": { + "type": "string", + "enum": [ + "compaction" + ], + "description": "The type of the item. Always `compaction`.", + "default": "compaction", + "x-stainless-const": true }, - "api_key_id": { + "encrypted_content": { + "type": "string", + "maxLength": 104857600, + "description": "The encrypted content of the compaction summary." + } + }, + "type": "object", + "required": [ + "type", + "encrypted_content" + ], + "title": "Compaction item", + "description": "A compaction item generated by the [`v1/responses/compact` API](https://developers.openai.com/api/reference/resources/responses/methods/compact)." + }, + "FunctionShellActionParam": { + "properties": { + "commands": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Ordered shell commands for the execution environment to run." + }, + "timeout_ms": { "anyOf": [ { - "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + "type": "integer", + "description": "Maximum wall-clock time in milliseconds to allow the shell commands to run." }, { "type": "null" } ] }, - "model": { + "max_output_length": { "anyOf": [ { - "type": "string", - "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + "type": "integer", + "description": "Maximum number of UTF-8 characters to capture from combined stdout and stderr output." }, { "type": "null" @@ -62265,74 +86167,93 @@ ] } }, + "type": "object", "required": [ - "object", - "characters", - "num_model_requests" + "commands" ], - "x-oaiMeta": { - "name": "Audio speeches usage object", - "example": "{\n \"object\": \"organization.usage.audio_speeches.result\",\n \"characters\": 45,\n \"num_model_requests\": 1,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"tts-1\"\n}\n" - } + "title": "Shell action", + "description": "Commands and limits describing how to run the shell tool call." }, - "UsageAudioTranscriptionsResult": { - "type": "object", - "description": "The aggregated audio transcriptions usage details of the specific time bucket.", + "FunctionShellCallItemStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ], + "title": "Shell call status", + "description": "Status values reported for shell tool calls." + }, + "FunctionShellCallItemParam": { "properties": { - "object": { - "type": "string", - "enum": [ - "organization.usage.audio_transcriptions.result" - ], - "x-stainless-const": true - }, - "seconds": { - "type": "integer", - "format": "int64", - "description": "The number of seconds processed." - }, - "num_model_requests": { - "type": "integer", - "description": "The count of requests made to the model." - }, - "project_id": { + "id": { "anyOf": [ { "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + "description": "The unique ID of the shell tool call. Populated when this item is returned via API.", + "example": "sh_123" }, { "type": "null" } ] }, - "user_id": { + "call_id": { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The unique ID of the shell tool call generated by the model." + }, + "caller": { "anyOf": [ { - "type": "string", - "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + "$ref": "#/components/schemas/ToolCallCallerParam", + "description": "The execution context that produced this tool call." }, { "type": "null" } ] }, - "api_key_id": { + "type": { + "type": "string", + "enum": [ + "shell_call" + ], + "description": "The type of the item. Always `shell_call`.", + "default": "shell_call", + "x-stainless-const": true + }, + "action": { + "$ref": "#/components/schemas/FunctionShellActionParam", + "description": "The shell commands and limits that describe how to run the tool call." + }, + "status": { "anyOf": [ { - "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + "$ref": "#/components/schemas/FunctionShellCallItemStatus", + "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`." }, { "type": "null" } ] }, - "model": { + "environment": { "anyOf": [ { - "type": "string", - "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + "oneOf": [ + { + "$ref": "#/components/schemas/LocalEnvironmentParam" + }, + { + "$ref": "#/components/schemas/ContainerReferenceParam" + } + ], + "description": "The environment to execute the shell commands in.", + "discriminator": { + "propertyName": "type" + } }, { "type": "null" @@ -62340,183 +86261,162 @@ ] } }, + "type": "object", "required": [ - "object", - "seconds", - "num_model_requests" + "call_id", + "type", + "action" ], - "x-oaiMeta": { - "name": "Audio transcriptions usage object", - "example": "{\n \"object\": \"organization.usage.audio_transcriptions.result\",\n \"seconds\": 10,\n \"num_model_requests\": 1,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"tts-1\"\n}\n" - } + "title": "Shell tool call", + "description": "A tool representing a request to execute one or more shell commands." }, - "UsageCodeInterpreterSessionsResult": { - "type": "object", - "description": "The aggregated code interpreter sessions usage details of the specific time bucket.", + "FunctionShellCallOutputTimeoutOutcomeParam": { "properties": { - "object": { + "type": { "type": "string", "enum": [ - "organization.usage.code_interpreter_sessions.result" + "timeout" ], + "description": "The outcome type. Always `timeout`.", + "default": "timeout", "x-stainless-const": true - }, - "num_sessions": { - "type": "integer", - "description": "The number of code interpreter sessions." - }, - "project_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." - }, - { - "type": "null" - } - ] } }, + "type": "object", "required": [ - "object", - "num_sessions" + "type" ], - "x-oaiMeta": { - "name": "Code interpreter sessions usage object", - "example": "{\n \"object\": \"organization.usage.code_interpreter_sessions.result\",\n \"num_sessions\": 1,\n \"project_id\": \"proj_abc\"\n}\n" - } + "title": "Shell call timeout outcome", + "description": "Indicates that the shell call exceeded its configured time limit." }, - "UsageCompletionsResult": { - "type": "object", - "description": "The aggregated completions usage details of the specific time bucket.", + "FunctionShellCallOutputExitOutcomeParam": { "properties": { - "object": { + "type": { "type": "string", "enum": [ - "organization.usage.completions.result" + "exit" ], + "description": "The outcome type. Always `exit`.", + "default": "exit", "x-stainless-const": true }, - "input_tokens": { - "type": "integer", - "description": "The aggregated number of input tokens used, including cached and cache-write tokens. This includes text, audio, and image tokens. For customers subscribed to Scale Tier, this includes Scale Tier tokens." - }, - "input_cached_tokens": { - "type": "integer", - "description": "The aggregated number of cached input tokens used across text, audio, and image inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens." - }, - "input_cache_write_tokens": { - "type": "integer", - "description": "The aggregated number of input tokens written to the cache." - }, - "input_uncached_tokens": { - "type": "integer", - "description": "The aggregated number of uncached input tokens used across text, audio, and image inputs, excluding cache-write tokens." - }, - "output_tokens": { - "type": "integer", - "description": "The aggregated number of output tokens used across text, audio, and image outputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens." - }, - "input_text_tokens": { - "type": "integer", - "description": "The aggregated number of uncached text input tokens used, excluding cache-write tokens." - }, - "output_text_tokens": { - "type": "integer", - "description": "The aggregated number of text output tokens used." - }, - "input_cached_text_tokens": { - "type": "integer", - "description": "The aggregated number of cached text input tokens used." - }, - "input_audio_tokens": { - "type": "integer", - "description": "The aggregated number of uncached audio input tokens used." - }, - "input_cached_audio_tokens": { - "type": "integer", - "description": "The aggregated number of cached audio input tokens used." - }, - "output_audio_tokens": { - "type": "integer", - "description": "The aggregated number of audio output tokens used." - }, - "input_image_tokens": { - "type": "integer", - "description": "The aggregated number of uncached image input tokens used." - }, - "input_cached_image_tokens": { + "exit_code": { "type": "integer", - "description": "The aggregated number of cached image input tokens used." + "description": "The exit code returned by the shell process." + } + }, + "type": "object", + "required": [ + "type", + "exit_code" + ], + "title": "Shell call exit outcome", + "description": "Indicates that the shell commands finished and returned an exit code." + }, + "FunctionShellCallOutputOutcomeParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/FunctionShellCallOutputTimeoutOutcomeParam" }, - "output_image_tokens": { - "type": "integer", - "description": "The aggregated number of image output tokens used." + { + "$ref": "#/components/schemas/FunctionShellCallOutputExitOutcomeParam" + } + ], + "title": "Shell call outcome", + "description": "The exit or timeout outcome associated with this shell call.", + "discriminator": { + "propertyName": "type" + } + }, + "FunctionShellCallOutputContentParam": { + "properties": { + "stdout": { + "type": "string", + "maxLength": 10485760, + "description": "Captured stdout output for the shell call." }, - "num_model_requests": { - "type": "integer", - "description": "The count of requests made to the model." + "stderr": { + "type": "string", + "maxLength": 10485760, + "description": "Captured stderr output for the shell call." }, - "project_id": { + "outcome": { + "$ref": "#/components/schemas/FunctionShellCallOutputOutcomeParam", + "description": "The exit or timeout outcome associated with this shell call." + } + }, + "type": "object", + "required": [ + "stdout", + "stderr", + "outcome" + ], + "title": "Shell output content", + "description": "Captured stdout and stderr for a portion of a shell tool call output." + }, + "FunctionShellCallOutputItemParam": { + "properties": { + "id": { "anyOf": [ { "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + "description": "The unique ID of the shell tool call output. Populated when this item is returned via API.", + "example": "sho_123" }, { "type": "null" } ] }, - "user_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." - }, - { - "type": "null" - } - ] + "call_id": { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The unique ID of the shell tool call generated by the model." }, - "api_key_id": { + "caller": { "anyOf": [ { - "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + "$ref": "#/components/schemas/ToolCallCallerParam", + "description": "The execution context that produced this tool call." }, { "type": "null" } ] }, - "model": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=model`, this field provides the model name of the grouped usage result." - }, - { - "type": "null" - } - ] + "type": { + "type": "string", + "enum": [ + "shell_call_output" + ], + "description": "The type of the item. Always `shell_call_output`.", + "default": "shell_call_output", + "x-stainless-const": true }, - "batch": { + "output": { + "items": { + "$ref": "#/components/schemas/FunctionShellCallOutputContentParam" + }, + "type": "array", + "description": "Captured chunks of stdout and stderr output, along with their associated outcomes." + }, + "status": { "anyOf": [ { - "type": "boolean", - "description": "When `group_by=batch`, this field tells whether the grouped usage result is batch or not." + "$ref": "#/components/schemas/FunctionShellCallItemStatus", + "description": "The status of the shell call output." }, { "type": "null" } ] }, - "service_tier": { + "max_output_length": { "anyOf": [ { - "type": "string", - "description": "When `group_by=service_tier`, this field provides the service tier of the grouped usage result." + "type": "integer", + "description": "The maximum number of UTF-8 characters captured for this shell call's combined output." }, { "type": "null" @@ -62524,239 +86424,707 @@ ] } }, + "type": "object", "required": [ - "object", - "input_tokens", - "output_tokens", - "num_model_requests" + "call_id", + "type", + "output" ], - "x-oaiMeta": { - "name": "Completions usage object", - "example": "{\n \"object\": \"organization.usage.completions.result\",\n \"input_tokens\": 5000,\n \"input_cached_tokens\": 1800,\n \"input_cache_write_tokens\": 200,\n \"input_uncached_tokens\": 3000,\n \"output_tokens\": 1000,\n \"input_text_tokens\": 2500,\n \"output_text_tokens\": 800,\n \"input_cached_text_tokens\": 1500,\n \"input_audio_tokens\": 300,\n \"input_cached_audio_tokens\": 100,\n \"output_audio_tokens\": 100,\n \"input_image_tokens\": 200,\n \"input_cached_image_tokens\": 200,\n \"output_image_tokens\": 100,\n \"num_model_requests\": 5,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"gpt-6-astra\",\n \"batch\": false,\n \"service_tier\": \"default\"\n}\n" - } + "title": "Shell tool call output", + "description": "The streamed output items emitted by a shell tool call." }, - "UsageEmbeddingsResult": { + "ApplyPatchCallStatusParam": { + "type": "string", + "enum": [ + "in_progress", + "completed" + ], + "title": "Apply patch call status", + "description": "Status values reported for apply_patch tool calls." + }, + "ApplyPatchCreateFileOperationParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "create_file" + ], + "description": "The operation type. Always `create_file`.", + "default": "create_file", + "x-stainless-const": true + }, + "path": { + "type": "string", + "minLength": 1, + "description": "Path of the file to create relative to the workspace root." + }, + "diff": { + "type": "string", + "maxLength": 10485760, + "description": "Unified diff content to apply when creating the file." + } + }, "type": "object", - "description": "The aggregated embeddings usage details of the specific time bucket.", + "required": [ + "type", + "path", + "diff" + ], + "title": "Apply patch create file operation", + "description": "Instruction for creating a new file via the apply_patch tool." + }, + "ApplyPatchDeleteFileOperationParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "delete_file" + ], + "description": "The operation type. Always `delete_file`.", + "default": "delete_file", + "x-stainless-const": true + }, + "path": { + "type": "string", + "minLength": 1, + "description": "Path of the file to delete relative to the workspace root." + } + }, + "type": "object", + "required": [ + "type", + "path" + ], + "title": "Apply patch delete file operation", + "description": "Instruction for deleting an existing file via the apply_patch tool." + }, + "ApplyPatchUpdateFileOperationParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "update_file" + ], + "description": "The operation type. Always `update_file`.", + "default": "update_file", + "x-stainless-const": true + }, + "path": { + "type": "string", + "minLength": 1, + "description": "Path of the file to update relative to the workspace root." + }, + "diff": { + "type": "string", + "maxLength": 10485760, + "description": "Unified diff content to apply to the existing file." + } + }, + "type": "object", + "required": [ + "type", + "path", + "diff" + ], + "title": "Apply patch update file operation", + "description": "Instruction for updating an existing file via the apply_patch tool." + }, + "ApplyPatchOperationParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/ApplyPatchCreateFileOperationParam" + }, + { + "$ref": "#/components/schemas/ApplyPatchDeleteFileOperationParam" + }, + { + "$ref": "#/components/schemas/ApplyPatchUpdateFileOperationParam" + } + ], + "title": "Apply patch operation", + "description": "One of the create_file, delete_file, or update_file operations supplied to the apply_patch tool.", + "discriminator": { + "propertyName": "type" + } + }, + "ApplyPatchToolCallItemParam": { "properties": { - "object": { + "type": { "type": "string", "enum": [ - "organization.usage.embeddings.result" + "apply_patch_call" ], + "description": "The type of the item. Always `apply_patch_call`.", + "default": "apply_patch_call", "x-stainless-const": true }, - "input_tokens": { - "type": "integer", - "description": "The aggregated number of input tokens used." - }, - "num_model_requests": { - "type": "integer", - "description": "The count of requests made to the model." - }, - "project_id": { + "id": { "anyOf": [ { "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API.", + "example": "apc_123" }, { "type": "null" } ] }, - "user_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." - }, - { - "type": "null" - } - ] + "call_id": { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The unique ID of the apply patch tool call generated by the model." }, - "api_key_id": { + "caller": { "anyOf": [ { - "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + "$ref": "#/components/schemas/ToolCallCallerParam", + "description": "The execution context that produced this tool call." }, { "type": "null" } ] }, - "model": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=model`, this field provides the model name of the grouped usage result." - }, - { - "type": "null" - } - ] + "status": { + "$ref": "#/components/schemas/ApplyPatchCallStatusParam", + "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." + }, + "operation": { + "$ref": "#/components/schemas/ApplyPatchOperationParam", + "description": "The specific create, delete, or update instruction for the apply_patch tool call." } }, + "type": "object", "required": [ - "object", - "input_tokens", - "num_model_requests" + "type", + "call_id", + "status", + "operation" ], - "x-oaiMeta": { - "name": "Embeddings usage object", - "example": "{\n \"object\": \"organization.usage.embeddings.result\",\n \"input_tokens\": 20,\n \"num_model_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"text-embedding-ada-002-v2\"\n}\n" - } + "title": "Apply patch tool call", + "description": "A tool call representing a request to create, delete, or update files using diff patches." }, - "UsageFileSearchCallsResult": { - "type": "object", - "description": "The aggregated file search calls usage details of the specific time bucket.", + "ApplyPatchCallOutputStatusParam": { + "type": "string", + "enum": [ + "completed", + "failed" + ], + "title": "Apply patch call output status", + "description": "Outcome values reported for apply_patch tool call outputs." + }, + "ApplyPatchToolCallOutputItemParam": { "properties": { - "object": { + "type": { "type": "string", "enum": [ - "organization.usage.file_searches.result" + "apply_patch_call_output" ], + "description": "The type of the item. Always `apply_patch_call_output`.", + "default": "apply_patch_call_output", "x-stainless-const": true }, - "num_requests": { - "type": "integer", - "description": "The count of file search calls." - }, - "project_id": { + "id": { "anyOf": [ { "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + "description": "The unique ID of the apply patch tool call output. Populated when this item is returned via API.", + "example": "apco_123" }, { "type": "null" } ] }, - "user_id": { + "call_id": { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The unique ID of the apply patch tool call generated by the model." + }, + "caller": { "anyOf": [ { - "type": "string", - "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + "$ref": "#/components/schemas/ToolCallCallerParam", + "description": "The execution context that produced this tool call." }, { "type": "null" } ] }, - "api_key_id": { + "status": { + "$ref": "#/components/schemas/ApplyPatchCallOutputStatusParam", + "description": "The status of the apply patch tool call output. One of `completed` or `failed`." + }, + "output": { "anyOf": [ { "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + "maxLength": 10485760, + "description": "Optional human-readable log text from the apply patch tool (e.g., patch results or errors)." + }, + { + "type": "null" + } + ] + } + }, + "type": "object", + "required": [ + "type", + "call_id", + "status" + ], + "title": "Apply patch tool call output", + "description": "The streamed output emitted by an apply patch tool call." + }, + "CompactionTriggerItemParam": { + "properties": { + "id": { + "anyOf": [ + { + "type": "string", + "description": "The unique ID of this compaction trigger.", + "example": "msg_123" }, { "type": "null" } ] }, - "vector_store_id": { + "type": { + "type": "string", + "enum": [ + "compaction_trigger" + ], + "description": "The type of the item. Always `compaction_trigger`.", + "default": "compaction_trigger", + "x-stainless-const": true + } + }, + "type": "object", + "required": [ + "type" + ], + "title": "Compaction trigger", + "description": "Compacts the current context. Must be the final input item." + }, + "ItemReferenceParam": { + "properties": { + "type": { "anyOf": [ { "type": "string", - "description": "When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result." + "enum": [ + "item_reference" + ], + "description": "The type of item to reference. Always `item_reference`.", + "default": "item_reference", + "x-stainless-const": true }, { "type": "null" } ] + }, + "id": { + "type": "string", + "description": "The ID of the item to reference." } }, + "type": "object", "required": [ - "object", - "num_requests" + "id" ], - "x-oaiMeta": { - "name": "File search calls usage object", - "example": "{\n \"object\": \"organization.usage.file_searches.result\",\n \"num_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"vector_store_id\": \"vs_abc\"\n}\n" - } + "title": "Item reference", + "description": "An internal identifier for an item to reference." }, - "UsageImagesResult": { + "ProgramItemParam": { + "properties": { + "id": { + "type": "string", + "description": "The unique ID of this program item.", + "example": "cm_123" + }, + "type": { + "type": "string", + "enum": [ + "program" + ], + "description": "The item type. Always `program`.", + "default": "program", + "x-stainless-const": true + }, + "call_id": { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The stable call ID of the program item." + }, + "code": { + "type": "string", + "maxLength": 10485760, + "description": "The JavaScript source executed by programmatic tool calling." + }, + "fingerprint": { + "type": "string", + "maxLength": 10485760, + "description": "Opaque program replay fingerprint that must be round-tripped." + } + }, "type": "object", - "description": "The aggregated images usage details of the specific time bucket.", + "required": [ + "id", + "type", + "call_id", + "code", + "fingerprint" + ] + }, + "ProgramOutputItemStatus": { + "type": "string", + "enum": [ + "completed", + "incomplete" + ] + }, + "ProgramOutputItemParam": { + "properties": { + "id": { + "type": "string", + "description": "The unique ID of this program output item.", + "example": "cmo_123" + }, + "type": { + "type": "string", + "enum": [ + "program_output" + ], + "description": "The item type. Always `program_output`.", + "default": "program_output", + "x-stainless-const": true + }, + "call_id": { + "type": "string", + "maxLength": 64, + "minLength": 1, + "description": "The call ID of the program item." + }, + "result": { + "type": "string", + "maxLength": 10485760, + "description": "The result produced by the program item." + }, + "status": { + "$ref": "#/components/schemas/ProgramOutputItemStatus", + "description": "The terminal status of the program output." + } + }, + "type": "object", + "required": [ + "id", + "type", + "call_id", + "result", + "status" + ] + }, + "ConversationResource": { "properties": { + "id": { + "type": "string", + "description": "The unique ID of the conversation." + }, "object": { "type": "string", "enum": [ - "organization.usage.images.result" + "conversation" ], + "description": "The object type, which is always `conversation`.", + "default": "conversation", "x-stainless-const": true }, - "images": { + "metadata": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.", + "x-oaiTypeLabel": "map" + }, + "created_at": { "type": "integer", - "description": "The number of images processed." + "format": "unixtime", + "description": "The time at which the conversation was created, measured in seconds since the Unix epoch." + } + }, + "type": "object", + "required": [ + "id", + "object", + "metadata", + "created_at" + ] + }, + "markup": { + "type": "string", + "format": "binary", + "description": "A transparent PNG overlaid on the first image to guide the edit. Must match that image's dimensions after orientation and contain transparent pixels. Supports GPT Image 2.5 and 2.6. Cannot be combined with mask." + }, + "ImageGenOutputTokensDetails": { + "properties": { + "image_tokens": { + "type": "integer", + "description": "The number of image output tokens generated by the model." }, - "num_model_requests": { + "text_tokens": { "type": "integer", - "description": "The count of requests made to the model." + "description": "The number of text output tokens generated by the model." + } + }, + "type": "object", + "required": [ + "image_tokens", + "text_tokens" + ], + "title": "Image generation output token details", + "description": "The output token details for the image generation." + }, + "ImageGenInputUsageDetails": { + "properties": { + "text_tokens": { + "type": "integer", + "description": "The number of text tokens in the input prompt." }, - "source": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`." - }, - { - "type": "null" - } - ] + "image_tokens": { + "type": "integer", + "description": "The number of image tokens in the input prompt." + } + }, + "type": "object", + "required": [ + "text_tokens", + "image_tokens" + ], + "title": "Input usage details", + "description": "The input tokens detailed information for the image generation." + }, + "ImageGenUsage": { + "properties": { + "input_tokens": { + "type": "integer", + "description": "The number of tokens (images and text) in the input prompt." }, - "size": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=size`, this field provides the image size of the grouped usage result." - }, - { - "type": "null" - } - ] + "total_tokens": { + "type": "integer", + "description": "The total number of tokens (images and text) used for the image generation." }, - "project_id": { - "anyOf": [ + "output_tokens": { + "type": "integer", + "description": "The number of output tokens generated by the model." + }, + "output_tokens_details": { + "$ref": "#/components/schemas/ImageGenOutputTokensDetails" + }, + "input_tokens_details": { + "$ref": "#/components/schemas/ImageGenInputUsageDetails" + } + }, + "type": "object", + "required": [ + "input_tokens", + "total_tokens", + "output_tokens", + "input_tokens_details" + ], + "title": "Image generation usage", + "description": "For `gpt-image-1` only, the token usage information for the image generation." + }, + "instructions": { + "anyOf": [ + { + "description": "Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "LiveCustomVoiceParam": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 1, + "maxLength": 128 + } + }, + "required": [ + "id" + ] + }, + "LiveInitialSessionAudioOutputParam": { + "description": "Settings for speech generated by the Live model. Choose the voice before starting the session.", + "type": "object", + "properties": { + "voice": { + "description": "The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.", + "oneOf": [ { - "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "alloy", + "ash", + "ballad", + "beacon", + "bossa", + "brise", + "cedar", + "cinder", + "coral", + "delta", + "echo", + "flitz", + "gleam", + "harema", + "juni", + "marin", + "meridian", + "nira", + "noeul", + "nuri", + "quartz", + "ripple", + "sage", + "shida", + "shimmer", + "sillage", + "stone", + "tempo", + "verse", + "vesper", + "willow" + ] + } + ] }, { - "type": "null" + "$ref": "#/components/schemas/LiveCustomVoiceParam" } ] + } + }, + "required": [] + }, + "LiveClientDelegationParam": { + "description": "Delegate tasks to your application. The Live session emits delegation events that your backend handles.", + "type": "object", + "properties": { + "acknowledgement_delay_ms": { + "description": "Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations.", + "type": "integer", + "minimum": 0, + "maximum": 800 }, - "user_id": { + "type": { + "description": "The delegation owner. Always `client` for tasks handled by your application.", + "default": "client", + "x-stainless-const": true, + "type": "string", + "enum": [ + "client" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveResponsesServiceTier": { + "type": "string", + "enum": [ + "auto", + "default", + "fast_tier_temp_pilot", + "flex", + "priority", + "ultrafast" + ] + }, + "LiveReasoningEffort": { + "type": "string", + "enum": [ + "none", + "minimal", + "low", + "medium", + "high", + "xhigh" + ] + }, + "LiveReasoningSummary": { + "type": "string", + "enum": [ + "concise", + "detailed", + "auto" + ] + }, + "LiveDelegationReasoningInputParam": { + "description": "Reasoning options for Responses requests made on behalf of the Live session.", + "type": "object", + "properties": { + "effort": { "anyOf": [ { - "type": "string", - "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + "description": "How much reasoning effort the delegated Responses model should use. Supported values depend on the backend model.", + "$ref": "#/components/schemas/LiveReasoningEffort" }, { "type": "null" } ] }, - "api_key_id": { + "summary": { "anyOf": [ { - "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + "description": "The reasoning summary to request from the delegated Responses model, when supported.", + "$ref": "#/components/schemas/LiveReasoningSummary" }, { "type": "null" } ] - }, - "model": { + } + }, + "required": [] + }, + "LiveTextVerbosity": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "LiveDelegationTextInputParam": { + "description": "Text generation options for the Live session’s Responses backend.", + "type": "object", + "properties": { + "verbosity": { "anyOf": [ { - "type": "string", - "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + "description": "The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery.", + "$ref": "#/components/schemas/LiveTextVerbosity" }, { "type": "null" @@ -62764,73 +87132,53 @@ ] } }, - "required": [ - "object", - "images", - "num_model_requests" - ], - "x-oaiMeta": { - "name": "Images usage object", - "example": "{\n \"object\": \"organization.usage.images.result\",\n \"images\": 2,\n \"num_model_requests\": 2,\n \"size\": \"1024x1024\",\n \"source\": \"image.generation\",\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"dall-e-3\"\n}\n" - } + "required": [] }, - "UsageModerationsResult": { + "LiveFunctionToolInputParam": { + "description": "A function tool available to the Responses backend when the Live model delegates a task.", "type": "object", - "description": "The aggregated moderations usage details of the specific time bucket.", "properties": { - "object": { + "type": { + "description": "The tool type. Always `function`.", + "default": "function", + "x-stainless-const": true, "type": "string", "enum": [ - "organization.usage.moderations.result" - ], - "x-stainless-const": true - }, - "input_tokens": { - "type": "integer", - "description": "The aggregated number of input tokens used." - }, - "num_model_requests": { - "type": "integer", - "description": "The count of requests made to the model." - }, - "project_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." - }, - { - "type": "null" - } + "function" ] }, - "user_id": { + "name": { + "description": "The name the delegated Responses model uses when calling this function.", + "type": "string" + }, + "description": { "anyOf": [ { - "type": "string", - "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." + "description": "What the function does and when the delegated Responses model should call it.", + "type": "string" }, { "type": "null" } ] }, - "api_key_id": { + "parameters": { "anyOf": [ { - "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." + "description": "A JSON Schema object describing the arguments accepted by the function.", + "type": "object", + "additionalProperties": {} }, { "type": "null" } ] }, - "model": { + "strict": { "anyOf": [ { - "type": "string", - "description": "When `group_by=model`, this field provides the model name of the grouped usage result." + "description": "Whether the delegated Responses model must follow the function’s parameter schema exactly.", + "type": "boolean" }, { "type": "null" @@ -62839,561 +87187,368 @@ } }, "required": [ - "object", - "input_tokens", - "num_model_requests" - ], - "x-oaiMeta": { - "name": "Moderations usage object", - "example": "{\n \"object\": \"organization.usage.moderations.result\",\n \"input_tokens\": 20,\n \"num_model_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"text-moderation\"\n}\n" - } + "type", + "name" + ] }, - "UsageResponse": { + "LiveWebSearchToolInputParam": { + "description": "A web search tool available to the Live session’s Responses backend.", "type": "object", "properties": { - "object": { + "type": { + "description": "The tool type. Always `web_search`.", + "default": "web_search", + "x-stainless-const": true, "type": "string", "enum": [ - "page" - ], - "x-stainless-const": true - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UsageTimeBucket" - } - }, - "has_more": { - "type": "boolean" - }, - "next_page": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "web_search" ] } }, "required": [ - "object", - "data", - "has_more", - "next_page" + "type" ] }, - "UsageTimeBucket": { + "LiveFileSearchToolInputParam": { "type": "object", "properties": { - "object": { + "type": { + "default": "file_search", + "x-stainless-const": true, "type": "string", "enum": [ - "bucket" - ], - "x-stainless-const": true - }, - "start_time": { - "type": "integer" - }, - "end_time": { - "type": "integer" - }, - "results": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/UsageCompletionsResult" - }, - { - "$ref": "#/components/schemas/UsageEmbeddingsResult" - }, - { - "$ref": "#/components/schemas/UsageModerationsResult" - }, - { - "$ref": "#/components/schemas/UsageImagesResult" - }, - { - "$ref": "#/components/schemas/UsageAudioSpeechesResult" - }, - { - "$ref": "#/components/schemas/UsageAudioTranscriptionsResult" - }, - { - "$ref": "#/components/schemas/UsageVectorStoresResult" - }, - { - "$ref": "#/components/schemas/UsageCodeInterpreterSessionsResult" - }, - { - "$ref": "#/components/schemas/UsageFileSearchCallsResult" - }, - { - "$ref": "#/components/schemas/UsageWebSearchCallsResult" - }, - { - "$ref": "#/components/schemas/CostsResult" - } - ], - "discriminator": { - "propertyName": "object" - } - } + "file_search" + ] } }, "required": [ - "object", - "start_time", - "end_time", - "results" + "type" ] }, - "UsageVectorStoresResult": { + "LiveCodeInterpreterToolInputParam": { "type": "object", - "description": "The aggregated vector stores usage details of the specific time bucket.", "properties": { - "object": { + "type": { + "default": "code_interpreter", + "x-stainless-const": true, "type": "string", "enum": [ - "organization.usage.vector_stores.result" - ], - "x-stainless-const": true - }, - "usage_bytes": { - "type": "integer", - "description": "The vector stores usage in bytes." - }, - "project_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." - }, - { - "type": "null" - } + "code_interpreter" ] } }, "required": [ - "object", - "usage_bytes" - ], - "x-oaiMeta": { - "name": "Vector stores usage object", - "example": "{\n \"object\": \"organization.usage.vector_stores.result\",\n \"usage_bytes\": 1024,\n \"project_id\": \"proj_abc\"\n}\n" - } + "type" + ] }, - "UsageWebSearchCallsResult": { + "LiveContainerMemoryLimit": { + "type": "string", + "enum": [ + "1g", + "4g", + "16g", + "64g" + ] + }, + "LiveContainerNetworkPolicyDisabledParam": { "type": "object", - "description": "The aggregated web search calls usage details of the specific time bucket.", "properties": { - "object": { + "type": { + "description": "Disable outbound network access. Always `disabled`.", + "default": "disabled", + "x-stainless-const": true, "type": "string", "enum": [ - "organization.usage.web_searches.result" - ], - "x-stainless-const": true - }, - "num_model_requests": { - "type": "integer", - "description": "The count of model requests." - }, - "num_requests": { - "type": "integer", - "description": "The count of web search calls." - }, - "project_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." - }, - { - "type": "null" - } - ] - }, - "user_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." - }, - { - "type": "null" - } - ] - }, - "api_key_id": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." - }, - { - "type": "null" - } + "disabled" ] - }, - "model": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=model`, this field provides the model name of the grouped usage result." - }, - { - "type": "null" - } + } + }, + "required": [ + "type" + ] + }, + "LiveHostedShellNetworkPolicyAllowlistParam": { + "type": "object", + "properties": { + "type": { + "description": "Allow outbound network access only to specified domains. Always `allowlist`.", + "default": "allowlist", + "x-stainless-const": true, + "type": "string", + "enum": [ + "allowlist" ] }, - "context_level": { - "anyOf": [ - { - "type": "string", - "description": "When `group_by=context_level`, this field provides the search context size of the grouped usage result." - }, - { - "type": "null" - } - ] + "allowed_domains": { + "description": "A list of allowed domains when type is `allowlist`.", + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 } }, "required": [ - "object", - "num_model_requests", - "num_requests" - ], - "x-oaiMeta": { - "name": "Web search calls usage object", - "example": "{\n \"object\": \"organization.usage.web_searches.result\",\n \"num_model_requests\": 2,\n \"num_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"gpt-6-astra\",\n \"context_level\": \"medium\"\n}\n" - } + "type", + "allowed_domains" + ] }, - "User": { + "LiveSkillReferenceParam": { "type": "object", - "description": "Represents an individual `user` within an organization.", "properties": { - "object": { + "type": { + "description": "References a skill created with the /v1/skills endpoint.", + "default": "skill_reference", + "x-stainless-const": true, "type": "string", "enum": [ - "organization.user" - ], - "description": "The object type, which is always `organization.user`", - "x-stainless-const": true + "skill_reference" + ] }, - "id": { + "skill_id": { + "description": "The ID of the referenced skill.", "type": "string", - "description": "The identifier, which can be referenced in API endpoints" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "The name of the user" - }, - "email": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "The email address of the user" + "minLength": 1, + "maxLength": 64 }, - "role": { + "version": { "anyOf": [ { + "description": "Optional skill version. Use a positive integer or 'latest'. Omit for default.", "type": "string" }, { "type": "null" } - ], - "description": "`owner` or `reader`" - }, - "added_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the user was added." - }, - "is_default": { - "type": "boolean", - "description": "Whether this is the organization's default user." - }, - "created": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the user was created." - }, - "user": { - "type": "object", - "description": "Nested user details.", - "properties": { - "object": { - "type": "string", - "enum": [ - "user" - ], - "x-stainless-const": true - }, - "id": { - "type": "string" - }, - "email": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "picture": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "enabled": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ] - }, - "banned": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ] - }, - "banned_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "object", - "id" + ] + } + }, + "required": [ + "type", + "skill_id" + ] + }, + "LiveInlineSkillSourceParam": { + "description": "Inline skill payload", + "type": "object", + "properties": { + "type": { + "description": "The type of the inline skill source. Must be `base64`.", + "default": "base64", + "x-stainless-const": true, + "type": "string", + "enum": [ + "base64" ] }, - "is_service_account": { - "type": "boolean", - "description": "Whether the user is a service account." + "media_type": { + "description": "The media type of the inline skill payload. Must be `application/zip`.", + "default": "application/zip", + "x-stainless-const": true, + "type": "string", + "enum": [ + "application/zip" + ] }, - "is_scale_tier_authorized_purchaser": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "description": "Whether the user is an authorized purchaser for Scale Tier." + "data": { + "description": "Base64-encoded skill zip bundle.", + "type": "string", + "minLength": 1, + "maxLength": 70254592 + } + }, + "required": [ + "type", + "media_type", + "data" + ] + }, + "LiveInlineSkillParam": { + "type": "object", + "properties": { + "type": { + "description": "Defines an inline skill for this request.", + "default": "inline", + "x-stainless-const": true, + "type": "string", + "enum": [ + "inline" + ] }, - "is_scim_managed": { - "type": "boolean", - "description": "Whether the user is managed through SCIM." + "name": { + "description": "The name of the skill.", + "type": "string" }, - "api_key_last_used_at": { + "description": { + "description": "The description of the skill.", + "type": "string" + }, + "source": { + "description": "Inline skill payload", + "$ref": "#/components/schemas/LiveInlineSkillSourceParam" + } + }, + "required": [ + "type", + "name", + "description", + "source" + ] + }, + "LiveHostedShellContainerAutoParam": { + "type": "object", + "properties": { + "type": { + "description": "Automatically creates a container for this request", + "default": "container_auto", + "x-stainless-const": true, + "type": "string", + "enum": [ + "container_auto" + ] + }, + "file_ids": { "anyOf": [ { - "type": "integer", - "format": "unixtime" + "description": "An optional list of uploaded files to make available to your code.", + "type": "array", + "items": { + "type": "string" + }, + "maxItems": 50 }, { "type": "null" } - ], - "description": "The Unix timestamp (in seconds) of the user's last API key usage." + ] }, - "technical_level": { + "memory_limit": { "anyOf": [ { - "type": "string" + "description": "The memory limit for the container.", + "$ref": "#/components/schemas/LiveContainerMemoryLimit" }, { "type": "null" } - ], - "description": "The technical level metadata for the user." + ] }, - "developer_persona": { + "network_policy": { "anyOf": [ { - "type": "string" + "description": "Network access policy for the container.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveContainerNetworkPolicyDisabledParam" + }, + { + "$ref": "#/components/schemas/LiveHostedShellNetworkPolicyAllowlistParam" + } + ] }, { "type": "null" } - ], - "description": "The developer persona metadata for the user." + ] }, - "projects": { + "skills": { "anyOf": [ { - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "x-stainless-const": true + "description": "An optional list of skills referenced by id or inline data.", + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" }, - "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - } - } + "oneOf": [ + { + "$ref": "#/components/schemas/LiveSkillReferenceParam" + }, + { + "$ref": "#/components/schemas/LiveInlineSkillParam" } - } + ] }, - "required": [ - "object", - "data" - ] + "maxItems": 200 }, { "type": "null" } - ], - "description": "Projects associated with the user, if included." + ] } }, "required": [ - "object", - "id", - "added_at" - ], - "x-oaiMeta": { - "name": "The user object", - "example": "{\n \"object\": \"organization.user\",\n \"id\": \"user_abc\",\n \"name\": \"First Last\",\n \"email\": \"user@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711471533\n}\n" - } + "type" + ] }, - "UserDeleteResponse": { + "LiveContainerReferenceParam": { "type": "object", "properties": { - "object": { + "type": { + "description": "References a container created with the /v1/containers endpoint", + "default": "container_reference", + "x-stainless-const": true, "type": "string", "enum": [ - "organization.user.deleted" - ], - "x-stainless-const": true + "container_reference" + ] }, - "id": { + "container_id": { + "description": "The ID of the referenced container.", + "type": "string" + } + }, + "required": [ + "type", + "container_id" + ] + }, + "LiveLocalSkillParam": { + "type": "object", + "properties": { + "name": { + "description": "The name of the skill.", "type": "string" }, - "deleted": { - "type": "boolean" + "description": { + "description": "The description of the skill.", + "type": "string" + }, + "path": { + "description": "The path to the directory containing the skill.", + "type": "string" } }, "required": [ - "object", - "id", - "deleted" + "name", + "description", + "path" ] }, - "UserListResource": { + "LiveLocalEnvironmentParam": { "type": "object", - "description": "Paginated list of user objects returned when inspecting group membership.", "properties": { - "object": { + "type": { + "description": "Use a local computer environment.", + "default": "local", + "x-stainless-const": true, "type": "string", "enum": [ - "list" - ], - "description": "Always `list`.", - "x-stainless-const": true - }, - "data": { - "type": "array", - "description": "Users in the current page.", - "items": { - "$ref": "#/components/schemas/GroupUser" - } - }, - "has_more": { - "type": "boolean", - "description": "Whether more users are available when paginating." + "local" + ] }, - "next": { - "description": "Cursor to fetch the next page of results, or `null` when no further users are available.", + "skills": { "anyOf": [ { - "type": "string" + "description": "An optional list of skills.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveLocalSkillParam" + }, + "maxItems": 200 }, { "type": "null" @@ -63402,812 +87557,771 @@ } }, "required": [ - "object", - "data", - "has_more", - "next" - ], - "x-oaiMeta": { - "name": "Group user list", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\"\n }\n ],\n \"has_more\": false,\n \"next\": null\n}\n" - } + "type" + ] }, - "UserListResponse": { + "LiveHostedShellToolInputParam": { + "description": "A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.", "type": "object", "properties": { - "object": { + "type": { + "default": "shell", + "x-stainless-const": true, "type": "string", "enum": [ - "list" - ], - "x-stainless-const": true - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/User" - } - }, - "first_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "shell" ] }, - "last_id": { + "environment": { "anyOf": [ { - "type": "string" + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveHostedShellContainerAutoParam" + }, + { + "$ref": "#/components/schemas/LiveContainerReferenceParam" + }, + { + "$ref": "#/components/schemas/LiveLocalEnvironmentParam" + } + ] }, { "type": "null" } ] - }, - "has_more": { - "type": "boolean" } }, "required": [ - "object", - "data", - "has_more" + "type" ] }, - "UserRoleAssignment": { + "LiveImageGenerationToolInputParam": { "type": "object", - "description": "Role assignment linking a user to a role.", "properties": { - "object": { + "type": { + "default": "image_generation", + "x-stainless-const": true, "type": "string", "enum": [ - "user.role" - ], - "description": "Always `user.role`.", - "x-stainless-const": true - }, - "user": { - "$ref": "#/components/schemas/User" - }, - "role": { - "$ref": "#/components/schemas/Role" + "image_generation" + ] } }, "required": [ - "object", - "user", - "role" - ], - "x-oaiMeta": { - "name": "The user role object", - "example": "{\n \"object\": \"user.role\",\n \"user\": {\n \"object\": \"organization.user\",\n \"id\": \"user_abc123\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"ada@example.com\",\n \"role\": \"owner\",\n \"added_at\": 1711470000\n },\n \"role\": {\n \"object\": \"role\",\n \"id\": \"role_01J1F8ROLE01\",\n \"name\": \"API Group Manager\",\n \"description\": \"Allows managing organization groups\",\n \"permissions\": [\n \"api.groups.read\",\n \"api.groups.write\"\n ],\n \"resource_type\": \"api.organization\",\n \"predefined_role\": false\n }\n}\n" - } + "type" + ] }, - "UserRoleUpdateRequest": { + "LiveMCPToolInputParam": { "type": "object", "properties": { - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "`owner` or `reader`" + "type": { + "default": "mcp", + "x-stainless-const": true, + "type": "string", + "enum": [ + "mcp" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveCustomToolInputParam": { + "type": "object", + "properties": { + "type": { + "default": "custom", + "x-stainless-const": true, + "type": "string", + "enum": [ + "custom" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveNamespaceToolInputParam": { + "type": "object", + "properties": { + "type": { + "default": "namespace", + "x-stainless-const": true, + "type": "string", + "enum": [ + "namespace" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveToolSearchToolInputParam": { + "type": "object", + "properties": { + "type": { + "default": "tool_search", + "x-stainless-const": true, + "type": "string", + "enum": [ + "tool_search" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveProgrammaticToolInputParam": { + "type": "object", + "properties": { + "type": { + "default": "programmatic_tool_calling", + "x-stainless-const": true, + "type": "string", + "enum": [ + "programmatic_tool_calling" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveComputerToolInputParam": { + "type": "object", + "properties": { + "type": { + "default": "computer", + "x-stainless-const": true, + "type": "string", + "enum": [ + "computer" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveApplyPatchToolInputParam": { + "type": "object", + "properties": { + "type": { + "default": "apply_patch", + "x-stainless-const": true, + "type": "string", + "enum": [ + "apply_patch" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveToolChoiceEnum": { + "type": "string", + "enum": [ + "auto", + "none", + "required" + ] + }, + "LiveFunctionToolChoiceParam": { + "type": "object", + "properties": { + "type": { + "description": "The tool to call. Always `function`.", + "default": "function", + "x-stainless-const": true, + "type": "string", + "enum": [ + "function" + ] }, - "role_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Role ID to assign to the user." + "name": { + "description": "The name of the function tool to call.", + "type": "string" + } + }, + "required": [ + "type", + "name" + ] + }, + "LiveMCPToolChoiceParam": { + "type": "object", + "properties": { + "type": { + "description": "The tool to call. Always `mcp`.", + "default": "mcp", + "x-stainless-const": true, + "type": "string", + "enum": [ + "mcp" + ] }, - "technical_level": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Technical level metadata." + "server_label": { + "description": "The label of the MCP server to call.", + "type": "string" }, - "developer_persona": { + "name": { "anyOf": [ { + "description": "The name of the MCP tool to call. If omitted, the server may choose a default.", "type": "string" }, { "type": "null" - } - ], - "description": "Developer persona metadata." + } + ] } - } + }, + "required": [ + "type", + "server_label" + ] }, - "VadConfig": { + "LiveSpecificFileSearchParam": { "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], "properties": { "type": { + "description": "The tool to call. Always `file_search`.", + "default": "file_search", + "x-stainless-const": true, "type": "string", "enum": [ - "server_vad" - ], - "description": "Must be set to `server_vad` to enable manual chunking using server side VAD." - }, - "prefix_padding_ms": { - "type": "integer", - "default": 300, - "description": "Amount of audio to include before the VAD detected speech (in \nmilliseconds).\n" - }, - "silence_duration_ms": { - "type": "integer", - "default": 200, - "description": "Duration of silence to detect speech stop (in milliseconds).\nWith shorter values the model will respond more quickly, \nbut may jump in on short pauses from the user.\n" - }, - "threshold": { - "type": "number", - "default": 0.5, - "description": "Sensitivity threshold (0.0 to 1.0) for voice activity detection. A \nhigher threshold will require louder audio to activate the model, and \nthus might perform better in noisy environments.\n" + "file_search" + ] } - } + }, + "required": [ + "type" + ] }, - "ValidateGraderRequest": { + "LiveSpecificWebSearchParam": { "type": "object", - "title": "ValidateGraderRequest", "properties": { - "grader": { - "type": "object", - "description": "The grader used for the fine-tuning job.", - "oneOf": [ - { - "$ref": "#/components/schemas/GraderStringCheck" - }, - { - "$ref": "#/components/schemas/GraderTextSimilarity" - }, - { - "$ref": "#/components/schemas/GraderPython" - }, - { - "$ref": "#/components/schemas/GraderScoreModel" - }, - { - "$ref": "#/components/schemas/GraderMulti" - } + "type": { + "description": "The tool to call. Always `web_search`.", + "default": "web_search", + "x-stainless-const": true, + "type": "string", + "enum": [ + "web_search" ] } }, "required": [ - "grader" + "type" ] }, - "ValidateGraderResponse": { + "LiveSpecificWebSearchPreviewParam": { "type": "object", - "title": "ValidateGraderResponse", "properties": { - "grader": { - "type": "object", - "description": "The grader used for the fine-tuning job.", - "oneOf": [ - { - "$ref": "#/components/schemas/GraderStringCheck" - }, - { - "$ref": "#/components/schemas/GraderTextSimilarity" - }, - { - "$ref": "#/components/schemas/GraderPython" - }, - { - "$ref": "#/components/schemas/GraderScoreModel" - }, - { - "$ref": "#/components/schemas/GraderMulti" - } + "type": { + "description": "The tool to call. Always `web_search_preview`.", + "default": "web_search_preview", + "x-stainless-const": true, + "type": "string", + "enum": [ + "web_search_preview" ] } - } + }, + "required": [ + "type" + ] }, - "VectorStoreExpirationAfter": { + "LiveSpecificImageGenParam": { "type": "object", - "title": "Vector store expiration policy", - "description": "The expiration policy for a vector store.", "properties": { - "anchor": { - "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.", + "type": { + "description": "The tool to call. Always `image_generation`.", + "default": "image_generation", + "x-stainless-const": true, "type": "string", "enum": [ - "last_active_at" - ], - "x-stainless-const": true - }, - "days": { - "description": "The number of days after the anchor time that the vector store will expire.", - "type": "integer", - "minimum": 1, - "maximum": 365 + "image_generation" + ] } }, "required": [ - "anchor", - "days" + "type" ] }, - "VectorStoreFileAttributes": { - "anyOf": [ - { - "type": "object", - "description": "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard. Keys are strings\nwith a maximum length of 64 characters. Values are strings with a maximum\nlength of 512 characters, booleans, or numbers.\n", - "maxProperties": 16, - "propertyNames": { - "type": "string", - "maxLength": 64 - }, - "additionalProperties": { - "oneOf": [ - { - "type": "string", - "maxLength": 512 - }, - { - "type": "number" - }, - { - "type": "boolean" - } - ] - }, - "x-oaiTypeLabel": "map" - }, - { - "type": "null" + "LiveSpecificComputerParam": { + "type": "object", + "properties": { + "type": { + "description": "The tool to call. Always `computer`.", + "default": "computer", + "x-stainless-const": true, + "type": "string", + "enum": [ + "computer" + ] } + }, + "required": [ + "type" ] }, - "VectorStoreFileBatchObject": { + "LiveSpecificCodeInterpreterParam": { "type": "object", - "title": "Vector store file batch", - "description": "A batch of files attached to a vector store.", "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `vector_store.file_batch`.", + "type": { + "description": "The tool to call. Always `code_interpreter`.", + "default": "code_interpreter", + "x-stainless-const": true, "type": "string", "enum": [ - "vector_store.files_batch" - ], - "x-stainless-const": true - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the vector store files batch was created.", - "type": "integer", - "format": "unixtime" - }, - "vector_store_id": { - "description": "The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to.", - "type": "string" - }, - "status": { - "description": "The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.", + "code_interpreter" + ] + } + }, + "required": [ + "type" + ] + }, + "LiveSpecificProgrammaticToolCallingParam": { + "type": "object", + "properties": { + "type": { + "description": "The tool to call. Always `programmatic_tool_calling`.", + "default": "programmatic_tool_calling", + "x-stainless-const": true, "type": "string", "enum": [ - "in_progress", - "completed", - "cancelled", - "failed" - ] - }, - "file_counts": { - "type": "object", - "properties": { - "in_progress": { - "description": "The number of files that are currently being processed.", - "type": "integer" - }, - "completed": { - "description": "The number of files that have been processed.", - "type": "integer" - }, - "failed": { - "description": "The number of files that have failed to process.", - "type": "integer" - }, - "cancelled": { - "description": "The number of files that where cancelled.", - "type": "integer" - }, - "total": { - "description": "The total number of files.", - "type": "integer" - } - }, - "required": [ - "in_progress", - "completed", - "cancelled", - "failed", - "total" + "programmatic_tool_calling" ] } }, "required": [ - "id", - "object", - "created_at", - "vector_store_id", - "status", - "file_counts" - ], - "x-oaiMeta": { - "name": "The vector store files batch object", - "beta": true, - "example": "{\n \"id\": \"vsfb_123\",\n \"object\": \"vector_store.files_batch\",\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 100\n }\n}\n" - } + "type" + ] }, - "VectorStoreFileContentResponse": { + "LiveSpecificFunctionShellParam": { + "title": "Specific shell tool choice", + "description": "Forces the model to call the shell tool when a tool call is required.", "type": "object", - "description": "Represents the parsed content of a vector store file.", "properties": { - "object": { + "type": { + "description": "The tool to call. Always `shell`.", + "default": "shell", + "x-stainless-const": true, "type": "string", "enum": [ - "vector_store.file_content.page" - ], - "description": "The object type, which is always `vector_store.file_content.page`", - "x-stainless-const": true - }, - "data": { - "type": "array", - "description": "Parsed content of the file.", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The content type (currently only `\"text\"`)" - }, - "text": { - "type": "string", - "description": "The text content" - } - } - } - }, - "has_more": { - "type": "boolean", - "description": "Indicates if there are more content pages to fetch." - }, - "next_page": { - "anyOf": [ - { - "type": "string", - "description": "The token for the next page, if any." - }, - { - "type": "null" - } + "shell" ] } }, "required": [ - "object", - "data", - "has_more", - "next_page" + "type" ] }, - "VectorStoreFileObject": { + "LiveSpecificCustomToolParam": { "type": "object", - "title": "Vector store files", - "description": "A list of files attached to a vector store.", "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `vector_store.file`.", + "type": { + "description": "The tool to call. Always `custom`.", + "default": "custom", + "x-stainless-const": true, "type": "string", "enum": [ - "vector_store.file" - ], - "x-stainless-const": true - }, - "usage_bytes": { - "description": "The total vector store usage in bytes. Note that this may be different from the original file size.", - "type": "integer" - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the vector store file was created.", - "type": "integer", - "format": "unixtime" + "custom" + ] }, - "vector_store_id": { - "description": "The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to.", + "name": { + "description": "The name of the custom tool to call.", "type": "string" - }, - "status": { - "description": "The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.", + } + }, + "required": [ + "type", + "name" + ] + }, + "LiveSpecificApplyPatchParam": { + "title": "Specific apply patch tool choice", + "description": "Forces the model to call the apply_patch tool when executing a tool call.", + "type": "object", + "properties": { + "type": { + "description": "The tool to call. Always `apply_patch`.", + "default": "apply_patch", + "x-stainless-const": true, "type": "string", "enum": [ - "in_progress", - "completed", - "cancelled", - "failed" - ] - }, - "last_error": { - "anyOf": [ - { - "type": "object", - "description": "The last error associated with this vector store file. Will be `null` if there are no errors.", - "properties": { - "code": { - "type": "string", - "description": "One of `server_error`, `unsupported_file`, or `invalid_file`.", - "enum": [ - "server_error", - "unsupported_file", - "invalid_file" - ] - }, - "message": { - "type": "string", - "description": "A human-readable description of the error." - } - }, - "required": [ - "code", - "message" - ] - }, - { - "type": "null" - } - ] - }, - "chunking_strategy": { - "type": "object", - "description": "The strategy used to chunk the file.", - "oneOf": [ - { - "$ref": "#/components/schemas/StaticChunkingStrategyResponseParam" - }, - { - "$ref": "#/components/schemas/OtherChunkingStrategyResponseParam" - } + "apply_patch" ] - }, - "attributes": { - "$ref": "#/components/schemas/VectorStoreFileAttributes" } }, "required": [ - "id", - "object", - "usage_bytes", - "created_at", - "vector_store_id", - "status", - "last_error" - ], - "x-oaiMeta": { - "name": "The vector store file object", - "beta": true, - "example": "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"usage_bytes\": 1234,\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"static\": {\n \"max_chunk_size_tokens\": 800,\n \"chunk_overlap_tokens\": 400\n }\n }\n}\n" - } + "type" + ] }, - "VectorStoreObject": { + "LiveToolChoiceValueEnum": { + "type": "string", + "enum": [ + "none", + "auto", + "required" + ] + }, + "LiveAllowedToolsChoiceParam": { "type": "object", - "title": "Vector store", - "description": "A vector store is a collection of processed files can be used by the `file_search` tool.", "properties": { - "id": { - "description": "The identifier, which can be referenced in API endpoints.", - "type": "string" - }, - "object": { - "description": "The object type, which is always `vector_store`.", + "type": { + "description": "The tool choice type. Always `allowed_tools`.", + "default": "allowed_tools", + "x-stainless-const": true, "type": "string", "enum": [ - "vector_store" - ], - "x-stainless-const": true - }, - "created_at": { - "description": "The Unix timestamp (in seconds) for when the vector store was created.", - "type": "integer", - "format": "unixtime" - }, - "name": { - "description": "The name of the vector store.", - "type": "string" - }, - "usage_bytes": { - "description": "The total number of bytes used by the files in the vector store.", - "type": "integer" + "allowed_tools" + ] }, - "file_counts": { - "type": "object", - "properties": { - "in_progress": { - "description": "The number of files that are currently being processed.", - "type": "integer" - }, - "completed": { - "description": "The number of files that have been successfully processed.", - "type": "integer" - }, - "failed": { - "description": "The number of files that have failed to process.", - "type": "integer" - }, - "cancelled": { - "description": "The number of files that were cancelled.", - "type": "integer" + "tools": { + "description": "The tools that the delegated Responses model may call.", + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" }, - "total": { - "description": "The total number of files.", - "type": "integer" - } + "oneOf": [ + { + "$ref": "#/components/schemas/LiveFunctionToolChoiceParam" + }, + { + "$ref": "#/components/schemas/LiveMCPToolChoiceParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificFileSearchParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificWebSearchParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificWebSearchPreviewParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificImageGenParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificComputerParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificCodeInterpreterParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificProgrammaticToolCallingParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificFunctionShellParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificCustomToolParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificApplyPatchParam" + } + ] }, - "required": [ - "in_progress", - "completed", - "failed", - "cancelled", - "total" + "minItems": 1, + "maxItems": 128 + }, + "mode": { + "anyOf": [ + { + "description": "How to select a tool from the allowed set.", + "$ref": "#/components/schemas/LiveToolChoiceValueEnum" + }, + { + "type": "null" + } ] + } + }, + "required": [ + "type", + "tools" + ] + }, + "LiveResponsesDelegationSettingsInputParam": { + "description": "Model, prompt, and tool settings for tasks delegated by the Live session to a Responses backend.", + "type": "object", + "properties": { + "model": { + "description": "The model used for server-owned Responses delegations.", + "type": "string" }, - "status": { - "description": "The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.", - "type": "string", - "enum": [ - "expired", - "in_progress", - "completed" + "instructions": { + "anyOf": [ + { + "description": "Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt).", + "type": "string" + }, + { + "type": "null" + } ] }, - "expires_after": { - "$ref": "#/components/schemas/VectorStoreExpirationAfter" - }, - "expires_at": { + "max_output_tokens": { "anyOf": [ { - "description": "The Unix timestamp (in seconds) for when the vector store will expire.", + "description": "Maximum number of output tokens for each delegated response.", "type": "integer", - "format": "unixtime" + "minimum": 16 }, { "type": "null" } ] }, - "last_active_at": { + "service_tier": { "anyOf": [ { - "description": "The Unix timestamp (in seconds) for when the vector store was last active.", - "type": "integer", - "format": "unixtime" + "description": "Service tier for delegated Responses requests.", + "$ref": "#/components/schemas/LiveResponsesServiceTier" }, { "type": "null" } ] }, - "metadata": { - "$ref": "#/components/schemas/Metadata" - } - }, - "required": [ - "id", - "object", - "usage_bytes", - "created_at", - "status", - "last_active_at", - "name", - "file_counts", - "metadata" - ], - "x-oaiMeta": { - "name": "The vector store object", - "example": "{\n \"id\": \"vs_123\",\n \"object\": \"vector_store\",\n \"created_at\": 1698107661,\n \"usage_bytes\": 123456,\n \"last_active_at\": 1698107661,\n \"name\": \"my_vector_store\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"cancelled\": 0,\n \"failed\": 0,\n \"total\": 100\n },\n \"last_used_at\": 1698107661\n}\n" - } - }, - "VectorStoreSearchRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "query": { - "description": "A query string for a search", - "oneOf": [ + "reasoning": { + "anyOf": [ { - "type": "string" + "description": "Reasoning settings passed to each delegated Responses request.", + "$ref": "#/components/schemas/LiveDelegationReasoningInputParam" }, { - "type": "array", - "items": { - "type": "string", - "description": "A list of queries to search for.", - "minItems": 1 - } + "type": "null" } ] }, - "rewrite_query": { - "description": "Whether to rewrite the natural language query for vector search.", - "type": "boolean", - "default": false + "text": { + "anyOf": [ + { + "description": "Text generation settings passed to each delegated Responses request.", + "$ref": "#/components/schemas/LiveDelegationTextInputParam" + }, + { + "type": "null" + } + ] }, - "max_num_results": { - "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 50 + "tools": { + "description": "Tools available to the Responses backend while it handles tasks delegated by the Live model.", + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveFunctionToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveWebSearchToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveFileSearchToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveCodeInterpreterToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveHostedShellToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveImageGenerationToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveMCPToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveCustomToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveNamespaceToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveToolSearchToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveProgrammaticToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveComputerToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveApplyPatchToolInputParam" + } + ] + } }, - "filters": { - "description": "A filter to apply based on file attributes.", + "tool_choice": { + "description": "Controls which tool the Responses backend uses when handling a task delegated by the Live model.", "oneOf": [ { - "$ref": "#/components/schemas/ComparisonFilter" + "$ref": "#/components/schemas/LiveToolChoiceEnum" }, { - "$ref": "#/components/schemas/CompoundFilter" + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveFunctionToolChoiceParam" + }, + { + "$ref": "#/components/schemas/LiveMCPToolChoiceParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificFileSearchParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificWebSearchParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificWebSearchPreviewParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificImageGenParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificComputerParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificCodeInterpreterParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificProgrammaticToolCallingParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificFunctionShellParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificCustomToolParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificApplyPatchParam" + } + ] + }, + { + "$ref": "#/components/schemas/LiveAllowedToolsChoiceParam" } ] }, - "ranking_options": { - "description": "Ranking options for search.", - "type": "object", - "additionalProperties": false, - "properties": { - "ranker": { - "description": "Enable re-ranking; set to `none` to disable, which can help reduce latency.", - "type": "string", - "enum": [ - "none", - "auto", - "default-2024-11-15" - ], - "default": "auto" + "parallel_tool_calls": { + "anyOf": [ + { + "description": "Whether the delegated Responses model may request multiple tool calls in a single response.", + "type": "boolean" }, - "score_threshold": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 0 + { + "type": "null" } - } + ] } }, "required": [ - "query" - ], - "x-oaiMeta": { - "name": "Vector store search request" - } + "model" + ] }, - "VectorStoreSearchResultContentObject": { + "LiveResponsesDelegationParam": { + "description": "Delegate tasks to a Responses model managed by the Live session.", "type": "object", - "additionalProperties": false, "properties": { + "acknowledgement_delay_ms": { + "description": "Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations.", + "type": "integer", + "minimum": 0, + "maximum": 800 + }, "type": { - "description": "The type of content.", + "description": "The delegation owner. Always `responses` for tasks handled by the Responses API.", + "default": "responses", + "x-stainless-const": true, "type": "string", "enum": [ - "text" + "responses" ] }, - "text": { - "description": "The text content returned from search.", - "type": "string" + "responses": { + "description": "Backend model, prompt, and tools used when the Live session delegates a task to Responses.", + "$ref": "#/components/schemas/LiveResponsesDelegationSettingsInputParam" } }, "required": [ "type", - "text" - ], - "x-oaiMeta": { - "name": "Vector store search result content object" - } + "responses" + ] }, - "VectorStoreSearchResultItem": { + "LiveDecisionInputTextParam": { "type": "object", - "additionalProperties": false, "properties": { - "file_id": { + "type": { + "default": "input_text", + "x-stainless-const": true, "type": "string", - "description": "The ID of the vector store file." + "enum": [ + "input_text" + ] }, - "filename": { + "text": { + "description": "The text input to the model.", "type": "string", - "description": "The name of the vector store file." - }, - "score": { - "type": "number", - "description": "The similarity score for the result.", - "minimum": 0, - "maximum": 1 - }, - "attributes": { - "$ref": "#/components/schemas/VectorStoreFileAttributes" - }, - "content": { - "type": "array", - "description": "Content chunks from the file.", - "items": { - "$ref": "#/components/schemas/VectorStoreSearchResultContentObject" - } + "maxLength": 10485760 } }, "required": [ - "file_id", - "filename", - "score", - "attributes", - "content" - ], - "x-oaiMeta": { - "name": "Vector store search result item" - } + "type", + "text" + ] }, - "VectorStoreSearchResultsPage": { + "LiveDetailEnum": { + "type": "string", + "enum": [ + "low", + "high", + "auto", + "original" + ] + }, + "LiveDecisionInputImageParam": { "type": "object", - "additionalProperties": false, "properties": { - "object": { + "type": { + "default": "input_image", + "x-stainless-const": true, "type": "string", "enum": [ - "vector_store.search_results.page" - ], - "description": "The object type, which is always `vector_store.search_results.page`", - "x-stainless-const": true - }, - "search_query": { - "type": "array", - "items": { - "type": "string", - "description": "The query used for this search.", - "minItems": 1 - } - }, - "data": { - "type": "array", - "description": "The list of search result items.", - "items": { - "$ref": "#/components/schemas/VectorStoreSearchResultItem" - } + "input_image" + ] }, - "has_more": { - "type": "boolean", - "description": "Indicates if there are more results to fetch." + "image_url": { + "description": "A base64-encoded image data URL or a publicly accessible HTTP(S) image URL.", + "type": "string", + "maxLength": 20971520, + "pattern": "^(data:|https?://)" }, - "next_page": { + "detail": { "anyOf": [ { - "type": "string", - "description": "The token for the next page, if any." + "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.", + "$ref": "#/components/schemas/LiveDetailEnum" }, { "type": "null" @@ -64216,1877 +88330,2017 @@ } }, "required": [ - "object", - "search_query", - "data", - "has_more", - "next_page" - ], - "x-oaiMeta": { - "name": "Vector store search results page" - } + "type", + "image_url" + ] }, - "Verbosity": { - "anyOf": [ - { + "LiveDecisionJsonObject": { + "type": "object", + "additionalProperties": true + }, + "LiveDecisionInputJsonParam": { + "type": "object", + "properties": { + "type": { + "default": "input_json", + "x-stainless-const": true, "type": "string", "enum": [ - "low", - "medium", - "high" - ], - "default": "medium", - "description": "Constrains the verbosity of the model's response. Lower values will result in\nmore concise responses, while higher values will result in more verbose responses.\nCurrently supported values are `low`, `medium`, and `high`. The default is\n`medium`.\n" + "input_json" + ] }, - { - "type": "null" + "data": { + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionJsonObject" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionJsonObject" + } + } + ] } + }, + "required": [ + "type", + "data" ] }, - "VoiceConsentDeletedResource": { + "LiveDecisionChoiceParam": { "type": "object", - "additionalProperties": false, "properties": { - "id": { - "type": "string", - "description": "The consent recording identifier.", - "example": "cons_1234" + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + } + ] }, - "object": { + "description": { + "type": "string" + } + }, + "required": [ + "value" + ] + }, + "LiveDecisionChoiceQuestionParam": { + "type": "object", + "properties": { + "type": { + "default": "choice", + "x-stainless-const": true, "type": "string", "enum": [ - "audio.voice_consent" - ], - "x-stainless-const": true + "choice" + ] }, - "deleted": { - "type": "boolean" + "name": { + "type": "string" + }, + "instructions": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputImageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputJsonParam" + } + ] + }, + "minItems": 1 + } + ] + }, + "choices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionChoiceParam" + }, + "minItems": 2, + "maxItems": 255 } }, "required": [ - "id", - "object", - "deleted" - ], - "x-oaiMeta": { - "name": "The voice consent deletion object", - "example": "{\n \"object\": \"audio.voice_consent\",\n \"id\": \"cons_1234\",\n \"deleted\": true\n}\n" - } + "type", + "instructions", + "choices" + ] }, - "VoiceConsentListResource": { + "LiveDecisionPredicateQuestionParam": { "type": "object", - "additionalProperties": false, "properties": { - "object": { + "type": { + "default": "predicate", + "x-stainless-const": true, "type": "string", "enum": [ - "list" - ], - "x-stainless-const": true + "predicate" + ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VoiceConsentResource" - } + "name": { + "type": "string" }, - "first_id": { - "anyOf": [ + "instructions": { + "oneOf": [ { "type": "string" }, { - "type": "null" + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputImageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputJsonParam" + } + ] + }, + "minItems": 1 } ] + } + }, + "required": [ + "type", + "instructions" + ] + }, + "LiveDecisionScoreLevelParam": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "label" + ] + }, + "LiveDecisionScoreQuestionParam": { + "type": "object", + "properties": { + "type": { + "default": "score", + "x-stainless-const": true, + "type": "string", + "enum": [ + "score" + ] }, - "last_id": { - "anyOf": [ + "name": { + "type": "string" + }, + "instructions": { + "oneOf": [ { "type": "string" }, { - "type": "null" + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputImageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputJsonParam" + } + ] + }, + "minItems": 1 } ] }, - "has_more": { - "type": "boolean" + "levels": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionScoreLevelParam" + }, + "minItems": 2, + "maxItems": 10 } }, "required": [ - "object", - "data", - "has_more" - ], - "x-oaiMeta": { - "name": "The voice consent list object", - "example": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"audio.voice_consent\",\n \"id\": \"cons_1234\",\n \"name\": \"John Doe\",\n \"language\": \"en-US\",\n \"created_at\": 1734220800\n }\n ],\n \"first_id\": \"cons_1234\",\n \"last_id\": \"cons_1234\",\n \"has_more\": false\n}\n" - } + "type", + "instructions", + "levels" + ] }, - "VoiceConsentResource": { + "LiveDecisionQuestion": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionChoiceQuestionParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionPredicateQuestionParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionScoreQuestionParam" + } + ] + }, + "LiveDecisionsSettingsInputParam": { "type": "object", - "title": "Voice consent", - "description": "A consent recording used to authorize creation of a custom voice.", - "additionalProperties": false, "properties": { - "object": { - "type": "string", - "description": "The object type, which is always `audio.voice_consent`.", - "enum": [ - "audio.voice_consent" - ], - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The consent recording identifier.", - "example": "cons_1234" + "questions": { + "description": "Native Decision API questions evaluated together, in order.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionQuestion" + }, + "minItems": 1, + "maxItems": 64 }, - "name": { + "model": { "type": "string", - "description": "The label provided when the consent recording was uploaded." + "minLength": 1 + } + }, + "required": [ + "questions", + "model" + ] + }, + "LiveDecisionsDelegationParam": { + "type": "object", + "properties": { + "acknowledgement_delay_ms": { + "description": "Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400. Updates apply to subsequent delegations.", + "type": "integer", + "minimum": 0, + "maximum": 800 }, - "language": { + "type": { + "default": "decisions", + "x-stainless-const": true, "type": "string", - "description": "The BCP 47 language tag for the consent phrase (for example, `en-US`)." + "enum": [ + "decisions" + ] }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the consent recording was created." + "decisions": { + "$ref": "#/components/schemas/LiveDecisionsSettingsInputParam" } }, "required": [ - "object", - "id", - "name", - "language", - "created_at" - ], - "x-oaiMeta": { - "name": "The voice consent object", - "example": "{\n \"object\": \"audio.voice_consent\",\n \"id\": \"cons_1234\",\n \"name\": \"John Doe\",\n \"language\": \"en-US\",\n \"created_at\": 1734220800\n}\n" - } + "type", + "decisions" + ] }, - "VoiceIdsOrCustomVoice": { - "title": "Voice", - "description": "A built-in voice name or a custom voice reference.\n", + "delegation": { "anyOf": [ { - "$ref": "#/components/schemas/VoiceIdsShared" + "description": "Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` or `decisions` to delegate to the corresponding API.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveClientDelegationParam" + }, + { + "$ref": "#/components/schemas/LiveResponsesDelegationParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionsDelegationParam" + } + ] }, { - "type": "object", - "description": "Custom voice reference.", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The custom voice ID, e.g. `voice_1234`.", - "example": "voice_1234" - } - } + "type": "null" } ] }, - "VoiceIdsShared": { - "example": "ash", - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "alloy", - "ash", - "ballad", - "coral", - "echo", - "sage", - "shimmer", - "verse", - "marin", - "cedar" - ] + "LiveDecisionQuestionsInputParam": { + "description": "Questions evaluated using the current transcript and the session's shared Decision items.", + "type": "object", + "properties": { + "questions": { + "description": "Native Decision API questions evaluated together, in order.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionQuestion" + }, + "minItems": 1, + "maxItems": 64 } + }, + "required": [ + "questions" ] }, - "VoiceResource": { + "LiveDecisionTriggerInputParam": { "type": "object", - "title": "Voice", - "description": "A custom voice that can be used for audio output.", - "additionalProperties": false, "properties": { - "object": { + "type": { + "default": "decisions", + "x-stainless-const": true, "type": "string", - "description": "The object type, which is always `audio.voice`.", "enum": [ - "audio.voice" - ], - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The voice identifier, which can be referenced in API endpoints." + "decisions" + ] }, - "name": { + "event_type": { "type": "string", - "description": "The name of the voice." + "enum": [ + "session.input_transcript.delta", + "session.output_transcript.delta" + ] }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the voice was created." + "decisions": { + "description": "Questions evaluated using the current transcript and the session's shared Decision items.", + "$ref": "#/components/schemas/LiveDecisionQuestionsInputParam" } }, "required": [ - "object", - "id", - "name", - "created_at" + "type", + "event_type", + "decisions" ], - "x-oaiMeta": { - "name": "The voice object", - "example": "{\n \"object\": \"audio.voice\",\n \"id\": \"voice_123abc\",\n \"name\": \"My new voice\",\n \"created_at\": 1734220800\n}\n" - } + "additionalProperties": false }, - "WebSearchActionFind": { + "triggers": { + "description": "At most one Decisions trigger per transcript event type. Triggers run independently of delegation. On update, omit triggers to keep the current configuration, send a list to replace it, or send an empty list to disable triggers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionTriggerInputParam" + }, + "maxItems": 2 + }, + "store": { + "description": "Whether to store the session for later forking and recording download. Defaults to false for new sessions.", + "type": "boolean" + }, + "LiveInitialMessageStatus": { + "type": "string", + "enum": [ + "incomplete", + "completed" + ] + }, + "LiveInitialInputTextContentPartParam": { + "description": "Text supplied in a developer or user message when starting a Live session.", "type": "object", - "title": "Find action", - "description": "Action type \"find_in_page\": Searches for a pattern within a loaded page.\n", "properties": { "type": { + "description": "The text content type. Always `input_text`.", + "default": "input_text", + "x-stainless-const": true, "type": "string", "enum": [ - "find_in_page" - ], - "description": "The action type.\n", - "x-stainless-const": true - }, - "url": { - "type": "string", - "format": "uri", - "description": "The URL of the page searched for the pattern.\n" + "input_text" + ] }, - "pattern": { - "type": "string", - "description": "The pattern or text to search for within the page.\n" + "text": { + "description": "The message text to include in the Live session’s initial conversation history.", + "type": "string" } }, "required": [ - "type", - "url", - "pattern" + "text" ] }, - "WebSearchActionOpenPage": { + "LiveInitialDeveloperMessageItemParam": { + "description": "A developer message included in the initial text history of a Live session.", "type": "object", - "title": "Open page action", - "description": "Action type \"open_page\" - Opens a specific URL from search results.\n", "properties": { + "id": { + "anyOf": [ + { + "description": "An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.", + "type": "string" + }, + { + "type": "null" + } + ] + }, "type": { + "description": "The history item type. Always `message`.", + "default": "message", + "x-stainless-const": true, "type": "string", "enum": [ - "open_page" - ], - "description": "The action type.\n", - "x-stainless-const": true + "message" + ] }, - "url": { - "description": "The URL opened by the model.\n", + "status": { "anyOf": [ { - "type": "string", - "format": "uri" + "description": "The supplied message’s status. Live uses its text as history and does not resume an incomplete message.", + "$ref": "#/components/schemas/LiveInitialMessageStatus" }, { "type": "null" } ] + }, + "role": { + "description": "The author of this history message. Always `developer`.", + "default": "developer", + "x-stainless-const": true, + "type": "string", + "enum": [ + "developer" + ] + }, + "content": { + "description": "The message content. Supply exactly one text part for the initial Live conversation history.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveInitialInputTextContentPartParam" + }, + "minItems": 1, + "maxItems": 1 } }, "required": [ - "type" + "role", + "content" ] }, - "WebSearchActionSearch": { + "LiveInitialUserMessageItemParam": { + "description": "A user message included in the initial text history of a Live session.", "type": "object", - "title": "Search action", - "description": "Action type \"search\" - Performs a web search query.\n", "properties": { + "id": { + "anyOf": [ + { + "description": "An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.", + "type": "string" + }, + { + "type": "null" + } + ] + }, "type": { + "description": "The history item type. Always `message`.", + "default": "message", + "x-stainless-const": true, "type": "string", "enum": [ - "search" - ], - "description": "The action type.\n", - "x-stainless-const": true + "message" + ] }, - "query": { - "type": "string", - "deprecated": true, - "description": "The search query.\n" + "status": { + "anyOf": [ + { + "description": "The supplied message’s status. Live uses its text as history and does not resume an incomplete message.", + "$ref": "#/components/schemas/LiveInitialMessageStatus" + }, + { + "type": "null" + } + ] }, - "queries": { - "type": "array", - "title": "Search queries", - "description": "The search queries.\n", - "items": { - "type": "string", - "description": "A search query.\n" - } + "role": { + "description": "The author of this history message. Always `user`.", + "default": "user", + "x-stainless-const": true, + "type": "string", + "enum": [ + "user" + ] }, - "sources": { + "content": { + "description": "The message content. Supply exactly one text part for the initial Live conversation history.", "type": "array", - "title": "Web search sources", - "description": "The sources used in the search.\n", "items": { - "type": "object", - "title": "Web search source", - "description": "A source used in the search.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "url" - ], - "description": "The type of source. Always `url`.\n", - "x-stainless-const": true - }, - "url": { - "type": "string", - "format": "uri", - "description": "The URL of the source.\n" - } - }, - "required": [ - "type", - "url" - ] - } + "$ref": "#/components/schemas/LiveInitialInputTextContentPartParam" + }, + "minItems": 1, + "maxItems": 1 } }, "required": [ - "type" + "role", + "content" ] }, - "WebSearchApproximateLocation": { - "anyOf": [ - { - "type": "object", - "title": "Web search approximate location", - "description": "The approximate location of the user.\n", - "properties": { - "type": { - "type": "string", - "enum": [ - "approximate" - ], - "description": "The type of location approximation. Always `approximate`.", - "default": "approximate", - "x-stainless-const": true - }, - "country": { - "anyOf": [ - { - "type": "string", - "description": "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`." - }, - { - "type": "null" - } - ] - }, - "region": { - "anyOf": [ - { - "type": "string", - "description": "Free text input for the region of the user, e.g. `California`." - }, - { - "type": "null" - } - ] - }, - "city": { - "anyOf": [ - { - "type": "string", - "description": "Free text input for the city of the user, e.g. `San Francisco`." - }, - { - "type": "null" - } - ] - }, - "timezone": { - "anyOf": [ - { - "type": "string", - "description": "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`." - }, - { - "type": "null" - } - ] - } - } + "LiveInitialTextContentPartParam": { + "description": "Assistant text supplied as conversation history when starting a Live session.", + "type": "object", + "properties": { + "type": { + "description": "The text content type. Always `text`.", + "default": "text", + "x-stainless-const": true, + "type": "string", + "enum": [ + "text" + ] }, - { - "type": "null" + "text": { + "description": "The message text to include in the Live session’s initial conversation history.", + "type": "string" } + }, + "required": [ + "text" ] }, - "WebSearchContextSize": { - "type": "string", - "description": "High level guidance for the amount of context window space to use for the \nsearch. One of `low`, `medium`, or `high`. `medium` is the default.\n", - "enum": [ - "low", - "medium", - "high" - ], - "default": "medium" - }, - "WebSearchLocation": { + "LiveInitialOutputTextContentPartParam": { + "description": "Assistant output text supplied as conversation history when starting a Live session.", "type": "object", - "title": "Web search location", - "description": "Approximate location parameters for the search.", "properties": { - "country": { - "type": "string", - "description": "The two-letter \n[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user,\ne.g. `US`.\n" - }, - "region": { - "type": "string", - "description": "Free text input for the region of the user, e.g. `California`.\n" - }, - "city": { + "type": { + "description": "The text content type. Always `output_text`.", + "default": "output_text", + "x-stainless-const": true, "type": "string", - "description": "Free text input for the city of the user, e.g. `San Francisco`.\n" + "enum": [ + "output_text" + ] }, - "timezone": { - "type": "string", - "description": "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) \nof the user, e.g. `America/Los_Angeles`.\n" + "text": { + "description": "The message text to include in the Live session’s initial conversation history.", + "type": "string" } - } + }, + "required": [ + "type", + "text" + ] }, - "WebSearchTool": { + "LiveInitialAssistantMessageItemParam": { + "description": "An assistant message included in the initial text history of a Live session.", "type": "object", - "title": "Web search", - "description": "Search the Internet for sources related to the prompt. Learn more about the\n[web search tool](https://developers.openai.com/api/docs/guides/tools-web-search).\n", "properties": { + "id": { + "anyOf": [ + { + "description": "An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.", + "type": "string" + }, + { + "type": "null" + } + ] + }, "type": { + "description": "The history item type. Always `message`.", + "default": "message", + "x-stainless-const": true, "type": "string", "enum": [ - "web_search", - "web_search_2025_08_26" - ], - "description": "The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.", - "default": "web_search" - }, - "external_web_access": { - "type": "boolean", - "default": true, - "description": "Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content." + "message" + ] }, - "filters": { + "status": { "anyOf": [ { - "type": "object", - "description": "Filters for the search.\n", - "properties": { - "allowed_domains": { - "anyOf": [ - { - "type": "array", - "title": "Allowed domains for the search.", - "description": "Allowed domains for the search. If not provided, all domains are allowed.\nSubdomains of the provided domains are allowed as well.\n\nExample: `[\"pubmed.ncbi.nlm.nih.gov\"]`\n", - "items": { - "type": "string", - "description": "Allowed domain for the search." - }, - "default": [] - }, - { - "type": "null" - } - ] - } - } + "description": "The supplied message’s status. Live uses its text as history and does not resume an incomplete message.", + "$ref": "#/components/schemas/LiveInitialMessageStatus" }, { "type": "null" } ] }, - "user_location": { - "$ref": "#/components/schemas/WebSearchApproximateLocation" - }, - "search_context_size": { + "role": { + "description": "The author of this history message. Always `assistant`.", + "default": "assistant", + "x-stainless-const": true, "type": "string", "enum": [ - "low", - "medium", - "high" - ], - "default": "medium", - "description": "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default." + "assistant" + ] + }, + "content": { + "description": "The message content. Supply exactly one text part for the initial Live conversation history.", + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveInitialTextContentPartParam" + }, + { + "$ref": "#/components/schemas/LiveInitialOutputTextContentPartParam" + } + ], + "x-oai-default-discriminator-value": "text" + }, + "minItems": 1, + "maxItems": 1 } }, "required": [ - "type" + "role", + "content" ] }, - "WebSearchToolCall": { + "LiveInitialItem": { + "description": "A developer, user, or assistant message supplied as text history before the Live session starts.", + "discriminator": { + "propertyName": "role" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveInitialDeveloperMessageItemParam" + }, + { + "$ref": "#/components/schemas/LiveInitialUserMessageItemParam" + }, + { + "$ref": "#/components/schemas/LiveInitialAssistantMessageItemParam" + } + ] + }, + "input": { + "description": "Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and a configured rendered-token limit (8,192 by default).", + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveInitialItem" + }, + "maxItems": 128 + }, + "LiveAllowedServerEventParam": { + "description": "A Live server event selector for the WebRTC frontend data channel.", + "example": { + "type": "session.started" + }, "type": "object", - "title": "Web search tool call", - "description": "The results of a web search tool call. See the\n[web search guide](https://developers.openai.com/api/docs/guides/tools-web-search) for more information.\n", "properties": { - "id": { - "type": "string", - "description": "The unique ID of the web search tool call.\n" - }, "type": { + "description": "The outer Live server event type. Use 'response.event' for Responses events.", "type": "string", - "enum": [ - "web_search_call" - ], - "description": "The type of the web search tool call. Always `web_search_call`.\n", - "x-stainless-const": true - }, - "status": { - "description": "The status of the web search tool call.\n", - "$ref": "#/components/schemas/WebSearchCallStatus" + "minLength": 1, + "maxLength": 256 }, - "action": { - "type": "object", - "description": "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n", + "response_event": { + "description": "The nested Responses event type. Required when type is 'response.event'; forbidden for other event types.", + "type": "string", + "minLength": 1, + "maxLength": 256 + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "x-oaiMeta": { + "example": { + "type": "session.started" + } + } + }, + "LiveDataChannelConfigParam": { + "description": "Control which Live events an untrusted WebRTC frontend can send and receive over its data channel. These restrictions do not apply to trusted sideband connections.", + "type": "object", + "properties": { + "allowed_client_events": { + "description": "Client event types that the frontend data channel may send. Use 'all' to allow every client event; an empty array allows none. Omission preserves the existing allow-all behavior.", "oneOf": [ { - "$ref": "#/components/schemas/WebSearchActionSearch" + "default": "all", + "x-stainless-const": true, + "type": "string", + "enum": [ + "all" + ] }, { - "$ref": "#/components/schemas/WebSearchActionOpenPage" + "type": "array", + "items": { + "description": "A Live client event type allowed on the frontend data channel, such as `session.input_audio.mute`.", + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^(?:error|info|[a-z][a-z0-9_-]*(?:\\.[a-z0-9_-]+)+)$" + }, + "maxItems": 256 + } + ] + }, + "allowed_server_events": { + "description": "Server events that may be sent to the frontend data channel. Use 'all' to allow every server event; an empty array allows none. Omission preserves the existing allow-all behavior. Responses events use an object with type 'response.event' and a response_event selector.", + "oneOf": [ + { + "default": "all", + "x-stainless-const": true, + "type": "string", + "enum": [ + "all" + ] }, { - "$ref": "#/components/schemas/WebSearchActionFind" + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveAllowedServerEventParam" + }, + "maxItems": 256 } - ], - "discriminator": { - "propertyName": "type" - } + ] + } + }, + "required": [] + }, + "LiveClientConfigParam": { + "description": "Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected.", + "type": "object", + "properties": { + "data_channel": { + "description": "Client and server event permissions for the WebRTC frontend data channel.", + "$ref": "#/components/schemas/LiveDataChannelConfigParam" } }, "required": [ - "id", - "type", - "status", - "action" + "data_channel" ] }, - "WebhookBatchCancelled": { + "session": { "type": "object", - "title": "batch.cancelled", - "description": "Sent when a batch API request has been cancelled.\n", - "required": [ - "created_at", - "id", - "data", - "type" - ], + "description": "The newly created Live session. Use its ID for session controls and sideband connections.", "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the batch API request was cancelled.\n" - }, "id": { "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the batch API request.\n" - } - } - }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true - }, - "type": { - "type": "string", - "description": "The type of the event. Always `batch.cancelled`.\n", - "enum": [ - "batch.cancelled" - ], - "x-stainless-const": true + "description": "Opaque session identifier. Preserve the returned value unchanged, including its prefix." } }, - "x-oaiMeta": { - "name": "batch.cancelled", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"batch.cancelled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"batch_abc123\"\n }\n}\n" - } + "required": [ + "id" + ] }, - "WebhookBatchCompleted": { + "properties-store": { + "description": "Whether to store the forked session. Omission inherits the stored session's setting.", + "type": "boolean" + }, + "LiveResponsesDelegationSettingsUpdateInputParam": { + "description": "Updates to the Responses backend of an existing Live session. Omitted settings retain their current values.", "type": "object", - "title": "batch.completed", - "description": "Sent when a batch API request has been completed.\n", - "required": [ - "created_at", - "id", - "data", - "type" - ], "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the batch API request was completed.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" + "model": { + "description": "The Responses backend model to use for subsequent delegated requests. Omit to keep the current backend model.", + "type": "string" }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the batch API request.\n" + "instructions": { + "anyOf": [ + { + "description": "Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt).", + "type": "string" + }, + { + "type": "null" } - } + ] }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true + "max_output_tokens": { + "anyOf": [ + { + "description": "Maximum number of output tokens for each delegated response.", + "type": "integer", + "minimum": 16 + }, + { + "type": "null" + } + ] }, - "type": { - "type": "string", - "description": "The type of the event. Always `batch.completed`.\n", - "enum": [ - "batch.completed" - ], - "x-stainless-const": true - } - }, - "x-oaiMeta": { - "name": "batch.completed", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"batch.completed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"batch_abc123\"\n }\n}\n" - } - }, - "WebhookBatchExpired": { - "type": "object", - "title": "batch.expired", - "description": "Sent when a batch API request has expired.\n", - "required": [ - "created_at", - "id", - "data", - "type" - ], - "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the batch API request expired.\n" + "service_tier": { + "anyOf": [ + { + "description": "Service tier for delegated Responses requests.", + "$ref": "#/components/schemas/LiveResponsesServiceTier" + }, + { + "type": "null" + } + ] }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" + "reasoning": { + "anyOf": [ + { + "description": "Reasoning settings passed to each delegated Responses request.", + "$ref": "#/components/schemas/LiveDelegationReasoningInputParam" + }, + { + "type": "null" + } + ] }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the batch API request.\n" + "text": { + "anyOf": [ + { + "description": "Text generation settings passed to each delegated Responses request.", + "$ref": "#/components/schemas/LiveDelegationTextInputParam" + }, + { + "type": "null" } + ] + }, + "tools": { + "description": "Tools available to the Responses backend while it handles tasks delegated by the Live model.", + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveFunctionToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveWebSearchToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveFileSearchToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveCodeInterpreterToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveHostedShellToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveImageGenerationToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveMCPToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveCustomToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveNamespaceToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveToolSearchToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveProgrammaticToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveComputerToolInputParam" + }, + { + "$ref": "#/components/schemas/LiveApplyPatchToolInputParam" + } + ] } }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true + "tool_choice": { + "description": "Controls which tool the Responses backend uses when handling a task delegated by the Live model.", + "oneOf": [ + { + "$ref": "#/components/schemas/LiveToolChoiceEnum" + }, + { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveFunctionToolChoiceParam" + }, + { + "$ref": "#/components/schemas/LiveMCPToolChoiceParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificFileSearchParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificWebSearchParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificWebSearchPreviewParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificImageGenParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificComputerParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificCodeInterpreterParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificProgrammaticToolCallingParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificFunctionShellParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificCustomToolParam" + }, + { + "$ref": "#/components/schemas/LiveSpecificApplyPatchParam" + } + ] + }, + { + "$ref": "#/components/schemas/LiveAllowedToolsChoiceParam" + } + ] }, - "type": { - "type": "string", - "description": "The type of the event. Always `batch.expired`.\n", - "enum": [ - "batch.expired" - ], - "x-stainless-const": true + "parallel_tool_calls": { + "anyOf": [ + { + "description": "Whether the delegated Responses model may request multiple tool calls in a single response.", + "type": "boolean" + }, + { + "type": "null" + } + ] } }, - "x-oaiMeta": { - "name": "batch.expired", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"batch.expired\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"batch_abc123\"\n }\n}\n" - } + "required": [] }, - "WebhookBatchFailed": { + "LiveResponsesDelegationUpdateParam": { + "description": "Update the Responses backend for an existing Live session without changing delegation ownership.", "type": "object", - "title": "batch.failed", - "description": "Sent when a batch API request has failed.\n", - "required": [ - "created_at", - "id", - "data", - "type" - ], "properties": { - "created_at": { + "acknowledgement_delay_ms": { + "description": "Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations.", "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the batch API request failed.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the batch API request.\n" - } - } - }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true + "minimum": 0, + "maximum": 800 }, "type": { + "description": "The delegation owner. Always `responses` for tasks handled by the Responses API.", + "default": "responses", + "x-stainless-const": true, "type": "string", - "description": "The type of the event. Always `batch.failed`.\n", "enum": [ - "batch.failed" - ], - "x-stainless-const": true + "responses" + ] + }, + "responses": { + "description": "Responses backend settings to update. Omitted settings keep their existing values.", + "$ref": "#/components/schemas/LiveResponsesDelegationSettingsUpdateInputParam" } }, - "x-oaiMeta": { - "name": "batch.failed", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"batch.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"batch_abc123\"\n }\n}\n" - } - }, - "WebhookEvalRunCanceled": { - "type": "object", - "title": "eval.run.canceled", - "description": "Sent when an eval run has been canceled.\n", "required": [ - "created_at", - "id", - "data", "type" - ], + ] + }, + "target_uri": { + "type": "string", + "description": "URI that should appear in the SIP Refer-To header. Supports values like\n`tel:+14155550123` or `sip:agent@example.com`.", + "example": "tel:+14155550123" + }, + "AwsExternalStorageProviderResponse": { "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the eval run was canceled.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the eval run.\n" - } - } - }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true - }, "type": { "type": "string", - "description": "The type of the event. Always `eval.run.canceled`.\n", "enum": [ - "eval.run.canceled" + "aws" ], + "default": "aws", "x-stainless-const": true - } - }, - "x-oaiMeta": { - "name": "eval.run.canceled", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.canceled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" - } - }, - "WebhookEvalRunFailed": { - "type": "object", - "title": "eval.run.failed", - "description": "Sent when an eval run has failed.\n", - "required": [ - "created_at", - "id", - "data", - "type" - ], - "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the eval run failed.\n" }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" + "account_id": { + "type": "string" }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the eval run.\n" - } - } + "region": { + "type": "string" }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true + "bucket": { + "type": "string" }, - "type": { - "type": "string", - "description": "The type of the event. Always `eval.run.failed`.\n", - "enum": [ - "eval.run.failed" - ], - "x-stainless-const": true + "role_arn": { + "type": "string" + }, + "external_id": { + "type": "string" } }, - "x-oaiMeta": { - "name": "eval.run.failed", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" - } - }, - "WebhookEvalRunSucceeded": { "type": "object", - "title": "eval.run.succeeded", - "description": "Sent when an eval run has succeeded.\n", "required": [ - "created_at", - "id", - "data", - "type" - ], + "type", + "account_id", + "region", + "bucket", + "role_arn", + "external_id" + ] + }, + "AzureExternalStorageProviderResponse": { "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the eval run succeeded.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the eval run.\n" - } - } - }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true - }, "type": { "type": "string", - "description": "The type of the event. Always `eval.run.succeeded`.\n", "enum": [ - "eval.run.succeeded" + "azure" ], + "default": "azure", "x-stainless-const": true + }, + "tenant_id": { + "type": "string" + }, + "subscription_id": { + "type": "string" + }, + "resource_group": { + "type": "string" + }, + "account_name": { + "type": "string" + }, + "container": { + "type": "string" + }, + "region": { + "type": "string" } }, - "x-oaiMeta": { - "name": "eval.run.succeeded", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.succeeded\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" - } - }, - "WebhookFineTuningJobCancelled": { "type": "object", - "title": "fine_tuning.job.cancelled", - "description": "Sent when a fine-tuning job has been cancelled.\n", "required": [ - "created_at", - "id", - "data", - "type" - ], + "type", + "tenant_id", + "subscription_id", + "resource_group", + "account_name", + "container", + "region" + ] + }, + "GcpExternalStorageProviderResponse": { "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the fine-tuning job.\n" - } - } - }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true - }, "type": { "type": "string", - "description": "The type of the event. Always `fine_tuning.job.cancelled`.\n", "enum": [ - "fine_tuning.job.cancelled" + "gcp" ], + "default": "gcp", "x-stainless-const": true + }, + "bucket": { + "type": "string" + }, + "workload_identity_project_number": { + "type": "string" + }, + "workload_identity_pool_id": { + "type": "string" + }, + "workload_identity_provider_id": { + "type": "string" + }, + "region": { + "type": "string" + }, + "audience": { + "type": "string" } }, - "x-oaiMeta": { - "name": "fine_tuning.job.cancelled", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.cancelled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" - } - }, - "WebhookFineTuningJobFailed": { "type": "object", - "title": "fine_tuning.job.failed", - "description": "Sent when a fine-tuning job has failed.\n", "required": [ - "created_at", - "id", - "data", - "type" - ], + "type", + "bucket", + "workload_identity_project_number", + "workload_identity_pool_id", + "workload_identity_provider_id", + "region", + "audience" + ] + }, + "OciExternalStorageProviderResponse": { "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the fine-tuning job failed.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the fine-tuning job.\n" - } - } - }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true - }, "type": { "type": "string", - "description": "The type of the event. Always `fine_tuning.job.failed`.\n", "enum": [ - "fine_tuning.job.failed" + "oci" ], + "default": "oci", "x-stainless-const": true + }, + "tenancy_ocid": { + "type": "string" + }, + "region": { + "type": "string" + }, + "bucket": { + "type": "string" } }, - "x-oaiMeta": { - "name": "fine_tuning.job.failed", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" - } - }, - "WebhookFineTuningJobSucceeded": { "type": "object", - "title": "fine_tuning.job.succeeded", - "description": "Sent when a fine-tuning job has succeeded.\n", "required": [ - "created_at", - "id", - "data", - "type" - ], - "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the fine-tuning job succeeded.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" + "type", + "tenancy_ocid", + "region", + "bucket" + ] + }, + "provider": { + "oneOf": [ + { + "$ref": "#/components/schemas/AwsExternalStorageProviderResponse" }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the fine-tuning job.\n" - } - } + { + "$ref": "#/components/schemas/AzureExternalStorageProviderResponse" }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true + { + "$ref": "#/components/schemas/GcpExternalStorageProviderResponse" }, - "type": { - "type": "string", - "description": "The type of the event. Always `fine_tuning.job.succeeded`.\n", - "enum": [ - "fine_tuning.job.succeeded" - ], - "x-stainless-const": true + { + "$ref": "#/components/schemas/OciExternalStorageProviderResponse" } - }, - "x-oaiMeta": { - "name": "fine_tuning.job.succeeded", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.succeeded\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" + ], + "discriminator": { + "propertyName": "type" } }, - "WebhookLiveCallIncoming": { - "type": "object", - "title": "live.call.incoming", - "deprecated": true, - "description": "Deprecated: use `live.transport.incoming`. Retained for existing subscriptions\nduring migration; new subscriptions to this event are not allowed.\nSent when an incoming API SIP session is available for Live acceptance. The\nsame pending session can also emit `realtime.call.incoming`; the first\nsuccessful Realtime or Live accept endpoint selects the runtime surface.\n", - "required": [ - "created_at", - "id", - "data", - "type" + "PublicProjectResidency": { + "type": "string", + "enum": [ + "GLOBAL", + "US_STORAGE_PROCESSING", + "EU_STORAGE_PROCESSING", + "JP_STORAGE", + "JP_STORAGE_PROCESSING", + "KR_STORAGE", + "CA_STORAGE", + "SG_STORAGE", + "IN_STORAGE", + "IN_STORAGE_PROCESSING", + "AU_STORAGE", + "AU_STORAGE_PROCESSING", + "GB_STORAGE", + "AE_STORAGE", + "AE_STORAGE_PROCESSING" + ] + }, + "UpdateProjectApiKeyBody": { + "anyOf": [ + { + "required": [ + "scopes" + ] + }, + { + "required": [ + "expires_in_seconds" + ] + } ], "properties": { - "created_at": { + "expires_in_seconds": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the event was created.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "session_id", - "sip_headers" - ], - "properties": { - "session_id": { - "type": "string", - "description": "The `live_...` ID of the pending SIP session. Pass this value unchanged\nto Live call controls and sideband connections. The corresponding\n`realtime.call.incoming` event uses a separate `rtc_...` call ID.\n" - }, - "sip_headers": { - "type": "array", - "description": "Headers from the SIP INVITE, excluding SIP authorization headers.\nRetained names, values, repeated entries, and order are preserved.\nTreat these values as untrusted call metadata.\n", - "items": { - "type": "object", - "description": "A header from the SIP Invite.\n", - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the SIP Header.\n" - }, - "value": { - "type": "string", - "description": "Value of the SIP Header.\n" - } - } - } - } - } + "maximum": 31536000, + "minimum": 1, + "description": "Number of seconds from this request until the API key expires. Must comply with the organization and project expiry policies. Expired keys cannot be updated. Retrying resets the expiry relative to the new request. Omit to keep the current expiration." }, - "object": { + "scopes": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Replace the API key scope restrictions. Omit to leave scopes unchanged. An empty array removes key restrictions (All permissions), subject to the owner's effective permissions. Use [\"api.all.read\"] for read-only access. Scopes do not change the owner's roles or grant administrative permissions." + } + }, + "type": "object", + "required": [] + }, + "SpecificProgrammaticToolCallingParam": { + "properties": { + "type": { "type": "string", - "description": "The object of the event. Always `event`.\n", "enum": [ - "event" + "programmatic_tool_calling" ], + "description": "The tool to call. Always `programmatic_tool_calling`.", + "default": "programmatic_tool_calling", "x-stainless-const": true - }, + } + }, + "type": "object", + "required": [ + "type" + ] + }, + "SpecificApplyPatchParam": { + "properties": { "type": { "type": "string", - "description": "The type of the event. Always `live.call.incoming`.\n", "enum": [ - "live.call.incoming" + "apply_patch" ], + "description": "The tool to call. Always `apply_patch`.", + "default": "apply_patch", "x-stainless-const": true } }, - "x-oaiMeta": { - "name": "live.call.incoming", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"live.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"session_id\": \"live_u0_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {\"name\": \"From\", \"value\": \";tag=abc123\"},\n {\"name\": \"To\", \"value\": \"\"},\n {\"name\": \"Call-ID\", \"value\": \"call-123@example.com\"}\n ]\n }\n}\n" - } - }, - "WebhookLiveTransportIncoming": { "type": "object", - "title": "live.transport.incoming", - "description": "Sent when an incoming API SIP session is available for Live acceptance. The\nsame pending session can also emit `realtime.call.incoming`; the first\nsuccessful Realtime or Live accept endpoint selects the runtime surface.\n", "required": [ - "created_at", - "id", - "data", "type" ], + "title": "Specific apply patch tool choice", + "description": "Forces the model to call the apply_patch tool when executing a tool call." + }, + "SpecificFunctionShellParam": { "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the event was created.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "type", - "session_id", - "sip_headers" - ], - "properties": { - "type": { - "type": "string", - "description": "The incoming transport type. Always `sip`.", - "enum": [ - "sip" - ], - "x-stainless-const": true - }, - "session_id": { - "type": "string", - "description": "The `live_...` ID of the pending SIP session. Forward this value\nunchanged when accepting or rejecting the call through the Live API.\n" - }, - "sip_headers": { - "type": "array", - "description": "Headers from the SIP INVITE, excluding SIP authorization headers.\nRetained names, values, repeated entries, and order are preserved.\nTreat these values as untrusted call metadata.\n", - "items": { - "type": "object", - "description": "A header from the SIP Invite.\n", - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the SIP Header.\n" - }, - "value": { - "type": "string", - "description": "Value of the SIP Header.\n" - } - } - } - } - } - }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true - }, "type": { "type": "string", - "description": "The type of the event. Always `live.transport.incoming`.\n", "enum": [ - "live.transport.incoming" + "shell" ], + "description": "The tool to call. Always `shell`.", + "default": "shell", "x-stainless-const": true } }, - "x-oaiMeta": { - "name": "live.transport.incoming", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"live.transport.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"type\": \"sip\",\n \"session_id\": \"live_u0_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {\"name\": \"From\", \"value\": \";tag=abc123\"},\n {\"name\": \"To\", \"value\": \"\"},\n {\"name\": \"Call-ID\", \"value\": \"call-123@example.com\"}\n ]\n }\n}\n" - } - }, - "WebhookRealtimeCallIncoming": { "type": "object", - "title": "realtime.call.incoming", - "description": "Sent when an incoming API SIP session is available for Realtime acceptance.\nThe same pending session can also emit `live.transport.incoming`; the first\nsuccessful Realtime or Live accept endpoint selects the runtime surface.\n", "required": [ - "created_at", - "id", - "data", "type" ], + "title": "Specific shell tool choice", + "description": "Forces the model to call the shell tool when a tool call is required." + }, + "CyberAccessProgramEnum": { + "type": "string", + "enum": [ + "standard", + "daybreak_blue", + "daybreak_red" + ] + }, + "AccessProgramsParam": { "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the model response was completed.\n" + "cyber": { + "$ref": "#/components/schemas/CyberAccessProgramEnum", + "description": "The Cyber access program to use for this request. Supported values are `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves the program from the model's Cyber tier and your organization and project access, subject to model-specific eligibility restrictions. By default, models without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when authorized; otherwise they fall back to Standard unless the model requires Daybreak access. Red-tier models use Daybreak Red and require authorization. Requests that require unavailable Daybreak access return 403. An implicit Standard fallback is represented by null in the response's access_programs field, rather than an explicit Standard selection." + } + }, + "additionalProperties": false, + "type": "object", + "required": [], + "description": "Domain-specific access programs to use for this request." + }, + "ImageContextCompression": { + "type": "string", + "enum": [ + "auto", + "enabled", + "disabled" + ] + }, + "ImageOptionsParam": { + "properties": { + "context_compression": { + "$ref": "#/components/schemas/ImageContextCompression", + "description": "Controls image context optimization. Defaults to `auto`, which uses the model, transport, and input to select a policy. Use `enabled` to require compression support or `disabled` to turn it off." + } + }, + "additionalProperties": false, + "type": "object", + "required": [], + "description": "Request level image options." + }, + "ResponsePromptCacheOptionsParam": { + "properties": { + "ttl": { + "$ref": "#/components/schemas/PromptCacheTTLEnum", + "description": "The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer." }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" + "mode": { + "$ref": "#/components/schemas/PromptCacheModeEnum", + "description": "Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching." }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "call_id", - "sip_headers" - ], - "properties": { - "call_id": { + "prewarm": { + "type": "boolean", + "description": "Prepares the prompt cache without generating output. Defaults to `false`. When set to `true`, overrides the `generate` field to `false`." + }, + "comparison_response_id": { + "anyOf": [ + { "type": "string", - "description": "The Transceiver `rtc_...` ID of the pending SIP session. The paired\n`live.transport.incoming` event derives its `session_id` by replacing the\n`rtc_` prefix with `live_`. Use the ID returned by the event with the\ncorresponding Realtime or Live API.\n" + "description": "The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled.", + "example": "resp_123" }, - "sip_headers": { - "type": "array", - "description": "Headers from the SIP INVITE, excluding SIP authorization headers.\nRetained names, values, repeated entries, and order are preserved.\nTreat these values as untrusted call metadata.\n", - "items": { - "type": "object", - "description": "A header from the SIP Invite.\n", - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the SIP Header.\n" - }, - "value": { - "type": "string", - "description": "Value of the SIP Header.\n" - } - } - } + { + "type": "null" } - } + ] + } + }, + "type": "object", + "required": [], + "title": "Prompt cache options", + "description": "Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details." + }, + "ReasoningModeEnum": { + "anyOf": [ + { + "type": "string" }, - "object": { + { "type": "string", - "description": "The object of the event. Always `event`.\n", "enum": [ - "event" - ], - "x-stainless-const": true - }, - "type": { + "standard", + "pro" + ] + } + ] + }, + "ConversationParam-2": { + "properties": { + "id": { "type": "string", - "description": "The type of the event. Always `realtime.call.incoming`.\n", - "enum": [ - "realtime.call.incoming" - ], - "x-stainless-const": true + "description": "The unique ID of the conversation.", + "example": "conv_123" } }, - "x-oaiMeta": { - "name": "realtime.call.incoming", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {\"name\": \"Max-Forwards\", \"value\": \"63\"},\n {\"name\": \"CSeq\", \"value\": \"851287 INVITE\"},\n {\"name\": \"Content-Type\", \"value\": \"application/sdp\"}\n ]\n }\n}\n" - } - }, - "WebhookResponseCancelled": { "type": "object", - "title": "response.cancelled", - "description": "Sent when a background response has been cancelled.\n", "required": [ - "created_at", - "id", - "data", - "type" + "id" ], + "title": "Conversation object", + "description": "The conversation that this response belongs to." + }, + "ContextManagementParam": { "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the model response was cancelled.\n" - }, - "id": { + "type": { "type": "string", - "description": "The unique ID of the event.\n" + "description": "The context management entry type. Currently only 'compaction' is supported." }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the model response.\n" + "compact_threshold": { + "anyOf": [ + { + "type": "integer", + "minimum": 1000, + "description": "Token threshold at which compaction should be triggered for this entry." + }, + { + "type": "null" } - } - }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true - }, - "type": { - "type": "string", - "description": "The type of the event. Always `response.cancelled`.\n", - "enum": [ - "response.cancelled" - ], - "x-stainless-const": true + ] } }, - "x-oaiMeta": { - "name": "response.cancelled", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"response.cancelled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"resp_abc123\"\n }\n}\n" - } - }, - "WebhookResponseCompleted": { "type": "object", - "title": "response.completed", - "description": "Sent when a background response has been completed.\n", "required": [ - "created_at", - "id", - "data", "type" - ], + ] + }, + "ResolvedImageContextCompressionEnum": { + "type": "string", + "enum": [ + "enabled", + "disabled" + ] + }, + "ResolvedImageOptions": { "properties": { - "created_at": { + "context_compression": { + "$ref": "#/components/schemas/ResolvedImageContextCompressionEnum", + "description": "Effective image context optimization policy." + } + }, + "type": "object", + "required": [ + "context_compression" + ] + }, + "AccessProgramsBody": { + "properties": { + "cyber": { + "$ref": "#/components/schemas/CyberAccessProgramEnum", + "description": "The effective Cyber access program used for this response." + } + }, + "type": "object", + "required": [ + "cyber" + ] + }, + "CachedUsageDetails": { + "properties": { + "cached_text_tokens": { + "type": "integer" + }, + "cached_image_tokens": { + "type": "integer" + } + }, + "type": "object", + "required": [ + "cached_text_tokens", + "cached_image_tokens" + ] + }, + "ImageGenToolUsage": { + "properties": { + "input_tokens": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the model response was completed.\n" + "description": "The number of tokens (images and text) in the input prompt." }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" + "total_tokens": { + "type": "integer", + "description": "The total number of tokens (images and text) used for the image generation." }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the model response.\n" - } - } + "output_tokens": { + "type": "integer", + "description": "The number of output tokens generated by the model." }, - "object": { - "type": "string", - "description": "The object of the event. Always `event`.\n", - "enum": [ - "event" - ], - "x-stainless-const": true + "output_tokens_details": { + "$ref": "#/components/schemas/ImageGenOutputTokensDetails" }, - "type": { - "type": "string", - "description": "The type of the event. Always `response.completed`.\n", - "enum": [ - "response.completed" - ], - "x-stainless-const": true + "input_tokens_details": { + "$ref": "#/components/schemas/ImageGenInputUsageDetails" + }, + "cached_tokens": { + "type": "integer" + }, + "cached_tokens_details": { + "$ref": "#/components/schemas/CachedUsageDetails" } }, - "x-oaiMeta": { - "name": "response.completed", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"response.completed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"resp_abc123\"\n }\n}\n" - } - }, - "WebhookResponseFailed": { "type": "object", - "title": "response.failed", - "description": "Sent when a background response has failed.\n", "required": [ - "created_at", - "id", - "data", - "type" + "input_tokens", + "total_tokens", + "output_tokens", + "input_tokens_details" ], + "title": "Image generation tool usage", + "description": "Token usage for image generation tool calls in a response." + }, + "WebSearchUsage": { "properties": { - "created_at": { + "num_requests": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the model response failed.\n" + "description": "The number of billable web search requests issued." + } + }, + "type": "object", + "required": [ + "num_requests" + ], + "title": "Web search usage", + "description": "Usage details for web search requests that ran while generating the response." + }, + "ResponseToolUsage": { + "properties": { + "image_gen": { + "$ref": "#/components/schemas/ImageGenToolUsage", + "description": "Aggregated usage statistics for image generation tool calls." }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" + "web_search": { + "$ref": "#/components/schemas/WebSearchUsage", + "description": "Aggregated billable usage statistics for web search tool calls." + } + }, + "type": "object", + "required": [ + "image_gen", + "web_search" + ], + "title": "Response tool usage", + "description": "Aggregated usage details for billable tools that ran while generating the response." + }, + "PromptCacheOptions": { + "properties": { + "ttl": { + "$ref": "#/components/schemas/PromptCacheTTLEnum", + "description": "The minimum lifetime applied to each cache breakpoint." }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { + "mode": { + "$ref": "#/components/schemas/PromptCacheModeEnum", + "description": "Whether implicit prompt-cache breakpoints were enabled." + }, + "comparison_response_id": { + "anyOf": [ + { "type": "string", - "description": "The unique ID of the model response.\n" + "description": "The response ID supplied as the prompt cache diagnostics comparison." + }, + { + "type": "null" } - } + ] + } + }, + "type": "object", + "required": [ + "ttl", + "mode" + ], + "title": "Prompt cache options", + "description": "The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models." + }, + "CacheMissReasonTypeEnum": { + "type": "string", + "enum": [ + "model_changed", + "prompt_cache_key_changed", + "tools_changed", + "text_format_changed", + "reasoning_effort_changed", + "verbosity_changed", + "context_compacted", + "input_changed", + "service_tier_changed" + ] + }, + "PromptCacheMissDiagnosticsBody": { + "properties": { + "type": { + "type": "string", + "enum": [ + "cache_miss" + ], + "default": "cache_miss", + "x-stainless-const": true }, - "object": { + "reason": { + "$ref": "#/components/schemas/CacheMissReasonTypeEnum", + "description": "The reason prompt cache reuse did not occur." + }, + "cache_missed_tokens": { + "type": "integer", + "description": "The estimated number of input tokens affected after the first detected divergence." + }, + "comparison_reusable_tokens": { + "type": "integer", + "description": "The raw token count of the reusable prefix in the compared response." + } + }, + "type": "object", + "required": [ + "type", + "reason", + "cache_missed_tokens" + ] + }, + "PromptCacheHitDiagnosticsBody": { + "properties": { + "type": { "type": "string", - "description": "The object of the event. Always `event`.\n", "enum": [ - "event" + "cache_hit" ], + "default": "cache_hit", "x-stainless-const": true - }, + } + }, + "type": "object", + "required": [ + "type" + ] + }, + "PromptCacheComparisonResponseNotFoundDiagnosticsBody": { + "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.failed`.\n", "enum": [ - "response.failed" + "comparison_response_not_found" ], + "default": "comparison_response_not_found", "x-stainless-const": true } }, - "x-oaiMeta": { - "name": "response.failed", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"response.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"resp_abc123\"\n }\n}\n" - } - }, - "WebhookResponseIncomplete": { "type": "object", - "title": "response.incomplete", - "description": "Sent when a background response has been interrupted.\n", "required": [ - "created_at", - "id", - "data", "type" - ], + ] + }, + "PromptCacheUnavailableDiagnosticsBody": { "properties": { - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) of when the model response was interrupted.\n" - }, - "id": { - "type": "string", - "description": "The unique ID of the event.\n" - }, - "data": { - "type": "object", - "description": "Event data payload.\n", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the model response.\n" - } - } - }, - "object": { + "type": { "type": "string", - "description": "The object of the event. Always `event`.\n", "enum": [ - "event" + "unavailable" ], + "default": "unavailable", "x-stainless-const": true + } + }, + "type": "object", + "required": [ + "type" + ] + }, + "PromptCacheDiagnostics": { + "oneOf": [ + { + "$ref": "#/components/schemas/PromptCacheMissDiagnosticsBody" + }, + { + "$ref": "#/components/schemas/PromptCacheHitDiagnosticsBody" + }, + { + "$ref": "#/components/schemas/PromptCacheComparisonResponseNotFoundDiagnosticsBody" }, + { + "$ref": "#/components/schemas/PromptCacheUnavailableDiagnosticsBody" + } + ], + "description": "Prompt cache diagnostics requested for this response.", + "discriminator": { + "propertyName": "type" + } + }, + "ModerationErrorBody": { + "properties": { "type": { "type": "string", - "description": "The type of the event. Always `response.incomplete`.\n", "enum": [ - "response.incomplete" + "error" ], + "description": "The object type, which was always `error` for moderation failures.", + "default": "error", "x-stainless-const": true + }, + "code": { + "type": "string", + "description": "The error code." + }, + "message": { + "type": "string", + "description": "The error message." } }, - "x-oaiMeta": { - "name": "response.incomplete", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_abc123\",\n \"type\": \"response.incomplete\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"resp_abc123\"\n }\n}\n" - } - }, - "WebhookSafetyAlertCreated": { "type": "object", - "title": "safety.alert.created", - "description": "Sent when an approved safety alert is available for an API project.", "required": [ - "id", - "object", - "created_at", "type", - "data" + "code", + "message" + ], + "title": "Moderation error", + "description": "An error produced while attempting moderation for the response input or output." + }, + "Moderation": { + "properties": { + "input": { + "oneOf": [ + { + "$ref": "#/components/schemas/ModerationResultBody" + }, + { + "$ref": "#/components/schemas/ModerationErrorBody" + } + ], + "description": "Moderation for the response input.", + "discriminator": { + "propertyName": "type" + } + }, + "output": { + "oneOf": [ + { + "$ref": "#/components/schemas/ModerationResultBody" + }, + { + "$ref": "#/components/schemas/ModerationErrorBody" + } + ], + "description": "Moderation for the response output.", + "discriminator": { + "propertyName": "type" + } + } + }, + "type": "object", + "required": [ + "input", + "output" ], + "title": "Moderation", + "description": "Moderation results or errors for the response input and output." + }, + "ResponseConversation": { "properties": { "id": { "type": "string", - "description": "The unique ID of the webhook event." - }, - "object": { + "description": "The unique ID of the conversation that this response was associated with." + } + }, + "type": "object", + "required": [ + "id" + ], + "title": "Conversation", + "description": "The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation." + }, + "ResponseCompactionCompactingStreamingEvent": { + "properties": { + "type": { "type": "string", "enum": [ - "event" + "response.compaction.compacting" ], - "x-stainless-const": true, - "description": "Always `event`." + "description": "The type of the event, always `response.compaction.compacting`.", + "default": "response.compaction.compacting", + "x-stainless-const": true }, - "created_at": { + "sequence_number": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp in seconds when the event was created." + "description": "The sequence number of the event that was emitted." + }, + "output_index": { + "type": "integer", + "description": "The index of the compaction output item." }, + "item_id": { + "type": "string", + "description": "The ID of the compaction output item." + } + }, + "type": "object", + "required": [ + "type", + "sequence_number", + "output_index", + "item_id" + ], + "title": "Response compaction compacting event", + "description": "Emitted when new summary content is sampled for a compaction trigger. Contains no summary content." + }, + "ResponseShellCallCommandAddedStreamingEvent": { + "properties": { "type": { "type": "string", "enum": [ - "safety.alert.created" + "response.shell_call_command.added" ], - "x-stainless-const": true, - "description": "Always `safety.alert.created`." + "description": "The type of the event, always `response.shell_call_command.added`.", + "default": "response.shell_call_command.added", + "x-stainless-const": true }, - "data": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^alert_[0-9a-f]{32}$", - "description": "The safety alert ID to pass to `GET /v1/safety/alerts/{id}`." - } - } + "sequence_number": { + "type": "integer", + "description": "The sequence number of the event that was emitted." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item that was updated." + }, + "command_index": { + "type": "integer", + "description": "The index of the shell command that was added." + }, + "command": { + "type": "string", + "description": "The shell command that was added." } }, - "x-oaiMeta": { - "name": "safety.alert.created", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1787659200,\n \"type\": \"safety.alert.created\",\n \"data\": {\"id\": \"alert_0123456789abcdef0123456789abcdef\"}\n}\n" - } - }, - "WebhookSafetyOrgAlertCreated": { "type": "object", - "title": "safety.org_alert.created", - "description": "Sent when an approved safety alert is available for an enterprise workspace.", "required": [ - "id", - "object", - "created_at", "type", - "data" + "sequence_number", + "output_index", + "command_index", + "command" ], + "title": "Response shell command added event", + "description": "A streaming event that indicated a shell command was added to a tool call." + }, + "ResponseShellCallCommandDeltaStreamingEvent": { "properties": { - "id": { - "type": "string", - "description": "The unique ID of the webhook event." - }, - "object": { + "type": { "type": "string", "enum": [ - "event" + "response.shell_call_command.delta" ], - "x-stainless-const": true, - "description": "Always `event`." + "description": "The type of the event, always `response.shell_call_command.delta`.", + "default": "response.shell_call_command.delta", + "x-stainless-const": true }, - "created_at": { + "sequence_number": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp in seconds when the event was created." + "description": "The sequence number of the event that was emitted." }, - "type": { + "output_index": { + "type": "integer", + "description": "The index of the output item that was updated." + }, + "command_index": { + "type": "integer", + "description": "The index of the shell command that was updated." + }, + "delta": { "type": "string", - "enum": [ - "safety.org_alert.created" - ], - "x-stainless-const": true, - "description": "Always `safety.org_alert.created`." + "description": "The shell command delta that was appended." }, - "data": { - "type": "object", - "additionalProperties": false, - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^alert_[0-9a-f]{32}$", - "description": "The safety alert ID to pass to `GET /v1/safety/alerts/{id}`." - } - } + "obfuscation": { + "type": "string", + "description": "An obfuscation string that was added to pad the event payload." } }, - "x-oaiMeta": { - "name": "safety.org_alert.created", - "group": "webhook-events", - "example": "{\n \"id\": \"evt_123\",\n \"object\": \"event\",\n \"created_at\": 1787659200,\n \"type\": \"safety.org_alert.created\",\n \"data\": {\"id\": \"alert_0123456789abcdef0123456789abcdef\"}\n}\n" - } - }, - "ModerationInputType": { - "type": "string", - "enum": [ - "text", - "image" - ] + "type": "object", + "required": [ + "type", + "sequence_number", + "output_index", + "command_index", + "delta" + ], + "title": "Response shell command delta event", + "description": "A streaming event that indicated a shell command was incrementally updated." }, - "ModerationResultBody": { + "ResponseShellCallCommandDoneStreamingEvent": { "properties": { "type": { "type": "string", "enum": [ - "moderation_result" + "response.shell_call_command.done" ], - "description": "The object type, which was always `moderation_result` for successful moderation results.", - "default": "moderation_result", + "description": "The type of the event, always `response.shell_call_command.done`.", + "default": "response.shell_call_command.done", "x-stainless-const": true }, - "model": { - "type": "string", - "description": "The moderation model that produced this result." - }, - "flagged": { - "type": "boolean", - "description": "A boolean indicating whether the content was flagged by any category." + "sequence_number": { + "type": "integer", + "description": "The sequence number of the event that was emitted." }, - "categories": { - "additionalProperties": { - "type": "boolean" - }, - "type": "object", - "description": "A dictionary of moderation categories to booleans, True if the input is flagged under this category.", - "x-oaiTypeLabel": "map" + "output_index": { + "type": "integer", + "description": "The index of the output item that was updated." }, - "category_scores": { - "additionalProperties": { - "type": "number" - }, - "type": "object", - "description": "A dictionary of moderation categories to scores.", - "x-oaiTypeLabel": "map" + "command_index": { + "type": "integer", + "description": "The index of the shell command that was completed." }, - "category_applied_input_types": { - "additionalProperties": { - "items": { - "$ref": "#/components/schemas/ModerationInputType" - }, - "type": "array" - }, - "type": "object", - "description": "Which modalities of input are reflected by the score for each category.", - "x-oaiTypeLabel": "map" + "command": { + "type": "string", + "description": "The final shell command that was emitted." } }, "type": "object", "required": [ "type", - "model", - "flagged", - "categories", - "category_scores", - "category_applied_input_types" + "sequence_number", + "output_index", + "command_index", + "command" ], - "title": "Moderation result", - "description": "A moderation result produced for the response input or output." - }, - "PromptCacheTTLEnum": { - "type": "string", - "enum": [ - "30m" - ] - }, - "PromptCacheModeEnum": { - "type": "string", - "enum": [ - "implicit", - "explicit" - ] + "title": "Response shell command done event", + "description": "A streaming event that indicated a shell command was completed." }, - "PromptCacheOptionsParam": { + "ShellCallOutputDelta": { "properties": { - "ttl": { - "$ref": "#/components/schemas/PromptCacheTTLEnum", - "description": "The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer." + "stdout": { + "type": "string", + "description": "The stdout delta that was emitted." }, - "mode": { - "$ref": "#/components/schemas/PromptCacheModeEnum", - "description": "Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching." + "stderr": { + "type": "string", + "description": "The stderr delta that was emitted." } }, "type": "object", "required": [], - "title": "Prompt cache options", - "description": "Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details." + "title": "Shell call output delta", + "description": "A delta of stdout/stderr emitted while a shell call was running." }, - "PromptCacheBreakpointParam": { + "ResponseShellCallOutputContentDeltaStreamingEvent": { "properties": { - "mode": { + "type": { "type": "string", "enum": [ - "explicit" + "response.shell_call_output_content.delta" ], - "description": "The breakpoint mode. Always `explicit`.", - "default": "explicit", + "description": "The type of the event, always `response.shell_call_output_content.delta`.", + "default": "response.shell_call_output_content.delta", "x-stainless-const": true + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of the event that was emitted." + }, + "item_id": { + "type": "string", + "description": "The ID of the output item that was updated." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item that was updated." + }, + "command_index": { + "type": "integer", + "description": "The index of the shell command that produced output." + }, + "delta": { + "$ref": "#/components/schemas/ShellCallOutputDelta", + "description": "The stdout/stderr delta that was emitted." } }, "type": "object", "required": [ - "mode" + "type", + "sequence_number", + "item_id", + "output_index", + "command_index", + "delta" ], - "title": "Prompt cache breakpoint", - "description": "Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." - }, - "ModerationMode": { - "type": "string", - "enum": [ - "score", - "block" - ] + "title": "Response shell call output content delta event", + "description": "A streaming event that indicated shell call output was incrementally added." }, - "ModerationConfigParam": { + "ResponseShellCallOutputContentDoneStreamingEvent": { "properties": { - "mode": { - "$ref": "#/components/schemas/ModerationMode" + "type": { + "type": "string", + "enum": [ + "response.shell_call_output_content.done" + ], + "description": "The type of the event, always `response.shell_call_output_content.done`.", + "default": "response.shell_call_output_content.done", + "x-stainless-const": true + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of the event that was emitted." + }, + "item_id": { + "type": "string", + "description": "The ID of the output item that was updated." + }, + "output_index": { + "type": "integer", + "description": "The index of the output item that was updated." + }, + "command_index": { + "type": "integer", + "description": "The index of the shell command that produced output." + }, + "output": { + "items": { + "$ref": "#/components/schemas/FunctionShellCallOutputContent" + }, + "type": "array", + "description": "The output contents emitted for the shell command." } }, "type": "object", "required": [ - "mode" + "type", + "sequence_number", + "item_id", + "output_index", + "command_index", + "output" ], - "description": "The moderation policy for the response input." + "title": "Response shell call output content done event", + "description": "A streaming event that indicated shell call output was completed." }, - "ModerationPolicyParam": { + "CreateConversationBody": { "properties": { - "input": { + "metadata": { "anyOf": [ { - "$ref": "#/components/schemas/ModerationConfigParam", - "description": "The moderation policy for the response input." + "$ref": "#/components/schemas/Metadata", + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters." }, { "type": "null" } ] }, - "output": { + "items": { "anyOf": [ { - "$ref": "#/components/schemas/ModerationConfigParam", - "description": "The moderation policy for the response output." + "items": { + "$ref": "#/components/schemas/InputItem" + }, + "type": "array", + "maxItems": 20, + "description": "Initial items to include in the conversation context. You may add up to 20 items at a time." }, { "type": "null" @@ -66095,881 +90349,1108 @@ } }, "type": "object", - "required": [], - "description": "The policy to apply to moderated response input and output." + "required": [] }, - "ModerationParam": { + "UpdateConversationBody": { "properties": { - "model": { - "type": "string", - "description": "The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'." - }, - "policy": { - "anyOf": [ - { - "$ref": "#/components/schemas/ModerationPolicyParam", - "description": "The policy to apply to moderated response input and output." - }, - { - "type": "null" - } - ] + "metadata": { + "$ref": "#/components/schemas/Metadata", + "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters." } }, "type": "object", "required": [ - "model" - ], - "description": "Configuration for running moderation on the input and output of this response." + "metadata" + ] }, - "SkillReferenceParam": { + "DeletedConversationResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "skill_reference" + "conversation.deleted" ], - "description": "References a skill created with the /v1/skills endpoint.", - "default": "skill_reference", + "default": "conversation.deleted", "x-stainless-const": true }, - "skill_id": { - "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The ID of the referenced skill." + "deleted": { + "type": "boolean" }, - "version": { - "type": "string", - "description": "Optional skill version. Use a positive integer or 'latest'. Omit for default." + "id": { + "type": "string" } }, "type": "object", "required": [ - "type", - "skill_id" + "object", + "deleted", + "id" ] }, - "InlineSkillSourceParam": { + "SafetyCaseNoticeType": { + "type": "string", + "enum": [ + "warning", + "deactivation" + ] + }, + "SafetyCaseNotice": { "properties": { "type": { - "type": "string", - "enum": [ - "base64" - ], - "description": "The type of the inline skill source. Must be `base64`.", - "default": "base64", - "x-stainless-const": true - }, - "media_type": { - "type": "string", - "enum": [ - "application/zip" - ], - "description": "The media type of the inline skill payload. Must be `application/zip`.", - "default": "application/zip", - "x-stainless-const": true - }, - "data": { - "type": "string", - "maxLength": 70254592, - "minLength": 1, - "description": "Base64-encoded skill zip bundle." + "$ref": "#/components/schemas/SafetyCaseNoticeType" } }, "type": "object", "required": [ - "type", - "media_type", - "data" - ], - "description": "Inline skill payload" + "type" + ] }, - "InlineSkillParam": { + "SafetyCaseResource": { "properties": { - "type": { + "id": { + "type": "string" + }, + "object": { "type": "string", "enum": [ - "inline" + "safety.case" ], - "description": "Defines an inline skill for this request.", - "default": "inline", + "default": "safety.case", "x-stainless-const": true }, - "name": { - "type": "string", - "description": "The name of the skill." + "created_at": { + "type": "integer", + "format": "unixtime" }, - "description": { - "type": "string", - "description": "The description of the skill." + "entity_identifier": { + "type": "string" }, - "source": { - "$ref": "#/components/schemas/InlineSkillSourceParam", - "description": "Inline skill payload" + "reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "notice": { + "$ref": "#/components/schemas/SafetyCaseNotice" } }, "type": "object", "required": [ - "type", - "name", - "description", - "source" + "id", + "object", + "created_at", + "entity_identifier", + "reason", + "notice" ] }, - "ContainerNetworkPolicyDisabledParam": { - "properties": { - "type": { - "type": "string", - "enum": [ - "disabled" - ], - "description": "Disable outbound network access. Always `disabled`.", - "default": "disabled", - "x-stainless-const": true - } - }, - "type": "object", - "required": [ - "type" + "SafetyAlertErrorType": { + "type": "string", + "enum": [ + "potentially_unintended_data_transfer", + "potentially_unintended_data_access", + "potentially_unintended_destructive_activity", + "other" ] }, - "ContainerNetworkPolicyDomainSecretParam": { + "SafetyAlertResource": { "properties": { - "domain": { - "type": "string", - "minLength": 1, - "description": "The domain associated with the secret." - }, - "name": { - "type": "string", - "minLength": 1, - "description": "The name of the secret to inject for the domain." + "id": { + "type": "string" }, - "value": { - "type": "string", - "maxLength": 10485760, - "minLength": 1, - "description": "The secret value to inject for the domain." - } - }, - "type": "object", - "required": [ - "domain", - "name", - "value" - ] - }, - "ContainerNetworkPolicyAllowlistParam": { - "properties": { - "type": { + "object": { "type": "string", "enum": [ - "allowlist" + "safety.alert" ], - "description": "Allow outbound network access only to specified domains. Always `allowlist`.", - "default": "allowlist", + "default": "safety.alert", "x-stainless-const": true }, - "allowed_domains": { - "items": { - "type": "string" - }, - "type": "array", - "minItems": 1, - "description": "A list of allowed domains when type is `allowlist`." + "created_at": { + "type": "integer", + "format": "unixtime" }, - "domain_secrets": { - "items": { - "$ref": "#/components/schemas/ContainerNetworkPolicyDomainSecretParam" - }, - "type": "array", - "minItems": 1, - "description": "Optional domain-scoped secrets for allowlisted domains." + "request_id": { + "type": "string" + }, + "response_id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "request_paused": { + "type": "boolean", + "description": "Whether block registration succeeded for this request. This does not confirm that response execution stopped." + }, + "error_type": { + "$ref": "#/components/schemas/SafetyAlertErrorType" + }, + "reason": { + "anyOf": [ + { + "type": "string", + "description": "A customer-safe description derived from error_type, or null for zero data retention requests." + }, + { + "type": "null" + } + ] + }, + "detailed_explanation": { + "anyOf": [ + { + "type": "string", + "description": "A generated explanation, temporarily available for eligible zero data retention alerts. Omitted when unavailable." + }, + { + "type": "null" + } + ] } }, "type": "object", "required": [ - "type", - "allowed_domains" + "id", + "object", + "created_at", + "request_id", + "response_id", + "model", + "request_paused", + "error_type", + "reason" ] }, - "IncludeEnum": { - "type": "string", - "enum": [ - "file_search_call.results", - "web_search_call.results", - "web_search_call.action.sources", - "message.input_image.image_url", - "computer_call_output.output.image_url", - "code_interpreter_call.outputs", - "reasoning.encrypted_content", - "message.output_text.logprobs" - ], - "description": "Specify additional output data to include in the model response. Currently supported values are:\n- `web_search_call.results`: Include the search results of the web search tool call.\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program)." - }, - "MessageStatus": { + "OrderEnum": { "type": "string", "enum": [ - "in_progress", - "completed", - "incomplete" + "asc", + "desc" ] }, - "MessageRole": { + "ExternalKeyPurpose": { "type": "string", "enum": [ - "unknown", - "user", - "assistant", - "system", - "critic", - "discriminator", - "developer", - "tool" + "ekm", + "psp_decryption" ] }, - "PromptCacheBreakpointConfig": { + "ExternalKeyResource": { "properties": { - "mode": { - "type": "string", - "enum": [ - "explicit" - ], - "description": "The breakpoint mode. Always `explicit`.", - "default": "explicit", - "x-stainless-const": true + "object": { + "type": "string" + }, + "id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "purpose": { + "$ref": "#/components/schemas/ExternalKeyPurpose" + }, + "name": { + "type": "string" + }, + "api_project_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "workspace_id": { + "type": "string" + }, + "created_at": { + "type": "integer" + }, + "role_arn": { + "type": "string" + }, + "external_id": { + "type": "string" + }, + "kms_arn": { + "type": "string" + }, + "workload_identity_project_number": { + "type": "string" + }, + "workload_identity_pool_id": { + "type": "string" + }, + "workload_identity_provider_id": { + "type": "string" + }, + "audience": { + "type": "string" + }, + "kms_project_id": { + "type": "string" + }, + "kms_key_ring_name": { + "type": "string" + }, + "kms_key_name": { + "type": "string" + }, + "kms_key_location": { + "type": "string" + }, + "kms_key_version": { + "type": "string" + }, + "tenant_id": { + "type": "string" + }, + "vault_uri": { + "type": "string" + }, + "key_name": { + "type": "string" + }, + "key_version": { + "type": "string" } }, "type": "object", "required": [ - "mode" - ], - "title": "Prompt cache breakpoint", - "description": "Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." + "object", + "id", + "type", + "name", + "api_project_ids", + "workspace_id", + "created_at" + ] }, - "InputTextContent": { + "ListExternalKeysResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "input_text" + "list" ], - "description": "The type of the input item. Always `input_text`.", - "default": "input_text", + "default": "list", "x-stainless-const": true }, - "text": { - "type": "string", - "description": "The text input to the model." + "data": { + "items": { + "$ref": "#/components/schemas/ExternalKeyResource" + }, + "type": "array" }, - "prompt_cache_breakpoint": { - "$ref": "#/components/schemas/PromptCacheBreakpointConfig" + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" } }, "type": "object", "required": [ - "type", - "text" - ], - "title": "Input text", - "description": "A text input to the model." + "object", + "data", + "first_id", + "last_id", + "has_more" + ] }, - "FileCitationBody": { + "AwsExternalKeyParams": { "properties": { + "name": { + "type": "string", + "description": "A friendly name to identify this config" + }, "type": { "type": "string", "enum": [ - "file_citation" + "aws" ], - "description": "The type of the file citation. Always `file_citation`.", - "default": "file_citation", + "default": "aws", "x-stainless-const": true }, - "file_id": { + "role_arn": { "type": "string", - "description": "The ID of the file." + "pattern": "^arn:aws:iam::\\d{12}:role/.+$", + "description": "The Role ARN that OpenAI will assume to call your KMS" }, - "index": { - "type": "integer", - "description": "The index of the file in the list of files." + "kms_arn": { + "type": "string", + "description": "The Key Management System ARN for the master key you manage" }, - "filename": { + "external_id": { "type": "string", - "description": "The filename of the file cited." + "description": "The ExternalID that OpenAI will pass in the AssumeRole call for the customer's AWS account. This must be the OpenAI organization ID or an API project ID that belongs to the organization." + }, + "purpose": { + "$ref": "#/components/schemas/ExternalKeyPurpose" } }, "type": "object", "required": [ + "name", "type", - "file_id", - "index", - "filename" - ], - "title": "File citation", - "description": "A citation to a file." + "role_arn", + "kms_arn", + "external_id" + ] }, - "UrlCitationBody": { + "GcpExternalKeyParams": { "properties": { + "name": { + "type": "string", + "description": "A friendly name to identify this config" + }, "type": { "type": "string", "enum": [ - "url_citation" + "gcp" ], - "description": "The type of the URL citation. Always `url_citation`.", - "default": "url_citation", + "default": "gcp", "x-stainless-const": true }, - "url": { + "workload_identity_project_number": { "type": "string", - "format": "uri", - "description": "The URL of the web resource." + "pattern": "^[0-9]{1,19}$", + "description": "The numeric GCP project number where you registered OpenAI's workload identity" }, - "start_index": { - "type": "integer", - "description": "The index of the first character of the URL citation in the message." + "workload_identity_pool_id": { + "type": "string", + "description": "The pool containing the Workload Identity provider that you registered for OpenAI" }, - "end_index": { - "type": "integer", - "description": "The index of the last character of the URL citation in the message." + "workload_identity_provider_id": { + "type": "string", + "description": "The Workload Identity provider that you registered for OpenAI" }, - "title": { + "kms_project_id": { "type": "string", - "description": "The title of the web resource." + "description": "The string GCP project name where your KMS resides" + }, + "kms_key_ring_name": { + "type": "string", + "description": "The Key Management System key ring for the master key you manage" + }, + "kms_key_name": { + "type": "string", + "description": "The name of the Key Management System master key you manage" + }, + "kms_key_location": { + "type": "string", + "description": "The region where your Key Management System master key is located" + }, + "audience": { + "type": "string", + "description": "The aud field in the identity token OpenAI will pass in the call to the customer's GCP STS. This must be the OpenAI organization ID or an API project ID that belongs to the organization." + }, + "purpose": { + "$ref": "#/components/schemas/ExternalKeyPurpose" + }, + "kms_key_version": { + "type": "string", + "pattern": "^[1-9][0-9]*$", + "description": "An exact CryptoKeyVersion number. Required for PSP decryption; not accepted for EKM." } }, "type": "object", "required": [ + "name", "type", - "url", - "start_index", - "end_index", - "title" - ], - "title": "URL citation", - "description": "A citation for a web resource used to generate a model response." + "workload_identity_project_number", + "workload_identity_pool_id", + "workload_identity_provider_id", + "kms_project_id", + "kms_key_ring_name", + "kms_key_name", + "kms_key_location", + "audience" + ] }, - "ContainerFileCitationBody": { + "AzureExternalKeyParams": { "properties": { + "name": { + "type": "string", + "description": "A friendly name to identify this config" + }, "type": { "type": "string", "enum": [ - "container_file_citation" + "azure" ], - "description": "The type of the container file citation. Always `container_file_citation`.", - "default": "container_file_citation", + "default": "azure", "x-stainless-const": true }, - "container_id": { + "tenant_id": { "type": "string", - "description": "The ID of the container file." + "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", + "description": "Your Azure tenant UUID" }, - "file_id": { + "vault_uri": { "type": "string", - "description": "The ID of the file." - }, - "start_index": { - "type": "integer", - "description": "The index of the first character of the container file citation in the message." + "pattern": "^https://.+\\.vault\\.azure\\.net/?$", + "description": "The URI of the Azure vault containing the master key you manage" }, - "end_index": { - "type": "integer", - "description": "The index of the last character of the container file citation in the message." + "key_name": { + "type": "string", + "maxLength": 127, + "pattern": "^org-[0-9a-zA-Z-]*--[0-9a-zA-Z-]*$", + "description": "The name of the Azure Key Vault master key that you manage" }, - "filename": { + "purpose": { + "$ref": "#/components/schemas/ExternalKeyPurpose" + }, + "key_version": { "type": "string", - "description": "The filename of the container file cited." + "pattern": "^[0-9a-fA-F]{32}$", + "description": "An exact Azure Key Vault key version. Required for PSP decryption; not accepted for EKM." } }, "type": "object", "required": [ + "name", "type", - "container_id", - "file_id", - "start_index", - "end_index", - "filename" - ], - "title": "Container file citation", - "description": "A citation for a container file used to generate a model response." + "tenant_id", + "vault_uri", + "key_name" + ] }, - "Annotation": { + "V1OrganizationExternalKeysPostRequest": { "oneOf": [ { - "$ref": "#/components/schemas/FileCitationBody" - }, - { - "$ref": "#/components/schemas/UrlCitationBody" + "$ref": "#/components/schemas/AwsExternalKeyParams" }, { - "$ref": "#/components/schemas/ContainerFileCitationBody" + "$ref": "#/components/schemas/GcpExternalKeyParams" }, { - "$ref": "#/components/schemas/FilePath" + "$ref": "#/components/schemas/AzureExternalKeyParams" } ], - "description": "An annotation that applies to a span of output text.", "discriminator": { "propertyName": "type" } }, - "TopLogProb": { + "ValidateExternalKeyResource": { "properties": { - "token": { + "status": { "type": "string" + } + }, + "type": "object", + "required": [ + "status" + ] + }, + "DiscoveryVerification": { + "properties": { + "type": { + "type": "string", + "enum": [ + "discovery" + ], + "default": "discovery", + "x-stainless-const": true }, - "logprob": { - "type": "number" + "discovery_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "type": "object", + "required": [ + "type", + "discovery_url" + ] + }, + "UploadedJwksVerification": { + "properties": { + "type": { + "type": "string", + "enum": [ + "uploaded_jwks" + ], + "default": "uploaded_jwks", + "x-stainless-const": true }, - "bytes": { - "items": { - "type": "integer" - }, - "type": "array" + "jwks": { + "additionalProperties": {}, + "type": "object", + "x-oaiTypeLabel": "map" } }, "type": "object", "required": [ - "token", - "logprob", - "bytes" - ], - "title": "Top log probability", - "description": "The top log probability of a token." + "type", + "jwks" + ] }, - "LogProb": { + "Transformation": { "properties": { - "token": { + "attribute": { "type": "string" }, - "logprob": { - "type": "number" - }, - "bytes": { - "items": { - "type": "integer" - }, - "type": "array" - }, - "top_logprobs": { - "items": { - "$ref": "#/components/schemas/TopLogProb" - }, - "type": "array" + "expression": { + "type": "string" } }, "type": "object", "required": [ - "token", - "logprob", - "bytes", - "top_logprobs" - ], - "title": "Log probability", - "description": "The log probability of a token." + "attribute", + "expression" + ] }, - "OutputTextContent": { + "PlatformProvider": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "output_text" + "organization.workload_identity_provider" ], - "description": "The type of the output text. Always `output_text`.", - "default": "output_text", + "default": "organization.workload_identity_provider", "x-stainless-const": true }, - "text": { + "id": { + "type": "string" + }, + "type": { "type": "string", - "description": "The text output from the model." + "enum": [ + "oidc" + ], + "default": "oidc", + "x-stainless-const": true }, - "annotations": { - "items": { - "$ref": "#/components/schemas/Annotation" - }, - "type": "array", - "description": "The annotations of the text output." + "name": { + "type": "string" }, - "logprobs": { + "issuer": { + "type": "string" + }, + "audience": { + "type": "string" + }, + "verification": { + "oneOf": [ + { + "$ref": "#/components/schemas/DiscoveryVerification" + }, + { + "$ref": "#/components/schemas/UploadedJwksVerification" + } + ] + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "attribute_transformations": { "items": { - "$ref": "#/components/schemas/LogProb" + "$ref": "#/components/schemas/Transformation" }, "type": "array" + }, + "enabled": { + "type": "boolean" + }, + "created_at": { + "type": "integer" + }, + "updated_at": { + "type": "integer" } }, "type": "object", "required": [ + "object", + "id", "type", - "text", - "annotations", - "logprobs" - ], - "title": "Output text", - "description": "A text output from the model." + "name", + "issuer", + "audience", + "verification", + "description", + "attribute_transformations", + "enabled", + "created_at", + "updated_at" + ] }, - "TextContent": { + "PlatformProviderListResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "text" + "list" ], - "default": "text", + "default": "list", "x-stainless-const": true }, - "text": { - "type": "string" + "data": { + "items": { + "$ref": "#/components/schemas/PlatformProvider" + }, + "type": "array" + }, + "first_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "has_more": { + "type": "boolean" } }, "type": "object", "required": [ - "type", - "text" - ], - "title": "Text Content", - "description": "A text content." + "object", + "data", + "first_id", + "last_id", + "has_more" + ] }, - "SummaryTextContent": { + "DiscoveryVerificationParam": { "properties": { "type": { "type": "string", "enum": [ - "summary_text" + "discovery" ], - "description": "The type of the object. Always `summary_text`.", - "default": "summary_text", + "default": "discovery", "x-stainless-const": true }, - "text": { - "type": "string", - "description": "A summary of the reasoning output from the model so far." + "discovery_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] } }, "type": "object", "required": [ "type", - "text" - ], - "title": "Summary text", - "description": "A summary text from the model." + "discovery_url" + ] }, - "ReasoningTextContent": { + "UploadedJwksVerificationParam": { "properties": { "type": { "type": "string", "enum": [ - "reasoning_text" + "uploaded_jwks" ], - "description": "The type of the reasoning text. Always `reasoning_text`.", - "default": "reasoning_text", + "default": "uploaded_jwks", "x-stainless-const": true }, - "text": { - "type": "string", - "description": "The reasoning text from the model." + "jwks": { + "additionalProperties": {}, + "type": "object", + "x-oaiTypeLabel": "map" } }, "type": "object", "required": [ "type", - "text" - ], - "title": "Reasoning text", - "description": "Reasoning text from the model." + "jwks" + ] }, - "RefusalContent": { + "TransformationParam": { "properties": { - "type": { + "attribute": { "type": "string", - "enum": [ - "refusal" - ], - "description": "The type of the refusal. Always `refusal`.", - "default": "refusal", - "x-stainless-const": true + "maxLength": 256, + "minLength": 1 }, - "refusal": { + "expression": { "type": "string", - "description": "The refusal explanation from the model." + "maxLength": 4096, + "minLength": 1 } }, "type": "object", "required": [ - "type", - "refusal" - ], - "title": "Refusal", - "description": "A refusal from the model." - }, - "ImageDetail": { - "type": "string", - "enum": [ - "low", - "high", - "auto", - "original" + "attribute", + "expression" ] }, - "InputImageContent": { + "CreatePlatformWorkloadIdentityProviderBody": { "properties": { + "name": { + "type": "string", + "minLength": 1 + }, "type": { "type": "string", "enum": [ - "input_image" + "oidc" ], - "description": "The type of the input item. Always `input_image`.", - "default": "input_image", + "default": "oidc", "x-stainless-const": true }, - "image_url": { - "anyOf": [ - { - "type": "string", - "format": "uri", - "description": "The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL." - }, - { - "type": "null" - } - ] + "issuer": { + "type": "string", + "minLength": 1 }, - "file_id": { - "anyOf": [ + "audience": { + "type": "string", + "minLength": 1 + }, + "verification": { + "oneOf": [ { - "type": "string", - "description": "The ID of the file to be sent to the model." + "$ref": "#/components/schemas/DiscoveryVerificationParam" }, { - "type": "null" + "$ref": "#/components/schemas/UploadedJwksVerificationParam" } ] }, - "detail": { - "$ref": "#/components/schemas/ImageDetail", - "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." + "description": { + "type": "string" }, - "prompt_cache_breakpoint": { - "$ref": "#/components/schemas/PromptCacheBreakpointConfig" + "attribute_transformations": { + "items": { + "$ref": "#/components/schemas/TransformationParam" + }, + "type": "array", + "maxItems": 20 + }, + "enabled": { + "type": "boolean" } }, "type": "object", "required": [ + "name", "type", - "detail" - ], - "title": "Input image", - "description": "An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision)." + "issuer", + "audience" + ] }, - "ComputerScreenshotContent": { + "UpdatePlatformWorkloadIdentityProviderBody": { "properties": { - "type": { + "name": { "type": "string", - "enum": [ - "computer_screenshot" - ], - "description": "Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.", - "default": "computer_screenshot", - "x-stainless-const": true + "minLength": 1 }, - "image_url": { - "anyOf": [ + "issuer": { + "type": "string", + "minLength": 1 + }, + "audience": { + "type": "string", + "minLength": 1 + }, + "verification": { + "oneOf": [ { - "type": "string", - "format": "uri", - "description": "The URL of the screenshot image." + "$ref": "#/components/schemas/DiscoveryVerificationParam" }, { - "type": "null" + "$ref": "#/components/schemas/UploadedJwksVerificationParam" } ] }, - "file_id": { + "description": { "anyOf": [ { - "type": "string", - "description": "The identifier of an uploaded file that contains the screenshot." + "type": "string" }, { "type": "null" } ] }, - "detail": { - "$ref": "#/components/schemas/ImageDetail", - "description": "The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." + "attribute_transformations": { + "items": { + "$ref": "#/components/schemas/TransformationParam" + }, + "type": "array", + "maxItems": 20 }, - "prompt_cache_breakpoint": { - "$ref": "#/components/schemas/PromptCacheBreakpointConfig" + "enabled": { + "type": "boolean" + } + }, + "type": "object", + "required": [] + }, + "PlatformProviderDeletedResource": { + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.workload_identity_provider.deleted" + ], + "default": "organization.workload_identity_provider.deleted", + "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" } }, "type": "object", "required": [ - "type", - "image_url", - "file_id", - "detail" - ], - "title": "Computer screenshot", - "description": "A screenshot of a computer." + "object", + "id", + "deleted" + ] }, - "FileInputDetail": { - "type": "string", - "enum": [ - "auto", - "low", - "high" + "DefaultPermissions": { + "properties": { + "type": { + "type": "string", + "enum": [ + "service_account_default" + ], + "default": "service_account_default", + "x-stainless-const": true + } + }, + "type": "object", + "required": [ + "type" ] }, - "InputFileContent": { + "RestrictedPermissions": { "properties": { "type": { "type": "string", "enum": [ - "input_file" + "restricted" ], - "description": "The type of the input item. Always `input_file`.", - "default": "input_file", + "default": "restricted", "x-stainless-const": true }, - "file_id": { + "scopes": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object", + "required": [ + "type", + "scopes" + ] + }, + "PlatformFederationRule": { + "properties": { + "object": { + "type": "string", + "enum": [ + "organization.workload_identity_federation_rule" + ], + "default": "organization.workload_identity_federation_rule", + "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "workload_identity_provider_id": { + "type": "string" + }, + "project_id": { + "type": "string" + }, + "service_account_id": { + "type": "string" + }, + "name": { "anyOf": [ { - "type": "string", - "description": "The ID of the file to be sent to the model." + "type": "string" }, { "type": "null" } ] }, - "filename": { - "type": "string", - "description": "The name of the file to be sent to the model." + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] }, - "file_data": { - "type": "string", - "description": "The content of the file to be sent to the model.\n" + "attribute_matchers": { + "additionalProperties": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "number" + } + ] + } + ] + }, + "type": "object", + "x-oaiTypeLabel": "map" }, - "prompt_cache_breakpoint": { - "$ref": "#/components/schemas/PromptCacheBreakpointConfig" + "permissions": { + "oneOf": [ + { + "$ref": "#/components/schemas/DefaultPermissions" + }, + { + "$ref": "#/components/schemas/RestrictedPermissions" + } + ] }, - "file_url": { - "type": "string", - "format": "uri", - "description": "The URL of the file to be sent to the model." + "enabled": { + "type": "boolean" + }, + "created_at": { + "type": "integer" }, - "detail": { - "$ref": "#/components/schemas/FileInputDetail", - "description": "The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`." + "updated_at": { + "type": "integer" } }, "type": "object", "required": [ - "type" - ], - "title": "Input file", - "description": "A file input to the model." - }, - "MessagePhase-2": { - "type": "string", - "enum": [ - "commentary", - "final_answer" + "object", + "id", + "workload_identity_provider_id", + "project_id", + "service_account_id", + "name", + "description", + "attribute_matchers", + "permissions", + "enabled", + "created_at", + "updated_at" ] }, - "Message": { + "PlatformFederationRuleListResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "message" + "list" ], - "description": "The type of the message. Always set to `message`.", - "default": "message", + "default": "list", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The unique ID of the message." - }, - "status": { - "$ref": "#/components/schemas/MessageStatus", - "description": "The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API." - }, - "role": { - "$ref": "#/components/schemas/MessageRole", - "description": "The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`." - }, - "content": { + "data": { "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/InputTextContent" - }, - { - "$ref": "#/components/schemas/OutputTextContent" - }, - { - "$ref": "#/components/schemas/TextContent" - }, - { - "$ref": "#/components/schemas/SummaryTextContent" - }, - { - "$ref": "#/components/schemas/ReasoningTextContent" - }, - { - "$ref": "#/components/schemas/RefusalContent" - }, - { - "$ref": "#/components/schemas/InputImageContent" - }, - { - "$ref": "#/components/schemas/ComputerScreenshotContent" - }, - { - "$ref": "#/components/schemas/InputFileContent" - } - ], - "description": "A content part that makes up an input or output item.", - "discriminator": { - "propertyName": "type" - } + "$ref": "#/components/schemas/PlatformFederationRule" }, - "type": "array", - "description": "The content of the message" + "type": "array" }, - "phase": { + "first_id": { "anyOf": [ { - "$ref": "#/components/schemas/MessagePhase-2", - "description": "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages." + "type": "string" + }, + { + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string" }, { "type": "null" } ] + }, + "has_more": { + "type": "boolean" } }, "type": "object", "required": [ - "type", - "id", - "status", - "role", - "content" - ], - "title": "Message", - "description": "A message to or from the model." + "object", + "data", + "first_id", + "last_id", + "has_more" + ] }, - "DirectToolCallCaller": { + "DefaultPermissionsParam": { "properties": { "type": { "type": "string", "enum": [ - "direct" + "service_account_default" ], - "default": "direct", + "default": "service_account_default", "x-stainless-const": true } }, @@ -66978,428 +91459,452 @@ "type" ] }, - "ProgramToolCallCaller": { + "RestrictedPermissionsParam": { "properties": { "type": { "type": "string", "enum": [ - "program" + "restricted" ], - "default": "program", + "default": "restricted", "x-stainless-const": true }, - "caller_id": { - "type": "string", - "description": "The call ID of the program item that produced this tool call." + "scopes": { + "items": { + "type": "string" + }, + "type": "array", + "minItems": 1 } }, "type": "object", "required": [ "type", - "caller_id" + "scopes" ] }, - "ToolCallCaller": { - "oneOf": [ - { - "$ref": "#/components/schemas/DirectToolCallCaller" + "CreatePlatformWorkloadIdentityFederationRuleBody": { + "properties": { + "project_id": { + "type": "string", + "minLength": 1 }, - { - "$ref": "#/components/schemas/ProgramToolCallCaller" + "service_account_id": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "attribute_matchers": { + "additionalProperties": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "number" + } + ] + } + ] + }, + "type": "object", + "x-oaiTypeLabel": "map" + }, + "permissions": { + "oneOf": [ + { + "$ref": "#/components/schemas/DefaultPermissionsParam" + }, + { + "$ref": "#/components/schemas/RestrictedPermissionsParam" + } + ] + }, + "enabled": { + "type": "boolean" } - ], - "description": "The execution context that produced this tool call.", - "discriminator": { - "propertyName": "type" - } - }, - "FunctionCallStatus": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" + }, + "type": "object", + "required": [ + "project_id", + "service_account_id", + "attribute_matchers" ] }, - "DirectToolCallCallerParam": { + "UpdatePlatformWorkloadIdentityFederationRuleBody": { "properties": { - "type": { - "type": "string", - "enum": [ - "direct" - ], - "description": "The caller type. Always `direct`.", - "default": "direct", - "x-stainless-const": true + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "attribute_matchers": { + "additionalProperties": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "number" + } + ] + } + ] + }, + "type": "object", + "x-oaiTypeLabel": "map" + }, + "permissions": { + "oneOf": [ + { + "$ref": "#/components/schemas/DefaultPermissionsParam" + }, + { + "$ref": "#/components/schemas/RestrictedPermissionsParam" + } + ] + }, + "enabled": { + "type": "boolean" } }, "type": "object", - "required": [ - "type" - ] + "required": [] }, - "ProgramToolCallCallerParam": { + "PlatformFederationRuleDeletedResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "program" + "organization.workload_identity_federation_rule.deleted" ], - "description": "The caller type. Always `program`.", - "default": "program", + "default": "organization.workload_identity_federation_rule.deleted", "x-stainless-const": true }, - "caller_id": { - "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The call ID of the program item that produced this tool call." + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" } }, "type": "object", "required": [ - "type", - "caller_id" - ] - }, - "ToolCallCallerParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/DirectToolCallCallerParam" - }, - { - "$ref": "#/components/schemas/ProgramToolCallCallerParam" - } - ], - "description": "The execution context that produced this tool call.", - "discriminator": { - "propertyName": "type" - } - }, - "FunctionCallOutputStatusEnum": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" - ] - }, - "WebSearchCallStatus": { - "type": "string", - "enum": [ - "in_progress", - "searching", - "completed", - "failed", - "incomplete" + "object", + "id", + "deleted" ] }, - "ImageGenActionEnum": { + "DecisionsUsageBucketWidth": { "type": "string", "enum": [ - "generate", - "edit", - "auto" + "1m", + "1h", + "1d" ] }, - "ImageBackground": { + "DecisionsUsageGroupBy": { "type": "string", "enum": [ - "transparent", - "opaque", - "auto" + "project_id", + "user_id", + "api_key_id", + "model", + "batch", + "service_tier", + "api_source" ] }, - "ImageOutputFormat": { + "DecisionsUsageApiSource": { "type": "string", "enum": [ - "png", - "webp", - "jpeg" + "agents_api", + "unlabeled" ] }, - "ImageGenToolCall": { + "DecisionsUsageResult": { "properties": { - "type": { + "api_source": { + "anyOf": [ + { + "$ref": "#/components/schemas/DecisionsUsageApiSource", + "description": "When grouped by `api_source`, `agents_api` identifies attributed Agents API activity and `unlabeled` includes all records without published source attribution, including historical and unknown origins. Unlabeled does not imply direct API usage. Without source grouping, this field is null." + }, + { + "type": "null" + } + ] + }, + "object": { "type": "string", "enum": [ - "image_generation_call" + "organization.usage.decisions.result" ], - "description": "The type of the image generation call. Always `image_generation_call`.", + "default": "organization.usage.decisions.result", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The unique ID of the image generation call." + "input_tokens": { + "type": "integer", + "description": "The aggregated number of input tokens used, including cached and cache-write tokens. This includes text, audio, and image tokens. For customers subscribed to Scale Tier, this includes Scale Tier tokens." }, - "status": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "generating", - "failed" - ], - "description": "The status of the image generation call." + "input_cached_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of cached input tokens used across text, audio, and image inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens." + }, + { + "type": "null" + } + ] }, - "result": { + "input_cache_write_tokens": { "anyOf": [ { - "type": "string", - "description": "The generated image encoded in base64." + "type": "integer", + "description": "The aggregated number of input tokens written to the cache across 30-minute and 12-hour retention periods." }, { "type": "null" } ] }, - "size": { + "input_cache_write_30m_tokens": { "anyOf": [ { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "1024x1024", - "1024x1536", - "1536x1024" - ] - } - ], - "description": "The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`." + "type": "integer", + "description": "The aggregated number of input tokens written to the cache with a 30-minute retention period." }, { "type": "null" } ] }, - "quality": { + "input_cache_write_12h_tokens": { "anyOf": [ { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "xhigh", - "max", - "auto" - ], - "description": "The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`." + "type": "integer", + "description": "The aggregated number of input tokens written to the cache with a 12-hour retention period." }, { "type": "null" } ] }, - "action": { + "input_uncached_tokens": { "anyOf": [ { - "$ref": "#/components/schemas/ImageGenActionEnum", - "description": "The action used for image generation." + "type": "integer", + "description": "The aggregated number of uncached input tokens used across text, audio, and image inputs, excluding cache-write tokens." }, { "type": "null" } - ], - "x-openai-go-optional-enum": true + ] }, - "background": { + "output_tokens": { + "type": "integer", + "description": "The aggregated number of output tokens used across text, audio, and image outputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens." + }, + "input_text_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of uncached text input tokens used, excluding cache-write tokens." + }, + { + "type": "null" + } + ] + }, + "output_text_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of text output tokens used." + }, + { + "type": "null" + } + ] + }, + "input_cached_text_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of cached text input tokens used." + }, + { + "type": "null" + } + ] + }, + "input_audio_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of uncached audio input tokens used." + }, + { + "type": "null" + } + ] + }, + "input_cached_audio_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of cached audio input tokens used." + }, + { + "type": "null" + } + ] + }, + "output_audio_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of audio output tokens used." + }, + { + "type": "null" + } + ] + }, + "input_image_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of uncached image input tokens used." + }, + { + "type": "null" + } + ] + }, + "input_cached_image_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of cached image input tokens used." + }, + { + "type": "null" + } + ] + }, + "output_image_tokens": { + "anyOf": [ + { + "type": "integer", + "description": "The aggregated number of image output tokens used." + }, + { + "type": "null" + } + ] + }, + "num_model_requests": { + "type": "integer", + "description": "The count of requests made to the model." + }, + "project_id": { "anyOf": [ { - "$ref": "#/components/schemas/ImageBackground", - "description": "The background setting used for generation." + "type": "string", + "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result." }, { "type": "null" } - ], - "x-openai-go-optional-enum": true + ] }, - "output_format": { + "user_id": { "anyOf": [ { - "$ref": "#/components/schemas/ImageOutputFormat", - "description": "The output format used for generation." + "type": "string", + "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result." }, { "type": "null" } - ], - "x-openai-go-optional-enum": true + ] }, - "revised_prompt": { + "api_key_id": { "anyOf": [ { "type": "string", - "description": "The prompt that was used after any model prompt rewriting." + "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result." }, { "type": "null" } ] - } - }, - "type": "object", - "required": [ - "type", - "id", - "status", - "result" - ], - "title": "Image generation call", - "description": "An image generation request made by the model." - }, - "ClickButtonType": { - "type": "string", - "enum": [ - "left", - "right", - "wheel", - "back", - "forward" - ] - }, - "ClickParam": { - "properties": { - "type": { - "type": "string", - "enum": [ - "click" - ], - "description": "Specifies the event type. For a click action, this property is always `click`.", - "default": "click", - "x-stainless-const": true - }, - "button": { - "$ref": "#/components/schemas/ClickButtonType", - "description": "Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`." - }, - "x": { - "type": "integer", - "description": "The x-coordinate where the click occurred." - }, - "y": { - "type": "integer", - "description": "The y-coordinate where the click occurred." }, - "keys": { + "model": { "anyOf": [ { - "items": { - "type": "string" - }, - "type": "array", - "description": "The keys being held while clicking." + "type": "string", + "description": "When `group_by=model`, this field provides the model name of the grouped usage result." }, { "type": "null" } ] - } - }, - "type": "object", - "required": [ - "type", - "button", - "x", - "y" - ], - "title": "Click", - "description": "A click action." - }, - "DoubleClickAction": { - "properties": { - "type": { - "type": "string", - "enum": [ - "double_click" - ], - "description": "Specifies the event type. For a double click action, this property is always set to `double_click`.", - "default": "double_click", - "x-stainless-const": true - }, - "x": { - "type": "integer", - "description": "The x-coordinate where the double click occurred." - }, - "y": { - "type": "integer", - "description": "The y-coordinate where the double click occurred." }, - "keys": { + "batch": { "anyOf": [ { - "items": { - "type": "string" - }, - "type": "array", - "description": "The keys being held while double-clicking." + "type": "boolean", + "description": "When `group_by=batch`, this field tells whether the grouped usage result is batch or not." }, { "type": "null" } ] - } - }, - "type": "object", - "required": [ - "type", - "x", - "y", - "keys" - ], - "title": "DoubleClick", - "description": "A double click action." - }, - "CoordParam": { - "properties": { - "x": { - "type": "integer", - "description": "The x-coordinate." - }, - "y": { - "type": "integer", - "description": "The y-coordinate." - } - }, - "type": "object", - "required": [ - "x", - "y" - ], - "title": "Coordinate", - "description": "An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`." - }, - "DragParam": { - "properties": { - "type": { - "type": "string", - "enum": [ - "drag" - ], - "description": "Specifies the event type. For a drag action, this property is always set to `drag`.", - "default": "drag", - "x-stainless-const": true - }, - "path": { - "items": { - "$ref": "#/components/schemas/CoordParam" - }, - "type": "array", - "description": "An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg\n```\n[\n { x: 100, y: 200 },\n { x: 200, y: 300 }\n]\n```" }, - "keys": { + "service_tier": { "anyOf": [ { - "items": { - "type": "string" - }, - "type": "array", - "description": "The keys being held while dragging the mouse." + "type": "string", + "description": "When `group_by=service_tier`, this field provides the service tier of the grouped usage result." }, { "type": "null" @@ -67409,613 +91914,413 @@ }, "type": "object", "required": [ - "type", - "path" + "object", + "input_tokens", + "output_tokens", + "num_model_requests" ], - "title": "Drag", - "description": "A drag action." + "description": "The aggregated Decisions API usage details of the specific time bucket." }, - "KeyPressAction": { + "DecisionsUsageBucket": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "keypress" + "bucket" ], - "description": "Specifies the event type. For a keypress action, this property is always set to `keypress`.", - "default": "keypress", + "default": "bucket", "x-stainless-const": true }, - "keys": { + "start_time": { + "type": "integer" + }, + "end_time": { + "type": "integer" + }, + "results": { "items": { - "type": "string", - "description": "One of the keys the model is requesting to be pressed." + "$ref": "#/components/schemas/DecisionsUsageResult" }, - "type": "array", - "description": "The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key." + "type": "array" } }, "type": "object", "required": [ - "type", - "keys" - ], - "title": "KeyPress", - "description": "A collection of keypresses the model would like to perform." + "object", + "start_time", + "end_time", + "results" + ] }, - "MoveParam": { + "PublicDecisionsUsageResponseResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "move" + "page" ], - "description": "Specifies the event type. For a move action, this property is always set to `move`.", - "default": "move", + "default": "page", "x-stainless-const": true }, - "x": { - "type": "integer", - "description": "The x-coordinate to move to." - }, - "y": { - "type": "integer", - "description": "The y-coordinate to move to." + "has_more": { + "type": "boolean" }, - "keys": { + "next_page": { "anyOf": [ { - "items": { - "type": "string" - }, - "type": "array", - "description": "The keys being held while moving the mouse." + "type": "string" }, { "type": "null" } ] + }, + "data": { + "items": { + "$ref": "#/components/schemas/DecisionsUsageBucket" + }, + "type": "array" } }, "type": "object", "required": [ - "type", - "x", - "y" - ], - "title": "Move", - "description": "A mouse move action." - }, - "ScreenshotParam": { - "properties": { - "type": { - "type": "string", - "enum": [ - "screenshot" - ], - "description": "Specifies the event type. For a screenshot action, this property is always set to `screenshot`.", - "default": "screenshot", - "x-stainless-const": true - } - }, - "type": "object", - "required": [ - "type" - ], - "title": "Screenshot", - "description": "A screenshot action." + "object", + "has_more", + "next_page", + "data" + ] }, - "ScrollParam": { + "DecisionsUsageErrorDetails": { "properties": { - "type": { - "type": "string", - "enum": [ - "scroll" - ], - "description": "Specifies the event type. For a scroll action, this property is always set to `scroll`.", - "default": "scroll", - "x-stainless-const": true - }, - "x": { - "type": "integer", - "description": "The x-coordinate where the scroll occurred." - }, - "y": { - "type": "integer", - "description": "The y-coordinate where the scroll occurred." - }, - "scroll_x": { - "type": "integer", - "description": "The horizontal scroll distance." + "code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] }, - "scroll_y": { - "type": "integer", - "description": "The vertical scroll distance." + "message": { + "type": "string" }, - "keys": { + "param": { "anyOf": [ { - "items": { - "type": "string" - }, - "type": "array", - "description": "The keys being held while scrolling." + "type": "string" }, { "type": "null" } ] - } - }, - "type": "object", - "required": [ - "type", - "x", - "y", - "scroll_x", - "scroll_y" - ], - "title": "Scroll", - "description": "A scroll action." - }, - "TypeParam": { - "properties": { - "type": { - "type": "string", - "enum": [ - "type" - ], - "description": "Specifies the event type. For a type action, this property is always set to `type`.", - "default": "type", - "x-stainless-const": true }, - "text": { - "type": "string", - "description": "The text to type." + "type": { + "type": "string" } }, "type": "object", "required": [ - "type", - "text" - ], - "title": "Type", - "description": "An action to type in text." + "code", + "message", + "param", + "type" + ] }, - "WaitParam": { + "DecisionsUsageErrorResponse": { "properties": { - "type": { - "type": "string", - "enum": [ - "wait" - ], - "description": "Specifies the event type. For a wait action, this property is always set to `wait`.", - "default": "wait", - "x-stainless-const": true + "error": { + "$ref": "#/components/schemas/DecisionsUsageErrorDetails" } }, "type": "object", "required": [ - "type" - ], - "title": "Wait", - "description": "A wait action." + "error" + ] }, - "ComputerCallSafetyCheckParam": { + "DecisionsUsagePermissionErrorResponse": { "properties": { - "id": { - "type": "string", - "description": "The ID of the pending safety check." - }, - "code": { - "anyOf": [ + "error": { + "oneOf": [ { - "type": "string", - "description": "The type of the pending safety check." + "$ref": "#/components/schemas/DecisionsUsageErrorDetails" }, - { - "type": "null" - } - ] - }, - "message": { - "anyOf": [ { "type": "string", - "description": "Details about the pending safety check." - }, - { - "type": "null" + "description": "An explanation of the missing API permissions." } - ] + ], + "description": "Details about the permission error." } }, "type": "object", "required": [ - "id" - ], - "description": "A pending safety check for the computer call." + "error" + ] }, - "ComputerCallOutputStatus": { + "ExternalStorageOrder": { "type": "string", "enum": [ - "completed", - "incomplete", - "failed" + "asc", + "desc" ] }, - "ToolSearchExecutionType": { + "ExternalStorageStatus": { "type": "string", "enum": [ - "server", - "client" + "pending", + "validated", + "degraded", + "unhealthy" ] }, - "ToolSearchCall": { + "ExternalStorageResponse": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "tool_search_call" + "organization.external_storage" ], - "description": "The type of the item. Always `tool_search_call`.", - "default": "tool_search_call", + "default": "organization.external_storage", "x-stainless-const": true }, "id": { - "type": "string", - "description": "The unique ID of the tool search call item." + "type": "string" }, - "call_id": { - "anyOf": [ + "project_id": { + "type": "string" + }, + "provider": { + "oneOf": [ { - "type": "string", - "description": "The unique ID of the tool search call generated by the model." + "$ref": "#/components/schemas/AwsExternalStorageProviderResponse" }, { - "type": "null" + "$ref": "#/components/schemas/AzureExternalStorageProviderResponse" + }, + { + "$ref": "#/components/schemas/GcpExternalStorageProviderResponse" + }, + { + "$ref": "#/components/schemas/OciExternalStorageProviderResponse" } - ] - }, - "execution": { - "$ref": "#/components/schemas/ToolSearchExecutionType", - "description": "Whether tool search was executed by the server or by the client." + ], + "discriminator": { + "propertyName": "type" + } }, - "arguments": { - "description": "Arguments used for the tool search call." + "geography": { + "type": "string" }, "status": { - "$ref": "#/components/schemas/FunctionCallStatus", - "description": "The status of the tool search call item that was recorded." + "$ref": "#/components/schemas/ExternalStorageStatus" }, - "created_by": { - "type": "string", - "description": "The identifier of the actor that created the item." + "created_at": { + "type": "integer", + "format": "unixtime" } }, "type": "object", "required": [ - "type", + "object", "id", - "call_id", - "execution", - "arguments", - "status" - ] - }, - "CallableToolAllowedCaller": { - "type": "string", - "enum": [ - "direct", - "programmatic" + "project_id", + "provider", + "geography", + "status", + "created_at" ] }, - "FunctionTool": { + "ExternalStorageListResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "function" + "list" ], - "description": "The type of the function tool. Always `function`.", - "default": "function", + "default": "list", "x-stainless-const": true }, - "name": { - "type": "string", - "description": "The name of the function to call." - }, - "async": { - "type": "boolean" - }, - "description": { - "anyOf": [ - { - "type": "string", - "description": "A description of the function. Used by the model to determine whether or not to call the function." - }, - { - "type": "null" - } - ] - }, - "parameters": { - "anyOf": [ - { - "additionalProperties": {}, - "type": "object", - "description": "A JSON schema object describing the parameters of the function.", - "x-oaiTypeLabel": "map" - }, - { - "type": "null" - } - ] - }, - "output_schema": { - "anyOf": [ - { - "additionalProperties": {}, - "type": "object", - "description": "A JSON schema object describing the JSON value encoded in string outputs for this function.", - "x-oaiTypeLabel": "map" - }, - { - "type": "null" - } - ] - }, - "strict": { + "data": { + "items": { + "$ref": "#/components/schemas/ExternalStorageResponse" + }, + "type": "array" + }, + "first_id": { "anyOf": [ { - "type": "boolean", - "description": "Whether strict parameter validation is enforced for this function tool." + "type": "string" }, { "type": "null" } ] }, - "defer_loading": { - "type": "boolean", - "description": "Whether this function is deferred and loaded via tool search." - }, - "allowed_callers": { + "last_id": { "anyOf": [ { - "items": { - "$ref": "#/components/schemas/CallableToolAllowedCaller" - }, - "type": "array", - "description": "The tool invocation context(s)." + "type": "string" }, { "type": "null" } ] - } - }, - "type": "object", - "required": [ - "type", - "name", - "strict", - "parameters" - ], - "title": "Function", - "description": "Defines a function in your own code the model can choose to call. Learn more about [function calling](https://developers.openai.com/api/docs/guides/function-calling)." - }, - "RankerVersionType": { - "type": "string", - "enum": [ - "auto", - "default-2024-11-15" - ] - }, - "HybridSearchOptions": { - "properties": { - "embedding_weight": { - "type": "number", - "description": "The weight of the embedding in the reciprocal ranking fusion." }, - "text_weight": { - "type": "number", - "description": "The weight of the text in the reciprocal ranking fusion." + "has_more": { + "type": "boolean" } }, "type": "object", "required": [ - "embedding_weight", - "text_weight" + "object", + "data", + "first_id", + "last_id", + "has_more" ] }, - "RankingOptions": { + "AwsExternalStorageProviderParams": { "properties": { - "ranker": { - "$ref": "#/components/schemas/RankerVersionType", - "description": "The ranker to use for the file search." + "type": { + "type": "string", + "enum": [ + "aws" + ], + "default": "aws", + "x-stainless-const": true }, - "score_threshold": { - "type": "number", - "description": "The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results." + "bucket": { + "type": "string" }, - "hybrid_search": { - "$ref": "#/components/schemas/HybridSearchOptions", - "description": "Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled." + "role_arn": { + "type": "string" } }, "type": "object", - "required": [] - }, - "Filters": { - "anyOf": [ - { - "$ref": "#/components/schemas/ComparisonFilter" - }, - { - "$ref": "#/components/schemas/CompoundFilter" - } + "required": [ + "type", + "bucket", + "role_arn" ] }, - "FileSearchTool": { + "AzureExternalStorageProviderParams": { "properties": { "type": { "type": "string", "enum": [ - "file_search" + "azure" ], - "description": "The type of the file search tool. Always `file_search`.", - "default": "file_search", + "default": "azure", "x-stainless-const": true }, - "vector_store_ids": { - "items": { - "type": "string" - }, - "type": "array", - "description": "The IDs of the vector stores to search." + "tenant_id": { + "type": "string" }, - "max_num_results": { - "type": "integer", - "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive." + "subscription_id": { + "type": "string" }, - "ranking_options": { - "$ref": "#/components/schemas/RankingOptions", - "description": "Ranking options for search." + "resource_group": { + "type": "string" }, - "filters": { - "anyOf": [ - { - "$ref": "#/components/schemas/Filters", - "description": "A filter to apply." - }, - { - "type": "null" - } - ] + "account_name": { + "type": "string" + }, + "container": { + "type": "string" } }, "type": "object", "required": [ "type", - "vector_store_ids" - ], - "title": "File search", - "description": "A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://developers.openai.com/api/docs/guides/tools-file-search)." + "tenant_id", + "subscription_id", + "resource_group", + "account_name", + "container" + ] }, - "ComputerTool": { + "GcpExternalStorageProviderParams": { "properties": { "type": { "type": "string", "enum": [ - "computer" + "gcp" ], - "description": "The type of the computer tool. Always `computer`.", - "default": "computer", + "default": "gcp", "x-stainless-const": true + }, + "bucket": { + "type": "string" + }, + "workload_identity_project_number": { + "type": "string" + }, + "workload_identity_pool_id": { + "type": "string" + }, + "workload_identity_provider_id": { + "type": "string" } }, "type": "object", "required": [ - "type" - ], - "title": "Computer", - "description": "A tool that controls a virtual computer. Learn more about the [computer tool](https://developers.openai.com/api/docs/guides/tools-computer-use)." - }, - "ComputerEnvironment": { - "type": "string", - "enum": [ - "windows", - "mac", - "linux", - "ubuntu", - "browser" + "type", + "bucket", + "workload_identity_project_number", + "workload_identity_pool_id", + "workload_identity_provider_id" ] }, - "ComputerUsePreviewTool": { + "OciExternalStorageProviderParams": { "properties": { "type": { "type": "string", "enum": [ - "computer_use_preview" + "oci" ], - "description": "The type of the computer use tool. Always `computer_use_preview`.", - "default": "computer_use_preview", + "default": "oci", "x-stainless-const": true }, - "environment": { - "$ref": "#/components/schemas/ComputerEnvironment", - "description": "The type of computer environment to control." + "tenancy_ocid": { + "type": "string" }, - "display_width": { - "type": "integer", - "description": "The width of the computer display." + "region": { + "type": "string" }, - "display_height": { - "type": "integer", - "description": "The height of the computer display." + "bucket": { + "type": "string" } }, "type": "object", "required": [ "type", - "environment", - "display_width", - "display_height" - ], - "title": "Computer use preview", - "description": "A tool that controls a virtual computer. Learn more about the [computer tool](https://developers.openai.com/api/docs/guides/tools-computer-use)." - }, - "ContainerMemoryLimit": { - "type": "string", - "enum": [ - "1g", - "4g", - "16g", - "64g" + "tenancy_ocid", + "region", + "bucket" ] }, - "AutoCodeInterpreterToolParam": { + "CreateExternalStorageBody": { "properties": { - "type": { + "project_id": { "type": "string", - "enum": [ - "auto" - ], - "description": "Always `auto`.", - "default": "auto", - "x-stainless-const": true + "example": "proj_123" }, - "file_ids": { - "items": { - "type": "string", - "example": "file-123" - }, - "type": "array", - "maxItems": 50, - "description": "An optional list of uploaded files to make available to your code." - }, - "memory_limit": { - "anyOf": [ + "provider": { + "oneOf": [ { - "$ref": "#/components/schemas/ContainerMemoryLimit", - "description": "The memory limit for the code interpreter container." + "$ref": "#/components/schemas/AwsExternalStorageProviderParams" }, { - "type": "null" - } - ] - }, - "network_policy": { - "oneOf": [ + "$ref": "#/components/schemas/AzureExternalStorageProviderParams" + }, { - "$ref": "#/components/schemas/ContainerNetworkPolicyDisabledParam" + "$ref": "#/components/schemas/GcpExternalStorageProviderParams" }, { - "$ref": "#/components/schemas/ContainerNetworkPolicyAllowlistParam" + "$ref": "#/components/schemas/OciExternalStorageProviderParams" } ], - "description": "Network access policy for the container.", "discriminator": { "propertyName": "type" } @@ -68023,547 +92328,388 @@ }, "type": "object", "required": [ - "type" - ], - "title": "CodeInterpreterToolAuto", - "description": "Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on." + "project_id", + "provider" + ] }, - "ProgrammaticToolCallingParam": { + "ExternalStorageDeletedResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "programmatic_tool_calling" + "organization.external_storage.deleted" ], - "description": "The type of the tool. Always `programmatic_tool_calling`.", - "default": "programmatic_tool_calling", + "default": "organization.external_storage.deleted", "x-stainless-const": true + }, + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean" } }, "type": "object", "required": [ - "type" + "object", + "id", + "deleted" ] }, - "InputFidelity": { - "type": "string", - "enum": [ - "high", - "low" - ], - "description": "Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`." + "SpendLimitCurrency": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "USD" + ] + } + ] }, - "LocalShellToolParam": { - "properties": { - "type": { + "SpendLimitInterval": { + "anyOf": [ + { + "type": "string" + }, + { "type": "string", "enum": [ - "local_shell" - ], - "description": "The type of the local shell tool. Always `local_shell`.", - "default": "local_shell", - "x-stainless-const": true + "month" + ] + } + ] + }, + "SpendLimitEnforcementStatus": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "inactive", + "enforcing" + ] + } + ] + }, + "SpendLimitEnforcement": { + "properties": { + "status": { + "$ref": "#/components/schemas/SpendLimitEnforcementStatus", + "description": "Whether the hard spend limit is currently enforcing." } }, "type": "object", "required": [ - "type" + "status" ], - "title": "Local shell tool", - "description": "A tool that allows the model to execute shell commands in a local environment." + "description": "The current enforcement state of a hard spend limit." }, - "ContainerAutoParam": { + "OrganizationSpendLimitResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "container_auto" + "organization.spend_limit" ], - "description": "Automatically creates a container for this request", - "default": "container_auto", + "description": "The object type, which is always `organization.spend_limit`.", + "default": "organization.spend_limit", "x-stainless-const": true }, - "file_ids": { - "items": { - "type": "string", - "example": "file-123" - }, - "type": "array", - "maxItems": 50, - "description": "An optional list of uploaded files to make available to your code." + "threshold_amount": { + "type": "integer", + "description": "The hard spend limit amount, in cents." }, - "memory_limit": { - "anyOf": [ - { - "$ref": "#/components/schemas/ContainerMemoryLimit", - "description": "The memory limit for the container." - }, - { - "type": "null" - } - ] + "currency": { + "$ref": "#/components/schemas/SpendLimitCurrency", + "description": "The currency for the threshold amount. Currently, only `USD` is supported." }, - "network_policy": { - "oneOf": [ - { - "$ref": "#/components/schemas/ContainerNetworkPolicyDisabledParam" - }, - { - "$ref": "#/components/schemas/ContainerNetworkPolicyAllowlistParam" - } - ], - "description": "Network access policy for the container.", - "discriminator": { - "propertyName": "type" - } + "interval": { + "$ref": "#/components/schemas/SpendLimitInterval", + "description": "The time interval for evaluating spend against the threshold. Currently, only `month` is supported." }, - "skills": { - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/SkillReferenceParam" - }, - { - "$ref": "#/components/schemas/InlineSkillParam" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "type": "array", - "maxItems": 200, - "description": "An optional list of skills referenced by id or inline data." + "enforcement": { + "$ref": "#/components/schemas/SpendLimitEnforcement", + "description": "The current enforcement state of the hard spend limit." } }, "type": "object", "required": [ - "type" - ] + "object", + "threshold_amount", + "currency", + "interval", + "enforcement" + ], + "description": "Represents a hard spend limit configured at the organization level." }, - "LocalSkillParam": { + "UpdateOrganizationSpendLimitBody": { "properties": { - "name": { - "type": "string", - "description": "The name of the skill." + "threshold_amount": { + "type": "integer", + "minimum": 1, + "description": "The hard spend limit amount, in cents." }, - "description": { + "currency": { "type": "string", - "description": "The description of the skill." + "enum": [ + "USD" + ], + "description": "The currency for the threshold amount. Currently, only `USD` is supported." }, - "path": { - "type": "string", - "description": "The path to the directory containing the skill." - } - }, - "type": "object", - "required": [ - "name", - "description", - "path" - ] - }, - "LocalEnvironmentParam": { - "properties": { - "type": { + "interval": { "type": "string", "enum": [ - "local" + "month" ], - "description": "Use a local computer environment.", - "default": "local", - "x-stainless-const": true - }, - "skills": { - "items": { - "$ref": "#/components/schemas/LocalSkillParam" - }, - "type": "array", - "maxItems": 200, - "description": "An optional list of skills." + "description": "The time interval for evaluating spend against the threshold. Currently, only `month` is supported." } }, "type": "object", "required": [ - "type" - ] + "threshold_amount", + "currency", + "interval" + ], + "description": "Parameters for the hard spend limit you want to create or replace." }, - "ContainerReferenceParam": { + "OrganizationSpendLimitDeletedResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "container_reference" + "organization.spend_limit.deleted" ], - "description": "References a container created with the /v1/containers endpoint", - "default": "container_reference", + "description": "The object type, which is always `organization.spend_limit.deleted`.", + "default": "organization.spend_limit.deleted", "x-stainless-const": true }, - "container_id": { - "type": "string", - "description": "The ID of the referenced container.", - "example": "cntr_123" + "deleted": { + "type": "boolean", + "description": "Whether the hard spend limit was deleted." } }, "type": "object", "required": [ - "type", - "container_id" - ] + "object", + "deleted" + ], + "description": "Confirmation payload returned after deleting an organization hard spend limit." }, - "FunctionShellToolParam": { + "ProjectSpendLimitResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "shell" + "project.spend_limit" ], - "description": "The type of the shell tool. Always `shell`.", - "default": "shell", + "description": "The object type, which is always `project.spend_limit`.", + "default": "project.spend_limit", "x-stainless-const": true }, - "environment": { - "anyOf": [ - { - "oneOf": [ - { - "$ref": "#/components/schemas/ContainerAutoParam" - }, - { - "$ref": "#/components/schemas/LocalEnvironmentParam" - }, - { - "$ref": "#/components/schemas/ContainerReferenceParam" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - { - "type": "null" - } - ] + "threshold_amount": { + "type": "integer", + "description": "The hard spend limit amount, in cents." }, - "allowed_callers": { - "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/CallableToolAllowedCaller" - }, - "type": "array", - "minItems": 1, - "description": "The tool invocation context(s)." - }, - { - "type": "null" - } - ] + "currency": { + "$ref": "#/components/schemas/SpendLimitCurrency", + "description": "The currency for the threshold amount. Currently, only `USD` is supported." + }, + "interval": { + "$ref": "#/components/schemas/SpendLimitInterval", + "description": "The time interval for evaluating spend against the threshold. Currently, only `month` is supported." + }, + "enforcement": { + "$ref": "#/components/schemas/SpendLimitEnforcement", + "description": "The current enforcement state of the hard spend limit." } }, "type": "object", "required": [ - "type" + "object", + "threshold_amount", + "currency", + "interval", + "enforcement" ], - "title": "Shell tool", - "description": "A tool that allows the model to execute shell commands." + "description": "Represents a hard spend limit configured at the project level." }, - "CustomTextFormatParam": { + "UpdateProjectSpendLimitBody": { "properties": { - "type": { + "threshold_amount": { + "type": "integer", + "minimum": 1, + "description": "The hard spend limit amount, in cents." + }, + "currency": { "type": "string", "enum": [ - "text" + "USD" ], - "description": "Unconstrained text format. Always `text`.", - "default": "text", - "x-stainless-const": true + "description": "The currency for the threshold amount. Currently, only `USD` is supported." + }, + "interval": { + "type": "string", + "enum": [ + "month" + ], + "description": "The time interval for evaluating spend against the threshold. Currently, only `month` is supported." } }, "type": "object", "required": [ - "type" + "threshold_amount", + "currency", + "interval" ], - "title": "Text format", - "description": "Unconstrained free-form text." - }, - "GrammarSyntax1": { - "type": "string", - "enum": [ - "lark", - "regex" - ] + "description": "Parameters for the hard spend limit you want to create or replace." }, - "CustomGrammarFormatParam": { + "ProjectSpendLimitDeletedResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "grammar" + "project.spend_limit.deleted" ], - "description": "Grammar format. Always `grammar`.", - "default": "grammar", + "description": "The object type, which is always `project.spend_limit.deleted`.", + "default": "project.spend_limit.deleted", "x-stainless-const": true }, - "syntax": { - "$ref": "#/components/schemas/GrammarSyntax1", - "description": "The syntax of the grammar definition. One of `lark` or `regex`." - }, - "definition": { - "type": "string", - "description": "The grammar definition." + "deleted": { + "type": "boolean", + "description": "Whether the hard spend limit was deleted." } }, "type": "object", "required": [ - "type", - "syntax", - "definition" + "object", + "deleted" ], - "title": "Grammar format", - "description": "A grammar defined by the user." + "description": "Confirmation payload returned after deleting a project hard spend limit." }, - "CustomToolParam": { + "ProjectDefaultServiceTier": { + "type": "string", + "enum": [ + "standard", + "fast", + "scale" + ] + }, + "ProjectOptionalServiceTier": { + "type": "string", + "enum": [ + "flex", + "fast", + "ultrafast" + ] + }, + "ProjectServiceTierSettingsResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "custom" + "project.service_tier_settings" ], - "description": "The type of the custom tool. Always `custom`.", - "default": "custom", + "default": "project.service_tier_settings", "x-stainless-const": true }, - "name": { - "type": "string", - "description": "The name of the custom tool, used to identify it in tool calls." - }, - "async": { - "type": "boolean", - "description": "Whether the tool response can be returned asynchronously versus immediately returned on next response creation." - }, - "description": { - "type": "string", - "description": "Optional description of the custom tool, used to provide more context." + "default": { + "$ref": "#/components/schemas/ProjectDefaultServiceTier", + "description": "Default tier for requests that omit service_tier or use auto." }, - "format": { + "enabled_tiers": { "oneOf": [ { - "$ref": "#/components/schemas/CustomTextFormatParam" + "type": "string", + "enum": [ + "all" + ], + "default": "all", + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/CustomGrammarFormatParam" - } - ], - "description": "The input format for the custom tool. Default is unconstrained text.", - "discriminator": { - "propertyName": "type" - } - }, - "defer_loading": { - "type": "boolean", - "description": "Whether this tool should be deferred and discovered via tool search." - }, - "allowed_callers": { - "anyOf": [ { "items": { - "$ref": "#/components/schemas/CallableToolAllowedCaller" + "$ref": "#/components/schemas/ProjectOptionalServiceTier" }, - "type": "array", - "minItems": 1, - "description": "The tool invocation context(s)." - }, - { - "type": "null" + "type": "array" } - ] + ], + "description": "Additional service tiers enabled for this project. \"all\" includes future tiers. An empty array allows only Standard. Organization policy and eligibility still apply." } }, "type": "object", "required": [ - "type", - "name" - ], - "title": "Custom tool", - "description": "A custom tool that processes input using a specified format. Learn more about [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools)" - }, - "EmptyModelParam": { - "properties": {}, - "type": "object", - "required": [] + "object", + "default", + "enabled_tiers" + ] }, - "FunctionToolParam": { - "properties": { - "name": { - "type": "string", - "maxLength": 128, - "minLength": 1, - "pattern": "^[a-zA-Z0-9_-]+$" - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "parameters": { - "anyOf": [ - { - "$ref": "#/components/schemas/EmptyModelParam" - }, - { - "type": "null" - } + "UpdateProjectServiceTierSettingsBody": { + "anyOf": [ + { + "required": [ + "default" ] }, - "strict": { - "anyOf": [ - { - "type": "boolean", - "description": "Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise." - }, - { - "type": "null" - } + { + "required": [ + "enabled_tiers" ] + } + ], + "properties": { + "default": { + "$ref": "#/components/schemas/ProjectDefaultServiceTier", + "description": "Default tier for requests that omit service_tier or use auto." }, - "type": { - "type": "string", - "enum": [ - "function" - ], - "default": "function", - "x-stainless-const": true - }, - "async": { - "type": "boolean", - "description": "Whether the tool response can be returned asynchronously versus immediately returned on next response creation." - }, - "output_schema": { - "anyOf": [ + "enabled_tiers": { + "oneOf": [ { - "additionalProperties": {}, - "type": "object", - "description": "A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.", - "x-oaiTypeLabel": "map" + "type": "string", + "enum": [ + "all" + ], + "default": "all", + "x-stainless-const": true }, - { - "type": "null" - } - ] - }, - "defer_loading": { - "type": "boolean", - "description": "Whether this function should be deferred and discovered via tool search." - }, - "allowed_callers": { - "anyOf": [ { "items": { - "$ref": "#/components/schemas/CallableToolAllowedCaller" + "$ref": "#/components/schemas/ProjectOptionalServiceTier" }, - "type": "array", - "minItems": 1, - "description": "The tool invocation context(s)." - }, - { - "type": "null" + "type": "array" } - ] + ], + "description": "Additional service tiers enabled for this project. \"all\" includes future tiers. An empty array allows only Standard. Organization policy and eligibility still apply." } }, "type": "object", - "required": [ - "name", - "type" - ] + "required": [] }, - "NamespaceToolParam": { + "CreateProjectServiceAccountApiKeyBody": { "properties": { - "type": { - "type": "string", - "enum": [ - "namespace" - ], - "description": "The type of the tool. Always `namespace`.", - "default": "namespace", - "x-stainless-const": true - }, "name": { "type": "string", - "minLength": 1, - "description": "The namespace name used in tool calls (for example, `crm`)." - }, - "description": { - "type": "string", - "description": "A description of the namespace shown to the model." + "description": "API key name." }, - "tools": { + "scopes": { "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/FunctionToolParam" - }, - { - "$ref": "#/components/schemas/CustomToolParam" - } - ], - "description": "A function or custom tool that belongs to a namespace.", - "discriminator": { - "propertyName": "type" - } + "type": "string", + "description": "API key scope." }, "type": "array", - "minItems": 1, - "description": "The function/custom tools available inside this namespace." - } - }, - "type": "object", - "required": [ - "type", - "name", - "description", - "tools" - ], - "title": "Namespace", - "description": "Groups function/custom tools under a shared namespace." - }, - "ToolSearchToolParam": { - "properties": { - "type": { - "type": "string", - "enum": [ - "tool_search" - ], - "description": "The type of the tool. Always `tool_search`.", - "default": "tool_search", - "x-stainless-const": true - }, - "execution": { - "$ref": "#/components/schemas/ToolSearchExecutionType", - "description": "Whether tool search is executed by the server or by the client." - }, - "description": { - "anyOf": [ - { - "type": "string", - "description": "Description shown to the model for a client-executed tool search tool." - }, - { - "type": "null" - } - ] + "description": "API key scopes." }, - "parameters": { + "expires_in_seconds": { "anyOf": [ { - "$ref": "#/components/schemas/EmptyModelParam", - "description": "Parameter schema for a client-executed tool search tool." + "type": "integer", + "maximum": 31536000, + "minimum": 1, + "description": "Number of seconds until the API key expires." }, { "type": "null" @@ -68572,149 +92718,140 @@ } }, "type": "object", - "required": [ - "type" - ], - "title": "Tool search tool", - "description": "Hosted or BYOT tool search configuration for deferred tools." + "required": [], + "description": "The service account API key create request payload." }, - "ApproximateLocation": { + "ServiceAccountApiKeyBody": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "approximate" + "organization.project.service_account.api_key" ], - "description": "The type of location approximation. Always `approximate`.", - "default": "approximate", + "description": "The object type, which is always `organization.project.service_account.api_key`", + "default": "organization.project.service_account.api_key", "x-stainless-const": true }, - "country": { - "anyOf": [ - { - "type": "string", - "description": "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`." - }, - { - "type": "null" - } - ] + "value": { + "type": "string", + "description": "The unredacted API key value." }, - "region": { - "anyOf": [ - { - "type": "string", - "description": "Free text input for the region of the user, e.g. `California`." - }, - { - "type": "null" - } - ] + "name": { + "type": "string", + "description": "The name of the API key." }, - "city": { - "anyOf": [ - { - "type": "string", - "description": "Free text input for the city of the user, e.g. `San Francisco`." - }, - { - "type": "null" - } - ] + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) when the API key was created." }, - "timezone": { + "expires_at": { "anyOf": [ { - "type": "string", - "description": "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`." + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) when the API key expires, or null if it does not expire." }, { "type": "null" } ] + }, + "id": { + "type": "string", + "description": "The identifier of the API key." } }, "type": "object", "required": [ - "type" + "object", + "value", + "name", + "created_at", + "id" ] }, - "SearchContextSize": { + "CreateContentProvenanceBody": { + "properties": { + "file": { + "type": "string", + "format": "binary", + "description": "The image or audio file to check for supported OpenAI provenance signals." + } + }, + "type": "object", + "required": [ + "file" + ] + }, + "ProvenanceCheckObject": { "type": "string", "enum": [ - "low", - "medium", - "high" + "content_provenance_check" ] }, - "SearchContentType": { + "ProvenanceDetectionResultApi": { "type": "string", "enum": [ - "text", - "image" + "detected", + "not_detected" ] }, - "WebSearchPreviewTool": { + "C2PAValidationStateApi": { + "type": "string", + "enum": [ + "trusted", + "valid", + "invalid", + "not_present" + ] + }, + "C2PAProvenanceResult": { "properties": { "type": { "type": "string", "enum": [ - "web_search_preview", - "web_search_preview_2025_03_11" + "c2pa" ], - "description": "The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.", - "default": "web_search_preview", + "description": "The provenance signal type. Always `c2pa`.", + "default": "c2pa", "x-stainless-const": true }, - "user_location": { + "outcome": { + "$ref": "#/components/schemas/ProvenanceDetectionResultApi", + "description": "Whether a supported OpenAI C2PA provenance signal was detected.\nIf `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect." + }, + "validation_state": { + "$ref": "#/components/schemas/C2PAValidationStateApi", + "description": "The validation status of the C2PA manifest in the uploaded image." + }, + "issuer": { "anyOf": [ { - "$ref": "#/components/schemas/ApproximateLocation", - "description": "The user's location." + "type": "string", + "description": "The C2PA manifest issuer, when available." }, { "type": "null" } ] }, - "search_context_size": { - "$ref": "#/components/schemas/SearchContextSize", - "description": "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default." - }, - "search_content_types": { - "items": { - "$ref": "#/components/schemas/SearchContentType" - }, - "type": "array" - } - }, - "type": "object", - "required": [ - "type" - ], - "title": "Web search preview", - "description": "This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search)." - }, - "ApplyPatchToolParam": { - "properties": { - "type": { - "type": "string", - "enum": [ - "apply_patch" - ], - "description": "The type of the tool. Always `apply_patch`.", - "default": "apply_patch", - "x-stainless-const": true + "model": { + "anyOf": [ + { + "type": "string", + "description": "The OpenAI model recorded by the provenance signal, when available." + }, + { + "type": "null" + } + ] }, - "allowed_callers": { + "generated_at": { "anyOf": [ { - "items": { - "$ref": "#/components/schemas/CallableToolAllowedCaller" - }, - "type": "array", - "minItems": 1, - "description": "The tool invocation context(s)." + "type": "string", + "description": "The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available." }, { "type": "null" @@ -68723,319 +92860,276 @@ } }, "type": "object", - "required": [ - "type" - ], - "title": "Apply patch tool", - "description": "Allows the assistant to create, delete, or update files using unified diffs." + "required": [ + "type", + "outcome", + "validation_state", + "issuer", + "model", + "generated_at" + ] }, - "ToolSearchOutput": { + "SynthIDProvenanceResult": { "properties": { "type": { "type": "string", "enum": [ - "tool_search_output" + "synthid" ], - "description": "The type of the item. Always `tool_search_output`.", - "default": "tool_search_output", + "description": "The provenance signal type. Always `synthid`.", + "default": "synthid", "x-stainless-const": true }, - "id": { - "type": "string", - "description": "The unique ID of the tool search output item." + "outcome": { + "$ref": "#/components/schemas/ProvenanceDetectionResultApi", + "description": "Whether a supported OpenAI SynthID watermark was detected.\nIf `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect." }, - "call_id": { + "model": { "anyOf": [ { "type": "string", - "description": "The unique ID of the tool search call generated by the model." + "description": "The OpenAI model recorded by the provenance signal, when available." }, { "type": "null" } ] }, - "execution": { - "$ref": "#/components/schemas/ToolSearchExecutionType", - "description": "Whether tool search was executed by the server or by the client." - }, - "tools": { - "items": { - "$ref": "#/components/schemas/Tool" - }, - "type": "array", - "description": "The loaded tool definitions returned by tool search." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallOutputStatusEnum", - "description": "The status of the tool search output item that was recorded." - }, - "created_by": { - "type": "string", - "description": "The identifier of the actor that created the item." + "generated_at": { + "anyOf": [ + { + "type": "string", + "description": "The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available." + }, + { + "type": "null" + } + ] } }, "type": "object", "required": [ "type", - "id", - "call_id", - "execution", - "tools", - "status" + "outcome", + "model", + "generated_at" ] }, - "AdditionalTools": { + "ProvenanceResource": { "properties": { - "type": { - "type": "string", - "enum": [ - "additional_tools" - ], - "description": "The type of the item. Always `additional_tools`.", - "default": "additional_tools", - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The unique ID of the additional tools item." + "object": { + "$ref": "#/components/schemas/ProvenanceCheckObject", + "description": "The object type. Always `content_provenance_check` for this endpoint." }, - "role": { - "$ref": "#/components/schemas/MessageRole", - "description": "The role that provided the additional tools." + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, when the provenance check was created." }, - "tools": { + "results": { "items": { - "$ref": "#/components/schemas/Tool" + "oneOf": [ + { + "$ref": "#/components/schemas/C2PAProvenanceResult" + }, + { + "$ref": "#/components/schemas/SynthIDProvenanceResult" + } + ], + "discriminator": { + "propertyName": "type" + } }, "type": "array", - "description": "The additional tool definitions made available at this item." + "description": "The provenance results that apply to the uploaded file. Image results include C2PA and SynthID; audio results include SynthID." } }, "type": "object", "required": [ - "type", - "id", - "role", - "tools" + "object", + "created_at", + "results" ] }, - "Program": { - "properties": { - "type": { - "type": "string", - "enum": [ - "program" - ], - "description": "The type of the item. Always `program`.", - "default": "program", - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The unique ID of the program item." - }, - "call_id": { - "type": "string", - "description": "The stable call ID of the program item." - }, - "code": { - "type": "string", - "description": "The JavaScript source executed by programmatic tool calling." + "VideoModel": { + "anyOf": [ + { + "type": "string" }, - "fingerprint": { + { "type": "string", - "description": "Opaque program replay fingerprint that must be round-tripped." + "enum": [ + "sora-2", + "sora-2-pro", + "sora-2-2025-10-06", + "sora-2-pro-2025-10-06", + "sora-2-2025-12-08" + ] } - }, - "type": "object", - "required": [ - "type", - "id", - "call_id", - "code", - "fingerprint" ] }, - "ProgramOutputStatus": { + "VideoStatus": { "type": "string", "enum": [ + "queued", + "in_progress", "completed", - "incomplete" + "failed" ] }, - "ProgramOutput": { - "properties": { - "type": { - "type": "string", - "enum": [ - "program_output" - ], - "description": "The type of the item. Always `program_output`.", - "default": "program_output", - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The unique ID of the program output item." - }, - "call_id": { - "type": "string", - "description": "The call ID of the program item." - }, - "result": { - "type": "string", - "description": "The result produced by the program item." - }, - "status": { - "$ref": "#/components/schemas/ProgramOutputStatus", - "description": "The terminal status of the program output item." - } - }, - "type": "object", - "required": [ - "type", - "id", - "call_id", - "result", - "status" + "VideoSize": { + "type": "string", + "enum": [ + "720x1280", + "1280x720", + "1024x1792", + "1792x1024" ] }, - "CompactionBody": { + "Error-2": { "properties": { - "type": { + "code": { "type": "string", - "enum": [ - "compaction" - ], - "description": "The type of the item. Always `compaction`.", - "default": "compaction", - "x-stainless-const": true + "description": "A machine-readable error code that was returned." }, - "id": { - "type": "string", - "description": "The unique ID of the compaction item." + "type": { + "anyOf": [ + { + "type": "string", + "description": "The original error type, or null if it was not recorded." + }, + { + "type": "null" + } + ] }, - "encrypted_content": { - "type": "string", - "description": "The encrypted content that was produced by compaction." + "param": { + "anyOf": [ + { + "type": "string", + "description": "The request parameter associated with the error, or null if none was recorded." + }, + { + "type": "null" + } + ] }, - "created_by": { - "type": "string", - "description": "The identifier of the actor that created the item." - } - }, - "type": "object", - "required": [ - "type", - "id", - "encrypted_content" - ], - "title": "Compaction item", - "description": "A compaction item generated by the [`v1/responses/compact` API](https://developers.openai.com/api/reference/resources/responses/methods/compact)." - }, - "CodeInterpreterOutputLogs": { - "properties": { - "type": { + "message": { "type": "string", - "enum": [ - "logs" - ], - "description": "The type of the output. Always `logs`.", - "default": "logs", - "x-stainless-const": true + "description": "A human-readable description of the error that was returned." }, - "logs": { - "type": "string", - "description": "The logs output from the code interpreter." + "headers": { + "additionalProperties": { + "type": "string", + "description": "The retry header value." + }, + "type": "object", + "description": "The Retry-After and Retry-After-Ms headers returned with the original error, if any.", + "x-oaiTypeLabel": "map" + }, + "misalignment": { + "$ref": "#/components/schemas/MisalignmentErrorDetailsResource" } }, "type": "object", "required": [ - "type", - "logs" + "code", + "message" ], - "title": "Code interpreter output logs", - "description": "The logs output from the code interpreter." + "title": "Error", + "description": "An error that occurred while generating the response." }, - "CodeInterpreterOutputImage": { + "VideoResource": { "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "image" - ], - "description": "The type of the output. Always `image`.", - "default": "image", - "x-stainless-const": true + "description": "Unique identifier for the video job." }, - "url": { - "type": "string", - "format": "uri", - "description": "The URL of the image output from the code interpreter." - } - }, - "type": "object", - "required": [ - "type", - "url" - ], - "title": "Code interpreter output image", - "description": "The image output from the code interpreter." - }, - "LocalShellExecAction": { - "properties": { - "type": { + "object": { "type": "string", "enum": [ - "exec" + "video" ], - "description": "The type of the local shell action. Always `exec`.", - "default": "exec", + "description": "The object type, which is always `video`.", + "default": "video", "x-stainless-const": true }, - "command": { - "items": { - "type": "string" - }, - "type": "array", - "description": "The command to run." + "model": { + "$ref": "#/components/schemas/VideoModel", + "description": "The video generation model that produced the job." }, - "timeout_ms": { + "status": { + "$ref": "#/components/schemas/VideoStatus", + "description": "Current lifecycle status of the video job." + }, + "progress": { + "type": "integer", + "description": "Approximate completion percentage for the generation task." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (seconds) for when the job was created." + }, + "completed_at": { "anyOf": [ { "type": "integer", - "description": "Optional timeout in milliseconds for the command." + "format": "unixtime", + "description": "Unix timestamp (seconds) for when the job completed, if finished." }, { "type": "null" } ] }, - "working_directory": { + "expires_at": { + "anyOf": [ + { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (seconds) for when the downloadable assets expire, if set." + }, + { + "type": "null" + } + ] + }, + "prompt": { "anyOf": [ { "type": "string", - "description": "Optional working directory to run the command in." + "description": "The prompt that was used to generate the video." }, { "type": "null" } ] }, - "env": { - "additionalProperties": { - "type": "string" - }, - "type": "object", - "description": "Environment variables to set for the command.", - "x-oaiTypeLabel": "map" + "size": { + "$ref": "#/components/schemas/VideoSize", + "description": "The resolution of the generated video." }, - "user": { + "seconds": { + "type": "string", + "description": "Duration of the generated clip in seconds. For extensions, this is the stitched total duration." + }, + "remixed_from_video_id": { "anyOf": [ { "type": "string", - "description": "Optional user to run the command as." + "description": "Identifier of the source video if this video is a remix." + }, + { + "type": "null" + } + ] + }, + "error": { + "anyOf": [ + { + "$ref": "#/components/schemas/Error-2", + "description": "Error payload that explains why generation failed, if applicable." }, { "type": "null" @@ -69045,1391 +93139,1877 @@ }, "type": "object", "required": [ - "type", - "command", - "env" + "id", + "object", + "model", + "status", + "progress", + "created_at", + "completed_at", + "expires_at", + "prompt", + "size", + "seconds", + "remixed_from_video_id", + "error" ], - "title": "Local shell exec action", - "description": "Execute a shell command on the server." + "title": "Video job", + "description": "Structured information describing a generated video job." }, - "FunctionShellAction": { + "VideoListResource": { "properties": { - "commands": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object returned, must be `list`.", + "default": "list", + "x-stainless-const": true + }, + "data": { "items": { - "type": "string", - "description": "A list of commands to run." + "$ref": "#/components/schemas/VideoResource" }, - "type": "array" + "type": "array", + "description": "A list of items" }, - "timeout_ms": { + "first_id": { "anyOf": [ { - "type": "integer", - "description": "Optional timeout in milliseconds for the commands." + "type": "string", + "description": "The ID of the first item in the list." }, { "type": "null" } ] }, - "max_output_length": { + "last_id": { "anyOf": [ { - "type": "integer", - "description": "Optional maximum number of characters to return from each command." + "type": "string", + "description": "The ID of the last item in the list." }, { "type": "null" } ] + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." } }, "type": "object", "required": [ - "commands", - "timeout_ms", - "max_output_length" - ], - "title": "Shell exec action", - "description": "Execute a shell command." + "object", + "data", + "first_id", + "last_id", + "has_more" + ] }, - "FunctionShellCallStatus": { + "ImageRefParam-2": { + "properties": { + "image_url": { + "type": "string", + "maxLength": 20971520, + "format": "uri", + "description": "A fully qualified URL or base64-encoded data URL." + }, + "file_id": { + "type": "string", + "example": "file-123" + } + }, + "type": "object", + "required": [] + }, + "VideoSeconds": { "type": "string", "enum": [ - "in_progress", - "completed", - "incomplete" + "4", + "8", + "12" ] }, - "LocalEnvironmentResource": { + "CreateVideoMultipartBody": { + "properties": { + "model": { + "$ref": "#/components/schemas/VideoModel", + "description": "The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`." + }, + "prompt": { + "type": "string", + "maxLength": 32000, + "minLength": 1, + "description": "Text prompt that describes the video to generate." + }, + "input_reference": { + "oneOf": [ + { + "type": "string", + "format": "binary", + "description": "Optional reference asset upload or reference object that guides generation." + }, + { + "$ref": "#/components/schemas/ImageRefParam-2", + "description": "Optional reference asset upload or reference object that guides generation. Provide exactly one of `image_url` or `file_id` when using an object." + } + ] + }, + "seconds": { + "$ref": "#/components/schemas/VideoSeconds", + "description": "Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds." + }, + "size": { + "$ref": "#/components/schemas/VideoSize", + "description": "Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280." + } + }, + "type": "object", + "required": [ + "prompt" + ], + "title": "Create video multipart request", + "description": "Multipart parameters for creating a new video generation job." + }, + "CreateVideoJsonBody": { "properties": { - "type": { + "model": { + "$ref": "#/components/schemas/VideoModel", + "description": "The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`." + }, + "prompt": { "type": "string", - "enum": [ - "local" - ], - "description": "The environment type. Always `local`.", - "default": "local", - "x-stainless-const": true + "maxLength": 32000, + "minLength": 1, + "description": "Text prompt that describes the video to generate." + }, + "input_reference": { + "$ref": "#/components/schemas/ImageRefParam-2", + "description": "Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`." + }, + "seconds": { + "$ref": "#/components/schemas/VideoSeconds", + "description": "Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds." + }, + "size": { + "$ref": "#/components/schemas/VideoSize", + "description": "Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280." } }, "type": "object", "required": [ - "type" + "prompt" ], - "title": "Local Environment", - "description": "Represents the use of a local environment to perform shell actions." + "title": "Create video JSON request", + "description": "JSON parameters for creating a new video generation job." }, - "ContainerReferenceResource": { + "CreateVideoCharacterBody": { "properties": { - "type": { + "video": { "type": "string", - "enum": [ - "container_reference" - ], - "description": "The environment type. Always `container_reference`.", - "default": "container_reference", - "x-stainless-const": true + "format": "binary", + "description": "Video file used to create a character." }, - "container_id": { - "type": "string" + "name": { + "type": "string", + "maxLength": 80, + "minLength": 1, + "description": "Display name for this API character." } }, "type": "object", "required": [ - "type", - "container_id" + "video", + "name" ], - "title": "Container Reference", - "description": "Represents a container created with /v1/containers." + "title": "Create character request", + "description": "Parameters for creating a character from an uploaded video." }, - "FunctionShellCall": { + "VideoCharacterResource": { "properties": { - "type": { - "type": "string", - "enum": [ - "shell_call" - ], - "description": "The type of the item. Always `shell_call`.", - "default": "shell_call", - "x-stainless-const": true - }, "id": { - "type": "string", - "description": "The unique ID of the shell tool call. Populated when this item is returned via API." - }, - "call_id": { - "type": "string", - "description": "The unique ID of the shell tool call generated by the model." - }, - "caller": { "anyOf": [ { - "$ref": "#/components/schemas/ToolCallCaller", - "description": "The execution context that produced this tool call." + "type": "string", + "description": "Identifier for the character creation cameo." }, { "type": "null" } ] }, - "action": { - "$ref": "#/components/schemas/FunctionShellAction", - "description": "The shell commands and limits that describe how to run the tool call." - }, - "status": { - "$ref": "#/components/schemas/FunctionShellCallStatus", - "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`." - }, - "environment": { + "name": { "anyOf": [ { - "oneOf": [ - { - "$ref": "#/components/schemas/LocalEnvironmentResource" - }, - { - "$ref": "#/components/schemas/ContainerReferenceResource" - } - ], - "discriminator": { - "propertyName": "type" - } + "type": "string", + "description": "Display name for the character." }, { "type": "null" } ] }, - "created_by": { - "type": "string", - "description": "The ID of the entity that created this tool call." + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the character was created." } }, "type": "object", "required": [ - "type", "id", - "call_id", - "action", - "status", - "environment" - ], - "title": "Shell tool call", - "description": "A tool call that executes one or more shell commands in a managed environment." - }, - "FunctionShellCallOutputStatusEnum": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" + "name", + "created_at" ] }, - "FunctionShellCallOutputTimeoutOutcome": { + "VideoReferenceInputParam": { "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "timeout" - ], - "description": "The outcome type. Always `timeout`.", - "default": "timeout", - "x-stainless-const": true + "description": "The identifier of the completed video.", + "example": "video_123" } }, "type": "object", "required": [ - "type" + "id" ], - "title": "Shell call timeout outcome", - "description": "Indicates that the shell call exceeded its configured time limit." + "description": "Reference to the completed video." }, - "FunctionShellCallOutputExitOutcome": { + "CreateVideoEditMultipartBody": { "properties": { - "type": { - "type": "string", - "enum": [ - "exit" - ], - "description": "The outcome type. Always `exit`.", - "default": "exit", - "x-stainless-const": true + "video": { + "oneOf": [ + { + "type": "string", + "format": "binary", + "description": "Reference to the completed video to edit." + }, + { + "$ref": "#/components/schemas/VideoReferenceInputParam", + "description": "Reference to the completed video to edit." + } + ] }, - "exit_code": { - "type": "integer", - "description": "Exit code from the shell process." + "prompt": { + "type": "string", + "maxLength": 32000, + "minLength": 1, + "description": "Text prompt that describes how to edit the source video." } }, "type": "object", "required": [ - "type", - "exit_code" + "video", + "prompt" ], - "title": "Shell call exit outcome", - "description": "Indicates that the shell commands finished and returned an exit code." + "title": "Create video edit multipart request", + "description": "Parameters for editing an existing generated video." }, - "FunctionShellCallOutputContent": { + "CreateVideoEditJsonBody": { "properties": { - "stdout": { - "type": "string", - "description": "The standard output that was captured." - }, - "stderr": { - "type": "string", - "description": "The standard error output that was captured." - }, - "outcome": { - "oneOf": [ - { - "$ref": "#/components/schemas/FunctionShellCallOutputTimeoutOutcome" - }, - { - "$ref": "#/components/schemas/FunctionShellCallOutputExitOutcome" - } - ], - "title": "Shell call outcome", - "description": "Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.", - "discriminator": { - "propertyName": "type" - } + "video": { + "$ref": "#/components/schemas/VideoReferenceInputParam", + "description": "Reference to the completed video to edit." }, - "created_by": { + "prompt": { "type": "string", - "description": "The identifier of the actor that created the item." + "maxLength": 32000, + "minLength": 1, + "description": "Text prompt that describes how to edit the source video." } }, "type": "object", "required": [ - "stdout", - "stderr", - "outcome" + "video", + "prompt" ], - "title": "Shell call output content", - "description": "The content of a shell tool call output that was emitted." + "title": "Create video edit JSON request", + "description": "JSON parameters for editing an existing generated video." }, - "FunctionShellCallOutput": { + "CreateVideoExtendMultipartBody": { "properties": { - "type": { - "type": "string", - "enum": [ - "shell_call_output" - ], - "description": "The type of the shell call output. Always `shell_call_output`.", - "default": "shell_call_output", - "x-stainless-const": true - }, - "id": { - "type": "string", - "description": "The unique ID of the shell call output. Populated when this item is returned via API." - }, - "call_id": { - "type": "string", - "description": "The unique ID of the shell tool call generated by the model." - }, - "caller": { - "anyOf": [ - { - "$ref": "#/components/schemas/ToolCallCaller", - "description": "The execution context that produced this tool call." - }, - { - "type": "null" - } - ] - }, - "status": { - "$ref": "#/components/schemas/FunctionShellCallOutputStatusEnum", - "description": "The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`." - }, - "output": { - "items": { - "$ref": "#/components/schemas/FunctionShellCallOutputContent" - }, - "type": "array", - "description": "An array of shell call output contents" - }, - "max_output_length": { - "anyOf": [ + "video": { + "oneOf": [ { - "type": "integer", - "description": "The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output." + "$ref": "#/components/schemas/VideoReferenceInputParam", + "description": "Reference to the completed video to extend." }, { - "type": "null" + "type": "string", + "format": "binary", + "description": "Reference to the completed video to extend." } ] }, - "created_by": { + "prompt": { "type": "string", - "description": "The identifier of the actor that created the item." + "maxLength": 32000, + "minLength": 1, + "description": "Updated text prompt that directs the extension generation." + }, + "seconds": { + "$ref": "#/components/schemas/VideoSeconds", + "description": "Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20)." } }, "type": "object", "required": [ - "type", - "id", - "call_id", - "status", - "output", - "max_output_length" + "video", + "prompt", + "seconds" ], - "title": "Shell call output", - "description": "The output of a shell tool call that was emitted." - }, - "ApplyPatchCallStatus": { - "type": "string", - "enum": [ - "in_progress", - "completed" - ] + "title": "Create video extension multipart request", + "description": "Multipart parameters for extending an existing generated video." }, - "ApplyPatchCreateFileOperation": { + "CreateVideoExtendJsonBody": { "properties": { - "type": { - "type": "string", - "enum": [ - "create_file" - ], - "description": "Create a new file with the provided diff.", - "default": "create_file", - "x-stainless-const": true + "video": { + "$ref": "#/components/schemas/VideoReferenceInputParam", + "description": "Reference to the completed video to extend." }, - "path": { + "prompt": { "type": "string", - "description": "Path of the file to create." + "maxLength": 32000, + "minLength": 1, + "description": "Updated text prompt that directs the extension generation." }, - "diff": { - "type": "string", - "description": "Diff to apply." + "seconds": { + "$ref": "#/components/schemas/VideoSeconds", + "description": "Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20)." } }, "type": "object", "required": [ - "type", - "path", - "diff" + "video", + "prompt", + "seconds" ], - "title": "Apply patch create file operation", - "description": "Instruction describing how to create a file via the apply_patch tool." + "title": "Create video extension JSON request", + "description": "JSON parameters for extending an existing generated video." }, - "ApplyPatchDeleteFileOperation": { + "DeletedVideoResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "delete_file" + "video.deleted" ], - "description": "Delete the specified file.", - "default": "delete_file", + "description": "The object type that signals the deletion response.", + "default": "video.deleted", "x-stainless-const": true }, - "path": { + "deleted": { + "type": "boolean", + "description": "Indicates that the video resource was deleted." + }, + "id": { "type": "string", - "description": "Path of the file to delete." + "description": "Identifier of the deleted video." } }, "type": "object", "required": [ - "type", - "path" + "object", + "deleted", + "id" ], - "title": "Apply patch delete file operation", - "description": "Instruction describing how to delete a file via the apply_patch tool." + "title": "Deleted video response", + "description": "Confirmation payload returned after deleting a video." }, - "ApplyPatchUpdateFileOperation": { + "VideoContentVariant": { + "type": "string", + "enum": [ + "video", + "thumbnail", + "spritesheet" + ] + }, + "CreateVideoRemixBody": { "properties": { - "type": { - "type": "string", - "enum": [ - "update_file" - ], - "description": "Update an existing file with the provided diff.", - "default": "update_file", - "x-stainless-const": true - }, - "path": { - "type": "string", - "description": "Path of the file to update." - }, - "diff": { + "prompt": { "type": "string", - "description": "Diff to apply." + "maxLength": 32000, + "minLength": 1, + "description": "Updated text prompt that directs the remix generation." } }, "type": "object", "required": [ - "type", - "path", - "diff" + "prompt" ], - "title": "Apply patch update file operation", - "description": "Instruction describing how to update a file via the apply_patch tool." + "title": "Create video remix request", + "description": "Parameters for remixing an existing generated video." }, - "ApplyPatchToolCall": { - "properties": { - "type": { + "TruncationEnum": { + "type": "string", + "enum": [ + "auto", + "disabled" + ] + }, + "PersonalityEnum": { + "anyOf": [ + { + "type": "string" + }, + { "type": "string", "enum": [ - "apply_patch_call" - ], - "description": "The type of the item. Always `apply_patch_call`.", - "default": "apply_patch_call", - "x-stainless-const": true + "friendly", + "pragmatic" + ] + } + ] + }, + "TokenCountsBody": { + "properties": { + "model": { + "anyOf": [ + { + "type": "string", + "description": "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models." + }, + { + "type": "null" + } + ] + }, + "input": { + "anyOf": [ + { + "oneOf": [ + { + "type": "string", + "maxLength": 10485760, + "description": "A text input to the model, equivalent to a text input with the `user` role." + }, + { + "items": { + "$ref": "#/components/schemas/InputItem" + }, + "type": "array", + "maxItems": 131072, + "description": "A list of one or many input items to the model, containing different content types." + } + ], + "description": "Text, image, or file inputs to the model, used to generate a response" + }, + { + "type": "null" + } + ] + }, + "previous_response_id": { + "anyOf": [ + { + "type": "string", + "description": "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.", + "example": "resp_123" + }, + { + "type": "null" + } + ] + }, + "tools": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Tool" + }, + "type": "array", + "description": "An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter." + }, + { + "type": "null" + } + ] + }, + "text": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResponseTextParam" + }, + { + "type": "null" + } + ] }, - "id": { - "type": "string", - "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API." + "reasoning": { + "anyOf": [ + { + "$ref": "#/components/schemas/Reasoning", + "description": "**gpt-5 and o-series models only** Configuration options for [reasoning models](https://developers.openai.com/api/docs/guides/reasoning)." + }, + { + "type": "null" + } + ] }, - "call_id": { - "type": "string", - "description": "The unique ID of the apply patch tool call generated by the model." + "truncation": { + "$ref": "#/components/schemas/TruncationEnum", + "description": "The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.", + "deprecated": true }, - "caller": { + "instructions": { "anyOf": [ { - "$ref": "#/components/schemas/ToolCallCaller", - "description": "The execution context that produced this tool call." + "type": "string", + "description": "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses." }, { "type": "null" } ] }, - "status": { - "$ref": "#/components/schemas/ApplyPatchCallStatus", - "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." + "personality": { + "$ref": "#/components/schemas/PersonalityEnum", + "description": "A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters." }, - "operation": { - "oneOf": [ + "conversation": { + "anyOf": [ { - "$ref": "#/components/schemas/ApplyPatchCreateFileOperation" + "$ref": "#/components/schemas/ConversationParam" }, { - "$ref": "#/components/schemas/ApplyPatchDeleteFileOperation" + "type": "null" + } + ] + }, + "tool_choice": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToolChoiceParam", + "description": "Controls which tool the model should use, if any." }, { - "$ref": "#/components/schemas/ApplyPatchUpdateFileOperation" + "type": "null" } - ], - "title": "Apply patch operation", - "description": "One of the create_file, delete_file, or update_file operations applied via apply_patch.", - "discriminator": { - "propertyName": "type" - } + ] }, - "created_by": { + "parallel_tool_calls": { + "anyOf": [ + { + "type": "boolean", + "description": "Whether to allow the model to run tool calls in parallel." + }, + { + "type": "null" + } + ] + } + }, + "type": "object", + "required": [] + }, + "TokenCountsResource": { + "properties": { + "object": { "type": "string", - "description": "The ID of the entity that created this tool call." + "enum": [ + "response.input_tokens" + ], + "default": "response.input_tokens", + "x-stainless-const": true + }, + "input_tokens": { + "type": "integer" } }, "type": "object", "required": [ - "type", - "id", - "call_id", - "status", - "operation" + "object", + "input_tokens" ], - "title": "Apply patch tool call", - "description": "A tool call that applies file diffs by creating, deleting, or updating files." + "title": "Token counts", + "example": { + "object": "response.input_tokens", + "input_tokens": 123 + } }, - "ApplyPatchCallOutputStatus": { + "PromptCacheRetentionEnum": { "type": "string", "enum": [ - "completed", - "failed" + "in_memory", + "24h" ] }, - "ApplyPatchToolCallOutput": { + "ServiceTierEnum": { + "type": "string", + "enum": [ + "auto", + "default", + "fast", + "flex", + "priority" + ] + }, + "CompactResponseMethodPublicBody": { "properties": { - "type": { - "type": "string", - "enum": [ - "apply_patch_call_output" - ], - "description": "The type of the item. Always `apply_patch_call_output`.", - "default": "apply_patch_call_output", - "x-stainless-const": true + "model": { + "$ref": "#/components/schemas/ModelIdsCompaction" }, - "id": { - "type": "string", - "description": "The unique ID of the apply patch tool call output. Populated when this item is returned via API." + "input": { + "anyOf": [ + { + "oneOf": [ + { + "type": "string", + "maxLength": 10485760, + "description": "A text input to the model, equivalent to a text input with the `user` role." + }, + { + "items": { + "$ref": "#/components/schemas/InputItem" + }, + "type": "array", + "maxItems": 131072, + "description": "A list of one or many input items to the model, containing different content types." + } + ], + "description": "Text, image, or file inputs to the model, used to generate a response" + }, + { + "type": "null" + } + ] }, - "call_id": { - "type": "string", - "description": "The unique ID of the apply patch tool call generated by the model." + "previous_response_id": { + "anyOf": [ + { + "type": "string", + "description": "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.", + "example": "resp_123" + }, + { + "type": "null" + } + ] }, - "caller": { + "instructions": { "anyOf": [ { - "$ref": "#/components/schemas/ToolCallCaller", - "description": "The execution context that produced this tool call." + "type": "string", + "description": "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses." }, { "type": "null" } ] }, - "status": { - "$ref": "#/components/schemas/ApplyPatchCallOutputStatus", - "description": "The status of the apply patch tool call output. One of `completed` or `failed`." + "image": { + "$ref": "#/components/schemas/ImageOptionsParam", + "description": "Request level image options." }, - "output": { + "prompt_cache_key": { "anyOf": [ { "type": "string", - "description": "Optional textual output returned by the apply patch tool." + "maxLength": 64, + "description": "A key to use when reading from or writing to the prompt cache." }, { "type": "null" } ] }, - "created_by": { - "type": "string", - "description": "The ID of the entity that created this tool call output." + "prompt_cache_retention": { + "anyOf": [ + { + "$ref": "#/components/schemas/PromptCacheRetentionEnum", + "description": "How long to retain a prompt cache entry created by this request.", + "deprecated": true + }, + { + "type": "null" + } + ] + }, + "prompt_cache_options": { + "anyOf": [ + { + "$ref": "#/components/schemas/PromptCacheOptionsParam" + }, + { + "type": "null" + } + ] + }, + "service_tier": { + "anyOf": [ + { + "$ref": "#/components/schemas/ServiceTierEnum", + "description": "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/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. For models with a dedicated Fast tier, either value resolves to `service_tier=fast`; for other models, either value resolves to `service_tier=priority`. - When not set, the default behavior is 'auto'.\n 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." + }, + { + "type": "null" + } + ] } }, "type": "object", "required": [ - "type", - "id", - "call_id", - "status" + "model" + ] + }, + "ItemField": { + "oneOf": [ + { + "$ref": "#/components/schemas/Message" + }, + { + "$ref": "#/components/schemas/Program" + }, + { + "$ref": "#/components/schemas/ProgramOutput" + }, + { + "$ref": "#/components/schemas/FunctionToolCall" + }, + { + "$ref": "#/components/schemas/ToolSearchCall" + }, + { + "$ref": "#/components/schemas/ToolSearchOutput" + }, + { + "$ref": "#/components/schemas/AdditionalTools" + }, + { + "$ref": "#/components/schemas/FunctionToolCallOutput" + }, + { + "$ref": "#/components/schemas/FileSearchToolCall" + }, + { + "$ref": "#/components/schemas/WebSearchToolCall" + }, + { + "$ref": "#/components/schemas/ImageGenToolCall" + }, + { + "$ref": "#/components/schemas/ComputerToolCall" + }, + { + "$ref": "#/components/schemas/ComputerToolCallOutputResource" + }, + { + "$ref": "#/components/schemas/ReasoningItem" + }, + { + "$ref": "#/components/schemas/CompactionBody" + }, + { + "$ref": "#/components/schemas/CodeInterpreterToolCall" + }, + { + "$ref": "#/components/schemas/LocalShellToolCall", + "deprecated": true + }, + { + "$ref": "#/components/schemas/LocalShellToolCallOutput", + "deprecated": true + }, + { + "$ref": "#/components/schemas/FunctionShellCall" + }, + { + "$ref": "#/components/schemas/FunctionShellCallOutput" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolCall" + }, + { + "$ref": "#/components/schemas/ApplyPatchToolCallOutput" + }, + { + "$ref": "#/components/schemas/MCPListTools" + }, + { + "$ref": "#/components/schemas/MCPApprovalRequest" + }, + { + "$ref": "#/components/schemas/MCPApprovalResponseResource" + }, + { + "$ref": "#/components/schemas/MCPToolCall" + }, + { + "$ref": "#/components/schemas/CustomToolCall" + }, + { + "$ref": "#/components/schemas/CustomToolCallOutput" + } ], - "title": "Apply patch tool call output", - "description": "The output emitted by an apply patch tool call." + "description": "An item representing a message, tool call, tool output, reasoning, or other response element.", + "discriminator": { + "propertyName": "type" + } }, - "MCPProtocolError": { + "CompactResource": { "properties": { - "type": { + "image": { + "$ref": "#/components/schemas/ResolvedImageOptions" + }, + "id": { + "type": "string", + "description": "The unique identifier for the compacted response." + }, + "object": { "type": "string", "enum": [ - "mcp_protocol_error" + "response.compaction" ], - "default": "mcp_protocol_error", + "description": "The object type. Always `response.compaction`.", + "default": "response.compaction", "x-stainless-const": true }, - "code": { - "type": "integer" + "output": { + "items": { + "$ref": "#/components/schemas/ItemField" + }, + "type": "array", + "description": "The compacted list of output items." }, - "message": { - "type": "string" + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) when the compacted conversation was created." + }, + "usage": { + "$ref": "#/components/schemas/ResponseUsage", + "description": "Token accounting for the compaction pass, including cached, reasoning, and total tokens." } }, "type": "object", "required": [ - "type", - "code", - "message" - ] + "id", + "object", + "output", + "created_at", + "usage" + ], + "title": "The compacted response object", + "example": { + "id": "resp_001", + "object": "response.compaction", + "image": { + "context_compression": "disabled" + }, + "output": [ + { + "id": "msg_001", + "status": "completed", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize our launch checklist from last week." + } + ] + }, + { + "id": "msg_002", + "status": "completed", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "You are performing a CONTEXT CHECKPOINT COMPACTION..." + } + ] + }, + { + "type": "compaction", + "id": "cmp_001", + "encrypted_content": "encrypted-summary" + } + ], + "created_at": 1731459200, + "usage": { + "input_tokens": 42897, + "input_tokens_details": { + "cached_tokens": 0, + "cache_write_tokens": 0 + }, + "output_tokens": 12000, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 54897 + } + } }, - "MCPToolExecutionError": { + "SkillResource": { "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "mcp_tool_execution_error" - ], - "default": "mcp_tool_execution_error", - "x-stainless-const": true + "description": "Unique identifier for the skill." }, - "content": {} - }, - "type": "object", - "required": [ - "type", - "content" - ] - }, - "HTTPError": { - "properties": { - "type": { + "object": { "type": "string", "enum": [ - "http_error" + "skill" ], - "default": "http_error", + "description": "The object type, which is `skill`.", + "default": "skill", "x-stainless-const": true }, - "code": { - "type": "integer" + "name": { + "type": "string", + "description": "Name of the skill." }, - "message": { - "type": "string" + "description": { + "type": "string", + "description": "Description of the skill." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (seconds) for when the skill was created." + }, + "default_version": { + "type": "string", + "description": "Default version for the skill." + }, + "latest_version": { + "type": "string", + "description": "Latest version for the skill." } }, "type": "object", "required": [ - "type", - "code", - "message" - ] - }, - "MCPToolCallStatus": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete", - "calling", - "failed" - ] - }, - "DetailEnum": { - "type": "string", - "enum": [ - "low", - "high", - "auto", - "original" - ] - }, - "FunctionCallItemStatus": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" + "id", + "object", + "name", + "description", + "created_at", + "default_version", + "latest_version" ] }, - "ComputerCallOutputItemParam": { + "SkillListResource": { "properties": { - "id": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object returned, must be `list`.", + "default": "list", + "x-stainless-const": true + }, + "data": { + "items": { + "$ref": "#/components/schemas/SkillResource" + }, + "type": "array", + "description": "A list of items" + }, + "first_id": { "anyOf": [ { "type": "string", - "description": "The ID of the computer tool call output.", - "example": "cuo_123" + "description": "The ID of the first item in the list." }, { "type": "null" } ] }, - "call_id": { - "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The ID of the computer tool call that produced the output." - }, - "type": { - "type": "string", - "enum": [ - "computer_call_output" - ], - "description": "The type of the computer tool call output. Always `computer_call_output`.", - "default": "computer_call_output", - "x-stainless-const": true - }, - "output": { - "$ref": "#/components/schemas/ComputerScreenshotImage" - }, - "acknowledged_safety_checks": { + "last_id": { "anyOf": [ { - "items": { - "$ref": "#/components/schemas/ComputerCallSafetyCheckParam" - }, - "type": "array", - "description": "The safety checks reported by the API that have been acknowledged by the developer." + "type": "string", + "description": "The ID of the last item in the list." }, { "type": "null" } ] }, - "status": { - "anyOf": [ + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." + } + }, + "type": "object", + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "CreateSkillBody": { + "properties": { + "files": { + "oneOf": [ { - "$ref": "#/components/schemas/FunctionCallItemStatus", - "description": "The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API." + "items": { + "type": "string", + "format": "binary" + }, + "type": "array", + "maxItems": 500, + "description": "Skill files to upload (directory upload) or a single zip file." }, { - "type": "null" + "type": "string", + "format": "binary", + "description": "Skill zip file to upload." } ] } }, "type": "object", "required": [ - "call_id", - "type", - "output" + "files" ], - "title": "Computer tool call output", - "description": "The output of a computer tool call." + "title": "Create skill request", + "description": "Uploads a skill either as a directory (multipart `files[]`) or as a single zip file." }, - "InputTextContentParam": { + "SetDefaultSkillVersionBody": { "properties": { - "type": { + "default_version": { + "type": "string", + "description": "The skill version number to set as default." + } + }, + "type": "object", + "required": [ + "default_version" + ], + "title": "Update skill request", + "description": "Updates the default version pointer for a skill." + }, + "DeletedSkillResource": { + "properties": { + "object": { "type": "string", "enum": [ - "input_text" + "skill.deleted" ], - "description": "The type of the input item. Always `input_text`.", - "default": "input_text", + "default": "skill.deleted", "x-stainless-const": true }, - "text": { - "type": "string", - "maxLength": 10485760, - "description": "The text input to the model." + "deleted": { + "type": "boolean" }, - "prompt_cache_breakpoint": { - "anyOf": [ - { - "$ref": "#/components/schemas/PromptCacheBreakpointParam" - }, - { - "type": "null" - } - ] + "id": { + "type": "string" } }, "type": "object", "required": [ - "type", - "text" - ], - "title": "Input text", - "description": "A text input to the model." + "object", + "deleted", + "id" + ] }, - "InputImageContentParamAutoParam": { + "SkillVersionResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "input_image" + "skill.version" ], - "description": "The type of the input item. Always `input_image`.", - "default": "input_image", + "description": "The object type, which is `skill.version`.", + "default": "skill.version", "x-stainless-const": true }, - "image_url": { - "anyOf": [ - { - "type": "string", - "maxLength": 20971520, - "format": "uri", - "description": "The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL." - }, - { - "type": "null" - } - ] + "id": { + "type": "string", + "description": "Unique identifier for the skill version." }, - "file_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the file to be sent to the model.", - "example": "file-123" - }, - { - "type": "null" - } - ] + "skill_id": { + "type": "string", + "description": "Identifier of the skill for this version." }, - "detail": { - "anyOf": [ - { - "$ref": "#/components/schemas/DetailEnum", - "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." - }, - { - "type": "null" - } - ] + "version": { + "type": "string", + "description": "Version number for this skill." }, - "prompt_cache_breakpoint": { - "anyOf": [ - { - "$ref": "#/components/schemas/PromptCacheBreakpointParam" - }, - { - "type": "null" - } - ] + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (seconds) for when the version was created." + }, + "name": { + "type": "string", + "description": "Name of the skill version." + }, + "description": { + "type": "string", + "description": "Description of the skill version." } }, "type": "object", "required": [ - "type" - ], - "title": "Input image", - "description": "An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision)" - }, - "FileDetailEnum": { - "type": "string", - "enum": [ - "auto", - "low", - "high" + "object", + "id", + "skill_id", + "version", + "created_at", + "name", + "description" ] }, - "InputFileContentParam": { + "SkillVersionListResource": { "properties": { - "type": { + "object": { "type": "string", "enum": [ - "input_file" + "list" ], - "description": "The type of the input item. Always `input_file`.", - "default": "input_file", + "description": "The type of object returned, must be `list`.", + "default": "list", "x-stainless-const": true }, - "file_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the file to be sent to the model.", - "example": "file-123" - }, - { - "type": "null" - } - ] + "data": { + "items": { + "$ref": "#/components/schemas/SkillVersionResource" + }, + "type": "array", + "description": "A list of items" }, - "filename": { + "first_id": { "anyOf": [ { "type": "string", - "description": "The name of the file to be sent to the model." + "description": "The ID of the first item in the list." }, { "type": "null" } ] }, - "file_data": { + "last_id": { "anyOf": [ { "type": "string", - "maxLength": 73400320, - "description": "The base64-encoded data of the file to be sent to the model." + "description": "The ID of the last item in the list." }, { "type": "null" } ] }, - "file_url": { - "anyOf": [ + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." + } + }, + "type": "object", + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "CreateSkillVersionBody": { + "properties": { + "files": { + "oneOf": [ { - "type": "string", - "format": "uri", - "description": "The URL of the file to be sent to the model." + "items": { + "type": "string", + "format": "binary" + }, + "type": "array", + "maxItems": 500, + "description": "Skill files to upload (directory upload) or a single zip file." }, { - "type": "null" + "type": "string", + "format": "binary", + "description": "Skill zip file to upload." } ] }, - "detail": { - "$ref": "#/components/schemas/FileDetailEnum", - "description": "The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`." + "default": { + "type": "boolean", + "description": "Whether to set this version as the default." + } + }, + "type": "object", + "required": [ + "files" + ], + "title": "Create skill version request", + "description": "Uploads a new immutable version of a skill." + }, + "DeletedSkillVersionResource": { + "properties": { + "object": { + "type": "string", + "enum": [ + "skill.version.deleted" + ], + "default": "skill.version.deleted", + "x-stainless-const": true }, - "prompt_cache_breakpoint": { - "anyOf": [ - { - "$ref": "#/components/schemas/PromptCacheBreakpointParam" - }, - { - "type": "null" - } - ] + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "version": { + "type": "string", + "description": "The deleted skill version." } }, "type": "object", "required": [ - "type" + "object", + "deleted", + "id", + "version" + ] + }, + "ChatkitWorkflowTracing": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates whether tracing is enabled." + } + }, + "type": "object", + "required": [ + "enabled" ], - "title": "Input file", - "description": "A file input to the model." + "title": "Tracing Configuration", + "description": "Controls diagnostic tracing during the session." }, - "FunctionCallOutputItemParam": { + "ChatkitWorkflow": { "properties": { "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of the function tool call output. Populated when this item is returned via API.", - "example": "fc_123" - }, - { - "type": "null" - } - ] + "type": "string", + "description": "Identifier of the workflow backing the session." }, - "call_id": { + "version": { "anyOf": [ { "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The unique ID of the function tool call generated by the model." + "description": "Specific workflow version used for the session. Defaults to null when using the latest deployment." }, { "type": "null" } ] }, - "type": { - "type": "string", - "enum": [ - "function_call_output" - ], - "description": "The type of the function tool call output. Always `function_call_output`.", - "default": "function_call_output", - "x-stainless-const": true - }, - "output": { - "oneOf": [ - { - "type": "string", - "maxLength": 10485760, - "description": "A JSON string of the output of the function tool call." - }, + "state_variables": { + "anyOf": [ { - "items": { - "oneOf": [ + "additionalProperties": { + "anyOf": [ { - "$ref": "#/components/schemas/InputTextContentParam" + "type": "string" }, { - "$ref": "#/components/schemas/InputImageContentParamAutoParam" + "type": "integer" }, { - "$ref": "#/components/schemas/InputFileContentParam" + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "null" } - ], - "description": "A piece of message content, such as text, an image, or a file.", - "discriminator": { - "propertyName": "type" - } + ] }, - "type": "array", - "description": "An array of content outputs (text, image, file) for the function tool call." + "type": "object", + "description": "State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.", + "x-oaiTypeLabel": "map" + }, + { + "type": "null" } - ], - "description": "Text, image, or file output of the function tool call." + ] }, - "name": { + "tracing": { + "$ref": "#/components/schemas/ChatkitWorkflowTracing", + "description": "Tracing settings applied to the workflow." + } + }, + "type": "object", + "required": [ + "id", + "version", + "state_variables", + "tracing" + ], + "title": "Workflow", + "description": "Workflow metadata and state returned for the session." + }, + "ChatSessionRateLimits": { + "properties": { + "max_requests_per_1_minute": { + "type": "integer", + "description": "Maximum allowed requests per one-minute window." + } + }, + "type": "object", + "required": [ + "max_requests_per_1_minute" + ], + "title": "Rate limits", + "description": "Active per-minute request limit for the session." + }, + "ChatSessionStatus": { + "type": "string", + "enum": [ + "active", + "expired", + "cancelled" + ] + }, + "ChatSessionAutomaticThreadTitling": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether automatic thread titling is enabled." + } + }, + "type": "object", + "required": [ + "enabled" + ], + "title": "Automatic thread titling", + "description": "Automatic thread title preferences for the session." + }, + "ChatSessionFileUpload": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if uploads are enabled for the session." + }, + "max_file_size": { "anyOf": [ { - "type": "string", - "maxLength": 128, - "minLength": 1, - "description": "The name of the tool that produced the output." + "type": "integer", + "description": "Maximum upload size in megabytes." }, { "type": "null" } ] }, - "namespace": { + "max_files": { "anyOf": [ { - "type": "string", - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9_-]+$", - "description": "The namespace of the tool that produced the output." + "type": "integer", + "description": "Maximum number of uploads allowed during the session." }, { "type": "null" } ] + } + }, + "type": "object", + "required": [ + "enabled", + "max_file_size", + "max_files" + ], + "title": "File upload settings", + "description": "Upload permissions and limits applied to the session." + }, + "ChatSessionHistory": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if chat history is persisted for the session." }, - "caller": { + "recent_threads": { "anyOf": [ { - "$ref": "#/components/schemas/ToolCallCallerParam", - "description": "The execution context that produced this tool call." + "type": "integer", + "description": "Number of prior threads surfaced in history views. Defaults to null when all history is retained." }, { "type": "null" } ] + } + }, + "type": "object", + "required": [ + "enabled", + "recent_threads" + ], + "title": "History settings", + "description": "History retention preferences returned for the session." + }, + "ChatSessionChatkitConfiguration": { + "properties": { + "automatic_thread_titling": { + "$ref": "#/components/schemas/ChatSessionAutomaticThreadTitling", + "description": "Automatic thread titling preferences." }, - "status": { - "anyOf": [ - { - "$ref": "#/components/schemas/FunctionCallItemStatus", - "description": "The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API." - }, - { - "type": "null" - } - ] + "file_upload": { + "$ref": "#/components/schemas/ChatSessionFileUpload", + "description": "Upload settings for the session." + }, + "history": { + "$ref": "#/components/schemas/ChatSessionHistory", + "description": "History retention configuration." } }, "type": "object", "required": [ - "type", - "output" + "automatic_thread_titling", + "file_upload", + "history" ], - "title": "Function tool call output", - "description": "The output of a function tool call." + "title": "ChatKit configuration", + "description": "ChatKit configuration for the session." }, - "FileCitationParam": { + "ChatSessionResource": { "properties": { - "type": { + "id": { + "type": "string", + "description": "Identifier for the ChatKit session." + }, + "object": { "type": "string", "enum": [ - "file_citation" + "chatkit.session" ], - "description": "The citation type. Always `file_citation`.", - "default": "file_citation", + "description": "Type discriminator that is always `chatkit.session`.", + "default": "chatkit.session", "x-stainless-const": true }, - "index": { + "expires_at": { "type": "integer", - "minimum": 0, - "description": "The index of the file in the list of files." + "format": "unixtime", + "description": "Unix timestamp (in seconds) for when the session expires." }, - "file_id": { + "client_secret": { "type": "string", - "description": "The ID of the file.", - "example": "file-123" + "description": "Ephemeral client secret that authenticates session requests." }, - "filename": { + "workflow": { + "$ref": "#/components/schemas/ChatkitWorkflow", + "description": "Workflow metadata for the session." + }, + "user": { "type": "string", - "description": "The filename of the file cited." + "description": "User identifier associated with the session." + }, + "rate_limits": { + "$ref": "#/components/schemas/ChatSessionRateLimits", + "description": "Resolved rate limit values." + }, + "max_requests_per_1_minute": { + "type": "integer", + "description": "Convenience copy of the per-minute request limit." + }, + "status": { + "$ref": "#/components/schemas/ChatSessionStatus", + "description": "Current lifecycle state of the session." + }, + "chatkit_configuration": { + "$ref": "#/components/schemas/ChatSessionChatkitConfiguration", + "description": "Resolved ChatKit feature configuration for the session." } }, "type": "object", "required": [ - "type", - "index", - "file_id", - "filename" - ] + "id", + "object", + "expires_at", + "client_secret", + "workflow", + "user", + "rate_limits", + "max_requests_per_1_minute", + "status", + "chatkit_configuration" + ], + "title": "The chat session object", + "description": "Represents a ChatKit session and its resolved configuration.", + "example": { + "id": "cksess_123", + "object": "chatkit.session", + "client_secret": "ek_token_123", + "expires_at": 1712349876, + "workflow": { + "id": "workflow_alpha", + "version": "2024-10-01", + "state_variables": { + "message": "hello" + }, + "tracing": { + "enabled": true + } + }, + "user": "user_789", + "rate_limits": { + "max_requests_per_1_minute": 60 + }, + "max_requests_per_1_minute": 60, + "status": "active", + "chatkit_configuration": { + "automatic_thread_titling": { + "enabled": true + }, + "file_upload": { + "enabled": true, + "max_file_size": 16, + "max_files": 20 + }, + "history": { + "enabled": true, + "recent_threads": 10 + } + } + } }, - "UrlCitationParam": { + "WorkflowTracingParam": { "properties": { - "type": { + "enabled": { + "type": "boolean", + "description": "Whether tracing is enabled during the session. Defaults to true." + } + }, + "type": "object", + "required": [], + "title": "Tracing Configuration", + "description": "Controls diagnostic tracing during the session." + }, + "WorkflowParam": { + "properties": { + "id": { "type": "string", - "enum": [ - "url_citation" - ], - "description": "The citation type. Always `url_citation`.", - "default": "url_citation", - "x-stainless-const": true - }, - "start_index": { - "type": "integer", - "minimum": 0, - "description": "The index of the first character of the citation in the message." - }, - "end_index": { - "type": "integer", - "minimum": 0, - "description": "The index of the last character of the citation in the message." + "description": "Identifier for the workflow invoked by the session." }, - "url": { + "version": { "type": "string", - "format": "uri", - "description": "The URL of the cited resource." + "description": "Specific workflow version to run. Defaults to the latest deployed version." }, - "title": { - "type": "string", - "description": "The title of the cited resource." + "state_variables": { + "additionalProperties": { + "oneOf": [ + { + "type": "string", + "maxLength": 10485760 + }, + { + "type": "integer" + }, + { + "type": "boolean" + }, + { + "type": "number" + } + ] + }, + "type": "object", + "maxProperties": 64, + "description": "State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object.", + "x-oaiTypeLabel": "map" + }, + "tracing": { + "$ref": "#/components/schemas/WorkflowTracingParam", + "description": "Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default." } }, "type": "object", "required": [ - "type", - "start_index", - "end_index", - "url", - "title" - ] + "id" + ], + "title": "Workflow settings", + "description": "Workflow reference and overrides applied to the chat session." }, - "ContainerFileCitationParam": { + "ExpiresAfterParam": { "properties": { - "type": { + "anchor": { "type": "string", "enum": [ - "container_file_citation" + "created_at" ], - "description": "The citation type. Always `container_file_citation`.", - "default": "container_file_citation", + "description": "Base timestamp used to calculate expiration. Currently fixed to `created_at`.", + "default": "created_at", "x-stainless-const": true }, - "start_index": { + "seconds": { "type": "integer", - "minimum": 0, - "description": "The index of the first character of the citation in the message." - }, - "end_index": { + "maximum": 600, + "minimum": 1, + "format": "int64", + "description": "Number of seconds after the anchor when the session expires." + } + }, + "type": "object", + "required": [ + "anchor", + "seconds" + ], + "title": "Expiration overrides", + "description": "Controls when the session expires relative to an anchor timestamp." + }, + "RateLimitsParam": { + "properties": { + "max_requests_per_1_minute": { "type": "integer", - "minimum": 0, - "description": "The index of the last character of the citation in the message." + "minimum": 1, + "description": "Maximum number of requests allowed per minute for the session. Defaults to 10." + } + }, + "type": "object", + "required": [], + "title": "Rate limit overrides", + "description": "Controls request rate limits for the session." + }, + "AutomaticThreadTitlingParam": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable automatic thread title generation. Defaults to true." + } + }, + "type": "object", + "required": [], + "title": "Automatic thread titling configuration", + "description": "Controls whether ChatKit automatically generates thread titles." + }, + "FileUploadParam": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable uploads for this session. Defaults to false." }, - "container_id": { - "type": "string", - "description": "The ID of the container.", - "example": "cntr_123" + "max_file_size": { + "type": "integer", + "maximum": 512, + "minimum": 1, + "description": "Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size." }, - "file_id": { - "type": "string", - "description": "The ID of the container file.", - "example": "cfile_123" + "max_files": { + "type": "integer", + "minimum": 1, + "description": "Maximum number of files that can be uploaded to the session. Defaults to 10." + } + }, + "type": "object", + "required": [], + "title": "File upload configuration", + "description": "Controls whether users can upload files." + }, + "HistoryParam": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enables chat users to access previous ChatKit threads. Defaults to true." }, - "filename": { - "type": "string", - "description": "The filename of the container file cited." + "recent_threads": { + "type": "integer", + "minimum": 1, + "description": "Number of recent ChatKit threads users have access to. Defaults to unlimited when unset." } }, "type": "object", - "required": [ - "type", - "start_index", - "end_index", - "container_id", - "file_id", - "filename" - ] + "required": [], + "title": "Chat history configuration", + "description": "Controls how much historical context is retained for the session." }, - "ToolSearchCallItemParam": { + "ChatkitConfigurationParam": { "properties": { - "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of this tool search call.", - "example": "tsc_123" - }, - { - "type": "null" - } - ] + "automatic_thread_titling": { + "$ref": "#/components/schemas/AutomaticThreadTitlingParam", + "description": "Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default." }, - "call_id": { - "anyOf": [ - { - "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The unique ID of the tool search call generated by the model." - }, - { - "type": "null" - } - ] + "file_upload": { + "$ref": "#/components/schemas/FileUploadParam", + "description": "Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB)." }, - "type": { + "history": { + "$ref": "#/components/schemas/HistoryParam", + "description": "Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null)." + } + }, + "type": "object", + "required": [], + "title": "ChatKit configuration overrides", + "description": "Optional per-session configuration settings for ChatKit behavior." + }, + "CreateChatSessionBody": { + "properties": { + "workflow": { + "$ref": "#/components/schemas/WorkflowParam", + "description": "Workflow that powers the session." + }, + "user": { "type": "string", - "enum": [ - "tool_search_call" - ], - "description": "The item type. Always `tool_search_call`.", - "default": "tool_search_call", - "x-stainless-const": true + "minLength": 1, + "description": "A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope." }, - "execution": { - "$ref": "#/components/schemas/ToolSearchExecutionType", - "description": "Whether tool search was executed by the server or by the client." + "expires_after": { + "$ref": "#/components/schemas/ExpiresAfterParam", + "description": "Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes." }, - "arguments": { - "$ref": "#/components/schemas/EmptyModelParam", - "description": "The arguments supplied to the tool search call." + "rate_limits": { + "$ref": "#/components/schemas/RateLimitsParam", + "description": "Optional override for per-minute request limits. When omitted, defaults to 10." }, - "status": { - "anyOf": [ - { - "$ref": "#/components/schemas/FunctionCallItemStatus", - "description": "The status of the tool search call." - }, - { - "type": "null" - } - ] + "chatkit_configuration": { + "$ref": "#/components/schemas/ChatkitConfigurationParam", + "description": "Optional overrides for ChatKit runtime configuration features" } }, "type": "object", "required": [ - "type", - "arguments" - ] + "workflow", + "user" + ], + "title": "Create chat session request", + "description": "Parameters for provisioning a new ChatKit session." }, - "ToolSearchOutputItemParam": { + "UserMessageInputText": { "properties": { - "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of this tool search output.", - "example": "tso_123" - }, - { - "type": "null" - } - ] - }, - "call_id": { - "anyOf": [ - { - "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The unique ID of the tool search call generated by the model." - }, - { - "type": "null" - } - ] - }, "type": { "type": "string", "enum": [ - "tool_search_output" + "input_text" ], - "description": "The item type. Always `tool_search_output`.", - "default": "tool_search_output", + "description": "Type discriminator that is always `input_text`.", + "default": "input_text", "x-stainless-const": true }, - "execution": { - "$ref": "#/components/schemas/ToolSearchExecutionType", - "description": "Whether tool search was executed by the server or by the client." - }, - "tools": { - "items": { - "$ref": "#/components/schemas/Tool" - }, - "type": "array", - "description": "The loaded tool definitions returned by the tool search output." - }, - "status": { - "anyOf": [ - { - "$ref": "#/components/schemas/FunctionCallItemStatus", - "description": "The status of the tool search output." - }, - { - "type": "null" - } - ] + "text": { + "type": "string", + "description": "Plain-text content supplied by the user." } }, "type": "object", "required": [ "type", - "tools" - ] + "text" + ], + "title": "User message input", + "description": "Text block that a user contributed to the thread." }, - "AdditionalToolsItemParam": { + "UserMessageQuotedText": { "properties": { - "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of this additional tools item.", - "example": "at_123" - }, - { - "type": "null" - } - ] - }, "type": { "type": "string", "enum": [ - "additional_tools" - ], - "description": "The item type. Always `additional_tools`.", - "default": "additional_tools", - "x-stainless-const": true - }, - "role": { - "type": "string", - "enum": [ - "developer" + "quoted_text" ], - "description": "The role that provided the additional tools. Only `developer` is supported.", - "default": "developer", + "description": "Type discriminator that is always `quoted_text`.", + "default": "quoted_text", "x-stainless-const": true }, - "tools": { - "items": { - "$ref": "#/components/schemas/Tool" - }, - "type": "array", - "description": "A list of additional tools made available at this item." + "text": { + "type": "string", + "description": "Quoted text content." } }, "type": "object", "required": [ "type", - "role", - "tools" + "text" + ], + "title": "User message quoted text", + "description": "Quoted snippet that the user referenced in their message." + }, + "AttachmentType": { + "type": "string", + "enum": [ + "image", + "file" ] }, - "CompactionSummaryItemParam": { + "Attachment": { "properties": { + "type": { + "$ref": "#/components/schemas/AttachmentType", + "description": "Attachment discriminator." + }, "id": { + "type": "string", + "description": "Identifier for the attachment." + }, + "name": { + "type": "string", + "description": "Original display name for the attachment." + }, + "mime_type": { + "type": "string", + "description": "MIME type of the attachment." + }, + "preview_url": { "anyOf": [ { "type": "string", - "description": "The ID of the compaction item.", - "example": "cmp_123" + "format": "uri", + "description": "Preview URL for rendering the attachment inline." }, { "type": "null" } ] - }, - "type": { - "type": "string", - "enum": [ - "compaction" - ], - "description": "The type of the item. Always `compaction`.", - "default": "compaction", - "x-stainless-const": true - }, - "encrypted_content": { - "type": "string", - "maxLength": 20971520, - "description": "The encrypted content of the compaction summary." } }, "type": "object", "required": [ "type", - "encrypted_content" + "id", + "name", + "mime_type", + "preview_url" ], - "title": "Compaction item", - "description": "A compaction item generated by the [`v1/responses/compact` API](https://developers.openai.com/api/reference/resources/responses/methods/compact)." + "title": "Attachment", + "description": "Attachment metadata included on thread items." }, - "FunctionShellActionParam": { + "ToolChoice": { "properties": { - "commands": { - "items": { - "type": "string" - }, - "type": "array", - "description": "Ordered shell commands for the execution environment to run." - }, - "timeout_ms": { + "id": { + "type": "string", + "description": "Identifier of the requested tool." + } + }, + "type": "object", + "required": [ + "id" + ], + "title": "Tool choice", + "description": "Tool selection that the assistant should honor when executing the item." + }, + "InferenceOptions": { + "properties": { + "tool_choice": { "anyOf": [ { - "type": "integer", - "description": "Maximum wall-clock time in milliseconds to allow the shell commands to run." + "$ref": "#/components/schemas/ToolChoice", + "description": "Preferred tool to invoke. Defaults to null when ChatKit should auto-select." }, { "type": "null" } ] }, - "max_output_length": { + "model": { "anyOf": [ { - "type": "integer", - "description": "Maximum number of UTF-8 characters to capture from combined stdout and stderr output." + "type": "string", + "description": "Model name that generated the response. Defaults to null when using the session default." }, { "type": "null" @@ -70439,91 +95019,74 @@ }, "type": "object", "required": [ - "commands" - ], - "title": "Shell action", - "description": "Commands and limits describing how to run the shell tool call." - }, - "FunctionShellCallItemStatus": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" + "tool_choice", + "model" ], - "title": "Shell call status", - "description": "Status values reported for shell tool calls." + "title": "Inference options", + "description": "Model and tool overrides applied when generating the assistant response." }, - "FunctionShellCallItemParam": { + "UserMessageItem": { "properties": { "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of the shell tool call. Populated when this item is returned via API.", - "example": "sh_123" - }, - { - "type": "null" - } - ] + "type": "string", + "description": "Identifier of the thread item." }, - "call_id": { + "object": { "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The unique ID of the shell tool call generated by the model." + "enum": [ + "chatkit.thread_item" + ], + "description": "Type discriminator that is always `chatkit.thread_item`.", + "default": "chatkit.thread_item", + "x-stainless-const": true }, - "caller": { - "anyOf": [ - { - "$ref": "#/components/schemas/ToolCallCallerParam", - "description": "The execution context that produced this tool call." - }, - { - "type": "null" - } - ] + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) for when the item was created." + }, + "thread_id": { + "type": "string", + "description": "Identifier of the parent thread." }, "type": { "type": "string", "enum": [ - "shell_call" + "chatkit.user_message" ], - "description": "The type of the item. Always `shell_call`.", - "default": "shell_call", + "default": "chatkit.user_message", "x-stainless-const": true }, - "action": { - "$ref": "#/components/schemas/FunctionShellActionParam", - "description": "The shell commands and limits that describe how to run the tool call." - }, - "status": { - "anyOf": [ - { - "$ref": "#/components/schemas/FunctionShellCallItemStatus", - "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`." - }, - { - "type": "null" + "content": { + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserMessageInputText" + }, + { + "$ref": "#/components/schemas/UserMessageQuotedText" + } + ], + "description": "Content blocks that comprise a user message.", + "discriminator": { + "propertyName": "type" } - ] + }, + "type": "array", + "description": "Ordered content elements supplied by the user." }, - "environment": { + "attachments": { + "items": { + "$ref": "#/components/schemas/Attachment" + }, + "type": "array", + "description": "Attachments associated with the user message. Defaults to an empty list." + }, + "inference_options": { "anyOf": [ { - "oneOf": [ - { - "$ref": "#/components/schemas/LocalEnvironmentParam" - }, - { - "$ref": "#/components/schemas/ContainerReferenceParam" - } - ], - "description": "The environment to execute the shell commands in.", - "discriminator": { - "propertyName": "type" - } + "$ref": "#/components/schemas/InferenceOptions", + "description": "Inference overrides applied to the message. Defaults to null when unset." }, { "type": "null" @@ -70533,408 +95096,405 @@ }, "type": "object", "required": [ - "call_id", + "id", + "object", + "created_at", + "thread_id", "type", - "action" + "content", + "attachments", + "inference_options" ], - "title": "Shell tool call", - "description": "A tool representing a request to execute one or more shell commands." + "title": "User Message Item", + "description": "User-authored messages within a thread." }, - "FunctionShellCallOutputTimeoutOutcomeParam": { + "FileAnnotationSource": { "properties": { "type": { "type": "string", "enum": [ - "timeout" + "file" ], - "description": "The outcome type. Always `timeout`.", - "default": "timeout", + "description": "Type discriminator that is always `file`.", + "default": "file", "x-stainless-const": true + }, + "filename": { + "type": "string", + "description": "Filename referenced by the annotation." } }, "type": "object", "required": [ - "type" + "type", + "filename" ], - "title": "Shell call timeout outcome", - "description": "Indicates that the shell call exceeded its configured time limit." + "title": "File annotation source", + "description": "Attachment source referenced by an annotation." }, - "FunctionShellCallOutputExitOutcomeParam": { + "FileAnnotation": { "properties": { "type": { "type": "string", "enum": [ - "exit" + "file" ], - "description": "The outcome type. Always `exit`.", - "default": "exit", + "description": "Type discriminator that is always `file` for this annotation.", + "default": "file", "x-stainless-const": true }, - "exit_code": { - "type": "integer", - "description": "The exit code returned by the shell process." + "source": { + "$ref": "#/components/schemas/FileAnnotationSource", + "description": "File attachment referenced by the annotation." } }, "type": "object", "required": [ "type", - "exit_code" + "source" ], - "title": "Shell call exit outcome", - "description": "Indicates that the shell commands finished and returned an exit code." + "title": "File annotation", + "description": "Annotation that references an uploaded file." }, - "FunctionShellCallOutputOutcomeParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/FunctionShellCallOutputTimeoutOutcomeParam" + "UrlAnnotationSource": { + "properties": { + "type": { + "type": "string", + "enum": [ + "url" + ], + "description": "Type discriminator that is always `url`.", + "default": "url", + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/FunctionShellCallOutputExitOutcomeParam" + "url": { + "type": "string", + "format": "uri", + "description": "URL referenced by the annotation." } + }, + "type": "object", + "required": [ + "type", + "url" ], - "title": "Shell call outcome", - "description": "The exit or timeout outcome associated with this shell call.", - "discriminator": { - "propertyName": "type" - } + "title": "URL annotation source", + "description": "URL backing an annotation entry." }, - "FunctionShellCallOutputContentParam": { + "UrlAnnotation": { "properties": { - "stdout": { - "type": "string", - "maxLength": 10485760, - "description": "Captured stdout output for the shell call." - }, - "stderr": { + "type": { "type": "string", - "maxLength": 10485760, - "description": "Captured stderr output for the shell call." + "enum": [ + "url" + ], + "description": "Type discriminator that is always `url` for this annotation.", + "default": "url", + "x-stainless-const": true }, - "outcome": { - "$ref": "#/components/schemas/FunctionShellCallOutputOutcomeParam", - "description": "The exit or timeout outcome associated with this shell call." + "source": { + "$ref": "#/components/schemas/UrlAnnotationSource", + "description": "URL referenced by the annotation." } }, "type": "object", "required": [ - "stdout", - "stderr", - "outcome" + "type", + "source" ], - "title": "Shell output content", - "description": "Captured stdout and stderr for a portion of a shell tool call output." + "title": "URL annotation", + "description": "Annotation that references a URL." }, - "FunctionShellCallOutputItemParam": { + "ResponseOutputText": { "properties": { - "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of the shell tool call output. Populated when this item is returned via API.", - "example": "sho_123" - }, - { - "type": "null" - } - ] - }, - "call_id": { - "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The unique ID of the shell tool call generated by the model." - }, - "caller": { - "anyOf": [ - { - "$ref": "#/components/schemas/ToolCallCallerParam", - "description": "The execution context that produced this tool call." - }, - { - "type": "null" - } - ] - }, "type": { "type": "string", "enum": [ - "shell_call_output" + "output_text" ], - "description": "The type of the item. Always `shell_call_output`.", - "default": "shell_call_output", + "description": "Type discriminator that is always `output_text`.", + "default": "output_text", "x-stainless-const": true }, - "output": { + "text": { + "type": "string", + "description": "Assistant generated text." + }, + "annotations": { "items": { - "$ref": "#/components/schemas/FunctionShellCallOutputContentParam" + "oneOf": [ + { + "$ref": "#/components/schemas/FileAnnotation" + }, + { + "$ref": "#/components/schemas/UrlAnnotation" + } + ], + "description": "Annotation object describing a cited source.", + "discriminator": { + "propertyName": "type" + } }, "type": "array", - "description": "Captured chunks of stdout and stderr output, along with their associated outcomes." - }, - "status": { - "anyOf": [ - { - "$ref": "#/components/schemas/FunctionShellCallItemStatus", - "description": "The status of the shell call output." - }, - { - "type": "null" - } - ] - }, - "max_output_length": { - "anyOf": [ - { - "type": "integer", - "description": "The maximum number of UTF-8 characters captured for this shell call's combined output." - }, - { - "type": "null" - } - ] + "description": "Ordered list of annotations attached to the response text." } }, "type": "object", "required": [ - "call_id", "type", - "output" - ], - "title": "Shell tool call output", - "description": "The streamed output items emitted by a shell tool call." - }, - "ApplyPatchCallStatusParam": { - "type": "string", - "enum": [ - "in_progress", - "completed" + "text", + "annotations" ], - "title": "Apply patch call status", - "description": "Status values reported for apply_patch tool calls." + "title": "Assistant message content", + "description": "Assistant response text accompanied by optional annotations." }, - "ApplyPatchCreateFileOperationParam": { + "AssistantMessageItem": { "properties": { - "type": { + "id": { + "type": "string", + "description": "Identifier of the thread item." + }, + "object": { "type": "string", "enum": [ - "create_file" + "chatkit.thread_item" ], - "description": "The operation type. Always `create_file`.", - "default": "create_file", + "description": "Type discriminator that is always `chatkit.thread_item`.", + "default": "chatkit.thread_item", "x-stainless-const": true }, - "path": { + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) for when the item was created." + }, + "thread_id": { "type": "string", - "minLength": 1, - "description": "Path of the file to create relative to the workspace root." + "description": "Identifier of the parent thread." }, - "diff": { + "type": { "type": "string", - "maxLength": 10485760, - "description": "Unified diff content to apply when creating the file." + "enum": [ + "chatkit.assistant_message" + ], + "description": "Type discriminator that is always `chatkit.assistant_message`.", + "default": "chatkit.assistant_message", + "x-stainless-const": true + }, + "content": { + "items": { + "$ref": "#/components/schemas/ResponseOutputText" + }, + "type": "array", + "description": "Ordered assistant response segments." } }, "type": "object", "required": [ + "id", + "object", + "created_at", + "thread_id", "type", - "path", - "diff" + "content" ], - "title": "Apply patch create file operation", - "description": "Instruction for creating a new file via the apply_patch tool." + "title": "Assistant message", + "description": "Assistant-authored message within a thread." }, - "ApplyPatchDeleteFileOperationParam": { + "WidgetMessageItem": { "properties": { + "id": { + "type": "string", + "description": "Identifier of the thread item." + }, + "object": { + "type": "string", + "enum": [ + "chatkit.thread_item" + ], + "description": "Type discriminator that is always `chatkit.thread_item`.", + "default": "chatkit.thread_item", + "x-stainless-const": true + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) for when the item was created." + }, + "thread_id": { + "type": "string", + "description": "Identifier of the parent thread." + }, "type": { "type": "string", "enum": [ - "delete_file" + "chatkit.widget" ], - "description": "The operation type. Always `delete_file`.", - "default": "delete_file", + "description": "Type discriminator that is always `chatkit.widget`.", + "default": "chatkit.widget", "x-stainless-const": true }, - "path": { + "widget": { "type": "string", - "minLength": 1, - "description": "Path of the file to delete relative to the workspace root." + "description": "Serialized widget payload rendered in the UI." } }, "type": "object", "required": [ + "id", + "object", + "created_at", + "thread_id", "type", - "path" + "widget" ], - "title": "Apply patch delete file operation", - "description": "Instruction for deleting an existing file via the apply_patch tool." + "title": "Widget message", + "description": "Thread item that renders a widget payload." }, - "ApplyPatchUpdateFileOperationParam": { + "ClientToolCallStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed" + ] + }, + "ClientToolCallItem": { "properties": { - "type": { + "id": { + "type": "string", + "description": "Identifier of the thread item." + }, + "object": { "type": "string", "enum": [ - "update_file" + "chatkit.thread_item" ], - "description": "The operation type. Always `update_file`.", - "default": "update_file", + "description": "Type discriminator that is always `chatkit.thread_item`.", + "default": "chatkit.thread_item", "x-stainless-const": true }, - "path": { - "type": "string", - "minLength": 1, - "description": "Path of the file to update relative to the workspace root." + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) for when the item was created." }, - "diff": { + "thread_id": { "type": "string", - "maxLength": 10485760, - "description": "Unified diff content to apply to the existing file." - } - }, - "type": "object", - "required": [ - "type", - "path", - "diff" - ], - "title": "Apply patch update file operation", - "description": "Instruction for updating an existing file via the apply_patch tool." - }, - "ApplyPatchOperationParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/ApplyPatchCreateFileOperationParam" - }, - { - "$ref": "#/components/schemas/ApplyPatchDeleteFileOperationParam" + "description": "Identifier of the parent thread." }, - { - "$ref": "#/components/schemas/ApplyPatchUpdateFileOperationParam" - } - ], - "title": "Apply patch operation", - "description": "One of the create_file, delete_file, or update_file operations supplied to the apply_patch tool.", - "discriminator": { - "propertyName": "type" - } - }, - "ApplyPatchToolCallItemParam": { - "properties": { "type": { "type": "string", "enum": [ - "apply_patch_call" + "chatkit.client_tool_call" ], - "description": "The type of the item. Always `apply_patch_call`.", - "default": "apply_patch_call", + "description": "Type discriminator that is always `chatkit.client_tool_call`.", + "default": "chatkit.client_tool_call", "x-stainless-const": true }, - "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API.", - "example": "apc_123" - }, - { - "type": "null" - } - ] + "status": { + "$ref": "#/components/schemas/ClientToolCallStatus", + "description": "Execution status for the tool call." }, "call_id": { "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The unique ID of the apply patch tool call generated by the model." + "description": "Identifier for the client tool call." }, - "caller": { + "name": { + "type": "string", + "description": "Tool name that was invoked." + }, + "arguments": { + "type": "string", + "description": "JSON-encoded arguments that were sent to the tool." + }, + "output": { "anyOf": [ { - "$ref": "#/components/schemas/ToolCallCallerParam", - "description": "The execution context that produced this tool call." + "type": "string", + "description": "JSON-encoded output captured from the tool. Defaults to null while execution is in progress." }, { "type": "null" } ] - }, - "status": { - "$ref": "#/components/schemas/ApplyPatchCallStatusParam", - "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." - }, - "operation": { - "$ref": "#/components/schemas/ApplyPatchOperationParam", - "description": "The specific create, delete, or update instruction for the apply_patch tool call." } }, "type": "object", "required": [ + "id", + "object", + "created_at", + "thread_id", "type", - "call_id", "status", - "operation" + "call_id", + "name", + "arguments", + "output" ], - "title": "Apply patch tool call", - "description": "A tool call representing a request to create, delete, or update files using diff patches." + "title": "Client tool call", + "description": "Record of a client side tool invocation initiated by the assistant." }, - "ApplyPatchCallOutputStatusParam": { + "TaskType": { "type": "string", "enum": [ - "completed", - "failed" - ], - "title": "Apply patch call output status", - "description": "Outcome values reported for apply_patch tool call outputs." + "custom", + "thought" + ] }, - "ApplyPatchToolCallOutputItemParam": { + "TaskItem": { "properties": { - "type": { + "id": { + "type": "string", + "description": "Identifier of the thread item." + }, + "object": { "type": "string", "enum": [ - "apply_patch_call_output" + "chatkit.thread_item" ], - "description": "The type of the item. Always `apply_patch_call_output`.", - "default": "apply_patch_call_output", + "description": "Type discriminator that is always `chatkit.thread_item`.", + "default": "chatkit.thread_item", "x-stainless-const": true }, - "id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of the apply patch tool call output. Populated when this item is returned via API.", - "example": "apco_123" - }, - { - "type": "null" - } - ] + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) for when the item was created." }, - "call_id": { + "thread_id": { "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The unique ID of the apply patch tool call generated by the model." + "description": "Identifier of the parent thread." }, - "caller": { + "type": { + "type": "string", + "enum": [ + "chatkit.task" + ], + "description": "Type discriminator that is always `chatkit.task`.", + "default": "chatkit.task", + "x-stainless-const": true + }, + "task_type": { + "$ref": "#/components/schemas/TaskType", + "description": "Subtype for the task." + }, + "heading": { "anyOf": [ { - "$ref": "#/components/schemas/ToolCallCallerParam", - "description": "The execution context that produced this tool call." + "type": "string", + "description": "Optional heading for the task. Defaults to null when not provided." }, { "type": "null" } ] }, - "status": { - "$ref": "#/components/schemas/ApplyPatchCallOutputStatusParam", - "description": "The status of the apply patch tool call output. One of `completed` or `failed`." - }, - "output": { + "summary": { "anyOf": [ { "type": "string", - "maxLength": 10485760, - "description": "Optional human-readable log text from the apply patch tool (e.g., patch results or errors)." + "description": "Optional summary that describes the task. Defaults to null when omitted." }, { "type": "null" @@ -70944,820 +95504,1064 @@ }, "type": "object", "required": [ + "id", + "object", + "created_at", + "thread_id", "type", - "call_id", - "status" + "task_type", + "heading", + "summary" ], - "title": "Apply patch tool call output", - "description": "The streamed output emitted by an apply patch tool call." + "title": "Task item", + "description": "Task emitted by the workflow to show progress and status updates." }, - "CompactionTriggerItemParam": { + "TaskGroupTask": { "properties": { - "id": { + "type": { + "$ref": "#/components/schemas/TaskType", + "description": "Subtype for the grouped task." + }, + "heading": { "anyOf": [ { "type": "string", - "description": "The unique ID of this compaction trigger.", - "example": "msg_123" + "description": "Optional heading for the grouped task. Defaults to null when not provided." }, { "type": "null" } ] }, - "type": { - "type": "string", - "enum": [ - "compaction_trigger" - ], - "description": "The type of the item. Always `compaction_trigger`.", - "default": "compaction_trigger", - "x-stainless-const": true - } - }, - "type": "object", - "required": [ - "type" - ], - "title": "Compaction trigger", - "description": "Compacts the current context. Must be the final input item." - }, - "ItemReferenceParam": { - "properties": { - "type": { + "summary": { "anyOf": [ { "type": "string", - "enum": [ - "item_reference" - ], - "description": "The type of item to reference. Always `item_reference`.", - "default": "item_reference", - "x-stainless-const": true + "description": "Optional summary that describes the grouped task. Defaults to null when omitted." }, { "type": "null" } ] - }, - "id": { - "type": "string", - "description": "The ID of the item to reference." } }, "type": "object", "required": [ - "id" + "type", + "heading", + "summary" ], - "title": "Item reference", - "description": "An internal identifier for an item to reference." + "title": "Task group task", + "description": "Task entry that appears within a TaskGroup." }, - "ProgramItemParam": { + "TaskGroupItem": { "properties": { "id": { "type": "string", - "description": "The unique ID of this program item.", - "example": "cm_123" + "description": "Identifier of the thread item." }, - "type": { + "object": { "type": "string", "enum": [ - "program" + "chatkit.thread_item" ], - "description": "The item type. Always `program`.", - "default": "program", + "description": "Type discriminator that is always `chatkit.thread_item`.", + "default": "chatkit.thread_item", "x-stainless-const": true }, - "call_id": { - "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The stable call ID of the program item." + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "Unix timestamp (in seconds) for when the item was created." }, - "code": { + "thread_id": { "type": "string", - "maxLength": 10485760, - "description": "The JavaScript source executed by programmatic tool calling." + "description": "Identifier of the parent thread." }, - "fingerprint": { + "type": { "type": "string", - "maxLength": 10485760, - "description": "Opaque program replay fingerprint that must be round-tripped." + "enum": [ + "chatkit.task_group" + ], + "description": "Type discriminator that is always `chatkit.task_group`.", + "default": "chatkit.task_group", + "x-stainless-const": true + }, + "tasks": { + "items": { + "$ref": "#/components/schemas/TaskGroupTask" + }, + "type": "array", + "description": "Tasks included in the group." } }, "type": "object", "required": [ "id", + "object", + "created_at", + "thread_id", "type", - "call_id", - "code", - "fingerprint" - ] - }, - "ProgramOutputItemStatus": { - "type": "string", - "enum": [ - "completed", - "incomplete" - ] + "tasks" + ], + "title": "Task group", + "description": "Collection of workflow tasks grouped together in the thread." }, - "ProgramOutputItemParam": { - "properties": { - "id": { - "type": "string", - "description": "The unique ID of this program output item.", - "example": "cmo_123" + "ThreadItem": { + "oneOf": [ + { + "$ref": "#/components/schemas/UserMessageItem" }, - "type": { - "type": "string", - "enum": [ - "program_output" - ], - "description": "The item type. Always `program_output`.", - "default": "program_output", - "x-stainless-const": true + { + "$ref": "#/components/schemas/AssistantMessageItem" }, - "call_id": { - "type": "string", - "maxLength": 64, - "minLength": 1, - "description": "The call ID of the program item." + { + "$ref": "#/components/schemas/WidgetMessageItem" }, - "result": { - "type": "string", - "maxLength": 10485760, - "description": "The result produced by the program item." + { + "$ref": "#/components/schemas/ClientToolCallItem" }, - "status": { - "$ref": "#/components/schemas/ProgramOutputItemStatus", - "description": "The terminal status of the program output." + { + "$ref": "#/components/schemas/TaskItem" + }, + { + "$ref": "#/components/schemas/TaskGroupItem" } - }, - "type": "object", - "required": [ - "id", - "type", - "call_id", - "result", - "status" - ] + ], + "title": "The thread item", + "discriminator": { + "propertyName": "type" + } }, - "ConversationResource": { + "ThreadItemListResource": { "properties": { - "id": { - "type": "string", - "description": "The unique ID of the conversation." - }, "object": { "type": "string", "enum": [ - "conversation" + "list" ], - "description": "The object type, which is always `conversation`.", - "default": "conversation", + "description": "The type of object returned, must be `list`.", + "default": "list", "x-stainless-const": true }, - "metadata": { - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters." + "data": { + "items": { + "$ref": "#/components/schemas/ThreadItem" + }, + "type": "array", + "description": "A list of items" }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The time at which the conversation was created, measured in seconds since the Unix epoch." - } - }, - "type": "object", - "required": [ - "id", - "object", - "metadata", - "created_at" - ] - }, - "_MisalignmentErrorType": { - "anyOf": [ - { - "type": "string" + "first_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the first item in the list." + }, + { + "type": "null" + } + ] }, - { - "type": "string", - "enum": [ - "potentially_unintended_data_transfer", - "potentially_unintended_data_access", - "potentially_unintended_destructive_activity", - "other" + "last_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the last item in the list." + }, + { + "type": "null" + } ] - } - ] - }, - "_MisalignmentSteer": { - "properties": { - "message": { - "type": "string", - "description": "The public continuation instruction." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." } }, "type": "object", "required": [ - "message" - ] + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "title": "Thread Items", + "description": "A paginated list of thread items rendered for the ChatKit API." }, - "MisalignmentErrorDetailsResource": { + "ActiveStatus": { "properties": { - "error_type": { - "$ref": "#/components/schemas/_MisalignmentErrorType", - "description": "An optional classification; clients must accept additional values." - }, - "detailed_explanation": { + "type": { "type": "string", - "description": "The public explanation for this block." - }, - "steer": { - "$ref": "#/components/schemas/_MisalignmentSteer", - "description": "An optional public continuation instruction." + "enum": [ + "active" + ], + "description": "Status discriminator that is always `active`.", + "default": "active", + "x-stainless-const": true } }, "type": "object", - "required": [] + "required": [ + "type" + ], + "title": "Active thread status", + "description": "Indicates that a thread is active." }, - "ImageGenOutputTokensDetails": { + "LockedStatus": { "properties": { - "image_tokens": { - "type": "integer", - "description": "The number of image output tokens generated by the model." + "type": { + "type": "string", + "enum": [ + "locked" + ], + "description": "Status discriminator that is always `locked`.", + "default": "locked", + "x-stainless-const": true }, - "text_tokens": { - "type": "integer", - "description": "The number of text output tokens generated by the model." + "reason": { + "anyOf": [ + { + "type": "string", + "description": "Reason that the thread was locked. Defaults to null when no reason is recorded." + }, + { + "type": "null" + } + ] } }, "type": "object", "required": [ - "image_tokens", - "text_tokens" + "type", + "reason" ], - "title": "Image generation output token details", - "description": "The output token details for the image generation." + "title": "Locked thread status", + "description": "Indicates that a thread is locked and cannot accept new input." }, - "ImageGenInputUsageDetails": { + "ClosedStatus": { "properties": { - "text_tokens": { - "type": "integer", - "description": "The number of text tokens in the input prompt." + "type": { + "type": "string", + "enum": [ + "closed" + ], + "description": "Status discriminator that is always `closed`.", + "default": "closed", + "x-stainless-const": true }, - "image_tokens": { - "type": "integer", - "description": "The number of image tokens in the input prompt." + "reason": { + "anyOf": [ + { + "type": "string", + "description": "Reason that the thread was closed. Defaults to null when no reason is recorded." + }, + { + "type": "null" + } + ] } }, "type": "object", "required": [ - "text_tokens", - "image_tokens" + "type", + "reason" ], - "title": "Input usage details", - "description": "The input tokens detailed information for the image generation." + "title": "Closed thread status", + "description": "Indicates that a thread has been closed." }, - "ImageGenUsage": { + "ThreadResource": { "properties": { - "input_tokens": { - "type": "integer", - "description": "The number of tokens (images and text) in the input prompt." + "id": { + "type": "string", + "description": "Identifier of the thread." }, - "total_tokens": { - "type": "integer", - "description": "The total number of tokens (images and text) used for the image generation." + "object": { + "type": "string", + "enum": [ + "chatkit.thread" + ], + "description": "Type discriminator that is always `chatkit.thread`.", + "default": "chatkit.thread", + "x-stainless-const": true }, - "output_tokens": { + "created_at": { "type": "integer", - "description": "The number of output tokens generated by the model." + "format": "unixtime", + "description": "Unix timestamp (in seconds) for when the thread was created." }, - "output_tokens_details": { - "$ref": "#/components/schemas/ImageGenOutputTokensDetails" + "title": { + "anyOf": [ + { + "type": "string", + "description": "Optional human-readable title for the thread. Defaults to null when no title has been generated." + }, + { + "type": "null" + } + ] }, - "input_tokens_details": { - "$ref": "#/components/schemas/ImageGenInputUsageDetails" + "status": { + "oneOf": [ + { + "$ref": "#/components/schemas/ActiveStatus" + }, + { + "$ref": "#/components/schemas/LockedStatus" + }, + { + "$ref": "#/components/schemas/ClosedStatus" + } + ], + "description": "Current status for the thread. Defaults to `active` for newly created threads.", + "discriminator": { + "propertyName": "type" + } + }, + "user": { + "type": "string", + "description": "Free-form string that identifies your end user who owns the thread." } }, "type": "object", "required": [ - "input_tokens", - "total_tokens", - "output_tokens", - "input_tokens_details" + "id", + "object", + "created_at", + "title", + "status", + "user" ], - "title": "Image generation usage", - "description": "For `gpt-image-1` only, the token usage information for the image generation." - }, - "instructions": { - "anyOf": [ - { - "description": "Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup.", - "type": "string" + "title": "The thread object", + "description": "Represents a ChatKit thread and its current status.", + "example": { + "id": "cthr_def456", + "object": "chatkit.thread", + "created_at": 1712345600, + "title": "Demo feedback", + "status": { + "type": "active" }, - { - "type": "null" - } - ] + "user": "user_456" + } }, - "LiveCustomVoiceParam": { - "type": "object", + "DeletedThreadResource": { "properties": { "id": { "type": "string", - "minLength": 1, - "maxLength": 128 + "description": "Identifier of the deleted thread." + }, + "object": { + "type": "string", + "enum": [ + "chatkit.thread.deleted" + ], + "description": "Type discriminator that is always `chatkit.thread.deleted`.", + "default": "chatkit.thread.deleted", + "x-stainless-const": true + }, + "deleted": { + "type": "boolean", + "description": "Indicates that the thread has been deleted." } }, + "type": "object", "required": [ - "id" - ] + "id", + "object", + "deleted" + ], + "title": "Deleted thread", + "description": "Confirmation payload returned after deleting a thread." }, - "LiveInitialSessionAudioOutputParam": { - "description": "Settings for speech generated by the Live model. Choose the voice before starting the session.", - "type": "object", + "ThreadListResource": { "properties": { - "voice": { - "description": "The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.", - "oneOf": [ + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object returned, must be `list`.", + "default": "list", + "x-stainless-const": true + }, + "data": { + "items": { + "$ref": "#/components/schemas/ThreadResource" + }, + "type": "array", + "description": "A list of items" + }, + "first_id": { + "anyOf": [ { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "alloy", - "ash", - "ballad", - "beacon", - "bossa", - "cedar", - "cinder", - "coral", - "delta", - "echo", - "gleam", - "marin", - "meridian", - "quartz", - "ripple", - "sage", - "shimmer", - "stone", - "tempo", - "verse", - "vesper", - "willow" - ] - } - ] + "type": "string", + "description": "The ID of the first item in the list." }, { - "$ref": "#/components/schemas/LiveCustomVoiceParam" + "type": "null" + } + ] + }, + "last_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the last item in the list." + }, + { + "type": "null" } ] + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more items available." } }, - "required": [] + "type": "object", + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], + "title": "Threads", + "description": "A paginated list of ChatKit threads." }, - "LiveClientDelegationParam": { - "description": "Delegate tasks to your application. The Live session emits delegation events that your backend handles.", + "DecisionInputText": { "type": "object", "properties": { "type": { - "description": "The delegation owner. Always `client` for tasks handled by your application.", - "default": "client", - "x-stainless-const": true, "type": "string", "enum": [ - "client" - ] + "input_text" + ], + "default": "input_text", + "x-stainless-const": true + }, + "text": { + "type": "string", + "minLength": 0, + "maxLength": 10485760 + }, + "prompt_cache_breakpoint": { + "type": [ + "object", + "null" + ], + "properties": { + "mode": { + "type": "string", + "enum": [ + "explicit" + ], + "default": "explicit", + "x-stainless-const": true, + "description": "The breakpoint mode. Always `explicit`." + } + }, + "required": [ + "mode" + ], + "additionalProperties": false, + "title": "Prompt cache breakpoint", + "description": "Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." } }, "required": [ - "type" - ] - }, - "LiveResponsesServiceTier": { - "type": "string", - "enum": [ - "auto", - "default", - "fast_tier_temp_pilot", - "flex", - "priority", - "ultrafast" - ] + "type", + "text" + ], + "additionalProperties": false }, - "LiveReasoningEffort": { + "ImageDetailParam": { "type": "string", "enum": [ - "none", - "minimal", "low", - "medium", "high", - "xhigh" - ] - }, - "LiveReasoningSummary": { - "type": "string", - "enum": [ - "concise", - "detailed", - "auto" + "auto", + "original" ] }, - "LiveDelegationReasoningInputParam": { - "description": "Reasoning options for Responses requests made on behalf of the Live session.", + "DecisionInputImage": { "type": "object", "properties": { - "effort": { + "image_url": { + "type": "string", + "minLength": 0, + "maxLength": 1073741824, + "pattern": "^(data:|https?://)", + "description": "A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL." + }, + "detail": { "anyOf": [ { - "description": "How much reasoning effort the delegated Responses model should use. Supported values depend on the backend model.", - "$ref": "#/components/schemas/LiveReasoningEffort" + "$ref": "#/components/schemas/ImageDetailParam" }, { "type": "null" } - ] + ], + "description": "The image detail level, using the selected model's image profile. Defaults to auto.", + "default": "auto" }, - "summary": { - "anyOf": [ - { - "description": "The reasoning summary to request from the delegated Responses model, when supported.", - "$ref": "#/components/schemas/LiveReasoningSummary" - }, - { - "type": "null" + "prompt_cache_breakpoint": { + "type": [ + "object", + "null" + ], + "properties": { + "mode": { + "type": "string", + "enum": [ + "explicit" + ], + "default": "explicit", + "x-stainless-const": true, + "description": "The breakpoint mode. Always `explicit`." } - ] + }, + "required": [ + "mode" + ], + "additionalProperties": false, + "title": "Prompt cache breakpoint", + "description": "Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." + }, + "type": { + "type": "string", + "enum": [ + "input_image" + ], + "default": "input_image", + "x-stainless-const": true } }, - "required": [] - }, - "LiveTextVerbosity": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] + "required": [ + "image_url", + "type" + ], + "additionalProperties": false, + "description": "An image provided as a base64 data URL or a publicly accessible HTTP(S) URL. File IDs are not supported." }, - "LiveDelegationTextInputParam": { - "description": "Text generation options for the Live session’s Responses backend.", + "DecisionInputJson": { "type": "object", "properties": { - "verbosity": { - "anyOf": [ + "type": { + "type": "string", + "enum": [ + "input_json" + ], + "default": "input_json", + "x-stainless-const": true + }, + "data": { + "oneOf": [ { - "description": "The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery.", - "$ref": "#/components/schemas/LiveTextVerbosity" + "type": "object", + "additionalProperties": { + "anyOf": [ + {}, + { + "type": "null" + } + ] + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0 }, { - "type": "null" + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "anyOf": [ + {}, + { + "type": "null" + } + ] + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0 + }, + "minItems": 0 } ] } }, - "required": [] + "required": [ + "type", + "data" + ], + "additionalProperties": false, + "description": "A JSON object or an array of objects rendered as text. Nested values may be any JSON value. Limited to 32 container levels, 10,000 values, and 256 KiB of compact UTF-8 JSON." }, - "LiveFunctionToolInputParam": { - "description": "A function tool available to the Responses backend when the Live model delegates a task.", + "DecisionInputContentParts": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/DecisionInputText" + }, + { + "$ref": "#/components/schemas/DecisionInputImage" + }, + { + "$ref": "#/components/schemas/DecisionInputJson" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "input_text": "#/components/schemas/DecisionInputText", + "input_image": "#/components/schemas/DecisionInputImage", + "input_json": "#/components/schemas/DecisionInputJson" + } + }, + "x-oai-discriminator-values": [ + "input_text", + "input_image", + "input_json" + ] + }, + "minItems": 0, + "maxItems": 16384 + }, + "DecisionInputContent": { + "oneOf": [ + { + "type": "string", + "minLength": 0, + "maxLength": 10485760 + }, + { + "$ref": "#/components/schemas/DecisionInputContentParts", + "title": "Parts" + } + ], + "description": "A text string or an ordered list of text, image, and JSON parts." + }, + "DecisionInputUserMessage": { "type": "object", "properties": { - "type": { - "description": "The tool type. Always `function`.", - "default": "function", - "x-stainless-const": true, + "role": { "type": "string", "enum": [ - "function" - ] + "user" + ], + "default": "user", + "x-stainless-const": true }, - "name": { - "description": "The name the delegated Responses model uses when calling this function.", - "type": "string" + "content": { + "$ref": "#/components/schemas/DecisionInputContent" }, - "description": { - "anyOf": [ - { - "description": "What the function does and when the delegated Responses model should call it.", - "type": "string" - }, - { - "type": "null" - } - ] + "type": { + "type": "string", + "enum": [ + "message" + ], + "default": "message", + "x-stainless-const": true + } + }, + "required": [ + "role", + "content" + ], + "additionalProperties": false, + "description": "A user message containing input text, images, or JSON." + }, + "DecisionInputDeveloperContentParts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DecisionInputText" + }, + "minItems": 0, + "maxItems": 16384 + }, + "DecisionInputDeveloperContent": { + "oneOf": [ + { + "type": "string", + "minLength": 0, + "maxLength": 10485760 + }, + { + "$ref": "#/components/schemas/DecisionInputDeveloperContentParts", + "title": "Parts" + } + ], + "description": "A text string or an ordered list of input text parts." + }, + "DecisionInputDeveloperMessage": { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "developer" + ], + "default": "developer", + "x-stainless-const": true }, - "parameters": { - "anyOf": [ - { - "description": "A JSON Schema object describing the arguments accepted by the function.", - "type": "object", - "additionalProperties": {} - }, - { - "type": "null" - } - ] + "content": { + "$ref": "#/components/schemas/DecisionInputDeveloperContent" }, - "strict": { - "anyOf": [ - { - "description": "Whether the delegated Responses model must follow the function’s parameter schema exactly.", - "type": "boolean" - }, - { - "type": "null" - } - ] + "type": { + "type": "string", + "enum": [ + "message" + ], + "default": "message", + "x-stainless-const": true } }, "required": [ - "type", - "name" - ] + "role", + "content" + ], + "additionalProperties": false, + "description": "A developer message containing input text." }, - "LiveWebSearchToolInputParam": { - "description": "A web search tool available to the Live session’s Responses backend.", + "DecisionInputSystemMessage": { "type": "object", "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ], + "default": "system", + "x-stainless-const": true + }, + "content": { + "$ref": "#/components/schemas/DecisionInputDeveloperContent" + }, "type": { - "description": "The tool type. Always `web_search`.", - "default": "web_search", - "x-stainless-const": true, "type": "string", "enum": [ - "web_search" - ] + "message" + ], + "default": "message", + "x-stainless-const": true } }, "required": [ - "type" - ] - }, - "LiveToolChoiceEnum": { - "type": "string", - "enum": [ - "auto", - "none", - "required" - ] + "role", + "content" + ], + "additionalProperties": false, + "description": "A system message containing input text." }, - "LiveFunctionToolChoiceParam": { + "DecisionInputOutputText": { "type": "object", "properties": { "type": { - "default": "function", - "x-stainless-const": true, "type": "string", "enum": [ - "function" - ] + "output_text" + ], + "default": "output_text", + "x-stainless-const": true }, - "name": { + "text": { "type": "string", - "minLength": 1, - "maxLength": 64, - "pattern": "^[a-zA-Z0-9_-]+$" + "minLength": 0, + "maxLength": 10485760 } }, "required": [ "type", - "name" - ] + "text" + ], + "additionalProperties": false }, - "LiveMCPToolChoiceParam": { + "DecisionInputRefusal": { "type": "object", "properties": { "type": { - "default": "mcp", - "x-stainless-const": true, "type": "string", "enum": [ - "mcp" - ] - }, - "server_label": { - "type": "string", - "minLength": 1, - "maxLength": 64, - "pattern": "^[a-zA-Z0-9_-]+$" + "refusal" + ], + "default": "refusal", + "x-stainless-const": true }, - "name": { + "refusal": { "type": "string", - "minLength": 1, - "maxLength": 64, - "pattern": "^[a-zA-Z0-9_-]+$" + "minLength": 0, + "maxLength": 10485760 } }, "required": [ "type", - "server_label", - "name" + "refusal" + ], + "additionalProperties": false + }, + "DecisionInputAssistantContentParts": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/DecisionInputOutputText" + }, + { + "$ref": "#/components/schemas/DecisionInputRefusal" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "output_text": "#/components/schemas/DecisionInputOutputText", + "refusal": "#/components/schemas/DecisionInputRefusal" + } + }, + "x-oai-discriminator-values": [ + "output_text", + "refusal" + ] + }, + "minItems": 0, + "maxItems": 16384 + }, + "DecisionInputAssistantContent": { + "oneOf": [ + { + "type": "string", + "minLength": 0, + "maxLength": 10485760 + }, + { + "$ref": "#/components/schemas/DecisionInputAssistantContentParts", + "title": "Parts" + } + ], + "description": "A text string or an ordered list of output text and refusal parts." + }, + "MessagePhaseParam": { + "type": "string", + "enum": [ + "commentary", + "final_answer" ] }, - "LiveResponsesDelegationSettingsInputParam": { - "description": "Model, prompt, and tool settings for tasks delegated by the Live session to a Responses backend.", + "DecisionInputAssistantMessage": { "type": "object", "properties": { - "model": { - "description": "The model used for server-owned Responses delegations.", - "type": "string" + "role": { + "type": "string", + "enum": [ + "assistant" + ], + "default": "assistant", + "x-stainless-const": true }, - "instructions": { - "anyOf": [ - { - "description": "Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt).", - "type": "string" - }, - { - "type": "null" - } - ] + "content": { + "$ref": "#/components/schemas/DecisionInputAssistantContent" }, - "max_output_tokens": { + "phase": { "anyOf": [ { - "description": "Maximum number of output tokens for each delegated response.", - "type": "integer", - "minimum": 16 + "$ref": "#/components/schemas/MessagePhaseParam" }, { "type": "null" } - ] + ], + "description": "The phase of an assistant message." }, - "service_tier": { - "anyOf": [ - { - "description": "Service tier for delegated Responses requests.", - "$ref": "#/components/schemas/LiveResponsesServiceTier" - }, - { - "type": "null" - } - ] + "type": { + "type": "string", + "enum": [ + "message" + ], + "default": "message", + "x-stainless-const": true + } + }, + "required": [ + "role", + "content" + ], + "additionalProperties": false, + "description": "An assistant message containing output text or refusals." + }, + "DecisionInputMessage": { + "oneOf": [ + { + "$ref": "#/components/schemas/DecisionInputUserMessage" }, - "reasoning": { - "anyOf": [ - { - "description": "Reasoning settings passed to each delegated Responses request.", - "$ref": "#/components/schemas/LiveDelegationReasoningInputParam" - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/DecisionInputDeveloperMessage" }, - "text": { - "anyOf": [ - { - "description": "Text generation settings passed to each delegated Responses request.", - "$ref": "#/components/schemas/LiveDelegationTextInputParam" - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/DecisionInputSystemMessage" }, - "tools": { - "description": "Tools available to the Responses backend while it handles tasks delegated by the Live model.", - "type": "array", - "items": { - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveFunctionToolInputParam" - }, - { - "$ref": "#/components/schemas/LiveWebSearchToolInputParam" - } - ] - } + { + "$ref": "#/components/schemas/DecisionInputAssistantMessage" + } + ], + "discriminator": { + "propertyName": "role", + "mapping": { + "user": "#/components/schemas/DecisionInputUserMessage", + "developer": "#/components/schemas/DecisionInputDeveloperMessage", + "system": "#/components/schemas/DecisionInputSystemMessage", + "assistant": "#/components/schemas/DecisionInputAssistantMessage" + } + }, + "x-oai-discriminator-values": [ + "user", + "developer", + "system", + "assistant" + ], + "type": "object" + }, + "FunctionCallStatusParam": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + }, + "DecisionInputFunctionCall": { + "type": "object", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576 }, - "tool_choice": { - "description": "Controls which tool the Responses backend uses when handling a task delegated by the Live model.", - "oneOf": [ - { - "$ref": "#/components/schemas/LiveToolChoiceEnum" - }, - { - "$ref": "#/components/schemas/LiveFunctionToolChoiceParam" - }, - { - "$ref": "#/components/schemas/LiveMCPToolChoiceParam" - } - ] + "call_id": { + "type": "string", + "minLength": 1, + "maxLength": 64 }, - "parallel_tool_calls": { + "namespace": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "pattern": "^[a-zA-Z0-9_.-]+$" + }, + "arguments": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "status": { "anyOf": [ { - "description": "Whether the delegated Responses model may request multiple tool calls in a single response.", - "type": "boolean" + "$ref": "#/components/schemas/FunctionCallStatusParam" }, { "type": "null" } ] - } - }, - "required": [ - "model" - ] - }, - "LiveResponsesDelegationParam": { - "description": "Delegate tasks to a Responses model managed by the Live session.", - "type": "object", - "properties": { + }, "type": { - "description": "The delegation owner. Always `responses` for tasks handled by the Responses API.", - "default": "responses", - "x-stainless-const": true, "type": "string", "enum": [ - "responses" - ] - }, - "responses": { - "description": "Backend model, prompt, and tools used when the Live session delegates a task to Responses.", - "$ref": "#/components/schemas/LiveResponsesDelegationSettingsInputParam" + "function_call" + ], + "default": "function_call", + "x-stainless-const": true } }, "required": [ - "type", - "responses" - ] + "call_id", + "name", + "arguments", + "type" + ], + "additionalProperties": false }, - "delegation": { - "anyOf": [ - { - "description": "Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` to let the API manage a Responses backend.", - "discriminator": { - "propertyName": "type" + "DecisionInputToolOutputContentParts": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/DecisionInputText" }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveClientDelegationParam" - }, - { - "$ref": "#/components/schemas/LiveResponsesDelegationParam" - } - ] + { + "$ref": "#/components/schemas/DecisionInputImage" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "input_text": "#/components/schemas/DecisionInputText", + "input_image": "#/components/schemas/DecisionInputImage" + } }, - { - "type": "null" - } - ] - }, - "store": { - "description": "Whether to store the session for later forking and recording download. Defaults to false for new sessions.", - "type": "boolean" - }, - "LiveInitialMessageStatus": { - "type": "string", - "enum": [ - "incomplete", - "completed" - ] + "x-oai-discriminator-values": [ + "input_text", + "input_image" + ] + }, + "minItems": 0, + "maxItems": 16384 }, - "LiveInitialInputTextContentPartParam": { - "description": "Text supplied in a developer or user message when starting a Live session.", - "type": "object", - "properties": { - "type": { - "description": "The text content type. Always `input_text`.", - "default": "input_text", - "x-stainless-const": true, + "DecisionInputToolOutputContent": { + "oneOf": [ + { "type": "string", - "enum": [ - "input_text" - ] + "minLength": 0, + "maxLength": 10485760 }, - "text": { - "description": "The message text to include in the Live session’s initial conversation history.", - "type": "string" + { + "$ref": "#/components/schemas/DecisionInputToolOutputContentParts", + "title": "Parts" } - }, - "required": [ - "text" - ] + ], + "description": "Text evidence or an ordered list of text and image parts." }, - "LiveInitialDeveloperMessageItemParam": { - "description": "A developer message included in the initial text history of a Live session.", + "DecisionInputFunctionCallOutput": { "type": "object", "properties": { "id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576 + }, + "call_id": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "output": { + "$ref": "#/components/schemas/DecisionInputToolOutputContent" + }, + "status": { "anyOf": [ { - "description": "An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.", - "type": "string" + "$ref": "#/components/schemas/FunctionCallStatusParam" }, { "type": "null" @@ -71765,4393 +96569,5394 @@ ] }, "type": { - "description": "The history item type. Always `message`.", - "default": "message", - "x-stainless-const": true, "type": "string", "enum": [ - "message" - ] + "function_call_output" + ], + "default": "function_call_output", + "x-stainless-const": true + } + }, + "required": [ + "call_id", + "output", + "type" + ], + "additionalProperties": false + }, + "DecisionInputCustomToolCall": { + "type": "object", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576 + }, + "call_id": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "namespace": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" + }, + "input": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, "status": { "anyOf": [ { - "description": "The supplied message’s status. Live uses its text as history and does not resume an incomplete message.", - "$ref": "#/components/schemas/LiveInitialMessageStatus" + "$ref": "#/components/schemas/FunctionCallStatusParam" }, { "type": "null" } ] }, - "role": { - "description": "The author of this history message. Always `developer`.", - "default": "developer", - "x-stainless-const": true, + "type": { "type": "string", "enum": [ - "developer" - ] - }, - "content": { - "description": "The message content. Supply exactly one text part for the initial Live conversation history.", - "type": "array", - "items": { - "$ref": "#/components/schemas/LiveInitialInputTextContentPartParam" - }, - "minItems": 1, - "maxItems": 1 + "custom_tool_call" + ], + "default": "custom_tool_call", + "x-stainless-const": true } }, "required": [ - "role", - "content" - ] + "call_id", + "name", + "input", + "type" + ], + "additionalProperties": false }, - "LiveInitialUserMessageItemParam": { - "description": "A user message included in the initial text history of a Live session.", + "DecisionInputCustomToolCallOutput": { "type": "object", "properties": { "id": { - "anyOf": [ - { - "description": "An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.", - "type": "string" - }, - { - "type": "null" - } - ] + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576 }, - "type": { - "description": "The history item type. Always `message`.", - "default": "message", - "x-stainless-const": true, + "call_id": { "type": "string", - "enum": [ - "message" - ] + "minLength": 1, + "maxLength": 64 + }, + "output": { + "$ref": "#/components/schemas/DecisionInputToolOutputContent" }, "status": { "anyOf": [ { - "description": "The supplied message’s status. Live uses its text as history and does not resume an incomplete message.", - "$ref": "#/components/schemas/LiveInitialMessageStatus" + "$ref": "#/components/schemas/FunctionCallStatusParam" }, { "type": "null" } ] }, - "role": { - "description": "The author of this history message. Always `user`.", - "default": "user", - "x-stainless-const": true, + "type": { "type": "string", "enum": [ - "user" - ] - }, - "content": { - "description": "The message content. Supply exactly one text part for the initial Live conversation history.", - "type": "array", - "items": { - "$ref": "#/components/schemas/LiveInitialInputTextContentPartParam" - }, - "minItems": 1, - "maxItems": 1 + "custom_tool_call_output" + ], + "default": "custom_tool_call_output", + "x-stainless-const": true } }, "required": [ - "role", - "content" - ] + "call_id", + "output", + "type" + ], + "additionalProperties": false }, - "LiveInitialTextContentPartParam": { - "description": "Assistant text supplied as conversation history when starting a Live session.", - "type": "object", - "properties": { - "type": { - "description": "The text content type. Always `text`.", - "default": "text", - "x-stainless-const": true, + "DecisionInput": { + "oneOf": [ + { "type": "string", - "enum": [ - "text" - ] + "minLength": 0, + "maxLength": 10485760 }, - "text": { - "description": "The message text to include in the Live session’s initial conversation history.", - "type": "string" + { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/DecisionInputMessage" + }, + { + "$ref": "#/components/schemas/DecisionInputFunctionCall" + }, + { + "$ref": "#/components/schemas/DecisionInputFunctionCallOutput" + }, + { + "$ref": "#/components/schemas/DecisionInputCustomToolCall" + }, + { + "$ref": "#/components/schemas/DecisionInputCustomToolCallOutput" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "message": "#/components/schemas/DecisionInputMessage", + "function_call": "#/components/schemas/DecisionInputFunctionCall", + "function_call_output": "#/components/schemas/DecisionInputFunctionCallOutput", + "custom_tool_call": "#/components/schemas/DecisionInputCustomToolCall", + "custom_tool_call_output": "#/components/schemas/DecisionInputCustomToolCallOutput" + } + }, + "x-oai-discriminator-values": [ + "message", + "function_call", + "function_call_output", + "custom_tool_call", + "custom_tool_call_output" + ], + "x-oai-default-discriminator-value": "message" + }, + "minItems": 0, + "maxItems": 131072 } - }, - "required": [ - "text" - ] + ], + "description": "The input to evaluate for every question. Provide a text string or an ordered array of messages, function calls and outputs, or custom tool calls and outputs. Each tool output must identify a matching call by call ID." }, - "LiveInitialOutputTextContentPartParam": { - "description": "Assistant output text supplied as conversation history when starting a Live session.", + "DecisionQuestionInputText": { "type": "object", "properties": { "type": { - "description": "The text content type. Always `output_text`.", - "default": "output_text", - "x-stainless-const": true, "type": "string", "enum": [ - "output_text" - ] + "input_text" + ], + "default": "input_text", + "x-stainless-const": true }, "text": { - "description": "The message text to include in the Live session’s initial conversation history.", - "type": "string" + "type": "string", + "minLength": 0, + "maxLength": 10485760 } }, "required": [ "type", "text" - ] + ], + "additionalProperties": false }, - "LiveInitialAssistantMessageItemParam": { - "description": "An assistant message included in the initial text history of a Live session.", + "DecisionQuestionInputImage": { "type": "object", "properties": { - "id": { - "anyOf": [ - { - "description": "An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.", - "type": "string" - }, - { - "type": "null" - } - ] - }, - "type": { - "description": "The history item type. Always `message`.", - "default": "message", - "x-stainless-const": true, + "image_url": { "type": "string", - "enum": [ - "message" - ] + "minLength": 0, + "maxLength": 1073741824, + "pattern": "^(data:|https?://)", + "description": "A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL." }, - "status": { + "detail": { "anyOf": [ { - "description": "The supplied message’s status. Live uses its text as history and does not resume an incomplete message.", - "$ref": "#/components/schemas/LiveInitialMessageStatus" + "$ref": "#/components/schemas/ImageDetailParam" }, { "type": "null" } - ] + ], + "description": "The image detail level, using the selected model's image profile. Defaults to auto.", + "default": "auto" }, - "role": { - "description": "The author of this history message. Always `assistant`.", - "default": "assistant", - "x-stainless-const": true, + "type": { "type": "string", "enum": [ - "assistant" - ] - }, - "content": { - "description": "The message content. Supply exactly one text part for the initial Live conversation history.", - "type": "array", - "items": { - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveInitialTextContentPartParam" - }, - { - "$ref": "#/components/schemas/LiveInitialOutputTextContentPartParam" - } - ], - "x-oai-default-discriminator-value": "text" - }, - "minItems": 1, - "maxItems": 1 + "input_image" + ], + "default": "input_image", + "x-stainless-const": true } }, "required": [ - "role", - "content" - ] + "image_url", + "type" + ], + "additionalProperties": false, + "description": "An image provided as a base64 data URL or a publicly accessible HTTP(S) URL. File IDs are not supported." }, - "LiveInitialItem": { - "description": "A developer, user, or assistant message supplied as text history before the Live session starts.", - "discriminator": { - "propertyName": "role" - }, + "DecisionQuestionInputPart": { "oneOf": [ { - "$ref": "#/components/schemas/LiveInitialDeveloperMessageItemParam" + "$ref": "#/components/schemas/DecisionQuestionInputText" }, { - "$ref": "#/components/schemas/LiveInitialUserMessageItemParam" + "$ref": "#/components/schemas/DecisionQuestionInputImage" }, { - "$ref": "#/components/schemas/LiveInitialAssistantMessageItemParam" + "$ref": "#/components/schemas/DecisionInputJson" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "input_text": "#/components/schemas/DecisionQuestionInputText", + "input_image": "#/components/schemas/DecisionQuestionInputImage", + "input_json": "#/components/schemas/DecisionInputJson" } - ] - }, - "input": { - "description": "Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.", - "type": "array", - "items": { - "$ref": "#/components/schemas/LiveInitialItem" }, - "maxItems": 128 + "x-oai-discriminator-values": [ + "input_text", + "input_image", + "input_json" + ], + "description": "A text, image, or JSON content part in a question instruction." }, - "LiveAllowedServerEventParam": { - "description": "A Live server event selector for the WebRTC frontend data channel.", - "example": { - "type": "session.started" - }, + "QuestionParamPredicate": { "type": "object", "properties": { "type": { - "description": "The outer Live server event type. Use 'response.event' for Responses events.", "type": "string", - "minLength": 1, - "maxLength": 256 + "enum": [ + "predicate" + ], + "default": "predicate", + "x-stainless-const": true, + "description": "The type of the object. Always `predicate`." }, - "response_event": { - "description": "The nested Responses event type. Required when type is 'response.event'; forbidden for other event types.", + "name": { "type": "string", - "minLength": 1, - "maxLength": 256 - } - }, - "required": [ - "type" - ], - "additionalProperties": false, - "x-oaiMeta": { - "example": { - "type": "session.started" - } - } - }, - "LiveDataChannelConfigParam": { - "description": "Control which Live events an untrusted WebRTC frontend can send and receive over its data channel. These restrictions do not apply to trusted sideband connections.", - "type": "object", - "properties": { - "allowed_client_events": { - "description": "Client event types that the frontend data channel may send. Use 'all' to allow every client event; an empty array allows none. Omission preserves the existing allow-all behavior.", + "minLength": 0, + "maxLength": 1048576 + }, + "instructions": { "oneOf": [ { - "default": "all", - "x-stainless-const": true, "type": "string", - "enum": [ - "all" - ] + "minLength": 0, + "maxLength": 1048576 }, { "type": "array", "items": { - "description": "A Live client event type allowed on the frontend data channel, such as `session.input_audio.mute`.", - "type": "string", - "minLength": 1, - "maxLength": 256, - "pattern": "^(?:error|info|[a-z][a-z0-9_-]*(?:\\.[a-z0-9_-]+)+)$" + "$ref": "#/components/schemas/DecisionQuestionInputPart" }, - "maxItems": 256 + "minItems": 1, + "maxItems": 16384 } ] + } + }, + "required": [ + "type", + "instructions" + ], + "additionalProperties": false, + "description": "Estimate how likely it is that a statement about the input is true." + }, + "ChoiceValueParam": { + "oneOf": [ + { + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "allowed_server_events": { - "description": "Server events that may be sent to the frontend data channel. Use 'all' to allow every server event; an empty array allows none. Omission preserves the existing allow-all behavior. Responses events use an object with type 'response.event' and a response_event selector.", + { + "type": "boolean" + } + ], + "description": "Choice values are typed: a string and a boolean with the same text are distinct." + }, + "ChoiceOptionParam": { + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/ChoiceValueParam" + }, + "description": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + } + }, + "required": [ + "value" + ], + "additionalProperties": false + }, + "QuestionParamChoice": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "choice" + ], + "default": "choice", + "x-stainless-const": true, + "description": "The type of the object. Always `choice`." + }, + "name": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "instructions": { "oneOf": [ { - "default": "all", - "x-stainless-const": true, "type": "string", - "enum": [ - "all" - ] + "minLength": 0, + "maxLength": 1048576 }, { "type": "array", "items": { - "$ref": "#/components/schemas/LiveAllowedServerEventParam" + "$ref": "#/components/schemas/DecisionQuestionInputPart" }, - "maxItems": 256 + "minItems": 1, + "maxItems": 16384 } ] + }, + "choices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChoiceOptionParam" + }, + "minItems": 2, + "maxItems": 255, + "description": "Provide between 2 and 255 choices. Each choice must be unique." } }, - "required": [] + "required": [ + "type", + "instructions", + "choices" + ], + "additionalProperties": false, + "description": "Choose from the supplied options based on the input." }, - "LiveClientConfigParam": { - "description": "Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected.", + "ScoreLevelParam": { "type": "object", "properties": { - "data_channel": { - "description": "Client and server event permissions for the WebRTC frontend data channel.", - "$ref": "#/components/schemas/LiveDataChannelConfigParam" + "label": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "description": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 } }, "required": [ - "data_channel" - ] - }, - "properties-store": { - "description": "Whether to store the forked session. Omission inherits the stored session's setting.", - "type": "boolean" + "label" + ], + "additionalProperties": false }, - "LiveResponsesDelegationSettingsUpdateInputParam": { - "description": "Updates to the Responses backend of an existing Live session. Omitted settings retain their current values.", + "QuestionParamScore": { "type": "object", "properties": { - "model": { - "description": "The Responses backend model to use for subsequent delegated requests. Omit to keep the current backend model.", - "type": "string" + "type": { + "type": "string", + "enum": [ + "score" + ], + "default": "score", + "x-stainless-const": true, + "description": "The type of the object. Always `score`." + }, + "name": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, "instructions": { - "anyOf": [ + "oneOf": [ { - "description": "Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt).", - "type": "string" + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, { - "type": "null" + "type": "array", + "items": { + "$ref": "#/components/schemas/DecisionQuestionInputPart" + }, + "minItems": 1, + "maxItems": 16384 } ] }, - "max_output_tokens": { - "anyOf": [ - { - "description": "Maximum number of output tokens for each delegated response.", - "type": "integer", - "minimum": 16 - }, - { - "type": "null" - } - ] + "levels": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoreLevelParam" + }, + "minItems": 2, + "maxItems": 10 + } + }, + "required": [ + "type", + "instructions", + "levels" + ], + "additionalProperties": false, + "description": "Rate the input against the supplied ordered levels." + }, + "QuestionParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/QuestionParamPredicate" }, - "service_tier": { - "anyOf": [ - { - "description": "Service tier for delegated Responses requests.", - "$ref": "#/components/schemas/LiveResponsesServiceTier" - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/QuestionParamChoice" }, - "reasoning": { - "anyOf": [ - { - "description": "Reasoning settings passed to each delegated Responses request.", - "$ref": "#/components/schemas/LiveDelegationReasoningInputParam" - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/QuestionParamScore" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "predicate": "#/components/schemas/QuestionParamPredicate", + "choice": "#/components/schemas/QuestionParamChoice", + "score": "#/components/schemas/QuestionParamScore" + } + }, + "x-oai-discriminator-values": [ + "predicate", + "choice", + "score" + ], + "description": "A question about the request's input, with an optional correlation name." + }, + "DecisionRequest": { + "type": "object", + "properties": { + "model": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The model to use. Only `gpt-6-luna` is supported." }, - "text": { - "anyOf": [ - { - "description": "Text generation settings passed to each delegated Responses request.", - "$ref": "#/components/schemas/LiveDelegationTextInputParam" - }, - { - "type": "null" - } - ] + "input": { + "$ref": "#/components/schemas/DecisionInput" }, - "tools": { - "description": "Tools available to the Responses backend while it handles tasks delegated by the Live model.", + "questions": { "type": "array", "items": { - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveFunctionToolInputParam" - }, - { - "$ref": "#/components/schemas/LiveWebSearchToolInputParam" - } - ] - } + "$ref": "#/components/schemas/QuestionParam" + }, + "minItems": 1, + "maxItems": 400, + "description": "Ask 1–400 questions about the input. Each question can be a predicate, choice, or score. Answers come back in the same order." }, - "tool_choice": { - "description": "Controls which tool the Responses backend uses when handling a task delegated by the Live model.", - "oneOf": [ - { - "$ref": "#/components/schemas/LiveToolChoiceEnum" - }, - { - "$ref": "#/components/schemas/LiveFunctionToolChoiceParam" - }, - { - "$ref": "#/components/schemas/LiveMCPToolChoiceParam" - } - ] + "safety_identifier": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 128, + "description": "Opaque caller-provided end-user identifier, scoped by the verified org. Match Responses' limit; this is never the authenticated user identity." }, - "parallel_tool_calls": { - "anyOf": [ - { - "description": "Whether the delegated Responses model may request multiple tool calls in a single response.", - "type": "boolean" + "prompt_cache_key": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 64, + "description": "Partition prompt cache reuse by caller-provided key." + }, + "prompt_cache_options": { + "type": [ + "object", + "null" + ], + "properties": { + "ttl": { + "type": "string", + "enum": [ + "30m" + ], + "default": "30m", + "x-stainless-const": true, + "description": "The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer." }, - { - "type": "null" + "mode": { + "type": [ + "string", + "null" + ], + "enum": [ + "implicit", + "explicit", + null + ], + "description": "Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching." } - ] + }, + "additionalProperties": false, + "title": "Prompt cache options", + "description": "Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details." } }, - "required": [] + "required": [ + "model", + "input", + "questions" + ], + "additionalProperties": false }, - "LiveResponsesDelegationUpdateParam": { - "description": "Update the Responses backend for an existing Live session without changing delegation ownership.", + "AnswerResourcePredicate": { "type": "object", "properties": { "type": { - "description": "The delegation owner. Always `responses` for tasks handled by the Responses API.", - "default": "responses", - "x-stainless-const": true, "type": "string", "enum": [ - "responses" - ] + "predicate" + ], + "default": "predicate", + "x-stainless-const": true, + "description": "The type of the object. Always `predicate`." }, - "responses": { - "description": "Responses backend settings to update. Omitted settings keep their existing values.", - "$ref": "#/components/schemas/LiveResponsesDelegationSettingsUpdateInputParam" + "name": { + "type": [ + "string", + "null" + ], + "minLength": 0 + }, + "probability": { + "type": "number" } }, "required": [ - "type" - ] + "type", + "name", + "probability" + ], + "additionalProperties": false }, - "target_uri": { - "type": "string", - "description": "URI that should appear in the SIP Refer-To header. Supports values like\n`tel:+14155550123` or `sip:agent@example.com`.", - "example": "tel:+14155550123" + "ChoiceValueResource": { + "oneOf": [ + { + "type": "string", + "minLength": 0 + }, + { + "type": "boolean" + } + ], + "description": "Choice values are typed: a string and a boolean with the same text are distinct." }, - "PublicProjectResidency": { - "type": "string", - "enum": [ - "GLOBAL", - "US_STORAGE_PROCESSING", - "EU_STORAGE_PROCESSING", - "JP_STORAGE", - "KR_STORAGE", - "CA_STORAGE", - "SG_STORAGE", - "IN_STORAGE", - "AU_STORAGE", - "GB_STORAGE", - "AE_STORAGE", - "AE_STORAGE_PROCESSING" - ] + "ChoiceProbabilityResource": { + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/ChoiceValueResource" + }, + "probability": { + "type": "number" + } + }, + "required": [ + "value", + "probability" + ], + "additionalProperties": false }, - "SpecificProgrammaticToolCallingParam": { + "AnswerResourceChoice": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "programmatic_tool_calling" + "choice" ], - "description": "The tool to call. Always `programmatic_tool_calling`.", - "default": "programmatic_tool_calling", - "x-stainless-const": true + "default": "choice", + "x-stainless-const": true, + "description": "The type of the object. Always `choice`." + }, + "name": { + "type": [ + "string", + "null" + ], + "minLength": 0 + }, + "choice": { + "$ref": "#/components/schemas/ChoiceValueResource" + }, + "probabilities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChoiceProbabilityResource" + }, + "minItems": 0, + "maxItems": 2000 + }, + "confidence": { + "type": "number" } }, + "required": [ + "type", + "name", + "choice", + "probabilities", + "confidence" + ], + "additionalProperties": false + }, + "ScoreProbabilityResource": { "type": "object", + "properties": { + "value": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string", + "minLength": 0 + }, + "probability": { + "type": "number" + } + }, "required": [ - "type" - ] + "value", + "label", + "probability" + ], + "additionalProperties": false }, - "SpecificApplyPatchParam": { + "AnswerResourceScore": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "apply_patch" + "score" ], - "description": "The tool to call. Always `apply_patch`.", - "default": "apply_patch", - "x-stainless-const": true + "default": "score", + "x-stainless-const": true, + "description": "The type of the object. Always `score`." + }, + "name": { + "type": [ + "string", + "null" + ], + "minLength": 0 + }, + "score": { + "type": "number" + }, + "probabilities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoreProbabilityResource" + }, + "minItems": 0, + "maxItems": 2000 + }, + "confidence": { + "type": "number" } }, - "type": "object", "required": [ - "type" + "type", + "name", + "score", + "probabilities", + "confidence" ], - "title": "Specific apply patch tool choice", - "description": "Forces the model to call the apply_patch tool when executing a tool call." + "additionalProperties": false }, - "SpecificFunctionShellParam": { + "AnswerResourceRefusal": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "shell" + "refusal" ], - "description": "The tool to call. Always `shell`.", - "default": "shell", - "x-stainless-const": true + "default": "refusal", + "x-stainless-const": true, + "description": "The type of the object. Always `refusal`." + }, + "name": { + "type": [ + "string", + "null" + ], + "minLength": 0 } }, - "type": "object", "required": [ - "type" + "type", + "name" ], - "title": "Specific shell tool choice", - "description": "Forces the model to call the shell tool when a tool call is required." + "additionalProperties": false, + "description": "The model declined to answer this question. Other questions in the same request can still receive answers." }, - "ResponsePromptCacheOptionsParam": { - "properties": { - "ttl": { - "$ref": "#/components/schemas/PromptCacheTTLEnum", - "description": "The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer." + "AnswerResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AnswerResourcePredicate" }, - "mode": { - "$ref": "#/components/schemas/PromptCacheModeEnum", - "description": "Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching." + { + "$ref": "#/components/schemas/AnswerResourceChoice" }, - "comparison_response_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled.", - "example": "resp_123" - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/AnswerResourceScore" + }, + { + "$ref": "#/components/schemas/AnswerResourceRefusal" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "predicate": "#/components/schemas/AnswerResourcePredicate", + "choice": "#/components/schemas/AnswerResourceChoice", + "score": "#/components/schemas/AnswerResourceScore", + "refusal": "#/components/schemas/AnswerResourceRefusal" } }, - "type": "object", - "required": [], - "title": "Prompt cache options", - "description": "Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details." + "x-oai-discriminator-values": [ + "predicate", + "choice", + "score", + "refusal" + ], + "description": "A completed question always includes its name, including null when unnamed." }, - "ReasoningModeEnum": { - "anyOf": [ - { - "type": "string" + "InputTokensDetailsResource": { + "type": "object", + "properties": { + "cached_tokens": { + "type": "integer", + "format": "int64", + "minimum": -2147483648, + "maximum": 2147483647 }, - { - "type": "string", - "enum": [ - "standard", - "pro" - ] + "cache_write_tokens": { + "type": "integer", + "format": "int64", + "minimum": -2147483648, + "maximum": 2147483647 } - ] + }, + "required": [ + "cached_tokens", + "cache_write_tokens" + ], + "additionalProperties": false }, - "ConversationParam-2": { + "OutputTokensDetailsResource": { + "type": "object", "properties": { - "id": { - "type": "string", - "description": "The unique ID of the conversation.", - "example": "conv_123" + "reasoning_tokens": { + "type": "integer", + "format": "int64", + "minimum": -2147483648, + "maximum": 2147483647 } }, + "required": [ + "reasoning_tokens" + ], + "additionalProperties": false + }, + "ResponseUsageResource": { "type": "object", + "properties": { + "input_tokens": { + "type": "integer", + "format": "int64", + "minimum": -2147483648, + "maximum": 2147483647 + }, + "input_tokens_details": { + "$ref": "#/components/schemas/InputTokensDetailsResource" + }, + "output_tokens": { + "type": "integer", + "format": "int64", + "minimum": -2147483648, + "maximum": 2147483647 + }, + "output_tokens_details": { + "$ref": "#/components/schemas/OutputTokensDetailsResource" + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "minimum": -2147483648, + "maximum": 2147483647 + } + }, "required": [ - "id" + "input_tokens", + "input_tokens_details", + "output_tokens", + "output_tokens_details", + "total_tokens" ], - "title": "Conversation object", - "description": "The conversation that this response belongs to." + "additionalProperties": false }, - "ContextManagementParam": { + "DecisionResponse": { + "type": "object", "properties": { - "type": { + "model": { "type": "string", - "description": "The context management entry type. Currently only 'compaction' is supported." + "minLength": 0, + "description": "The model used." }, - "compact_threshold": { + "answers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AnswerResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Answers in question order. Any question can return a refusal instead of an answer; other questions can still receive answers. A refusal has `type: \"refusal\"` and the question's `name`, or `null` if it was unnamed." + }, + "usage": { + "$ref": "#/components/schemas/ResponseUsageResource", + "description": "Token usage for the request." + } + }, + "required": [ + "model", + "answers", + "usage" + ], + "additionalProperties": false + }, + "ListOrderParam": { + "type": "string", + "enum": [ + "asc", + "desc" + ], + "x-enumDescriptions": [ + "Returns resources in ascending order.", + "Returns resources in descending order." + ], + "description": "The order in which paginated resources are returned." + }, + "ReasoningEffortResource": { + "type": "string", + "enum": [ + "none", + "minimal", + "low", + "medium", + "high", + "xhigh", + "max" + ], + "description": "The amount of reasoning effort used by an agent." + }, + "ReasoningSummaryResource": { + "type": "string", + "enum": [ + "concise", + "detailed", + "auto" + ], + "x-enumDescriptions": [ + "Returns a concise reasoning summary when supported.", + "Returns a detailed reasoning summary when supported.", + "Automatically selects the most detailed summary supported by the model." + ], + "description": "The reasoning summary format requested from an agent." + }, + "ReasoningResource": { + "type": "object", + "properties": { + "effort": { "anyOf": [ { - "type": "integer", - "minimum": 1000, - "description": "Token threshold at which compaction should be triggered for this entry." + "$ref": "#/components/schemas/ReasoningEffortResource" }, { "type": "null" } - ] - } - }, - "type": "object", - "required": [ - "type" - ] - }, - "PromptCacheOptions": { - "properties": { - "ttl": { - "$ref": "#/components/schemas/PromptCacheTTLEnum", - "description": "The minimum lifetime applied to each cache breakpoint." - }, - "mode": { - "$ref": "#/components/schemas/PromptCacheModeEnum", - "description": "Whether implicit prompt-cache breakpoints were enabled." + ], + "description": "The requested reasoning effort, or `null` when the model selects its own default." }, - "comparison_response_id": { + "summary": { "anyOf": [ { - "type": "string", - "description": "The response ID supplied as the prompt cache diagnostics comparison." + "$ref": "#/components/schemas/ReasoningSummaryResource" }, { "type": "null" } - ] + ], + "description": "The requested reasoning summary format, or `null` when summaries are disabled." } }, - "type": "object", "required": [ - "ttl", - "mode" + "effort", + "summary" ], - "title": "Prompt cache options", - "description": "The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models." + "additionalProperties": false, + "description": "The reasoning configuration used by an agent." }, - "CacheMissReasonTypeEnum": { - "type": "string", - "enum": [ - "model_changed", - "prompt_cache_key_changed", - "tools_changed", - "text_format_changed", - "reasoning_effort_changed", - "verbosity_changed", - "context_compacted", - "input_changed", - "service_tier_changed" - ] + "TextFormatResourceText": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "text" + ], + "default": "text", + "x-stainless-const": true, + "description": "The type of the object. Always `text`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Generates ordinary text without a structured-output constraint." }, - "PromptCacheMissDiagnosticsBody": { + "TextFormatResourceJsonSchema": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "cache_miss" + "json_schema" ], - "default": "cache_miss", - "x-stainless-const": true - }, - "reason": { - "$ref": "#/components/schemas/CacheMissReasonTypeEnum", - "description": "The reason prompt cache reuse did not occur." + "default": "json_schema", + "x-stainless-const": true, + "description": "The type of the object. Always `json_schema`." }, - "cache_missed_tokens": { - "type": "integer", - "description": "The estimated number of input tokens affected after the first detected divergence." + "schema": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "The JSON Schema that generated text must match." + } + }, + "required": [ + "type", + "schema" + ], + "additionalProperties": false, + "description": "Constrains generated text to a JSON Schema." + }, + "TextFormatResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/TextFormatResourceText" }, - "comparison_reusable_tokens": { - "type": "integer", - "description": "The raw token count of the reusable prefix in the compared response." + { + "$ref": "#/components/schemas/TextFormatResourceJsonSchema" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "text": "#/components/schemas/TextFormatResourceText", + "json_schema": "#/components/schemas/TextFormatResourceJsonSchema" } }, + "x-oai-discriminator-values": [ + "text", + "json_schema" + ], + "description": "The effective output format for generated text." + }, + "VerbosityResource": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ], + "description": "The amount of text produced by an agent." + }, + "TextResource": { "type": "object", + "properties": { + "format": { + "$ref": "#/components/schemas/TextFormatResource", + "description": "The effective output format. Defaults to ordinary text." + }, + "verbosity": { + "$ref": "#/components/schemas/VerbosityResource", + "description": "The amount of text produced by the agent. Defaults to `medium`." + } + }, "required": [ - "type", - "reason", - "cache_missed_tokens" - ] + "format", + "verbosity" + ], + "additionalProperties": false, + "description": "The text configuration used by an agent." + }, + "ServiceTierResource": { + "type": "string", + "enum": [ + "auto", + "default", + "flex", + "priority", + "fast", + "ultrafast" + ], + "description": "The service-tier policy configured for an agent." }, - "PromptCacheHitDiagnosticsBody": { + "AgentToolResourceFunction": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "cache_hit" + "function" ], - "default": "cache_hit", - "x-stainless-const": true + "default": "function", + "x-stainless-const": true, + "description": "The type of the object. Always `function`." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The name of the function." + }, + "description": { + "type": "string", + "minLength": 0, + "description": "A description of what the function does." + }, + "parameters": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "A JSON Schema object describing the function's arguments." + }, + "defer_loading": { + "type": "boolean", + "description": "Whether the function is deferred and discovered through tool search." } }, - "type": "object", "required": [ - "type" - ] + "type", + "name", + "description", + "parameters", + "defer_loading" + ], + "additionalProperties": false, + "description": "A function defined by the application." }, - "PromptCacheComparisonResponseNotFoundDiagnosticsBody": { + "AgentToolResourceProgrammaticToolCalling": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "comparison_response_not_found" + "programmatic_tool_calling" ], - "default": "comparison_response_not_found", - "x-stainless-const": true + "default": "programmatic_tool_calling", + "x-stainless-const": true, + "description": "The type of the object. Always `programmatic_tool_calling`." + }, + "enabled": { + "type": "boolean", + "description": "Whether tools can be called from model-generated code." } }, - "type": "object", "required": [ - "type" - ] + "type", + "enabled" + ], + "additionalProperties": false, + "description": "Enables calling tools from model-generated code." }, - "PromptCacheUnavailableDiagnosticsBody": { + "McpTransportResourceHttp": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "unavailable" + "http" ], - "default": "unavailable", - "x-stainless-const": true + "default": "http", + "x-stainless-const": true, + "description": "The type of the object. Always `http`." + }, + "server_url": { + "type": "string", + "minLength": 0, + "description": "The URL of the MCP server." } }, - "type": "object", "required": [ - "type" - ] - }, - "PromptCacheDiagnostics": { - "oneOf": [ - { - "$ref": "#/components/schemas/PromptCacheMissDiagnosticsBody" - }, - { - "$ref": "#/components/schemas/PromptCacheHitDiagnosticsBody" - }, - { - "$ref": "#/components/schemas/PromptCacheComparisonResponseNotFoundDiagnosticsBody" - }, - { - "$ref": "#/components/schemas/PromptCacheUnavailableDiagnosticsBody" - } + "type", + "server_url" ], - "description": "Prompt cache diagnostics requested for this response.", - "discriminator": { - "propertyName": "type" - } + "additionalProperties": false, + "description": "Connects to an MCP server over HTTP." }, - "ModerationErrorBody": { + "McpTransportResourceStdio": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "error" + "stdio" ], - "description": "The object type, which was always `error` for moderation failures.", - "default": "error", - "x-stainless-const": true + "default": "stdio", + "x-stainless-const": true, + "description": "The type of the object. Always `stdio`." }, - "code": { + "command": { "type": "string", - "description": "The error code." + "minLength": 0, + "description": "The command used to start the MCP server." }, - "message": { + "args": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Arguments passed to the MCP server command." + }, + "cwd": { "type": "string", - "description": "The error message." + "minLength": 0, + "description": "The working directory used to start the MCP server." + }, + "env_vars": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Environment variable names inherited from the execution environment." } }, - "type": "object", "required": [ "type", - "code", - "message" + "command", + "args", + "cwd", + "env_vars" ], - "title": "Moderation error", - "description": "An error produced while attempting moderation for the response input or output." + "additionalProperties": false, + "description": "Starts an MCP server as a local process." }, - "Moderation": { - "properties": { - "input": { - "oneOf": [ - { - "$ref": "#/components/schemas/ModerationResultBody" - }, - { - "$ref": "#/components/schemas/ModerationErrorBody" - } - ], - "description": "Moderation for the response input.", - "discriminator": { - "propertyName": "type" - } + "McpTransportResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/McpTransportResourceHttp" }, - "output": { - "oneOf": [ - { - "$ref": "#/components/schemas/ModerationResultBody" - }, - { - "$ref": "#/components/schemas/ModerationErrorBody" - } - ], - "description": "Moderation for the response output.", - "discriminator": { - "propertyName": "type" - } + { + "$ref": "#/components/schemas/McpTransportResourceStdio" } - }, - "type": "object", - "required": [ - "input", - "output" ], - "title": "Moderation", - "description": "Moderation results or errors for the response input and output." - }, - "ResponseConversation": { - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the conversation that this response was associated with." + "discriminator": { + "propertyName": "type", + "mapping": { + "http": "#/components/schemas/McpTransportResourceHttp", + "stdio": "#/components/schemas/McpTransportResourceStdio" } }, - "type": "object", - "required": [ - "id" + "x-oai-discriminator-values": [ + "http", + "stdio" ], - "title": "Conversation", - "description": "The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation." + "description": "The transport used to connect to an MCP server." }, - "ResponseShellCallCommandAddedStreamingEvent": { + "McpConnectionOriginResource": { + "type": "string", + "enum": [ + "service", + "environment" + ], + "description": "Where outbound MCP HTTP connections originate." + }, + "AgentToolResourceMcp": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "response.shell_call_command.added" + "mcp" ], - "description": "The type of the event, always `response.shell_call_command.added`.", - "default": "response.shell_call_command.added", - "x-stainless-const": true + "default": "mcp", + "x-stainless-const": true, + "description": "The type of the object. Always `mcp`." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the event that was emitted." + "server_label": { + "type": "string", + "minLength": 0, + "description": "A label used to identify the MCP server in tool calls." }, - "output_index": { - "type": "integer", - "description": "The index of the output item that was updated." + "credential_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL." }, - "command_index": { - "type": "integer", - "description": "The index of the shell command that was added." + "transport": { + "$ref": "#/components/schemas/McpTransportResource", + "description": "The transport used to connect to the MCP server." }, - "command": { - "type": "string", - "description": "The shell command that was added." + "request_metadata": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Metadata included with requests to this MCP server." + }, + "allowed_tools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "The MCP tools the agent may call." + }, + "required": { + "type": "boolean", + "description": "Whether this MCP server must initialize before the first turn." + }, + "connection_origin": { + "$ref": "#/components/schemas/McpConnectionOriginResource", + "description": "Where outbound MCP HTTP connections originate." } }, - "type": "object", "required": [ "type", - "sequence_number", - "output_index", - "command_index", - "command" + "server_label", + "credential_id", + "transport", + "request_metadata", + "allowed_tools", + "required", + "connection_origin" ], - "title": "Response shell command added event", - "description": "A streaming event that indicated a shell command was added to a tool call." + "additionalProperties": false, + "description": "Tools provided by a remote MCP server." }, - "ResponseShellCallCommandDeltaStreamingEvent": { + "WebSearchModeResource": { + "type": "string", + "enum": [ + "disabled", + "cached", + "live" + ], + "description": "The source used for web search results." + }, + "WebSearchContextSizeResource": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ], + "description": "The amount of web search context made available to the model." + }, + "WebSearchLocationResource": { + "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "response.shell_call_command.delta" + "country": { + "type": [ + "string", + "null" ], - "description": "The type of the event, always `response.shell_call_command.delta`.", - "default": "response.shell_call_command.delta", - "x-stainless-const": true - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the event that was emitted." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item that was updated." + "minLength": 0, + "description": "The two-letter ISO country code, such as `US`." }, - "command_index": { - "type": "integer", - "description": "The index of the shell command that was updated." + "region": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The region or state name." }, - "delta": { - "type": "string", - "description": "The shell command delta that was appended." + "city": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The city name." }, - "obfuscation": { - "type": "string", - "description": "An obfuscation string that was added to pad the event payload." + "timezone": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The IANA timezone, such as `America/Los_Angeles`." } }, - "type": "object", "required": [ - "type", - "sequence_number", - "output_index", - "command_index", - "delta" + "country", + "region", + "city", + "timezone" ], - "title": "Response shell command delta event", - "description": "A streaming event that indicated a shell command was incrementally updated." + "additionalProperties": false, + "description": "Approximate user location used to localize web search results." }, - "ResponseShellCallCommandDoneStreamingEvent": { + "AgentToolResourceWebSearch": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "response.shell_call_command.done" + "web_search" ], - "description": "The type of the event, always `response.shell_call_command.done`.", - "default": "response.shell_call_command.done", - "x-stainless-const": true + "default": "web_search", + "x-stainless-const": true, + "description": "The type of the object. Always `web_search`." }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the event that was emitted." + "mode": { + "$ref": "#/components/schemas/WebSearchModeResource", + "description": "The source used for web search results." }, - "output_index": { - "type": "integer", - "description": "The index of the output item that was updated." + "context_size": { + "$ref": "#/components/schemas/WebSearchContextSizeResource", + "description": "The amount of search context made available to the model. Defaults to `medium`." }, - "command_index": { - "type": "integer", - "description": "The index of the shell command that was completed." + "allowed_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Allowed search domains, or `null` when the search is unrestricted." }, - "command": { - "type": "string", - "description": "The final shell command that was emitted." + "location": { + "anyOf": [ + { + "$ref": "#/components/schemas/WebSearchLocationResource" + }, + { + "type": "null" + } + ], + "description": "Approximate location used to localize search results, if provided." } }, - "type": "object", "required": [ "type", - "sequence_number", - "output_index", - "command_index", - "command" + "mode", + "context_size", + "allowed_domains", + "location" ], - "title": "Response shell command done event", - "description": "A streaming event that indicated a shell command was completed." + "additionalProperties": false, + "description": "Web search." }, - "ShellCallOutputDelta": { - "properties": { - "stdout": { - "type": "string", - "description": "The stdout delta that was emitted." - }, - "stderr": { - "type": "string", - "description": "The stderr delta that was emitted." - } - }, + "AgentToolResourceComputerUse": { "type": "object", - "required": [], - "title": "Shell call output delta", - "description": "A delta of stdout/stderr emitted while a shell call was running." - }, - "ResponseShellCallOutputContentDeltaStreamingEvent": { "properties": { "type": { "type": "string", "enum": [ - "response.shell_call_output_content.delta" + "computer_use" ], - "description": "The type of the event, always `response.shell_call_output_content.delta`.", - "default": "response.shell_call_output_content.delta", - "x-stainless-const": true - }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the event that was emitted." - }, - "item_id": { - "type": "string", - "description": "The ID of the output item that was updated." - }, - "output_index": { - "type": "integer", - "description": "The index of the output item that was updated." - }, - "command_index": { - "type": "integer", - "description": "The index of the shell command that produced output." + "default": "computer_use", + "x-stainless-const": true, + "description": "The type of the object. Always `computer_use`." }, - "delta": { - "$ref": "#/components/schemas/ShellCallOutputDelta", - "description": "The stdout/stderr delta that was emitted." + "include_screenshots": { + "type": "boolean", + "description": "Whether computer tool outputs include screenshots." } }, - "type": "object", "required": [ "type", - "sequence_number", - "item_id", - "output_index", - "command_index", - "delta" + "include_screenshots" ], - "title": "Response shell call output content delta event", - "description": "A streaming event that indicated shell call output was incrementally added." + "additionalProperties": false, + "description": "Browser use in an OpenAI-hosted session." }, - "ResponseShellCallOutputContentDoneStreamingEvent": { + "AgentToolResourceAutomations": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "response.shell_call_output_content.done" + "automations" ], - "description": "The type of the event, always `response.shell_call_output_content.done`.", - "default": "response.shell_call_output_content.done", - "x-stainless-const": true + "default": "automations", + "x-stainless-const": true, + "description": "The type of the object. Always `automations`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Lets the agent manage its own scheduled wakeups." + }, + "AgentToolResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AgentToolResourceFunction" }, - "sequence_number": { - "type": "integer", - "description": "The sequence number of the event that was emitted." + { + "$ref": "#/components/schemas/AgentToolResourceProgrammaticToolCalling" }, - "item_id": { - "type": "string", - "description": "The ID of the output item that was updated." + { + "$ref": "#/components/schemas/AgentToolResourceMcp" }, - "output_index": { - "type": "integer", - "description": "The index of the output item that was updated." + { + "$ref": "#/components/schemas/AgentToolResourceWebSearch" }, - "command_index": { - "type": "integer", - "description": "The index of the shell command that produced output." + { + "$ref": "#/components/schemas/AgentToolResourceComputerUse" }, - "output": { - "items": { - "$ref": "#/components/schemas/FunctionShellCallOutputContent" - }, - "type": "array", - "description": "The output contents emitted for the shell command." + { + "$ref": "#/components/schemas/AgentToolResourceAutomations" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "function": "#/components/schemas/AgentToolResourceFunction", + "programmatic_tool_calling": "#/components/schemas/AgentToolResourceProgrammaticToolCalling", + "mcp": "#/components/schemas/AgentToolResourceMcp", + "web_search": "#/components/schemas/AgentToolResourceWebSearch", + "computer_use": "#/components/schemas/AgentToolResourceComputerUse", + "automations": "#/components/schemas/AgentToolResourceAutomations" } }, - "type": "object", - "required": [ - "type", - "sequence_number", - "item_id", - "output_index", - "command_index", - "output" + "x-oai-discriminator-values": [ + "function", + "programmatic_tool_calling", + "mcp", + "web_search", + "computer_use", + "automations" ], - "title": "Response shell call output content done event", - "description": "A streaming event that indicated shell call output was completed." + "description": "A tool available to the agent." }, - "CreateConversationBody": { + "MultiAgentConfigResource": { + "type": "object", "properties": { - "metadata": { - "anyOf": [ - { - "$ref": "#/components/schemas/Metadata", - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters." - }, - { - "type": "null" - } - ] + "enabled": { + "type": "boolean", + "description": "Whether subagent tools are enabled. Defaults to false." }, - "items": { - "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/InputItem" - }, - "type": "array", - "maxItems": 20, - "description": "Initial items to include in the conversation context. You may add up to 20 items at a time." - }, - { - "type": "null" - } - ] + "max_concurrent_subagents": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "minimum": 1, + "maximum": 4294967295, + "description": "Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled." } }, - "type": "object", - "required": [] + "required": [ + "enabled", + "max_concurrent_subagents" + ], + "additionalProperties": false, + "description": "The resolved configuration for creating and coordinating subagents." }, - "UpdateConversationBody": { + "CompactionResource": { + "type": "object", "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata", - "description": "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters." + "async": { + "type": "boolean", + "description": "Whether context is compacted in the background. Defaults to true." } }, - "type": "object", "required": [ - "metadata" - ] + "async" + ], + "additionalProperties": false, + "description": "The effective settings for compacting the agent's context." }, - "DeletedConversationResource": { + "ExperimentalConfigResource": { + "type": "object", "properties": { - "object": { - "type": "string", - "enum": [ - "conversation.deleted" - ], - "default": "conversation.deleted", - "x-stainless-const": true - }, - "deleted": { - "type": "boolean" - }, - "id": { - "type": "string" + "time_awareness": { + "type": "boolean", + "description": "Whether the model receives periodic current-time reminders." } }, - "type": "object", "required": [ - "object", - "deleted", - "id" - ] - }, - "SafetyAlertErrorType": { - "type": "string", - "enum": [ - "potentially_unintended_data_transfer", - "potentially_unintended_data_access", - "potentially_unintended_destructive_activity", - "other" - ] + "time_awareness" + ], + "additionalProperties": false, + "description": "The effective experimental settings for an agent." }, - "SafetyAlertResource": { + "AutomationAgentConfigResource": { + "type": "object", "properties": { - "id": { - "type": "string" - }, - "object": { + "model": { "type": "string", - "enum": [ - "safety.alert" - ], - "default": "safety.alert", - "x-stainless-const": true + "minLength": 0, + "description": "The requested model name." }, - "created_at": { - "type": "integer", - "format": "unixtime" + "reasoning": { + "$ref": "#/components/schemas/ReasoningResource", + "description": "The configured reasoning policy." }, - "request_id": { - "type": "string" + "text": { + "$ref": "#/components/schemas/TextResource", + "description": "The configured output format and verbosity." }, - "response_id": { - "type": "string" + "service_tier": { + "$ref": "#/components/schemas/ServiceTierResource", + "description": "The configured service-tier policy." }, - "model": { - "type": "string" + "instructions": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "Custom instructions, or null when absent." }, - "request_paused": { - "type": "boolean", - "description": "Whether block registration succeeded for this request. This does not confirm that response execution stopped." + "tools": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AgentToolResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Configured tools, excluding confidential credentials." }, - "error_type": { - "$ref": "#/components/schemas/SafetyAlertErrorType" + "multi_agent": { + "$ref": "#/components/schemas/MultiAgentConfigResource", + "description": "The configuration for creating and coordinating subagents." }, - "reason": { - "anyOf": [ - { - "type": "string", - "description": "A customer-safe description derived from error_type, or null for zero data retention requests." - }, - { - "type": "null" - } - ] + "compaction": { + "$ref": "#/components/schemas/CompactionResource", + "description": "The effective context compaction settings." + }, + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigResource", + "description": "The effective experimental settings for the agent." } }, - "type": "object", "required": [ - "id", - "object", - "created_at", - "request_id", - "response_id", "model", - "request_paused", - "error_type", - "reason" - ] + "reasoning", + "text", + "service_tier", + "instructions", + "tools", + "multi_agent" + ], + "additionalProperties": false, + "description": "Inline agent configuration without a generated session-local identity." }, - "SpendLimitCurrency": { - "anyOf": [ - { - "type": "string" - }, - { + "AutomationEnvironmentResourceNone": { + "type": "object", + "properties": { + "type": { "type": "string", "enum": [ - "USD" - ] + "none" + ], + "default": "none", + "x-stainless-const": true, + "description": "The type of the object. Always `none`." } - ] + }, + "required": [ + "type" + ], + "additionalProperties": false }, - "SpendLimitInterval": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "month" - ] - } - ] + "ContainerSizeResource": { + "type": "string", + "enum": [ + "small", + "medium", + "large" + ], + "description": "The effective CPU and memory tier of an OpenAI-hosted environment." }, - "SpendLimitEnforcementStatus": { - "anyOf": [ - { - "type": "string" + "EnvironmentPackagesResource": { + "type": "object", + "properties": { + "python": { + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Python packages installed in the environment." }, - { - "type": "string", - "enum": [ - "inactive", - "enforcing" - ] + "system": { + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "System packages installed in the environment." + }, + "npm": { + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "npm packages installed globally in the environment." } - ] + }, + "required": [ + "python", + "system", + "npm" + ], + "additionalProperties": false, + "description": "Packages installed in an OpenAI-hosted environment." }, - "SpendLimitEnforcement": { + "NetworkAccessResource": { + "type": "string", + "enum": [ + "enabled", + "disabled", + "restricted" + ], + "x-enumDescriptions": [ + "Allows unrestricted network access.", + "Disables network access.", + "Applies the configured domain restrictions." + ], + "description": "The network access mode for an OpenAI-hosted environment." + }, + "NetworkPolicyResource": { + "type": "object", "properties": { - "status": { - "$ref": "#/components/schemas/SpendLimitEnforcementStatus", - "description": "Whether the hard spend limit is currently enforcing." + "access": { + "$ref": "#/components/schemas/NetworkAccessResource", + "description": "The environment's network access mode." + }, + "allowed_domains": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Domains the environment may access when network access is restricted." } }, - "type": "object", "required": [ - "status" + "access", + "allowed_domains" ], - "description": "The current enforcement state of a hard spend limit." + "additionalProperties": false, + "description": "Network access for an OpenAI-hosted environment." }, - "OrganizationSpendLimitResource": { + "DesktopResource": { + "type": "object", "properties": { - "object": { - "type": "string", - "enum": [ - "organization.spend_limit" - ], - "description": "The object type, which is always `organization.spend_limit`.", - "default": "organization.spend_limit", - "x-stainless-const": true - }, - "threshold_amount": { - "type": "integer", - "description": "The hard spend limit amount, in cents." - }, - "currency": { - "$ref": "#/components/schemas/SpendLimitCurrency", - "description": "The currency for the threshold amount. Currently, only `USD` is supported." - }, - "interval": { - "$ref": "#/components/schemas/SpendLimitInterval", - "description": "The time interval for evaluating spend against the threshold. Currently, only `month` is supported." - }, - "enforcement": { - "$ref": "#/components/schemas/SpendLimitEnforcement", - "description": "The current enforcement state of the hard spend limit." + "enabled": { + "type": "boolean", + "description": "Whether the environment provisions a desktop and browser proxy." } }, - "type": "object", "required": [ - "object", - "threshold_amount", - "currency", - "interval", - "enforcement" + "enabled" ], - "description": "Represents a hard spend limit configured at the organization level." + "additionalProperties": false, + "description": "The effective desktop configuration for an OpenAI-hosted environment." }, - "UpdateOrganizationSpendLimitBody": { + "HostedTemplateSkillResourceSkillReference": { + "type": "object", "properties": { - "threshold_amount": { - "type": "integer", - "minimum": 1, - "description": "The hard spend limit amount, in cents." - }, - "currency": { + "type": { "type": "string", "enum": [ - "USD" + "skill_reference" ], - "description": "The currency for the threshold amount. Currently, only `USD` is supported." + "default": "skill_reference", + "x-stainless-const": true, + "description": "The type of the object. Always `skill_reference`." }, - "interval": { + "skill_id": { "type": "string", - "enum": [ - "month" + "minLength": 0, + "description": "The referenced skill ID." + }, + "version": { + "type": [ + "string", + "null" ], - "description": "The time interval for evaluating spend against the threshold. Currently, only `month` is supported." + "minLength": 0, + "description": "The requested version selector, including `latest`." } }, - "type": "object", "required": [ - "threshold_amount", - "currency", - "interval" + "type", + "skill_id", + "version" ], - "description": "Parameters for the hard spend limit you want to create or replace." + "additionalProperties": false, + "description": "A skill resolved afresh from the Skills API whenever a session starts." }, - "OrganizationSpendLimitDeletedResource": { + "HostedTemplateSkillResourceInline": { + "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "organization.spend_limit.deleted" + "inline" ], - "description": "The object type, which is always `organization.spend_limit.deleted`.", - "default": "organization.spend_limit.deleted", - "x-stainless-const": true + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." }, - "deleted": { - "type": "boolean", - "description": "Whether the hard spend limit was deleted." + "name": { + "type": "string", + "minLength": 0, + "description": "The skill name declared in `SKILL.md`." + }, + "description": { + "type": "string", + "minLength": 0, + "description": "The skill description declared in `SKILL.md`." } }, - "type": "object", "required": [ - "object", - "deleted" + "type", + "name", + "description" ], - "description": "Confirmation payload returned after deleting an organization hard spend limit." + "additionalProperties": false, + "description": "Safe metadata for an inline skill archive." }, - "ProjectSpendLimitResource": { - "properties": { - "object": { - "type": "string", - "enum": [ - "project.spend_limit" - ], - "description": "The object type, which is always `project.spend_limit`.", - "default": "project.spend_limit", - "x-stainless-const": true - }, - "threshold_amount": { - "type": "integer", - "description": "The hard spend limit amount, in cents." - }, - "currency": { - "$ref": "#/components/schemas/SpendLimitCurrency", - "description": "The currency for the threshold amount. Currently, only `USD` is supported." - }, - "interval": { - "$ref": "#/components/schemas/SpendLimitInterval", - "description": "The time interval for evaluating spend against the threshold. Currently, only `month` is supported." + "HostedTemplateSkillResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedTemplateSkillResourceSkillReference" }, - "enforcement": { - "$ref": "#/components/schemas/SpendLimitEnforcement", - "description": "The current enforcement state of the hard spend limit." + { + "$ref": "#/components/schemas/HostedTemplateSkillResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "skill_reference": "#/components/schemas/HostedTemplateSkillResourceSkillReference", + "inline": "#/components/schemas/HostedTemplateSkillResourceInline" } }, - "type": "object", - "required": [ - "object", - "threshold_amount", - "currency", - "interval", - "enforcement" + "x-oai-discriminator-values": [ + "skill_reference", + "inline" ], - "description": "Represents a hard spend limit configured at the project level." + "description": "Safe metadata for a skill configured by an environment template." }, - "UpdateProjectSpendLimitBody": { + "HostedPluginResourceInline": { + "type": "object", "properties": { - "threshold_amount": { - "type": "integer", - "minimum": 1, - "description": "The hard spend limit amount, in cents." - }, - "currency": { + "type": { "type": "string", "enum": [ - "USD" + "inline" ], - "description": "The currency for the threshold amount. Currently, only `USD` is supported." + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." }, - "interval": { + "name": { "type": "string", - "enum": [ - "month" - ], - "description": "The time interval for evaluating spend against the threshold. Currently, only `month` is supported." + "minLength": 0, + "description": "The installed plugin name." + }, + "description": { + "type": "string", + "minLength": 0, + "description": "The installed plugin description." } }, - "type": "object", "required": [ - "threshold_amount", - "currency", - "interval" + "type", + "name", + "description" ], - "description": "Parameters for the hard spend limit you want to create or replace." + "additionalProperties": false, + "description": "A plugin installed from an inline ZIP archive." }, - "ProjectSpendLimitDeletedResource": { - "properties": { - "object": { - "type": "string", - "enum": [ - "project.spend_limit.deleted" - ], - "description": "The object type, which is always `project.spend_limit.deleted`.", - "default": "project.spend_limit.deleted", - "x-stainless-const": true - }, - "deleted": { - "type": "boolean", - "description": "Whether the hard spend limit was deleted." + "HostedPluginResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedPluginResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "inline": "#/components/schemas/HostedPluginResourceInline" } }, - "type": "object", - "required": [ - "object", - "deleted" + "x-oai-discriminator-values": [ + "inline" ], - "description": "Confirmation payload returned after deleting a project hard spend limit." + "description": "A plugin installed in an OpenAI-hosted environment." }, - "CreateProjectServiceAccountApiKeyBody": { + "HostedTemplateFileResourceFileId": { + "type": "object", "properties": { - "name": { + "type": { "type": "string", - "description": "API key name." + "enum": [ + "file_id" + ], + "default": "file_id", + "x-stainless-const": true, + "description": "The type of the object. Always `file_id`." }, - "scopes": { - "items": { - "type": "string", - "description": "API key scope." - }, - "type": "array", - "description": "API key scopes." + "file_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the uploaded file." }, - "expires_in_seconds": { - "anyOf": [ - { - "type": "integer", - "maximum": 31536000, - "minimum": 1, - "description": "Number of seconds until the API key expires." - }, - { - "type": "null" - } - ] + "path": { + "type": "string", + "minLength": 0, + "description": "The file's absolute path inside the environment." } }, - "type": "object", - "required": [], - "description": "The service account API key create request payload." + "required": [ + "type", + "file_id", + "path" + ], + "additionalProperties": false, + "description": "A project-scoped Files API reference resolved separately for each session." }, - "ServiceAccountApiKeyBody": { + "HostedTemplateFileResourceInline": { + "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "organization.project.service_account.api_key" + "inline" ], - "description": "The object type, which is always `organization.project.service_account.api_key`", - "default": "organization.project.service_account.api_key", - "x-stainless-const": true - }, - "value": { - "type": "string", - "description": "The unredacted API key value." + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." }, - "name": { + "path": { "type": "string", - "description": "The name of the API key." + "minLength": 0, + "description": "The file's absolute path inside the environment." }, - "created_at": { + "size_bytes": { "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) when the API key was created." - }, - "expires_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) when the API key expires, or null if it does not expire." - }, - { - "type": "null" - } - ] - }, - "id": { - "type": "string", - "description": "The identifier of the API key." + "format": "int64", + "minimum": 0, + "description": "The decoded size of the inline file in bytes." } }, - "type": "object", "required": [ - "object", - "value", - "name", - "created_at", - "id" - ] + "type", + "path", + "size_bytes" + ], + "additionalProperties": false, + "description": "Metadata for confidential inline file contents." }, - "CreateContentProvenanceBody": { - "properties": { - "file": { - "type": "string", - "format": "binary", - "description": "The image or audio file to check for supported OpenAI provenance signals." + "HostedTemplateFileResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedTemplateFileResourceFileId" + }, + { + "$ref": "#/components/schemas/HostedTemplateFileResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "file_id": "#/components/schemas/HostedTemplateFileResourceFileId", + "inline": "#/components/schemas/HostedTemplateFileResourceInline" } }, - "type": "object", - "required": [ - "file" - ] - }, - "ProvenanceCheckObject": { - "type": "string", - "enum": [ - "content_provenance_check" - ] - }, - "ProvenanceDetectionResultApi": { - "type": "string", - "enum": [ - "detected", - "not_detected" - ] - }, - "C2PAValidationStateApi": { - "type": "string", - "enum": [ - "trusted", - "valid", - "invalid", - "not_present" - ] + "x-oai-discriminator-values": [ + "file_id", + "inline" + ], + "description": "Safe metadata for a file configured by an environment template." }, - "C2PAProvenanceResult": { + "AutomationEnvironmentResourceOpenaiHosted": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "c2pa" + "openai_hosted" ], - "description": "The provenance signal type. Always `c2pa`.", - "default": "c2pa", - "x-stainless-const": true + "default": "openai_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `openai_hosted`." }, - "outcome": { - "$ref": "#/components/schemas/ProvenanceDetectionResultApi", - "description": "Whether a supported OpenAI C2PA provenance signal was detected.\nIf `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect." + "environment_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "An existing environment reference, or null when provisioning a new environment." }, - "validation_state": { - "$ref": "#/components/schemas/C2PAValidationStateApi", - "description": "The validation status of the C2PA manifest in the uploaded image." + "environment_template_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "A template reference, or null when no template is selected." }, - "issuer": { + "container_size": { "anyOf": [ { - "type": "string", - "description": "The C2PA manifest issuer, when available." + "$ref": "#/components/schemas/ContainerSizeResource" }, { "type": "null" } - ] + ], + "description": "The configured container size, or null to use the creation default." }, - "model": { + "packages": { "anyOf": [ { - "type": "string", - "description": "The OpenAI model recorded by the provenance signal, when available." + "$ref": "#/components/schemas/EnvironmentPackagesResource" }, { "type": "null" } - ] + ], + "description": "Package overrides, or null to inherit the template or creation default." }, - "generated_at": { + "network": { "anyOf": [ { - "type": "string", - "description": "The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available." + "$ref": "#/components/schemas/NetworkPolicyResource" }, { "type": "null" } - ] + ], + "description": "Network overrides, or null to inherit the template or creation default." + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopResource" + }, + { + "type": "null" + } + ], + "description": "Desktop overrides, or null to inherit the template or creation default." + }, + "capability_directories": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Directory overrides, or null to inherit the template or creation default." + }, + "skills": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedTemplateSkillResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Skill overrides, excluding archive contents, or null to inherit." + }, + "plugins": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedPluginResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Plugin overrides, excluding archive contents, or null to inherit." + }, + "files": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedTemplateFileResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "File overrides, excluding contents, or null to inherit." } }, - "type": "object", "required": [ "type", - "outcome", - "validation_state", - "issuer", - "model", - "generated_at" - ] + "environment_id", + "environment_template_id", + "container_size", + "packages", + "network", + "desktop", + "capability_directories", + "skills", + "plugins", + "files" + ], + "additionalProperties": false, + "description": "Hosted environment selection with confidential setup commands and variables omitted." }, - "SynthIDProvenanceResult": { + "AutomationEnvironmentResourceSelfHosted": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "synthid" + "self_hosted" ], - "description": "The provenance signal type. Always `synthid`.", - "default": "synthid", - "x-stainless-const": true + "default": "self_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `self_hosted`." }, - "outcome": { - "$ref": "#/components/schemas/ProvenanceDetectionResultApi", - "description": "Whether a supported OpenAI SynthID watermark was detected.\nIf `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect." + "environment_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "An existing registration, or null to create a session-owned environment." }, - "model": { - "anyOf": [ - { - "type": "string", - "description": "The OpenAI model recorded by the provenance signal, when available." - }, - { - "type": "null" - } - ] + "workspace_directory": { + "type": "string", + "minLength": 0, + "description": "The absolute project directory in the environment." }, - "generated_at": { - "anyOf": [ - { - "type": "string", - "description": "The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available." - }, - { - "type": "null" - } - ] + "capability_directories": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Directories that expose capabilities to the agent." } }, - "type": "object", "required": [ "type", - "outcome", - "model", - "generated_at" - ] + "environment_id", + "workspace_directory", + "capability_directories" + ], + "additionalProperties": false }, - "ProvenanceResource": { - "properties": { - "object": { - "$ref": "#/components/schemas/ProvenanceCheckObject", - "description": "The object type. Always `content_provenance_check` for this endpoint." + "AutomationEnvironmentResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationEnvironmentResourceNone" }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, when the provenance check was created." + { + "$ref": "#/components/schemas/AutomationEnvironmentResourceOpenaiHosted" }, - "results": { - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/C2PAProvenanceResult" - }, - { - "$ref": "#/components/schemas/SynthIDProvenanceResult" - } - ], - "discriminator": { - "propertyName": "type" - } - }, - "type": "array", - "description": "The provenance results that apply to the uploaded file. Image results include C2PA and SynthID; audio results include SynthID." + { + "$ref": "#/components/schemas/AutomationEnvironmentResourceSelfHosted" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "none": "#/components/schemas/AutomationEnvironmentResourceNone", + "openai_hosted": "#/components/schemas/AutomationEnvironmentResourceOpenaiHosted", + "self_hosted": "#/components/schemas/AutomationEnvironmentResourceSelfHosted" } }, + "x-oai-discriminator-values": [ + "none", + "openai_hosted", + "self_hosted" + ], + "description": "Environment selection saved before an invocation creates its session." + }, + "InputContentResourceInputText": { "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_text" + ], + "default": "input_text", + "x-stainless-const": true, + "description": "The type of the object. Always `input_text`." + }, + "text": { + "type": "string", + "minLength": 0, + "description": "The text supplied to the agent." + } + }, "required": [ - "object", - "created_at", - "results" - ] + "type", + "text" + ], + "additionalProperties": false, + "description": "Text input recorded in a session item." }, - "OrderEnum": { - "type": "string", - "enum": [ - "asc", - "desc" - ] + "InputContentResourceInputImage": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input_image" + ], + "default": "input_image", + "x-stainless-const": true, + "description": "The type of the object. Always `input_image`." + }, + "image_url": { + "type": "string", + "minLength": 0, + "description": "The URL of the image supplied to the agent, which may be a base64-encoded data URL." + } + }, + "required": [ + "type", + "image_url" + ], + "additionalProperties": false, + "description": "Image input recorded in a session item." }, - "VideoModel": { - "anyOf": [ + "InputContentResource": { + "oneOf": [ { - "type": "string" + "$ref": "#/components/schemas/InputContentResourceInputText" }, { - "type": "string", - "enum": [ - "sora-2", - "sora-2-pro", - "sora-2-2025-10-06", - "sora-2-pro-2025-10-06", - "sora-2-2025-12-08" - ] + "$ref": "#/components/schemas/InputContentResourceInputImage" } - ] - }, - "VideoStatus": { - "type": "string", - "enum": [ - "queued", - "in_progress", - "completed", - "failed" - ] - }, - "VideoSize": { - "type": "string", - "enum": [ - "720x1280", - "1280x720", - "1024x1792", - "1792x1024" - ] + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "input_text": "#/components/schemas/InputContentResourceInputText", + "input_image": "#/components/schemas/InputContentResourceInputImage" + } + }, + "x-oai-discriminator-values": [ + "input_text", + "input_image" + ], + "description": "User-provided content recorded in a session item." }, - "Error-2": { + "InputMessageResource-2": { + "type": "object", "properties": { - "code": { + "type": { "type": "string", - "description": "A machine-readable error code that was returned." + "enum": [ + "message" + ], + "default": "message", + "x-stainless-const": true, + "description": "The type of the input item. Always `message`." }, - "message": { + "role": { "type": "string", - "description": "A human-readable description of the error that was returned." + "enum": [ + "user" + ], + "default": "user", + "x-stainless-const": true, + "description": "The role of the message author. Always `user`." }, - "misalignment": { - "$ref": "#/components/schemas/MisalignmentErrorDetailsResource" + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputContentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The content of the message." } }, - "type": "object", "required": [ - "code", - "message" + "type", + "role", + "content" ], - "title": "Error", - "description": "An error that occurred while generating the response." + "additionalProperties": false, + "description": "A user message recorded in a session." }, - "VideoResource": { + "AutomationTargetResourceNewSession": { + "type": "object", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the video job." - }, - "object": { + "type": { "type": "string", "enum": [ - "video" + "new_session" ], - "description": "The object type, which is always `video`.", - "default": "video", - "x-stainless-const": true - }, - "model": { - "$ref": "#/components/schemas/VideoModel", - "description": "The video generation model that produced the job." - }, - "status": { - "$ref": "#/components/schemas/VideoStatus", - "description": "Current lifecycle status of the video job." - }, - "progress": { - "type": "integer", - "description": "Approximate completion percentage for the generation task." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (seconds) for when the job was created." - }, - "completed_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (seconds) for when the job completed, if finished." - }, - { - "type": "null" - } - ] + "default": "new_session", + "x-stainless-const": true, + "description": "The type of the object. Always `new_session`." }, - "expires_at": { - "anyOf": [ - { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (seconds) for when the downloadable assets expire, if set." - }, - { - "type": "null" - } - ] + "agent_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The saved agent reference, or null when an inline agent is configured." }, - "prompt": { + "agent": { "anyOf": [ { - "type": "string", - "description": "The prompt that was used to generate the video." + "$ref": "#/components/schemas/AutomationAgentConfigResource" }, { "type": "null" } - ] + ], + "description": "The inline agent configuration, or null when agent_id is configured." }, - "size": { - "$ref": "#/components/schemas/VideoSize", - "description": "The resolution of the generated video." + "environment": { + "$ref": "#/components/schemas/AutomationEnvironmentResource", + "description": "Configuration or references used to select the execution environment." }, - "seconds": { - "type": "string", - "description": "Duration of the generated clip in seconds. For extensions, this is the stitched total duration." + "input": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputMessageResource-2" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Initial input delivered to each new session." }, - "remixed_from_video_id": { - "anyOf": [ - { - "type": "string", - "description": "Identifier of the source video if this video is a remix." - }, - { - "type": "null" - } - ] + "vault_ids": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Vaults made available to each new session." }, - "error": { - "anyOf": [ - { - "$ref": "#/components/schemas/Error-2", - "description": "Error payload that explains why generation failed, if applicable." - }, - { - "type": "null" - } - ] + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Metadata attached to each new session." } }, - "type": "object", "required": [ - "id", - "object", - "model", - "status", - "progress", - "created_at", - "completed_at", - "expires_at", - "prompt", - "size", - "seconds", - "remixed_from_video_id", - "error" + "type", + "agent_id", + "agent", + "environment", + "input", + "vault_ids", + "metadata" ], - "title": "Video job", - "description": "Structured information describing a generated video job." + "additionalProperties": false }, - "VideoListResource": { + "AutomationTargetResourceExistingSession": { + "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "existing_session" ], - "description": "The type of object returned, must be `list`.", - "default": "list", - "x-stainless-const": true - }, - "data": { - "items": { - "$ref": "#/components/schemas/VideoResource" - }, - "type": "array", - "description": "A list of items" + "default": "existing_session", + "x-stainless-const": true, + "description": "The type of the object. Always `existing_session`." }, - "first_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the first item in the list." - }, - { - "type": "null" - } - ] + "session_id": { + "type": "string", + "minLength": 0, + "description": "The session receiving each invocation." }, - "last_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the last item in the list." - }, - { - "type": "null" - } - ] + "instructions": { + "type": "string", + "minLength": 0, + "description": "Saved instructions delivered as an automation notification." + } + }, + "required": [ + "type", + "session_id", + "instructions" + ], + "additionalProperties": false + }, + "AutomationTargetResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationTargetResourceNewSession" }, - "has_more": { - "type": "boolean", - "description": "Whether there are more items available." + { + "$ref": "#/components/schemas/AutomationTargetResourceExistingSession" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "new_session": "#/components/schemas/AutomationTargetResourceNewSession", + "existing_session": "#/components/schemas/AutomationTargetResourceExistingSession" } }, + "x-oai-discriminator-values": [ + "new_session", + "existing_session" + ], + "description": "Saved target configuration, excluding confidential request-only values." + }, + "AutomationCreatedByResourceDeveloper": { "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "developer" + ], + "default": "developer", + "x-stainless-const": true, + "description": "The type of the object. Always `developer`." + } + }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] + "type" + ], + "additionalProperties": false }, - "ImageRefParam-2": { + "AutomationCreatedByResourceAgent": { + "type": "object", "properties": { - "image_url": { + "type": { "type": "string", - "maxLength": 20971520, - "format": "uri", - "description": "A fully qualified URL or base64-encoded data URL." + "enum": [ + "agent" + ], + "default": "agent", + "x-stainless-const": true, + "description": "The type of the object. Always `agent`." }, - "file_id": { + "session_id": { "type": "string", - "example": "file-123" + "minLength": 0, + "description": "The creator session, which is also the automation's target." + }, + "tool_call_id": { + "type": "string", + "minLength": 0, + "description": "The tool call that created the automation." } }, - "type": "object", - "required": [] + "required": [ + "type", + "session_id", + "tool_call_id" + ], + "additionalProperties": false }, - "VideoSeconds": { + "AutomationCreatedByResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationCreatedByResourceDeveloper" + }, + { + "$ref": "#/components/schemas/AutomationCreatedByResourceAgent" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "developer": "#/components/schemas/AutomationCreatedByResourceDeveloper", + "agent": "#/components/schemas/AutomationCreatedByResourceAgent" + } + }, + "x-oai-discriminator-values": [ + "developer", + "agent" + ], + "description": "How the automation was created, independently of how an invocation started." + }, + "PeriodicAutomationStatusResource": { "type": "string", "enum": [ - "4", - "8", - "12" + "active", + "paused" ] }, - "CreateVideoMultipartBody": { + "AutomationResourcePeriodic": { + "type": "object", "properties": { - "model": { - "$ref": "#/components/schemas/VideoModel", - "description": "The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`." - }, - "prompt": { + "type": { "type": "string", - "maxLength": 32000, - "minLength": 1, - "description": "Text prompt that describes the video to generate." + "enum": [ + "periodic" + ], + "default": "periodic", + "x-stainless-const": true, + "description": "The type of the object. Always `periodic`." }, - "input_reference": { - "oneOf": [ - { - "type": "string", - "format": "binary", - "description": "Optional reference asset upload or reference object that guides generation." - }, - { - "$ref": "#/components/schemas/ImageRefParam-2", - "description": "Optional reference asset upload or reference object that guides generation. Provide exactly one of `image_url` or `file_id` when using an object." - } - ] + "id": { + "type": "string", + "minLength": 0, + "description": "The automation ID." }, - "seconds": { - "$ref": "#/components/schemas/VideoSeconds", - "description": "Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds." + "object": { + "type": "string", + "enum": [ + "agent.automation" + ], + "default": "agent.automation", + "x-stainless-const": true, + "description": "Always `agent.automation`." }, - "size": { - "$ref": "#/components/schemas/VideoSize", - "description": "Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280." - } - }, - "type": "object", - "required": [ - "prompt" - ], - "title": "Create video multipart request", - "description": "Multipart parameters for creating a new video generation job." - }, - "CreateVideoJsonBody": { - "properties": { - "model": { - "$ref": "#/components/schemas/VideoModel", - "description": "The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The creation time as a Unix timestamp in seconds." }, - "prompt": { + "name": { "type": "string", - "maxLength": 32000, - "minLength": 1, - "description": "Text prompt that describes the video to generate." + "minLength": 0, + "description": "The automation's display name." }, - "input_reference": { - "$ref": "#/components/schemas/ImageRefParam-2", - "description": "Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`." + "target": { + "$ref": "#/components/schemas/AutomationTargetResource", + "description": "The session configuration or existing session receiving invocations." }, - "seconds": { - "$ref": "#/components/schemas/VideoSeconds", - "description": "Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds." + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Custom string key-value pairs attached to the automation." }, - "size": { - "$ref": "#/components/schemas/VideoSize", - "description": "Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280." - } - }, - "type": "object", - "required": [ - "prompt" - ], - "title": "Create video JSON request", - "description": "JSON parameters for creating a new video generation job." - }, - "CreateVideoCharacterBody": { - "properties": { - "video": { + "created_by": { + "$ref": "#/components/schemas/AutomationCreatedByResource", + "description": "Service-recorded provenance; callers cannot supply this field." + }, + "expression": { "type": "string", - "format": "binary", - "description": "Video file used to create a character." + "minLength": 0, + "description": "The cron expression determining scheduled occurrences." }, - "name": { + "timezone": { "type": "string", - "maxLength": 80, - "minLength": 1, - "description": "Display name for this API character." + "minLength": 0, + "description": "The timezone used to interpret the expression." + }, + "status": { + "$ref": "#/components/schemas/PeriodicAutomationStatusResource", + "description": "Whether scheduled delivery is active or paused." } }, - "type": "object", "required": [ - "video", - "name" + "type", + "id", + "object", + "created_at", + "name", + "target", + "metadata", + "created_by", + "expression", + "timezone", + "status" ], - "title": "Create character request", - "description": "Parameters for creating a character from an uploaded video." + "additionalProperties": false, + "description": "Fields shared by periodic and one-time automations." }, - "VideoCharacterResource": { + "OnceAutomationStatusResource": { + "type": "string", + "enum": [ + "active", + "paused", + "completed" + ] + }, + "AutomationResourceOnce": { + "type": "object", "properties": { + "type": { + "type": "string", + "enum": [ + "once" + ], + "default": "once", + "x-stainless-const": true, + "description": "The type of the object. Always `once`." + }, "id": { - "anyOf": [ - { - "type": "string", - "description": "Identifier for the character creation cameo." - }, - { - "type": "null" - } - ] + "type": "string", + "minLength": 0, + "description": "The automation ID." + }, + "object": { + "type": "string", + "enum": [ + "agent.automation" + ], + "default": "agent.automation", + "x-stainless-const": true, + "description": "Always `agent.automation`." + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "The creation time as a Unix timestamp in seconds." }, "name": { - "anyOf": [ - { - "type": "string", - "description": "Display name for the character." - }, - { - "type": "null" - } - ] + "type": "string", + "minLength": 0, + "description": "The automation's display name." }, - "created_at": { + "target": { + "$ref": "#/components/schemas/AutomationTargetResource", + "description": "The session configuration or existing session receiving invocations." + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Custom string key-value pairs attached to the automation." + }, + "created_by": { + "$ref": "#/components/schemas/AutomationCreatedByResource", + "description": "Service-recorded provenance; callers cannot supply this field." + }, + "run_at": { "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the character was created." + "format": "int64", + "description": "The Unix timestamp, in seconds, of the scheduled occurrence." + }, + "status": { + "$ref": "#/components/schemas/OnceAutomationStatusResource", + "description": "Completion means the schedule has finished, not the agent's work." } }, - "type": "object", "required": [ + "type", "id", + "object", + "created_at", "name", - "created_at" - ] - }, - "VideoReferenceInputParam": { - "properties": { - "id": { - "type": "string", - "description": "The identifier of the completed video.", - "example": "video_123" - } - }, - "type": "object", - "required": [ - "id" + "target", + "metadata", + "created_by", + "run_at", + "status" ], - "description": "Reference to the completed video." + "additionalProperties": false, + "description": "Fields shared by periodic and one-time automations." }, - "CreateVideoEditMultipartBody": { - "properties": { - "video": { - "oneOf": [ - { - "type": "string", - "format": "binary", - "description": "Reference to the completed video to edit." - }, - { - "$ref": "#/components/schemas/VideoReferenceInputParam", - "description": "Reference to the completed video to edit." - } - ] + "AutomationResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationResourcePeriodic" }, - "prompt": { - "type": "string", - "maxLength": 32000, - "minLength": 1, - "description": "Text prompt that describes how to edit the source video." + { + "$ref": "#/components/schemas/AutomationResourceOnce" } - }, - "type": "object", - "required": [ - "video", - "prompt" ], - "title": "Create video edit multipart request", - "description": "Parameters for editing an existing generated video." - }, - "CreateVideoEditJsonBody": { - "properties": { - "video": { - "$ref": "#/components/schemas/VideoReferenceInputParam", - "description": "Reference to the completed video to edit." - }, - "prompt": { - "type": "string", - "maxLength": 32000, - "minLength": 1, - "description": "Text prompt that describes how to edit the source video." + "discriminator": { + "propertyName": "type", + "mapping": { + "periodic": "#/components/schemas/AutomationResourcePeriodic", + "once": "#/components/schemas/AutomationResourceOnce" } }, - "type": "object", - "required": [ - "video", - "prompt" + "x-oai-discriminator-values": [ + "periodic", + "once" ], - "title": "Create video edit JSON request", - "description": "JSON parameters for editing an existing generated video." + "description": "A saved automation and its schedule." }, - "CreateVideoExtendMultipartBody": { + "ErrorBodyResource": { + "type": "object", "properties": { - "video": { - "oneOf": [ - { - "$ref": "#/components/schemas/VideoReferenceInputParam", - "description": "Reference to the completed video to extend." - }, - { - "type": "string", - "format": "binary", - "description": "Reference to the completed video to extend." - } - ] + "type": { + "type": "string", + "minLength": 0, + "description": "The error type." }, - "prompt": { + "code": { "type": "string", - "maxLength": 32000, - "minLength": 1, - "description": "Updated text prompt that directs the extension generation." + "minLength": 0, + "description": "A machine-readable error code." }, - "seconds": { - "$ref": "#/components/schemas/VideoSeconds", - "description": "Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20)." + "message": { + "type": "string", + "minLength": 0, + "description": "A human-readable error message." + }, + "param": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The request parameter that caused the error, or null for a request-wide error." } }, - "type": "object", "required": [ - "video", - "prompt", - "seconds" + "type", + "code", + "message", + "param" ], - "title": "Create video extension multipart request", - "description": "Multipart parameters for extending an existing generated video." + "additionalProperties": false, + "description": "Details about an API error." }, - "CreateVideoExtendJsonBody": { + "ErrorResponse-2": { + "type": "object", "properties": { - "video": { - "$ref": "#/components/schemas/VideoReferenceInputParam", - "description": "Reference to the completed video to extend." - }, - "prompt": { - "type": "string", - "maxLength": 32000, - "minLength": 1, - "description": "Updated text prompt that directs the extension generation." - }, - "seconds": { - "$ref": "#/components/schemas/VideoSeconds", - "description": "Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20)." + "error": { + "$ref": "#/components/schemas/ErrorBodyResource", + "description": "The error returned by the API." } }, - "type": "object", "required": [ - "video", - "prompt", - "seconds" + "error" ], - "title": "Create video extension JSON request", - "description": "JSON parameters for extending an existing generated video." + "additionalProperties": false, + "description": "An API error response." }, - "DeletedVideoResource": { + "ExperimentalConfigOverridesParam": { + "type": "object", "properties": { - "object": { - "type": "string", - "enum": [ - "video.deleted" - ], - "description": "The object type that signals the deletion response.", - "default": "video.deleted", - "x-stainless-const": true - }, - "deleted": { + "time_awareness": { "type": "boolean", - "description": "Indicates that the video resource was deleted." - }, - "id": { - "type": "string", - "description": "Identifier of the deleted video." + "description": "Whether to give the model periodic current-time reminders. Omit to keep the current setting." } }, - "type": "object", - "required": [ - "object", - "deleted", - "id" - ], - "title": "Deleted video response", - "description": "Confirmation payload returned after deleting a video." + "additionalProperties": false, + "description": "Experimental settings to update. Omitted settings keep their current values." }, - "VideoContentVariant": { + "ReasoningEffortParam": { "type": "string", "enum": [ - "video", - "thumbnail", - "spritesheet" - ] - }, - "CreateVideoRemixBody": { - "properties": { - "prompt": { - "type": "string", - "maxLength": 32000, - "minLength": 1, - "description": "Updated text prompt that directs the remix generation." - } - }, - "type": "object", - "required": [ - "prompt" + "none", + "minimal", + "low", + "medium", + "high", + "xhigh", + "max" ], - "title": "Create video remix request", - "description": "Parameters for remixing an existing generated video." + "description": "The amount of reasoning effort the model should use." }, - "TruncationEnum": { + "ReasoningSummaryParam": { "type": "string", "enum": [ - "auto", - "disabled" - ] - }, - "PersonalityEnum": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "friendly", - "pragmatic" - ] - } - ] + "concise", + "detailed", + "auto" + ], + "x-enumDescriptions": [ + "Returns a concise reasoning summary when supported.", + "Returns a detailed reasoning summary when supported.", + "Automatically selects the most detailed summary supported by the model." + ], + "description": "The reasoning summary format requested from the model." }, - "TokenCountsBody": { + "ReasoningParam": { + "type": "object", "properties": { - "model": { - "anyOf": [ - { - "type": "string", - "description": "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models." - }, - { - "type": "null" - } - ] - }, - "input": { - "anyOf": [ - { - "oneOf": [ - { - "type": "string", - "maxLength": 10485760, - "description": "A text input to the model, equivalent to a text input with the `user` role." - }, - { - "items": { - "$ref": "#/components/schemas/InputItem" - }, - "type": "array", - "maxItems": 131072, - "description": "A list of one or many input items to the model, containing different content types." - } - ], - "description": "Text, image, or file inputs to the model, used to generate a response" - }, - { - "type": "null" - } - ] - }, - "previous_response_id": { - "anyOf": [ - { - "type": "string", - "description": "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.", - "example": "resp_123" - }, - { - "type": "null" - } - ] - }, - "tools": { - "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/Tool" - }, - "type": "array", - "description": "An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter." - }, - { - "type": "null" - } - ] - }, - "text": { - "anyOf": [ - { - "$ref": "#/components/schemas/ResponseTextParam" - }, - { - "type": "null" - } - ] - }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/Reasoning", - "description": "**gpt-5 and o-series models only** Configuration options for [reasoning models](https://developers.openai.com/api/docs/guides/reasoning)." - }, - { - "type": "null" - } - ] - }, - "truncation": { - "$ref": "#/components/schemas/TruncationEnum", - "description": "The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.", - "deprecated": true - }, - "instructions": { - "anyOf": [ - { - "type": "string", - "description": "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses." - }, - { - "type": "null" - } - ] - }, - "personality": { - "$ref": "#/components/schemas/PersonalityEnum", - "description": "A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters." - }, - "conversation": { - "anyOf": [ - { - "$ref": "#/components/schemas/ConversationParam" - }, - { - "type": "null" - } - ] - }, - "tool_choice": { + "effort": { "anyOf": [ { - "$ref": "#/components/schemas/ToolChoiceParam", - "description": "Controls which tool the model should use, if any." + "$ref": "#/components/schemas/ReasoningEffortParam" }, { "type": "null" } - ] + ], + "description": "The amount of reasoning effort the model should use. Omission lets the model select it." }, - "parallel_tool_calls": { + "summary": { "anyOf": [ { - "type": "boolean", - "description": "Whether to allow the model to run tool calls in parallel." + "$ref": "#/components/schemas/ReasoningSummaryParam" }, { "type": "null" } - ] + ], + "description": "Controls whether the response includes a reasoning summary." } }, + "additionalProperties": false, + "description": "Reasoning configuration for the agent." + }, + "TextFormatParamText": { "type": "object", - "required": [] + "properties": { + "type": { + "type": "string", + "enum": [ + "text" + ], + "default": "text", + "x-stainless-const": true, + "description": "The type of the object. Always `text`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Generates ordinary text without a structured-output constraint." }, - "TokenCountsResource": { + "TextFormatParamJsonSchema": { + "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "response.input_tokens" + "json_schema" ], - "default": "response.input_tokens", - "x-stainless-const": true + "default": "json_schema", + "x-stainless-const": true, + "description": "The type of the object. Always `json_schema`." }, - "input_tokens": { - "type": "integer" + "schema": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "The JSON Schema that generated text must match." } }, - "type": "object", "required": [ - "object", - "input_tokens" + "type", + "schema" ], - "title": "Token counts", - "example": { - "object": "response.input_tokens", - "input_tokens": 123 - } + "additionalProperties": false, + "description": "Constrains generated text to a JSON Schema." }, - "PromptCacheRetentionEnum": { - "type": "string", - "enum": [ - "in_memory", - "24h" - ] + "TextFormatParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/TextFormatParamText" + }, + { + "$ref": "#/components/schemas/TextFormatParamJsonSchema" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "text": "#/components/schemas/TextFormatParamText", + "json_schema": "#/components/schemas/TextFormatParamJsonSchema" + } + }, + "x-oai-discriminator-values": [ + "text", + "json_schema" + ], + "description": "The output format for generated text." }, - "ServiceTierEnum": { + "VerbosityParam": { "type": "string", "enum": [ - "auto", - "default", - "fast", - "flex", - "priority" - ] + "low", + "medium", + "high" + ], + "x-enumDescriptions": [ + "Produces less text.", + "Uses the default amount of text.", + "Produces more text." + ], + "description": "The amount of text the model should produce." }, - "CompactResponseMethodPublicBody": { + "TextParam": { + "type": "object", "properties": { - "model": { - "$ref": "#/components/schemas/ModelIdsCompaction" - }, - "input": { + "format": { "anyOf": [ { - "oneOf": [ - { - "type": "string", - "maxLength": 10485760, - "description": "A text input to the model, equivalent to a text input with the `user` role." - }, - { - "items": { - "$ref": "#/components/schemas/InputItem" - }, - "type": "array", - "maxItems": 131072, - "description": "A list of one or many input items to the model, containing different content types." - } - ], - "description": "Text, image, or file inputs to the model, used to generate a response" + "$ref": "#/components/schemas/TextFormatParam" }, { "type": "null" } - ] + ], + "description": "The output format. Omission uses ordinary text (`{\"type\": \"text\"}`)." }, - "previous_response_id": { + "verbosity": { "anyOf": [ { - "type": "string", - "description": "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.", - "example": "resp_123" + "$ref": "#/components/schemas/VerbosityParam" }, { "type": "null" } - ] + ], + "description": "The amount of text the model should produce. Defaults to `medium`, matching Responses." + } + }, + "additionalProperties": false, + "description": "Configuration for text generated by the agent." + }, + "ServiceTierParam": { + "type": "string", + "enum": [ + "auto", + "default", + "flex", + "priority", + "fast", + "ultrafast" + ], + "x-enumDescriptions": [ + "Selects the service tier automatically.", + "Uses the default service tier.", + "Uses the flex service tier.", + "Uses the priority service tier.", + "Uses the fast service tier.", + "Uses the ultrafast service tier." + ], + "description": "The service tier used for model requests." + }, + "MultiAgentConfigCurrentParam": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether subagent tools are enabled." }, - "instructions": { - "anyOf": [ - { - "type": "string", - "description": "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses." - }, - { - "type": "null" - } - ] + "max_concurrent_subagents": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 4294967295, + "description": "Maximum number of subagents that may run concurrently. Defaults to 6." + } + }, + "required": [ + "enabled" + ], + "additionalProperties": false, + "description": "Explicit configuration for creating and coordinating subagents." + }, + "CompactionParam": { + "type": "object", + "properties": { + "async": { + "type": [ + "boolean", + "null" + ], + "description": "Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage." + } + }, + "additionalProperties": false, + "description": "Settings for compacting the agent's context." + }, + "AgentToolConfigParamFunction": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ], + "default": "function", + "x-stainless-const": true, + "description": "The type of the object. Always `function`." }, - "prompt_cache_key": { - "anyOf": [ - { - "type": "string", - "maxLength": 64, - "description": "A key to use when reading from or writing to the prompt cache." - }, - { - "type": "null" - } - ] + "name": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The name of the function." }, - "prompt_cache_retention": { - "anyOf": [ - { - "$ref": "#/components/schemas/PromptCacheRetentionEnum", - "description": "How long to retain a prompt cache entry created by this request.", - "deprecated": true - }, - { - "type": "null" - } - ] + "description": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "A description of what the function does." }, - "prompt_cache_options": { - "anyOf": [ - { - "$ref": "#/components/schemas/PromptCacheOptionsParam" - }, - { - "type": "null" - } - ] + "parameters": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "A JSON Schema object describing the function's arguments." }, - "service_tier": { - "anyOf": [ - { - "$ref": "#/components/schemas/ServiceTierEnum", - "description": "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/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. For models with a dedicated Fast tier, either value resolves to `service_tier=fast`; for other models, either value resolves to `service_tier=priority`. - When not set, the default behavior is 'auto'.\n 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." - }, - { - "type": "null" - } - ] + "defer_loading": { + "type": "boolean", + "default": false, + "description": "Whether this function is deferred and discovered through tool search. Defaults to `false`." } }, + "required": [ + "type", + "name", + "description", + "parameters" + ], + "additionalProperties": false, + "description": "A function defined by the application." + }, + "AgentToolConfigParamToolSearch": { "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "tool_search" + ], + "default": "tool_search", + "x-stainless-const": true, + "description": "The type of the object. Always `tool_search`." + } + }, "required": [ - "model" - ] + "type" + ], + "additionalProperties": false, + "description": "Discovers deferred function tools and loads them into the model context." }, - "ItemField": { - "oneOf": [ - { - "$ref": "#/components/schemas/Message" - }, - { - "$ref": "#/components/schemas/Program" - }, - { - "$ref": "#/components/schemas/ProgramOutput" - }, - { - "$ref": "#/components/schemas/FunctionToolCall" - }, - { - "$ref": "#/components/schemas/ToolSearchCall" - }, - { - "$ref": "#/components/schemas/ToolSearchOutput" - }, - { - "$ref": "#/components/schemas/AdditionalTools" - }, - { - "$ref": "#/components/schemas/FunctionToolCallOutput" - }, - { - "$ref": "#/components/schemas/FileSearchToolCall" - }, - { - "$ref": "#/components/schemas/WebSearchToolCall" - }, - { - "$ref": "#/components/schemas/ImageGenToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCall" - }, - { - "$ref": "#/components/schemas/ComputerToolCallOutputResource" - }, - { - "$ref": "#/components/schemas/ReasoningItem" - }, - { - "$ref": "#/components/schemas/CompactionBody" - }, - { - "$ref": "#/components/schemas/CodeInterpreterToolCall" - }, - { - "$ref": "#/components/schemas/LocalShellToolCall", - "deprecated": true - }, - { - "$ref": "#/components/schemas/LocalShellToolCallOutput", - "deprecated": true + "AgentToolConfigParamProgrammaticToolCalling": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "programmatic_tool_calling" + ], + "default": "programmatic_tool_calling", + "x-stainless-const": true, + "description": "The type of the object. Always `programmatic_tool_calling`." }, - { - "$ref": "#/components/schemas/FunctionShellCall" + "enabled": { + "type": "boolean", + "default": true, + "description": "Whether tools can be called from model-generated code. Defaults to `true`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Enables calling tools from model-generated code." + }, + "McpTransportConfigParamHttp": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "http" + ], + "default": "http", + "x-stainless-const": true, + "description": "The type of the object. Always `http`." }, - { - "$ref": "#/components/schemas/FunctionShellCallOutput" + "server_url": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The URL of the MCP server." }, - { - "$ref": "#/components/schemas/ApplyPatchToolCall" + "authorization": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The authorization value sent to the MCP server, if any." }, - { - "$ref": "#/components/schemas/ApplyPatchToolCallOutput" + "headers": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Additional HTTP headers sent to the MCP server." + } + }, + "required": [ + "type", + "server_url" + ], + "additionalProperties": false, + "description": "Connects to an MCP server over HTTP." + }, + "McpTransportConfigParamStdio": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "stdio" + ], + "default": "stdio", + "x-stainless-const": true, + "description": "The type of the object. Always `stdio`." }, - { - "$ref": "#/components/schemas/MCPListTools" + "command": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The command used to start the MCP server." }, - { - "$ref": "#/components/schemas/MCPApprovalRequest" + "args": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Arguments passed to the MCP server command." }, - { - "$ref": "#/components/schemas/MCPApprovalResponseResource" + "cwd": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The working directory used to start the MCP server." }, - { - "$ref": "#/components/schemas/MCPToolCall" + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Environment variables set for the MCP server process." }, + "env_vars": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Environment variable names to inherit from the selected execution environment." + } + }, + "required": [ + "type", + "command", + "cwd" + ], + "additionalProperties": false, + "description": "Starts an MCP server as a local process." + }, + "McpTransportConfigParam": { + "oneOf": [ { - "$ref": "#/components/schemas/CustomToolCall" + "$ref": "#/components/schemas/McpTransportConfigParamHttp" }, { - "$ref": "#/components/schemas/CustomToolCallOutput" + "$ref": "#/components/schemas/McpTransportConfigParamStdio" } ], - "description": "An item representing a message, tool call, tool output, reasoning, or other response element.", "discriminator": { - "propertyName": "type" - } + "propertyName": "type", + "mapping": { + "http": "#/components/schemas/McpTransportConfigParamHttp", + "stdio": "#/components/schemas/McpTransportConfigParamStdio" + } + }, + "x-oai-discriminator-values": [ + "http", + "stdio" + ], + "description": "The transport used to connect to an MCP server." }, - "CompactResource": { + "McpConnectionOriginParam": { + "type": "string", + "enum": [ + "service", + "environment" + ], + "x-enumDescriptions": [ + "Uses the Managed Agents service network.", + "Uses the session's execution environment." + ], + "description": "Where outbound MCP HTTP connections originate." + }, + "AgentToolConfigParamMcp": { + "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "The unique identifier for the compacted response." + "enum": [ + "mcp" + ], + "default": "mcp", + "x-stainless-const": true, + "description": "The type of the object. Always `mcp`." }, - "object": { + "server_label": { "type": "string", - "enum": [ - "response.compaction" + "minLength": 0, + "maxLength": 1048576, + "description": "A label used to identify the MCP server in tool calls." + }, + "credential_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL." + }, + "transport": { + "$ref": "#/components/schemas/McpTransportConfigParam", + "description": "The transport used to connect to the MCP server." + }, + "request_metadata": { + "type": [ + "object", + "null" + ], + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Metadata included with requests to this MCP server." + }, + "allowed_tools": { + "type": [ + "array", + "null" ], - "description": "The object type. Always `response.compaction`.", - "default": "response.compaction", - "x-stainless-const": true - }, - "output": { "items": { - "$ref": "#/components/schemas/ItemField" + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, - "type": "array", - "description": "The compacted list of output items." + "minItems": 0, + "maxItems": 16384, + "description": "The MCP tools the agent may call. All server tools are allowed when omitted." }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) when the compacted conversation was created." + "required": { + "type": "boolean", + "default": false, + "description": "Whether this MCP server must initialize before the first turn. Defaults to `false`." }, - "usage": { - "$ref": "#/components/schemas/ResponseUsage", - "description": "Token accounting for the compaction pass, including cached, reasoning, and total tokens." + "connection_origin": { + "anyOf": [ + { + "$ref": "#/components/schemas/McpConnectionOriginParam" + }, + { + "type": "null" + } + ], + "description": "Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment." } }, - "type": "object", "required": [ - "id", - "object", - "output", - "created_at", - "usage" + "type", + "server_label", + "transport" ], - "title": "The compacted response object", - "example": { - "id": "resp_001", - "object": "response.compaction", - "output": [ - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Summarize our launch checklist from last week." - } - ] - }, - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "You are performing a CONTEXT CHECKPOINT COMPACTION..." - } - ] - }, - { - "type": "compaction", - "id": "cmp_001", - "encrypted_content": "encrypted-summary" - } - ], - "created_at": 1731459200, - "usage": { - "input_tokens": 42897, - "output_tokens": 12000, - "total_tokens": 54912 - } - } + "additionalProperties": false, + "description": "Tools provided by a remote MCP server." }, - "SkillResource": { + "WebSearchModeParam": { + "type": "string", + "enum": [ + "disabled", + "cached", + "live" + ], + "x-enumDescriptions": [ + "Disables web search.", + "Uses cached search results.", + "Searches the live web." + ], + "description": "The source used for web search results." + }, + "WebSearchContextSizeParam": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ], + "description": "The amount of web search context made available to the model." + }, + "WebSearchLocationParam": { + "type": "object", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the skill." - }, - "object": { - "type": "string", - "enum": [ - "skill" + "country": { + "type": [ + "string", + "null" ], - "description": "The object type, which is `skill`.", - "default": "skill", - "x-stainless-const": true - }, - "name": { - "type": "string", - "description": "Name of the skill." - }, - "description": { - "type": "string", - "description": "Description of the skill." + "minLength": 0, + "maxLength": 1048576, + "description": "The two-letter ISO country code, such as `US`." }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (seconds) for when the skill was created." + "region": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The region or state name." }, - "default_version": { - "type": "string", - "description": "Default version for the skill." + "city": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The city name." }, - "latest_version": { - "type": "string", - "description": "Latest version for the skill." + "timezone": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The IANA timezone, such as `America/Los_Angeles`." } }, - "type": "object", - "required": [ - "id", - "object", - "name", - "description", - "created_at", - "default_version", - "latest_version" - ] + "additionalProperties": false, + "description": "Approximate user location used to localize web search results." }, - "SkillListResource": { + "AgentToolConfigParamWebSearch": { + "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "web_search" ], - "description": "The type of object returned, must be `list`.", - "default": "list", - "x-stainless-const": true - }, - "data": { - "items": { - "$ref": "#/components/schemas/SkillResource" - }, - "type": "array", - "description": "A list of items" + "default": "web_search", + "x-stainless-const": true, + "description": "The type of the object. Always `web_search`." }, - "first_id": { + "mode": { "anyOf": [ { - "type": "string", - "description": "The ID of the first item in the list." + "$ref": "#/components/schemas/WebSearchModeParam" }, { "type": "null" } - ] + ], + "description": "The source used for web search results. Defaults to `live`." }, - "last_id": { + "context_size": { "anyOf": [ { - "type": "string", - "description": "The ID of the last item in the list." + "$ref": "#/components/schemas/WebSearchContextSizeParam" }, { "type": "null" } - ] + ], + "description": "The amount of search context made available to the model. Defaults to `medium`." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more items available." - } - }, - "type": "object", - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "CreateSkillBody": { - "properties": { - "files": { - "oneOf": [ + "allowed_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Domains the search may include." + }, + "location": { + "anyOf": [ { - "items": { - "type": "string", - "format": "binary" - }, - "type": "array", - "maxItems": 500, - "description": "Skill files to upload (directory upload) or a single zip file." + "$ref": "#/components/schemas/WebSearchLocationParam" }, { - "type": "string", - "format": "binary", - "description": "Skill zip file to upload." + "type": "null" } - ] + ], + "description": "Approximate location used to localize search results." } }, - "type": "object", "required": [ - "files" + "type" ], - "title": "Create skill request", - "description": "Uploads a skill either as a directory (multipart `files[]`) or as a single zip file." + "additionalProperties": false, + "description": "Web search." }, - "SetDefaultSkillVersionBody": { + "AgentToolConfigParamComputerUse": { + "type": "object", "properties": { - "default_version": { + "type": { "type": "string", - "description": "The skill version number to set as default." + "enum": [ + "computer_use" + ], + "default": "computer_use", + "x-stainless-const": true, + "description": "The type of the object. Always `computer_use`." + }, + "include_screenshots": { + "type": "boolean", + "default": false, + "description": "Whether computer tool outputs include screenshots. Defaults to `false`." } }, - "type": "object", "required": [ - "default_version" + "type" ], - "title": "Update skill request", - "description": "Updates the default version pointer for a skill." + "additionalProperties": false, + "description": "Browser use in an OpenAI-hosted session." }, - "DeletedSkillResource": { + "AgentToolConfigParamAutomations": { + "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "skill.deleted" + "automations" ], - "default": "skill.deleted", - "x-stainless-const": true - }, - "deleted": { - "type": "boolean" - }, - "id": { - "type": "string" + "default": "automations", + "x-stainless-const": true, + "description": "The type of the object. Always `automations`." } }, - "type": "object", "required": [ - "object", - "deleted", - "id" - ] + "type" + ], + "additionalProperties": false, + "description": "Lets the agent manage its own scheduled wakeups." }, - "SkillVersionResource": { - "properties": { - "object": { - "type": "string", - "enum": [ - "skill.version" - ], - "description": "The object type, which is `skill.version`.", - "default": "skill.version", - "x-stainless-const": true + "AgentToolConfigParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/AgentToolConfigParamFunction" }, - "id": { - "type": "string", - "description": "Unique identifier for the skill version." + { + "$ref": "#/components/schemas/AgentToolConfigParamToolSearch" }, - "skill_id": { - "type": "string", - "description": "Identifier of the skill for this version." + { + "$ref": "#/components/schemas/AgentToolConfigParamProgrammaticToolCalling" }, - "version": { - "type": "string", - "description": "Version number for this skill." + { + "$ref": "#/components/schemas/AgentToolConfigParamMcp" }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (seconds) for when the version was created." + { + "$ref": "#/components/schemas/AgentToolConfigParamWebSearch" }, - "name": { - "type": "string", - "description": "Name of the skill version." + { + "$ref": "#/components/schemas/AgentToolConfigParamComputerUse" }, - "description": { - "type": "string", - "description": "Description of the skill version." + { + "$ref": "#/components/schemas/AgentToolConfigParamAutomations" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "function": "#/components/schemas/AgentToolConfigParamFunction", + "tool_search": "#/components/schemas/AgentToolConfigParamToolSearch", + "programmatic_tool_calling": "#/components/schemas/AgentToolConfigParamProgrammaticToolCalling", + "mcp": "#/components/schemas/AgentToolConfigParamMcp", + "web_search": "#/components/schemas/AgentToolConfigParamWebSearch", + "computer_use": "#/components/schemas/AgentToolConfigParamComputerUse", + "automations": "#/components/schemas/AgentToolConfigParamAutomations" } }, - "type": "object", - "required": [ - "object", - "id", - "skill_id", - "version", - "created_at", - "name", - "description" - ] + "x-oai-discriminator-values": [ + "function", + "tool_search", + "programmatic_tool_calling", + "mcp", + "web_search", + "computer_use", + "automations" + ], + "description": "A tool available to the agent." }, - "SkillVersionListResource": { + "SessionAgentConfigParam": { + "type": "object", "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object returned, must be `list`.", - "default": "list", - "x-stainless-const": true + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigOverridesParam", + "default": {}, + "description": "Experimental settings to merge by key. Omitted settings keep their current values." }, - "data": { - "items": { - "$ref": "#/components/schemas/SkillVersionResource" - }, - "type": "array", - "description": "A list of items" + "model": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The model to use for the agent. The requested model name is preserved." }, - "first_id": { + "reasoning": { "anyOf": [ { - "type": "string", - "description": "The ID of the first item in the list." + "$ref": "#/components/schemas/ReasoningParam" }, { "type": "null" } - ] + ], + "description": "Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort." }, - "last_id": { + "text": { "anyOf": [ { - "type": "string", - "description": "The ID of the last item in the list." + "$ref": "#/components/schemas/TextParam" }, { "type": "null" } - ] - }, - "has_more": { - "type": "boolean", - "description": "Whether there are more items available." - } - }, - "type": "object", - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - }, - "CreateSkillVersionBody": { - "properties": { - "files": { - "oneOf": [ - { - "items": { - "type": "string", - "format": "binary" - }, - "type": "array", - "maxItems": 500, - "description": "Skill files to upload (directory upload) or a single zip file." - }, - { - "type": "string", - "format": "binary", - "description": "Skill zip file to upload." - } - ] - }, - "default": { - "type": "boolean", - "description": "Whether to set this version as the default." - } - }, - "type": "object", - "required": [ - "files" - ], - "title": "Create skill version request", - "description": "Uploads a new immutable version of a skill." - }, - "DeletedSkillVersionResource": { - "properties": { - "object": { - "type": "string", - "enum": [ - "skill.version.deleted" ], - "default": "skill.version.deleted", - "x-stainless-const": true - }, - "deleted": { - "type": "boolean" - }, - "id": { - "type": "string" - }, - "version": { - "type": "string", - "description": "The deleted skill version." - } - }, - "type": "object", - "required": [ - "object", - "deleted", - "id", - "version" - ] - }, - "ChatkitWorkflowTracing": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Indicates whether tracing is enabled." - } - }, - "type": "object", - "required": [ - "enabled" - ], - "title": "Tracing Configuration", - "description": "Controls diagnostic tracing during the session." - }, - "ChatkitWorkflow": { - "properties": { - "id": { - "type": "string", - "description": "Identifier of the workflow backing the session." + "description": "Configuration for text generated by the agent." }, - "version": { + "service_tier": { "anyOf": [ { - "type": "string", - "description": "Specific workflow version used for the session. Defaults to null when using the latest deployment." + "$ref": "#/components/schemas/ServiceTierParam" }, { "type": "null" } - ] + ], + "description": "The service tier used for model requests." }, - "state_variables": { + "instructions": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "Additional instructions appended to the agent's default base instructions. Omit to leave unchanged." + }, + "multi_agent": { "anyOf": [ { - "additionalProperties": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - }, - { - "type": "boolean" - }, - { - "type": "number" - } - ] - }, - "type": "object", - "description": "State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.", - "x-oaiTypeLabel": "map" + "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" }, { "type": "null" } - ] + ], + "description": "Configuration for creating and coordinating subagents." }, - "tracing": { - "$ref": "#/components/schemas/ChatkitWorkflowTracing", - "description": "Tracing settings applied to the workflow." + "compaction": { + "anyOf": [ + { + "$ref": "#/components/schemas/CompactionParam" + }, + { + "type": "null" + } + ], + "description": "Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction." + }, + "tools": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/AgentToolConfigParam" + }, + "minItems": 0, + "maxItems": 16384, + "description": "Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON." } }, + "additionalProperties": false, + "description": "Agent configuration for a session. Omitted fields inherit from `agent_id` when supplied. Supplied objects and arrays replace the whole field, except experimental settings, which merge by key. Null resets nullable fields." + }, + "EnvironmentParamNone": { "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "none" + ], + "default": "none", + "x-stainless-const": true, + "description": "The type of the object. Always `none`." + } + }, "required": [ - "id", - "version", - "state_variables", - "tracing" + "type" ], - "title": "Workflow", - "description": "Workflow metadata and state returned for the session." + "additionalProperties": false, + "description": "Runs the agent without an execution environment." }, - "ChatSessionRateLimits": { + "EnvironmentPackagesParam": { + "type": "object", "properties": { - "max_requests_per_1_minute": { - "type": "integer", - "description": "Maximum allowed requests per one-minute window." + "python": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Python packages to install. Defaults to an empty list." + }, + "system": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "System packages to install. Defaults to an empty list." + }, + "npm": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "npm packages to install globally. Defaults to an empty list." } }, + "additionalProperties": false, + "description": "Packages to install in an OpenAI-hosted environment." + }, + "SetupCommandParam": { "type": "object", + "properties": { + "command": { + "type": "string", + "minLength": 0, + "maxLength": 65536, + "description": "The shell command to execute." + }, + "cwd": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 4096, + "description": "The absolute working directory. Defaults to `/workspace`." + } + }, "required": [ - "max_requests_per_1_minute" + "command" ], - "title": "Rate limits", - "description": "Active per-minute request limit for the session." + "additionalProperties": false, + "description": "A confidential setup command executed before the hosted agent starts." }, - "ChatSessionStatus": { + "NetworkAccessParam": { "type": "string", "enum": [ - "active", - "expired", - "cancelled" - ] - }, - "ChatSessionAutomaticThreadTitling": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether automatic thread titling is enabled." - } - }, - "type": "object", - "required": [ - "enabled" + "enabled", + "disabled", + "restricted" ], - "title": "Automatic thread titling", - "description": "Automatic thread title preferences for the session." + "x-enumDescriptions": [ + "Allows unrestricted network access.", + "Disables network access.", + "Applies the configured domain restrictions." + ], + "description": "The network access mode for an OpenAI-hosted environment." }, - "ChatSessionFileUpload": { + "NetworkPolicyParam": { + "type": "object", "properties": { - "enabled": { - "type": "boolean", - "description": "Indicates if uploads are enabled for the session." + "access": { + "$ref": "#/components/schemas/NetworkAccessParam", + "description": "The environment's network access mode." }, - "max_file_size": { - "anyOf": [ - { - "type": "integer", - "description": "Maximum upload size in megabytes." - }, - { - "type": "null" - } - ] + "allowed_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Domains the environment may access when network access is restricted." }, - "max_files": { - "anyOf": [ - { - "type": "integer", - "description": "Maximum number of uploads allowed during the session." - }, - { - "type": "null" - } - ] + "blocked_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 100, + "description": "Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported." } }, - "type": "object", "required": [ - "enabled", - "max_file_size", - "max_files" + "access" ], - "title": "File upload settings", - "description": "Upload permissions and limits applied to the session." + "additionalProperties": false, + "description": "Network access for an OpenAI-hosted environment." }, - "ChatSessionHistory": { + "DesktopParam": { + "type": "object", "properties": { "enabled": { "type": "boolean", - "description": "Indicates if chat history is persisted for the session." - }, - "recent_threads": { - "anyOf": [ - { - "type": "integer", - "description": "Number of prior threads surfaced in history views. Defaults to null when all history is retained." - }, - { - "type": "null" - } - ] + "description": "Whether to provision the desktop and its browser proxy." } }, - "type": "object", "required": [ - "enabled", - "recent_threads" + "enabled" ], - "title": "History settings", - "description": "History retention preferences returned for the session." + "additionalProperties": false, + "description": "Desktop configuration for an OpenAI-hosted environment." }, - "ChatSessionChatkitConfiguration": { + "HostedSkillParamSkillReference": { + "type": "object", "properties": { - "automatic_thread_titling": { - "$ref": "#/components/schemas/ChatSessionAutomaticThreadTitling", - "description": "Automatic thread titling preferences." + "type": { + "type": "string", + "enum": [ + "skill_reference" + ], + "default": "skill_reference", + "x-stainless-const": true, + "description": "The type of the object. Always `skill_reference`." }, - "file_upload": { - "$ref": "#/components/schemas/ChatSessionFileUpload", - "description": "Upload settings for the session." + "skill_id": { + "type": "string", + "minLength": 1, + "maxLength": 64, + "description": "The ID of the skill created through `/v1/skills`." }, - "history": { - "$ref": "#/components/schemas/ChatSessionHistory", - "description": "History retention configuration." + "version": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The skill version, a positive integer or `latest`; omission selects the default." } }, - "type": "object", "required": [ - "automatic_thread_titling", - "file_upload", - "history" + "type", + "skill_id" ], - "title": "ChatKit configuration", - "description": "ChatKit configuration for the session." + "additionalProperties": false, + "description": "References a skill uploaded through the Skills API." }, - "ChatSessionResource": { + "InlineCapabilitySourceParamBase64": { + "type": "object", "properties": { - "id": { - "type": "string", - "description": "Identifier for the ChatKit session." - }, - "object": { + "type": { "type": "string", "enum": [ - "chatkit.session" + "base64" ], - "description": "Type discriminator that is always `chatkit.session`.", - "default": "chatkit.session", - "x-stainless-const": true - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) for when the session expires." + "default": "base64", + "x-stainless-const": true, + "description": "The type of the object. Always `base64`." }, - "client_secret": { + "media_type": { "type": "string", - "description": "Ephemeral client secret that authenticates session requests." - }, - "workflow": { - "$ref": "#/components/schemas/ChatkitWorkflow", - "description": "Workflow metadata for the session." + "enum": [ + "application/zip" + ], + "default": "application/zip", + "x-stainless-const": true, + "description": "The archive media type, always `application/zip`." }, - "user": { + "data": { "type": "string", - "description": "User identifier associated with the session." - }, - "rate_limits": { - "$ref": "#/components/schemas/ChatSessionRateLimits", - "description": "Resolved rate limit values." - }, - "max_requests_per_1_minute": { - "type": "integer", - "description": "Convenience copy of the per-minute request limit." - }, - "status": { - "$ref": "#/components/schemas/ChatSessionStatus", - "description": "Current lifecycle state of the session." - }, - "chatkit_configuration": { - "$ref": "#/components/schemas/ChatSessionChatkitConfiguration", - "description": "Resolved ChatKit feature configuration for the session." + "minLength": 1, + "maxLength": 70254592, + "description": "Standard-base64 encoded ZIP archive bytes." } }, - "type": "object", "required": [ - "id", - "object", - "expires_at", - "client_secret", - "workflow", - "user", - "rate_limits", - "max_requests_per_1_minute", - "status", - "chatkit_configuration" + "type", + "media_type", + "data" ], - "title": "The chat session object", - "description": "Represents a ChatKit session and its resolved configuration.", - "example": { - "id": "cksess_123", - "object": "chatkit.session", - "client_secret": "ek_token_123", - "expires_at": 1712349876, - "workflow": { - "id": "workflow_alpha", - "version": "2024-10-01" - }, - "user": "user_789", - "rate_limits": { - "max_requests_per_1_minute": 60 - }, - "max_requests_per_1_minute": 60, - "status": "cancelled", - "chatkit_configuration": { - "automatic_thread_titling": { - "enabled": true - }, - "file_upload": { - "enabled": true, - "max_file_size": 16, - "max_files": 20 - }, - "history": { - "enabled": true, - "recent_threads": 10 - } - } - } + "additionalProperties": false, + "description": "Provides ZIP bytes encoded with standard base64." }, - "WorkflowTracingParam": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether tracing is enabled during the session. Defaults to true." + "InlineCapabilitySourceParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/InlineCapabilitySourceParamBase64" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "base64": "#/components/schemas/InlineCapabilitySourceParamBase64" } }, - "type": "object", - "required": [], - "title": "Tracing Configuration", - "description": "Controls diagnostic tracing during the session." + "x-oai-discriminator-values": [ + "base64" + ], + "description": "The encoded ZIP archive for an inline skill or plugin." }, - "WorkflowParam": { + "HostedSkillParamInline": { + "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "Identifier for the workflow invoked by the session." + "enum": [ + "inline" + ], + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." }, - "version": { + "name": { "type": "string", - "description": "Specific workflow version to run. Defaults to the latest deployed version." + "minLength": 1, + "maxLength": 64, + "description": "The skill name declared in `SKILL.md`." }, - "state_variables": { - "additionalProperties": { - "oneOf": [ - { - "type": "string", - "maxLength": 10485760 - }, - { - "type": "integer" - }, - { - "type": "boolean" - }, - { - "type": "number" - } - ] - }, - "type": "object", - "maxProperties": 64, - "description": "State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object.", - "x-oaiTypeLabel": "map" + "description": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The skill description declared in `SKILL.md`." }, - "tracing": { - "$ref": "#/components/schemas/WorkflowTracingParam", - "description": "Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default." + "source": { + "$ref": "#/components/schemas/InlineCapabilitySourceParam", + "description": "The inline ZIP archive." + } + }, + "required": [ + "type", + "name", + "description", + "source" + ], + "additionalProperties": false, + "description": "Supplies a skill ZIP directly in the session request." + }, + "HostedSkillParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedSkillParamSkillReference" + }, + { + "$ref": "#/components/schemas/HostedSkillParamInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "skill_reference": "#/components/schemas/HostedSkillParamSkillReference", + "inline": "#/components/schemas/HostedSkillParamInline" } }, - "type": "object", - "required": [ - "id" + "x-oai-discriminator-values": [ + "skill_reference", + "inline" ], - "title": "Workflow settings", - "description": "Workflow reference and overrides applied to the chat session." + "description": "A skill installed in an OpenAI-hosted environment." }, - "ExpiresAfterParam": { + "HostedPluginParamInline": { + "type": "object", "properties": { - "anchor": { + "type": { "type": "string", "enum": [ - "created_at" + "inline" ], - "description": "Base timestamp used to calculate expiration. Currently fixed to `created_at`.", - "default": "created_at", - "x-stainless-const": true + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." }, - "seconds": { - "type": "integer", - "maximum": 600, - "minimum": 1, - "format": "int64", - "description": "Number of seconds after the anchor when the session expires." + "name": { + "type": "string", + "minLength": 1, + "maxLength": 64, + "description": "The plugin name declared in `.codex-plugin/plugin.json`." + }, + "description": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The plugin description declared in `.codex-plugin/plugin.json`." + }, + "source": { + "$ref": "#/components/schemas/InlineCapabilitySourceParam", + "description": "The inline ZIP archive." } }, - "type": "object", "required": [ - "anchor", - "seconds" + "type", + "name", + "description", + "source" ], - "title": "Expiration overrides", - "description": "Controls when the session expires relative to an anchor timestamp." + "additionalProperties": false, + "description": "Supplies a plugin ZIP directly in the session request." }, - "RateLimitsParam": { - "properties": { - "max_requests_per_1_minute": { - "type": "integer", - "minimum": 1, - "description": "Maximum number of requests allowed per minute for the session. Defaults to 10." + "HostedPluginParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedPluginParamInline" } - }, - "type": "object", - "required": [], - "title": "Rate limit overrides", - "description": "Controls request rate limits for the session." - }, - "AutomaticThreadTitlingParam": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Enable automatic thread title generation. Defaults to true." + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "inline": "#/components/schemas/HostedPluginParamInline" } }, - "type": "object", - "required": [], - "title": "Automatic thread titling configuration", - "description": "Controls whether ChatKit automatically generates thread titles." + "x-oai-discriminator-values": [ + "inline" + ], + "description": "A plugin installed in an OpenAI-hosted environment." }, - "FileUploadParam": { + "HostedEnvironmentFileParamFileId": { + "type": "object", "properties": { - "enabled": { - "type": "boolean", - "description": "Enable uploads for this session. Defaults to false." + "type": { + "type": "string", + "enum": [ + "file_id" + ], + "default": "file_id", + "x-stainless-const": true, + "description": "The type of the object. Always `file_id`." }, - "max_file_size": { - "type": "integer", - "maximum": 512, - "minimum": 1, - "description": "Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size." + "file_id": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "description": "The ID of the uploaded file." }, - "max_files": { - "type": "integer", - "minimum": 1, - "description": "Maximum number of files that can be uploaded to the session. Defaults to 10." + "path": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "description": "The absolute destination path inside `/workspace`." } }, - "type": "object", - "required": [], - "title": "File upload configuration", - "description": "Controls whether users can upload files." + "required": [ + "type", + "file_id", + "path" + ], + "additionalProperties": false, + "description": "A file previously uploaded through the OpenAI Files API." }, - "HistoryParam": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Enables chat users to access previous ChatKit threads. Defaults to true." - }, - "recent_threads": { - "type": "integer", - "minimum": 1, - "description": "Number of recent ChatKit threads users have access to. Defaults to unlimited when unset." - } - }, + "HostedEnvironmentFileParamInline": { "type": "object", - "required": [], - "title": "Chat history configuration", - "description": "Controls how much historical context is retained for the session." - }, - "ChatkitConfigurationParam": { "properties": { - "automatic_thread_titling": { - "$ref": "#/components/schemas/AutomaticThreadTitlingParam", - "description": "Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default." + "type": { + "type": "string", + "enum": [ + "inline" + ], + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." }, - "file_upload": { - "$ref": "#/components/schemas/FileUploadParam", - "description": "Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB)." + "data": { + "type": "string", + "minLength": 0, + "maxLength": 6990508, + "description": "The standard-base64-encoded file contents." }, - "history": { - "$ref": "#/components/schemas/HistoryParam", - "description": "Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null)." + "path": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "description": "The absolute destination path inside `/workspace`." } }, - "type": "object", - "required": [], - "title": "ChatKit configuration overrides", - "description": "Optional per-session configuration settings for ChatKit behavior." + "required": [ + "type", + "data", + "path" + ], + "additionalProperties": false, + "description": "A file supplied directly as standard-base64 data." }, - "CreateChatSessionBody": { - "properties": { - "workflow": { - "$ref": "#/components/schemas/WorkflowParam", - "description": "Workflow that powers the session." - }, - "user": { - "type": "string", - "minLength": 1, - "description": "A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope." - }, - "expires_after": { - "$ref": "#/components/schemas/ExpiresAfterParam", - "description": "Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes." - }, - "rate_limits": { - "$ref": "#/components/schemas/RateLimitsParam", - "description": "Optional override for per-minute request limits. When omitted, defaults to 10." + "HostedEnvironmentFileParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedEnvironmentFileParamFileId" }, - "chatkit_configuration": { - "$ref": "#/components/schemas/ChatkitConfigurationParam", - "description": "Optional overrides for ChatKit runtime configuration features" + { + "$ref": "#/components/schemas/HostedEnvironmentFileParamInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "file_id": "#/components/schemas/HostedEnvironmentFileParamFileId", + "inline": "#/components/schemas/HostedEnvironmentFileParamInline" } }, - "type": "object", - "required": [ - "workflow", - "user" + "x-oai-discriminator-values": [ + "file_id", + "inline" ], - "title": "Create chat session request", - "description": "Parameters for provisioning a new ChatKit session." + "description": "A file materialized in an OpenAI-hosted execution environment." }, - "UserMessageInputText": { + "ContainerSizeParam": { + "type": "string", + "enum": [ + "small", + "medium", + "large" + ], + "description": "The CPU and memory tier for a new OpenAI-hosted session environment." + }, + "EnvironmentParamOpenaiHosted": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_text" + "openai_hosted" ], - "description": "Type discriminator that is always `input_text`.", - "default": "input_text", - "x-stainless-const": true + "default": "openai_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `openai_hosted`." }, - "text": { + "packages": { + "anyOf": [ + { + "$ref": "#/components/schemas/EnvironmentPackagesParam" + }, + { + "type": "null" + } + ], + "description": "Packages to install in the environment. Defaults to empty package lists." + }, + "setup_commands": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/SetupCommandParam" + }, + "minItems": 0, + "maxItems": 16, + "description": "Ordered, confidential setup commands. Command bodies are never returned." + }, + "network": { + "anyOf": [ + { + "$ref": "#/components/schemas/NetworkPolicyParam" + }, + { + "type": "null" + } + ], + "description": "Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled." + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopParam" + }, + { + "type": "null" + } + ], + "description": "Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled." + }, + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Environment variables made available to the agent." + }, + "capability_directories": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + }, + "skills": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedSkillParam" + }, + "minItems": 0, + "maxItems": 200, + "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." + }, + "plugins": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedPluginParam" + }, + "minItems": 0, + "maxItems": 32, + "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." + }, + "files": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileParam" + }, + "minItems": 0, + "maxItems": 50, + "description": "Files available before the agent starts. Defaults to an empty list." + }, + "environment_id": { "type": "string", - "description": "Plain-text content supplied by the user." + "minLength": 9, + "maxLength": 256, + "description": "An existing prewarmed environment. Cannot be combined with a template or inline configuration." + }, + "environment_template_id": { + "type": "string", + "minLength": 0, + "maxLength": 64, + "description": "A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy." + }, + "container_size": { + "$ref": "#/components/schemas/ContainerSizeParam", + "description": "The hosted container size. Omission selects the medium tier." } }, - "type": "object", "required": [ - "type", - "text" + "type" ], - "title": "User message input", - "description": "Text block that a user contributed to the thread." + "additionalProperties": false, + "description": "An existing OpenAI-hosted environment or new inline/template-based hosted configuration.", + "not": { + "required": [ + "environment_id" + ], + "anyOf": [ + { + "required": [ + "packages" + ] + }, + { + "required": [ + "setup_commands" + ] + }, + { + "required": [ + "network" + ] + }, + { + "required": [ + "desktop" + ] + }, + { + "required": [ + "env" + ] + }, + { + "required": [ + "capability_directories" + ] + }, + { + "required": [ + "skills" + ] + }, + { + "required": [ + "plugins" + ] + }, + { + "required": [ + "files" + ] + }, + { + "required": [ + "environment_template_id" + ] + }, + { + "required": [ + "container_size" + ] + } + ] + } }, - "UserMessageQuotedText": { + "EnvironmentParamSelfHosted": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "quoted_text" + "self_hosted" ], - "description": "Type discriminator that is always `quoted_text`.", - "default": "quoted_text", - "x-stainless-const": true + "default": "self_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `self_hosted`." }, - "text": { + "capability_directories": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + }, + "workspace_directory": { "type": "string", - "description": "Quoted text content." + "minLength": 0, + "maxLength": 1048576, + "description": "Absolute project directory inside the self-hosted environment." } }, - "type": "object", "required": [ "type", - "text" + "workspace_directory" ], - "title": "User message quoted text", - "description": "Quoted snippet that the user referenced in their message." + "additionalProperties": false, + "description": "An application-hosted environment configured inline." }, - "AttachmentType": { - "type": "string", - "enum": [ - "image", - "file" - ] + "EnvironmentParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/EnvironmentParamNone" + }, + { + "$ref": "#/components/schemas/EnvironmentParamOpenaiHosted" + }, + { + "$ref": "#/components/schemas/EnvironmentParamSelfHosted" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "none": "#/components/schemas/EnvironmentParamNone", + "openai_hosted": "#/components/schemas/EnvironmentParamOpenaiHosted", + "self_hosted": "#/components/schemas/EnvironmentParamSelfHosted" + } + }, + "x-oai-discriminator-values": [ + "none", + "openai_hosted", + "self_hosted" + ], + "description": "The execution environment and optional reusable template for a session." }, - "Attachment": { + "InputContentParamInputText": { + "type": "object", "properties": { "type": { - "$ref": "#/components/schemas/AttachmentType", - "description": "Attachment discriminator." - }, - "id": { - "type": "string", - "description": "Identifier for the attachment." - }, - "name": { "type": "string", - "description": "Original display name for the attachment." + "enum": [ + "input_text" + ], + "default": "input_text", + "x-stainless-const": true, + "description": "The type of the object. Always `input_text`." }, - "mime_type": { + "text": { "type": "string", - "description": "MIME type of the attachment." - }, - "preview_url": { - "anyOf": [ - { - "type": "string", - "format": "uri", - "description": "Preview URL for rendering the attachment inline." - }, - { - "type": "null" - } - ] + "minLength": 0, + "maxLength": 1048576, + "description": "The text sent to the model." } }, - "type": "object", "required": [ "type", - "id", - "name", - "mime_type", - "preview_url" + "text" ], - "title": "Attachment", - "description": "Attachment metadata included on thread items." + "additionalProperties": false, + "description": "Text input to the model." }, - "ToolChoice": { + "InputContentParamInputImage": { + "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "Identifier of the requested tool." + "enum": [ + "input_image" + ], + "default": "input_image", + "x-stainless-const": true, + "description": "The type of the object. Always `input_image`." + }, + "image_url": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The URL of the image sent to the model." } }, - "type": "object", "required": [ - "id" + "type", + "image_url" ], - "title": "Tool choice", - "description": "Tool selection that the assistant should honor when executing the item." + "additionalProperties": false, + "description": "Image input to the model." }, - "InferenceOptions": { - "properties": { - "tool_choice": { - "anyOf": [ - { - "$ref": "#/components/schemas/ToolChoice", - "description": "Preferred tool to invoke. Defaults to null when ChatKit should auto-select." - }, - { - "type": "null" - } - ] + "InputContentParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/InputContentParamInputText" }, - "model": { - "anyOf": [ - { - "type": "string", - "description": "Model name that generated the response. Defaults to null when using the session default." - }, - { - "type": "null" - } - ] + { + "$ref": "#/components/schemas/InputContentParamInputImage" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "input_text": "#/components/schemas/InputContentParamInputText", + "input_image": "#/components/schemas/InputContentParamInputImage" } }, - "type": "object", - "required": [ - "tool_choice", - "model" + "x-oai-discriminator-values": [ + "input_text", + "input_image" ], - "title": "Inference options", - "description": "Model and tool overrides applied when generating the assistant response." + "description": "Content included in an input message." }, - "UserMessageItem": { + "InputMessageParam": { + "type": "object", "properties": { - "id": { - "type": "string", - "description": "Identifier of the thread item." - }, - "object": { + "type": { "type": "string", "enum": [ - "chatkit.thread_item" + "message" ], - "description": "Type discriminator that is always `chatkit.thread_item`.", - "default": "chatkit.thread_item", - "x-stainless-const": true - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) for when the item was created." - }, - "thread_id": { - "type": "string", - "description": "Identifier of the parent thread." + "default": "message", + "x-stainless-const": true, + "description": "The type of the input item. Always `message`." }, - "type": { + "role": { "type": "string", "enum": [ - "chatkit.user_message" + "user" ], - "default": "chatkit.user_message", - "x-stainless-const": true + "default": "user", + "x-stainless-const": true, + "description": "The role of the message author. Always `user`." }, "content": { - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserMessageInputText" - }, - { - "$ref": "#/components/schemas/UserMessageQuotedText" - } - ], - "description": "Content blocks that comprise a user message.", - "discriminator": { - "propertyName": "type" - } - }, "type": "array", - "description": "Ordered content elements supplied by the user." - }, - "attachments": { "items": { - "$ref": "#/components/schemas/Attachment" + "$ref": "#/components/schemas/InputContentParam" }, - "type": "array", - "description": "Attachments associated with the user message. Defaults to an empty list." - }, - "inference_options": { - "anyOf": [ - { - "$ref": "#/components/schemas/InferenceOptions", - "description": "Inference overrides applied to the message. Defaults to null when unset." - }, - { - "type": "null" - } - ] + "minItems": 0, + "maxItems": 16384, + "description": "The content of the message." } }, - "type": "object", "required": [ - "id", - "object", - "created_at", - "thread_id", - "type", - "content", - "attachments", - "inference_options" + "role", + "content" ], - "title": "User Message Item", - "description": "User-authored messages within a thread." + "additionalProperties": false, + "description": "A user message submitted to a session." }, - "FileAnnotationSource": { + "AutomationTargetParamNewSession": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "file" + "new_session" ], - "description": "Type discriminator that is always `file`.", - "default": "file", - "x-stainless-const": true + "default": "new_session", + "x-stainless-const": true, + "description": "The type of the object. Always `new_session`." }, - "filename": { + "agent": { + "$ref": "#/components/schemas/SessionAgentConfigParam", + "description": "Inline agent configuration. Provide exactly one of agent and agent_id." + }, + "agent_id": { "type": "string", - "description": "Filename referenced by the annotation." + "minLength": 0, + "maxLength": 64, + "description": "A saved agent ID. Provide exactly one of agent and agent_id." + }, + "environment": { + "$ref": "#/components/schemas/EnvironmentParam", + "description": "The execution environment for each new session." + }, + "input": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputMessageParam" + }, + "minItems": 0, + "maxItems": 16384, + "description": "Initial user messages submitted with each new session." + }, + "vault_ids": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "The IDs of vaults made available to each new session." + }, + "metadata": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Metadata attached to each new session." } }, - "type": "object", "required": [ "type", - "filename" + "environment", + "input" ], - "title": "File annotation source", - "description": "Attachment source referenced by an annotation." + "additionalProperties": false, + "description": "Create a session for each invocation." }, - "FileAnnotation": { + "AutomationTargetParamExistingSession": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "file" + "existing_session" ], - "description": "Type discriminator that is always `file` for this annotation.", - "default": "file", - "x-stainless-const": true + "default": "existing_session", + "x-stainless-const": true, + "description": "The type of the object. Always `existing_session`." }, - "source": { - "$ref": "#/components/schemas/FileAnnotationSource", - "description": "File attachment referenced by the annotation." + "session_id": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The session receiving each invocation." + }, + "instructions": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "Instructions delivered as an automation notification." } }, - "type": "object", "required": [ "type", - "source" + "session_id", + "instructions" ], - "title": "File annotation", - "description": "Annotation that references an uploaded file." + "additionalProperties": false, + "description": "Deliver instructions to an existing session." }, - "UrlAnnotationSource": { - "properties": { - "type": { - "type": "string", - "enum": [ - "url" - ], - "description": "Type discriminator that is always `url`.", - "default": "url", - "x-stainless-const": true + "AutomationTargetParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationTargetParamNewSession" }, - "url": { - "type": "string", - "format": "uri", - "description": "URL referenced by the annotation." + { + "$ref": "#/components/schemas/AutomationTargetParamExistingSession" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "new_session": "#/components/schemas/AutomationTargetParamNewSession", + "existing_session": "#/components/schemas/AutomationTargetParamExistingSession" } }, - "type": "object", - "required": [ - "type", - "url" + "x-oai-discriminator-values": [ + "new_session", + "existing_session" ], - "title": "URL annotation source", - "description": "URL backing an annotation entry." + "description": "The session an automation invocation targets." }, - "UrlAnnotation": { + "CreateAutomationParamsPeriodic": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "url" + "periodic" ], - "description": "Type discriminator that is always `url` for this annotation.", - "default": "url", - "x-stainless-const": true + "default": "periodic", + "x-stainless-const": true, + "description": "The type of the object. Always `periodic`." }, - "source": { - "$ref": "#/components/schemas/UrlAnnotationSource", - "description": "URL referenced by the annotation." + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "description": "A human-readable name for the automation." + }, + "target": { + "$ref": "#/components/schemas/AutomationTargetParam" + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 + }, + "expression": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "description": "A standard five-field cron expression defining scheduled occurrences." + }, + "timezone": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "The IANA timezone used to interpret the cron expression." } }, - "type": "object", "required": [ "type", - "source" + "name", + "target", + "expression", + "timezone" ], - "title": "URL annotation", - "description": "Annotation that references a URL." + "additionalProperties": false }, - "ResponseOutputText": { + "CreateAutomationParamsOnce": { + "type": "object", "properties": { "type": { "type": "string", "enum": [ - "output_text" + "once" ], - "description": "Type discriminator that is always `output_text`.", - "default": "output_text", - "x-stainless-const": true + "default": "once", + "x-stainless-const": true, + "description": "The type of the object. Always `once`." }, - "text": { + "name": { "type": "string", - "description": "Assistant generated text." + "minLength": 1, + "maxLength": 256, + "description": "A human-readable name for the automation." }, - "annotations": { - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/FileAnnotation" - }, - { - "$ref": "#/components/schemas/UrlAnnotation" - } - ], - "description": "Annotation object describing a cited source.", - "discriminator": { - "propertyName": "type" - } + "target": { + "$ref": "#/components/schemas/AutomationTargetParam" + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 }, - "type": "array", - "description": "Ordered list of annotations attached to the response text." + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16 + }, + "run_at": { + "type": "integer", + "format": "int64", + "description": "A future Unix timestamp in seconds." } }, - "type": "object", "required": [ "type", - "text", - "annotations" + "name", + "target", + "run_at" ], - "title": "Assistant message content", - "description": "Assistant response text accompanied by optional annotations." + "additionalProperties": false }, - "AssistantMessageItem": { + "CreateAutomationParams": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateAutomationParamsPeriodic" + }, + { + "$ref": "#/components/schemas/CreateAutomationParamsOnce" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "periodic": "#/components/schemas/CreateAutomationParamsPeriodic", + "once": "#/components/schemas/CreateAutomationParamsOnce" + } + }, + "x-oai-discriminator-values": [ + "periodic", + "once" + ], + "description": "Creates an automation without invoking it immediately." + }, + "UpdateAutomationParams": { + "type": "object", "properties": { - "id": { + "name": { "type": "string", - "description": "Identifier of the thread item." + "minLength": 1, + "maxLength": 256 }, - "object": { - "type": "string", - "enum": [ - "chatkit.thread_item" - ], - "description": "Type discriminator that is always `chatkit.thread_item`.", - "default": "chatkit.thread_item", - "x-stainless-const": true + "target": { + "$ref": "#/components/schemas/AutomationTargetParam", + "description": "Replaces the complete target, retaining its type and any creator session." }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) for when the item was created." + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Replaces all metadata; omit to leave unchanged." }, - "thread_id": { + "expression": { "type": "string", - "description": "Identifier of the parent thread." + "minLength": 1, + "maxLength": 256, + "description": "Only accepted for periodic automations." }, - "type": { + "timezone": { "type": "string", - "enum": [ - "chatkit.assistant_message" - ], - "description": "Type discriminator that is always `chatkit.assistant_message`.", - "default": "chatkit.assistant_message", - "x-stainless-const": true + "minLength": 1, + "maxLength": 128, + "description": "Only accepted for periodic automations." }, - "content": { - "items": { - "$ref": "#/components/schemas/ResponseOutputText" - }, - "type": "array", - "description": "Ordered assistant response segments." + "run_at": { + "type": "integer", + "format": "int64", + "description": "A future Unix timestamp in seconds; accepted only before a one-time scheduled invocation exists." } }, - "type": "object", - "required": [ - "id", - "object", - "created_at", - "thread_id", - "type", - "content" - ], - "title": "Assistant message", - "description": "Assistant-authored message within a thread." + "additionalProperties": false, + "description": "Updates configuration; timing fields must match the stored automation type." }, - "WidgetMessageItem": { + "DeletedAutomationResource": { + "type": "object", "properties": { "id": { "type": "string", - "description": "Identifier of the thread item." + "minLength": 0, + "description": "The deleted automation ID." }, "object": { "type": "string", "enum": [ - "chatkit.thread_item" + "agent.automation.deleted" ], - "description": "Type discriminator that is always `chatkit.thread_item`.", - "default": "chatkit.thread_item", - "x-stainless-const": true - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) for when the item was created." + "default": "agent.automation.deleted", + "x-stainless-const": true, + "description": "Always `agent.automation.deleted`." }, - "thread_id": { + "deleted": { + "type": "boolean", + "description": "Always true." + } + }, + "required": [ + "id", + "object", + "deleted" + ], + "additionalProperties": false + }, + "AutomationInvocationSourceResourceManual": { + "type": "object", + "properties": { + "type": { "type": "string", - "description": "Identifier of the parent thread." - }, + "enum": [ + "manual" + ], + "default": "manual", + "x-stainless-const": true, + "description": "The type of the object. Always `manual`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "AutomationInvocationSourceResourceAutomation": { + "type": "object", + "properties": { "type": { "type": "string", "enum": [ - "chatkit.widget" + "automation" ], - "description": "Type discriminator that is always `chatkit.widget`.", - "default": "chatkit.widget", - "x-stainless-const": true + "default": "automation", + "x-stainless-const": true, + "description": "The type of the object. Always `automation`." }, - "widget": { - "type": "string", - "description": "Serialized widget payload rendered in the UI." + "automation": { + "$ref": "#/components/schemas/AutomationResource", + "description": "The automation snapshot for this occurrence, excluding confidential values." } }, - "type": "object", "required": [ - "id", - "object", - "created_at", - "thread_id", "type", - "widget" + "automation" ], - "title": "Widget message", - "description": "Thread item that renders a widget payload." + "additionalProperties": false }, - "ClientToolCallStatus": { + "AutomationInvocationSourceResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationInvocationSourceResourceManual" + }, + { + "$ref": "#/components/schemas/AutomationInvocationSourceResourceAutomation" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "manual": "#/components/schemas/AutomationInvocationSourceResourceManual", + "automation": "#/components/schemas/AutomationInvocationSourceResourceAutomation" + } + }, + "x-oai-discriminator-values": [ + "manual", + "automation" + ] + }, + "AutomationInvocationStatusResource": { "type": "string", "enum": [ - "in_progress", - "completed" + "queued", + "completed", + "failed", + "skipped" ] }, - "ClientToolCallItem": { + "AutomationInvocationErrorResource": { + "type": "object", + "properties": { + "code": { + "type": "string", + "minLength": 0, + "description": "A machine-readable error code." + }, + "message": { + "type": "string", + "minLength": 0, + "description": "A public explanation of the delivery failure." + } + }, + "required": [ + "code", + "message" + ], + "additionalProperties": false + }, + "AutomationInvocationResource": { + "type": "object", "properties": { "id": { "type": "string", - "description": "Identifier of the thread item." + "minLength": 0, + "description": "The invocation ID." }, "object": { "type": "string", "enum": [ - "chatkit.thread_item" + "agent.automation.invocation" ], - "description": "Type discriminator that is always `chatkit.thread_item`.", - "default": "chatkit.thread_item", - "x-stainless-const": true + "default": "agent.automation.invocation", + "x-stainless-const": true, + "description": "Always `agent.automation.invocation`." + }, + "automation_id": { + "type": "string", + "minLength": 0, + "description": "The automation that owns the invocation." }, "created_at": { "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) for when the item was created." + "format": "int64", + "description": "The creation time as a Unix timestamp in seconds." }, - "thread_id": { - "type": "string", - "description": "Identifier of the parent thread." + "source": { + "$ref": "#/components/schemas/AutomationInvocationSourceResource", + "description": "Whether the invocation was manual or scheduled." }, - "type": { - "type": "string", - "enum": [ - "chatkit.client_tool_call" + "scheduled_at": { + "type": [ + "integer", + "null" ], - "description": "Type discriminator that is always `chatkit.client_tool_call`.", - "default": "chatkit.client_tool_call", - "x-stainless-const": true - }, - "status": { - "$ref": "#/components/schemas/ClientToolCallStatus", - "description": "Execution status for the tool call." + "format": "int64", + "description": "The intended occurrence as a Unix timestamp in seconds, or null for manual runs." }, - "call_id": { - "type": "string", - "description": "Identifier for the client tool call." + "session_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The target or newly created session ID, or null before one is available." }, - "name": { - "type": "string", - "description": "Tool name that was invoked." + "status": { + "$ref": "#/components/schemas/AutomationInvocationStatusResource", + "description": "Delivery status; completed does not mean the agent's work has finished." }, - "arguments": { - "type": "string", - "description": "JSON-encoded arguments that were sent to the tool." + "skip_reason": { + "type": [ + "string", + "null" + ], + "enum": [ + "pending_delivery", + null + ], + "default": "pending_delivery", + "x-stainless-const": true, + "description": "Why an occurrence was skipped, or null when it was not skipped." }, - "output": { + "error": { "anyOf": [ { - "type": "string", - "description": "JSON-encoded output captured from the tool. Defaults to null while execution is in progress." + "$ref": "#/components/schemas/AutomationInvocationErrorResource" }, { "type": "null" } - ] + ], + "description": "The permanent delivery failure, or null when no failure occurred." } }, - "type": "object", "required": [ "id", "object", + "automation_id", "created_at", - "thread_id", - "type", + "source", + "scheduled_at", + "session_id", "status", - "call_id", - "name", - "arguments", - "output" + "skip_reason", + "error" ], - "title": "Client tool call", - "description": "Record of a client side tool invocation initiated by the assistant." + "additionalProperties": false, + "description": "One attempted delivery by an automation." }, - "TaskType": { + "EnvironmentTypeParam": { "type": "string", "enum": [ - "custom", - "thought" - ] + "openai_hosted" + ], + "description": "The hosting type of an execution environment." }, - "TaskItem": { + "EnvironmentTypeResource": { + "type": "string", + "enum": [ + "openai_hosted", + "self_hosted" + ], + "description": "The kind of execution environment." + }, + "EnvironmentStatusResource": { + "type": "string", + "enum": [ + "pending", + "ready", + "connected", + "disconnected", + "suspended", + "expired", + "failed" + ], + "x-enumDescriptions": [ + "", + "Provisioning succeeded and the environment is available for attachment or use.", + "", + "", + "The sandbox is stopped and can be resumed from its private checkpoint.", + "", + "" + ], + "description": "The public lifecycle status of an execution environment." + }, + "HostedEnvironmentFileResourceFileId": { + "type": "object", "properties": { - "id": { - "type": "string", - "description": "Identifier of the thread item." - }, - "object": { + "type": { "type": "string", "enum": [ - "chatkit.thread_item" + "file_id" ], - "description": "Type discriminator that is always `chatkit.thread_item`.", - "default": "chatkit.thread_item", - "x-stainless-const": true - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) for when the item was created." + "default": "file_id", + "x-stainless-const": true, + "description": "The type of the object. Always `file_id`." }, - "thread_id": { + "id": { "type": "string", - "description": "Identifier of the parent thread." + "minLength": 0, + "description": "The session-scoped ID of the file in the execution environment." }, - "type": { + "file_id": { "type": "string", - "enum": [ - "chatkit.task" - ], - "description": "Type discriminator that is always `chatkit.task`.", - "default": "chatkit.task", - "x-stainless-const": true - }, - "task_type": { - "$ref": "#/components/schemas/TaskType", - "description": "Subtype for the task." + "minLength": 0, + "description": "The ID of the uploaded file." }, - "heading": { - "anyOf": [ - { - "type": "string", - "description": "Optional heading for the task. Defaults to null when not provided." - }, - { - "type": "null" - } - ] + "path": { + "type": "string", + "minLength": 0, + "description": "The file's absolute path inside the environment." }, - "summary": { - "anyOf": [ - { - "type": "string", - "description": "Optional summary that describes the task. Defaults to null when omitted." - }, - { - "type": "null" - } - ] + "size_bytes": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "The decoded file size in bytes." } }, - "type": "object", "required": [ - "id", - "object", - "created_at", - "thread_id", "type", - "task_type", - "heading", - "summary" + "id", + "file_id", + "path", + "size_bytes" ], - "title": "Task item", - "description": "Task emitted by the workflow to show progress and status updates." + "additionalProperties": false, + "description": "A file copied from the OpenAI Files API." }, - "TaskGroupTask": { + "HostedEnvironmentFileResourceInline": { + "type": "object", "properties": { "type": { - "$ref": "#/components/schemas/TaskType", - "description": "Subtype for the grouped task." + "type": "string", + "enum": [ + "inline" + ], + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." }, - "heading": { - "anyOf": [ - { - "type": "string", - "description": "Optional heading for the grouped task. Defaults to null when not provided." - }, - { - "type": "null" - } - ] + "id": { + "type": "string", + "minLength": 0, + "description": "The session-scoped ID of the file in the execution environment." }, - "summary": { - "anyOf": [ - { - "type": "string", - "description": "Optional summary that describes the grouped task. Defaults to null when omitted." - }, - { - "type": "null" - } - ] + "path": { + "type": "string", + "minLength": 0, + "description": "The file's absolute path inside the environment." + }, + "size_bytes": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "The decoded file size in bytes." } }, - "type": "object", "required": [ "type", - "heading", - "summary" + "id", + "path", + "size_bytes" ], - "title": "Task group task", - "description": "Task entry that appears within a TaskGroup." + "additionalProperties": false, + "description": "A file supplied inline when the session was created." }, - "TaskGroupItem": { - "properties": { - "id": { - "type": "string", - "description": "Identifier of the thread item." + "HostedEnvironmentFileResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/HostedEnvironmentFileResourceFileId" }, - "object": { + { + "$ref": "#/components/schemas/HostedEnvironmentFileResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "file_id": "#/components/schemas/HostedEnvironmentFileResourceFileId", + "inline": "#/components/schemas/HostedEnvironmentFileResourceInline" + } + }, + "x-oai-discriminator-values": [ + "file_id", + "inline" + ], + "description": "Metadata for a file materialized in an OpenAI-hosted execution environment." + }, + "HostedSkillResourceSkillReference": { + "type": "object", + "properties": { + "type": { "type": "string", "enum": [ - "chatkit.thread_item" + "skill_reference" ], - "description": "Type discriminator that is always `chatkit.thread_item`.", - "default": "chatkit.thread_item", - "x-stainless-const": true + "default": "skill_reference", + "x-stainless-const": true, + "description": "The type of the object. Always `skill_reference`." }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) for when the item was created." + "skill_id": { + "type": "string", + "minLength": 0, + "description": "The referenced skill ID." }, - "thread_id": { + "version": { "type": "string", - "description": "Identifier of the parent thread." + "minLength": 0, + "description": "The concrete skill version installed for this session." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The installed skill name." }, + "description": { + "type": "string", + "minLength": 0, + "description": "The installed skill description." + } + }, + "required": [ + "type", + "skill_id", + "version", + "name", + "description" + ], + "additionalProperties": false, + "description": "A skill installed from the Skills API." + }, + "HostedSkillResourceInline": { + "type": "object", + "properties": { "type": { "type": "string", "enum": [ - "chatkit.task_group" + "inline" ], - "description": "Type discriminator that is always `chatkit.task_group`.", - "default": "chatkit.task_group", - "x-stainless-const": true + "default": "inline", + "x-stainless-const": true, + "description": "The type of the object. Always `inline`." }, - "tasks": { - "items": { - "$ref": "#/components/schemas/TaskGroupTask" - }, - "type": "array", - "description": "Tasks included in the group." + "name": { + "type": "string", + "minLength": 0, + "description": "The installed skill name." + }, + "description": { + "type": "string", + "minLength": 0, + "description": "The installed skill description." } }, - "type": "object", "required": [ - "id", - "object", - "created_at", - "thread_id", "type", - "tasks" + "name", + "description" ], - "title": "Task group", - "description": "Collection of workflow tasks grouped together in the thread." + "additionalProperties": false, + "description": "A skill installed from an inline ZIP archive." }, - "ThreadItem": { + "HostedSkillResource": { "oneOf": [ { - "$ref": "#/components/schemas/UserMessageItem" + "$ref": "#/components/schemas/HostedSkillResourceSkillReference" }, { - "$ref": "#/components/schemas/AssistantMessageItem" + "$ref": "#/components/schemas/HostedSkillResourceInline" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "skill_reference": "#/components/schemas/HostedSkillResourceSkillReference", + "inline": "#/components/schemas/HostedSkillResourceInline" + } + }, + "x-oai-discriminator-values": [ + "skill_reference", + "inline" + ], + "description": "A skill installed in an OpenAI-hosted environment." + }, + "PublicEnvironmentResource": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/EnvironmentTypeResource", + "description": "Whether the environment is hosted by OpenAI or by the application." }, - { - "$ref": "#/components/schemas/WidgetMessageItem" + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the environment." }, - { - "$ref": "#/components/schemas/ClientToolCallItem" + "object": { + "type": "string", + "enum": [ + "agent.environment" + ], + "default": "agent.environment", + "x-stainless-const": true, + "description": "The object type. Always `agent.environment`." }, - { - "$ref": "#/components/schemas/TaskItem" + "status": { + "$ref": "#/components/schemas/EnvironmentStatusResource", + "description": "The current environment connection status." }, - { - "$ref": "#/components/schemas/TaskGroupItem" + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Files installed in the environment, without their contents." + }, + "skills": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedSkillResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Skills installed in the environment, without their archive contents." + }, + "plugins": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedPluginResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Plugins installed in the environment, without their archive contents." } + }, + "required": [ + "id", + "object", + "type", + "status", + "files", + "skills", + "plugins" ], - "title": "The thread item", - "discriminator": { - "propertyName": "type" - } + "additionalProperties": false, + "description": "Safe metadata for a first-class execution environment." }, - "ThreadItemListResource": { + "AgentEnvironmentListResource": { + "type": "object", "properties": { "object": { "type": "string", "enum": [ "list" ], - "description": "The type of object returned, must be `list`.", "default": "list", - "x-stainless-const": true + "x-stainless-const": true, + "description": "The object type, which is always `list`." }, "data": { + "type": "array", "items": { - "$ref": "#/components/schemas/ThreadItem" + "$ref": "#/components/schemas/PublicEnvironmentResource" }, - "type": "array", - "description": "A list of items" + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." }, "first_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the first item in the list." - }, - { - "type": "null" - } - ] + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, "last_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the last item in the list." - }, - { - "type": "null" - } - ] + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, "has_more": { "type": "boolean", - "description": "Whether there are more items available." + "description": "Whether there are more resources to retrieve after this page." } }, - "type": "object", "required": [ "object", "data", @@ -76159,2319 +101964,2990 @@ "last_id", "has_more" ], - "title": "Thread Items", - "description": "A paginated list of thread items rendered for the ChatKit API." + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "ActiveStatus": { - "properties": { - "type": { - "type": "string", - "enum": [ - "active" - ], - "description": "Status discriminator that is always `active`.", - "default": "active", - "x-stainless-const": true - } - }, + "CreateEnvironmentParamOpenaiHosted": { "type": "object", - "required": [ - "type" - ], - "title": "Active thread status", - "description": "Indicates that a thread is active." - }, - "LockedStatus": { "properties": { "type": { "type": "string", "enum": [ - "locked" + "openai_hosted" ], - "description": "Status discriminator that is always `locked`.", - "default": "locked", - "x-stainless-const": true + "default": "openai_hosted", + "x-stainless-const": true, + "description": "The type of the object. Always `openai_hosted`." }, - "reason": { + "packages": { "anyOf": [ { - "type": "string", - "description": "Reason that the thread was locked. Defaults to null when no reason is recorded." + "$ref": "#/components/schemas/EnvironmentPackagesParam" }, { "type": "null" } - ] - } - }, - "type": "object", - "required": [ - "type", - "reason" - ], - "title": "Locked thread status", - "description": "Indicates that a thread is locked and cannot accept new input." - }, - "ClosedStatus": { - "properties": { - "type": { - "type": "string", - "enum": [ - "closed" ], - "description": "Status discriminator that is always `closed`.", - "default": "closed", - "x-stainless-const": true + "description": "Packages to install in the environment. Defaults to empty package lists." }, - "reason": { + "setup_commands": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/SetupCommandParam" + }, + "minItems": 0, + "maxItems": 16, + "description": "Ordered, confidential setup commands. Command bodies are never returned." + }, + "network": { "anyOf": [ { - "type": "string", - "description": "Reason that the thread was closed. Defaults to null when no reason is recorded." + "$ref": "#/components/schemas/NetworkPolicyParam" }, { "type": "null" } - ] + ], + "description": "Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled." + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopParam" + }, + { + "type": "null" + } + ], + "description": "Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled." + }, + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Environment variables made available to the agent." + }, + "capability_directories": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + }, + "skills": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedSkillParam" + }, + "minItems": 0, + "maxItems": 200, + "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." + }, + "plugins": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedPluginParam" + }, + "minItems": 0, + "maxItems": 32, + "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." + }, + "files": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileParam" + }, + "minItems": 0, + "maxItems": 50, + "description": "Files available before the agent starts. Defaults to an empty list." + }, + "environment_template_id": { + "type": "string", + "minLength": 0, + "maxLength": 64, + "description": "A reusable hosted template applied before inline configuration. Omitted fields inherit the template; network overrides cannot broaden its policy." } }, - "type": "object", "required": [ - "type", - "reason" + "type" ], - "title": "Closed thread status", - "description": "Indicates that a thread has been closed." + "additionalProperties": false, + "description": "Provision an OpenAI-hosted environment from inline configuration or a template." }, - "ThreadResource": { + "CreateEnvironmentParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateEnvironmentParamOpenaiHosted" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "openai_hosted": "#/components/schemas/CreateEnvironmentParamOpenaiHosted" + } + }, + "x-oai-discriminator-values": [ + "openai_hosted" + ], + "description": "Configuration for a new prewarmed OpenAI-hosted environment." + }, + "CreateAgentEnvironmentParams": { + "type": "object", "properties": { - "id": { - "type": "string", - "description": "Identifier of the thread." + "environment": { + "$ref": "#/components/schemas/CreateEnvironmentParam", + "description": "The required hosting type and its configuration." }, + "vault_ids": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 10, + "description": "The IDs of up to 10 vaults made available to an OpenAI-hosted environment." + } + }, + "required": [ + "environment" + ], + "additionalProperties": false, + "description": "Parameters for creating an execution environment before its sessions." + }, + "EnvironmentFilePageObjectResource": { + "type": "string", + "enum": [ + "page" + ], + "default": "page", + "x-stainless-const": true, + "description": "The object type for a page of files in an execution environment." + }, + "EnvironmentFileResource": { + "type": "object", + "properties": { "object": { "type": "string", "enum": [ - "chatkit.thread" + "agent.environment.file" ], - "description": "Type discriminator that is always `chatkit.thread`.", - "default": "chatkit.thread", - "x-stainless-const": true + "default": "agent.environment.file", + "x-stainless-const": true, + "description": "The object type. Always `agent.environment.file`." }, - "created_at": { + "environment_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the environment containing this file." + }, + "path": { + "type": "string", + "minLength": 0, + "description": "The absolute file path inside the environment's workspace." + }, + "size_bytes": { "type": "integer", - "format": "unixtime", - "description": "Unix timestamp (in seconds) for when the thread was created." + "format": "int64", + "minimum": 0, + "description": "The file size in bytes." + } + }, + "required": [ + "object", + "environment_id", + "path", + "size_bytes" + ], + "additionalProperties": false, + "description": "A live file in an execution environment." + }, + "EnvironmentFileListResource": { + "type": "object", + "properties": { + "object": { + "$ref": "#/components/schemas/EnvironmentFilePageObjectResource", + "description": "The object type. Always `page`." }, - "title": { - "anyOf": [ - { - "type": "string", - "description": "Optional human-readable title for the thread. Defaults to null when no title has been generated." - }, - { - "type": "null" - } - ] + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EnvironmentFileResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Files available on the current page." }, - "status": { - "oneOf": [ - { - "$ref": "#/components/schemas/ActiveStatus" - }, - { - "$ref": "#/components/schemas/LockedStatus" - }, - { - "$ref": "#/components/schemas/ClosedStatus" - } + "next": { + "type": [ + "string", + "null" ], - "description": "Current status for the thread. Defaults to `active` for newly created threads.", - "discriminator": { - "propertyName": "type" - } + "minLength": 0, + "description": "The opaque cursor to use when requesting the next page, if any." }, - "user": { - "type": "string", - "description": "Free-form string that identifies your end user who owns the thread." + "has_more": { + "type": "boolean", + "description": "Whether more files follow this page." } }, - "type": "object", "required": [ - "id", "object", - "created_at", - "title", - "status", - "user" + "data", + "next", + "has_more" ], - "title": "The thread object", - "description": "Represents a ChatKit thread and its current status.", - "example": { - "id": "cthr_def456", - "object": "chatkit.thread", - "created_at": 1712345600, - "title": "Demo feedback", - "status": { - "type": "active" - }, - "user": "user_456" - } + "additionalProperties": false, + "description": "A paginated list of live execution environment files." }, - "DeletedThreadResource": { + "SubagentObjectResource": { + "type": "string", + "enum": [ + "agent.session.subagent" + ], + "default": "agent.session.subagent", + "x-stainless-const": true, + "description": "The object type for a subagent." + }, + "OutputTextResource": { + "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "Identifier of the deleted thread." + "enum": [ + "output_text" + ], + "default": "output_text", + "x-stainless-const": true, + "description": "The content type. Always `output_text`." }, - "object": { + "text": { + "type": "string", + "minLength": 0, + "description": "The text produced by the agent." + } + }, + "required": [ + "type", + "text" + ], + "additionalProperties": false, + "description": "A text content part produced by the agent." + }, + "EncryptedContentResource": { + "type": "object", + "properties": { + "type": { "type": "string", "enum": [ - "chatkit.thread.deleted" + "encrypted_content" ], - "description": "Type discriminator that is always `chatkit.thread.deleted`.", - "default": "chatkit.thread.deleted", - "x-stainless-const": true + "default": "encrypted_content", + "x-stainless-const": true, + "description": "The content type. Always `encrypted_content`." }, - "deleted": { - "type": "boolean", - "description": "Indicates that the thread has been deleted." + "encrypted_content": { + "type": "string", + "minLength": 0, + "description": "The encrypted content payload." } }, - "type": "object", "required": [ - "id", - "object", - "deleted" + "type", + "encrypted_content" ], - "title": "Deleted thread", - "description": "Confirmation payload returned after deleting a thread." + "additionalProperties": false, + "description": "Encrypted content exchanged between agents." }, - "ThreadListResource": { + "AgentContentResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/OutputTextResource" + }, + { + "$ref": "#/components/schemas/EncryptedContentResource" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "output_text": "#/components/schemas/OutputTextResource", + "encrypted_content": "#/components/schemas/EncryptedContentResource" + } + }, + "x-oai-discriminator-values": [ + "output_text", + "encrypted_content" + ], + "description": "A plaintext or encrypted content part exchanged between agents." + }, + "SubagentStatusResource": { + "type": "string", + "enum": [ + "active", + "closed" + ], + "x-enumDescriptions": [ + "The subagent remains available, including while idle between turns.", + "The subagent is closed." + ], + "description": "The current status of a subagent." + }, + "SubagentResource": { + "type": "object", "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the subagent." + }, "object": { + "$ref": "#/components/schemas/SubagentObjectResource", + "description": "The object type. Always `agent.session.subagent`." + }, + "session_id": { "type": "string", - "enum": [ - "list" + "minLength": 0, + "description": "The ID of the session that owns the subagent." + }, + "name": { + "type": [ + "string", + "null" ], - "description": "The type of object returned, must be `list`.", - "default": "list", - "x-stainless-const": true + "minLength": 0, + "description": "The runner-assigned nickname, or null when unavailable." }, - "data": { + "instructions": { + "type": [ + "array", + "null" + ], "items": { - "$ref": "#/components/schemas/ThreadResource" + "$ref": "#/components/schemas/AgentContentResource" }, - "type": "array", - "description": "A list of items" + "minItems": 0, + "maxItems": 2000, + "description": "Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available." }, - "first_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the first item in the list." - }, - { - "type": "null" - } - ] + "parent_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent that created this subagent." }, - "last_id": { - "anyOf": [ - { - "type": "string", - "description": "The ID of the last item in the list." - }, - { - "type": "null" - } - ] + "status": { + "$ref": "#/components/schemas/SubagentStatusResource", + "description": "The current status of the subagent." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more items available." + "opened_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it." + }, + "closed_at": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "description": "The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume." } }, - "type": "object", "required": [ + "id", "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "title": "Threads", - "description": "A paginated list of ChatKit threads." - }, - "EnvironmentTypeResource": { - "type": "string", - "enum": [ - "openai_hosted", - "self_hosted" + "session_id", + "name", + "instructions", + "parent_agent_id", + "status", + "opened_at", + "closed_at" ], - "description": "The kind of execution environment." + "additionalProperties": false, + "description": "A subagent created within a session." }, - "EnvironmentStatusResource": { + "SessionMessageRoleResource": { "type": "string", "enum": [ - "pending", - "connected", - "disconnected", - "expired", - "failed" + "user", + "assistant" ], - "description": "The public lifecycle status of an execution environment." + "description": "The author of a session message." }, - "HostedEnvironmentFileResourceFileId": { + "MessageContentResourceInputText": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "file_id" + "input_text" ], - "default": "file_id", + "default": "input_text", "x-stainless-const": true, - "description": "The type of the object. Always `file_id`." + "description": "The type of the object. Always `input_text`." }, - "id": { + "text": { "type": "string", "minLength": 0, - "description": "The session-scoped ID of the file in the execution environment." - }, - "file_id": { + "description": "The text supplied by the user." + } + }, + "required": [ + "type", + "text" + ], + "additionalProperties": false, + "description": "Text supplied by the user." + }, + "MessageContentResourceInputImage": { + "type": "object", + "properties": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the uploaded file." + "enum": [ + "input_image" + ], + "default": "input_image", + "x-stainless-const": true, + "description": "The type of the object. Always `input_image`." }, - "path": { + "image_url": { "type": "string", "minLength": 0, - "description": "The file's absolute path inside the environment." - }, - "size_bytes": { - "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The decoded file size in bytes." + "description": "The URL of the image supplied by the user, which may be a base64-encoded data URL." } }, "required": [ "type", - "id", - "file_id", - "path", - "size_bytes" + "image_url" ], "additionalProperties": false, - "description": "A file copied from the OpenAI Files API." + "description": "An image supplied by the user." }, - "HostedEnvironmentFileResourceInline": { + "MessageContentResourceOutputText": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "output_text" ], - "default": "inline", + "default": "output_text", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The session-scoped ID of the file in the execution environment." + "description": "The type of the object. Always `output_text`." }, - "path": { + "text": { "type": "string", "minLength": 0, - "description": "The file's absolute path inside the environment." - }, - "size_bytes": { - "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The decoded file size in bytes." + "description": "The text produced by the assistant." } }, "required": [ "type", - "id", - "path", - "size_bytes" + "text" ], "additionalProperties": false, - "description": "A file supplied inline when the session was created." + "description": "Text produced by the assistant." }, - "HostedEnvironmentFileResource": { + "MessageContentResource": { "oneOf": [ { - "$ref": "#/components/schemas/HostedEnvironmentFileResourceFileId" + "$ref": "#/components/schemas/MessageContentResourceInputText" }, { - "$ref": "#/components/schemas/HostedEnvironmentFileResourceInline" + "$ref": "#/components/schemas/MessageContentResourceInputImage" + }, + { + "$ref": "#/components/schemas/MessageContentResourceOutputText" } ], "discriminator": { "propertyName": "type", "mapping": { - "file_id": "#/components/schemas/HostedEnvironmentFileResourceFileId", - "inline": "#/components/schemas/HostedEnvironmentFileResourceInline" + "input_text": "#/components/schemas/MessageContentResourceInputText", + "input_image": "#/components/schemas/MessageContentResourceInputImage", + "output_text": "#/components/schemas/MessageContentResourceOutputText" } }, "x-oai-discriminator-values": [ - "file_id", - "inline" + "input_text", + "input_image", + "output_text" ], - "description": "Metadata for a file materialized in an OpenAI-hosted execution environment." + "description": "A content part in a session message." }, - "HostedSkillResourceSkillReference": { + "OutputItemStatusResource": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ], + "x-enumDescriptions": [ + "The item is in progress.", + "The item is complete.", + "The item stopped before completing." + ], + "description": "The status of an agent output item." + }, + "MessagePhaseResource": { + "type": "string", + "enum": [ + "commentary", + "final_answer" + ], + "x-enumDescriptions": [ + "Commentary produced while the agent works.", + "The agent's final answer." + ], + "description": "The phase of an assistant message." + }, + "MessageItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "skill_reference" + "message" ], - "default": "skill_reference", + "default": "message", "x-stainless-const": true, - "description": "The type of the object. Always `skill_reference`." + "description": "The item type. Always `message`." }, - "skill_id": { - "type": "string", + "id": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The referenced skill ID." + "description": "The ID of this item, or null for legacy user messages whose ID was not recorded." }, - "version": { + "turn_id": { "type": "string", "minLength": 0, - "description": "The concrete skill version installed for this session." + "description": "The ID of the turn that contains this item." }, - "name": { + "role": { + "$ref": "#/components/schemas/SessionMessageRoleResource", + "description": "The role of the message author." + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MessageContentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The content of the message. User messages contain input text or images; assistant messages contain output text." + }, + "status": { + "$ref": "#/components/schemas/OutputItemStatusResource", + "description": "The status of the message. User messages are always `completed`." + }, + "phase": { + "anyOf": [ + { + "$ref": "#/components/schemas/MessagePhaseResource" + }, + { + "type": "null" + } + ], + "description": "The phase of an assistant message. Null for user messages." + } + }, + "required": [ + "type", + "id", + "turn_id", + "role", + "content", + "status", + "phase" + ], + "additionalProperties": false, + "description": "A user or assistant message recorded in a session." + }, + "SummaryTextResource": { + "type": "object", + "properties": { + "type": { "type": "string", - "minLength": 0, - "description": "The installed skill name." + "enum": [ + "summary_text" + ], + "default": "summary_text", + "x-stainless-const": true, + "description": "The content type. Always `summary_text`." }, - "description": { + "text": { "type": "string", "minLength": 0, - "description": "The installed skill description." + "description": "The reasoning summary text." } }, "required": [ "type", - "skill_id", - "version", - "name", - "description" + "text" ], "additionalProperties": false, - "description": "A skill installed from the Skills API." + "description": "A reasoning summary content part." }, - "HostedSkillResourceInline": { + "ReasoningItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "reasoning" ], - "default": "inline", + "default": "reasoning", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "description": "The item type. Always `reasoning`." }, - "name": { + "id": { "type": "string", "minLength": 0, - "description": "The installed skill name." + "description": "The ID of the reasoning item." }, - "description": { + "turn_id": { "type": "string", "minLength": 0, - "description": "The installed skill description." + "description": "The ID of the turn that contains this item." + }, + "summary": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SummaryTextResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The reasoning summaries produced by the agent." + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/OutputItemStatusResource" + }, + { + "type": "null" + } + ], + "description": "The status of the reasoning item." } }, "required": [ "type", - "name", - "description" + "id", + "turn_id", + "summary", + "status" ], "additionalProperties": false, - "description": "A skill installed from an inline ZIP archive." + "description": "A reasoning item produced by the agent." }, - "HostedSkillResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/HostedSkillResourceSkillReference" - }, - { - "$ref": "#/components/schemas/HostedSkillResourceInline" - } + "FunctionCallStatusResource": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "failed", + "incomplete" ], - "discriminator": { - "propertyName": "type", - "mapping": { - "skill_reference": "#/components/schemas/HostedSkillResourceSkillReference", - "inline": "#/components/schemas/HostedSkillResourceInline" - } - }, - "x-oai-discriminator-values": [ - "skill_reference", - "inline" + "x-enumDescriptions": [ + "The call is in progress.", + "The call completed successfully.", + "The call failed.", + "The call stopped before completing." ], - "description": "A skill installed in an OpenAI-hosted environment." + "description": "The status of a tool call." }, - "HostedPluginResourceInline": { + "FunctionCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "function_call" ], - "default": "inline", + "default": "function_call", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "description": "The item type. Always `function_call`." }, - "name": { + "id": { "type": "string", "minLength": 0, - "description": "The installed plugin name." + "description": "The ID of the function call item." }, - "description": { + "turn_id": { "type": "string", "minLength": 0, - "description": "The installed plugin description." + "description": "The ID of the turn that contains this item." + }, + "call_id": { + "type": "string", + "minLength": 0, + "description": "The ID used to submit the function result." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The name of the function to call." + }, + "arguments": { + "description": "The arguments to pass to the function." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the function call." } }, "required": [ "type", + "id", + "turn_id", + "call_id", "name", - "description" + "arguments", + "status" ], "additionalProperties": false, - "description": "A plugin installed from an inline ZIP archive." + "description": "A function call produced by the agent." }, - "HostedPluginResource": { + "FunctionCallOutputResource": { "oneOf": [ { - "$ref": "#/components/schemas/HostedPluginResourceInline" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "inline": "#/components/schemas/HostedPluginResourceInline" + "type": "string", + "minLength": 0 + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputContentResource" + }, + "minItems": 0, + "maxItems": 2000 } - }, - "x-oai-discriminator-values": [ - "inline" ], - "description": "A plugin installed in an OpenAI-hosted environment." + "description": "The text or model-input content supplied as a function result." }, - "PublicEnvironmentResource": { + "FunctionCallOutputItemResource": { "type": "object", "properties": { "id": { "type": "string", "minLength": 0, - "description": "The ID of the environment." + "description": "The ID of the function call output item." }, - "object": { + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "type": { "type": "string", "enum": [ - "agent.environment" + "function_call_output" ], - "default": "agent.environment", + "default": "function_call_output", "x-stainless-const": true, - "description": "The object type. Always `agent.environment`." + "description": "The item type. Always `function_call_output`." }, - "type": { - "$ref": "#/components/schemas/EnvironmentTypeResource", - "description": "Whether the environment is hosted by OpenAI or by the application." + "call_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the function call that produced this output." }, "status": { - "$ref": "#/components/schemas/EnvironmentStatusResource", - "description": "The current environment connection status." + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the function call." + }, + "output": { + "anyOf": [ + { + "$ref": "#/components/schemas/FunctionCallOutputResource" + }, + { + "type": "null" + } + ], + "description": "The function result, if the call succeeded." + }, + "error": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The error message, if the call failed." + } + }, + "required": [ + "id", + "turn_id", + "type", + "call_id", + "status", + "output", + "error" + ], + "additionalProperties": false, + "description": "The result supplied for a function call." + }, + "AgentMessageItemResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the message." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "type": { + "type": "string", + "enum": [ + "agent_message" + ], + "default": "agent_message", + "x-stainless-const": true, + "description": "The item type. Always `agent_message`." }, - "files": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Files installed in the environment, without their contents." + "sender_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID or name of the sending agent." }, - "skills": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedSkillResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Skills installed in the environment, without their archive contents." + "recipient_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID or name of the receiving agent." }, - "plugins": { + "content": { "type": "array", "items": { - "$ref": "#/components/schemas/HostedPluginResource" + "$ref": "#/components/schemas/AgentContentResource" }, "minItems": 0, "maxItems": 2000, - "description": "Plugins installed in the environment, without their archive contents." + "description": "The content exchanged between the agents." } }, "required": [ "id", - "object", + "turn_id", "type", - "status", - "files", - "skills", - "plugins" + "sender_agent_id", + "recipient_agent_id", + "content" ], "additionalProperties": false, - "description": "Safe metadata for a first-class execution environment." + "description": "A message exchanged between agent threads." }, - "ErrorBodyResource": { + "McpCallItemResource": { "type": "object", "properties": { "type": { + "type": "string", + "enum": [ + "mcp_call" + ], + "default": "mcp_call", + "x-stainless-const": true, + "description": "The item type. Always `mcp_call`." + }, + "id": { "type": "string", "minLength": 0, - "description": "The error type." + "description": "The ID of the MCP call item." }, - "code": { + "turn_id": { "type": "string", "minLength": 0, - "description": "A machine-readable error code." + "description": "The ID of the turn that contains this item." }, - "message": { + "server_label": { "type": "string", "minLength": 0, - "description": "A human-readable error message." + "description": "The label of the MCP server." }, - "param": { - "type": [ - "string", - "null" - ], + "name": { + "type": "string", "minLength": 0, - "description": "The request parameter that caused the error, or null for a request-wide error." + "description": "The name of the MCP tool." + }, + "arguments": { + "description": "The arguments passed to the MCP tool." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the MCP tool call." + }, + "output": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "description": "The output returned by the MCP tool, if any." + }, + "error": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "description": "The error returned by the MCP tool, if any." } }, "required": [ "type", - "code", - "message", - "param" + "id", + "turn_id", + "server_label", + "name", + "arguments", + "status", + "output", + "error" ], "additionalProperties": false, - "description": "Details about an API error." + "description": "A call to a tool on an MCP server." }, - "ErrorResponse-2": { + "ComputerScreenshotResource": { "type": "object", "properties": { - "error": { - "$ref": "#/components/schemas/ErrorBodyResource", - "description": "The error returned by the API." + "type": { + "type": "string", + "enum": [ + "computer_screenshot" + ], + "default": "computer_screenshot", + "x-stainless-const": true, + "description": "The content type. Always `computer_screenshot`." + }, + "image_url": { + "type": "string", + "minLength": 0, + "description": "The complete JPEG image as a base64 data URL." } }, "required": [ - "error" + "type", + "image_url" ], "additionalProperties": false, - "description": "An API error response." - }, - "ListOrderParam": { - "type": "string", - "enum": [ - "asc", - "desc" - ], - "x-enumDescriptions": [ - "Returns resources in ascending order.", - "Returns resources in descending order." - ], - "description": "The order in which paginated resources are returned." + "description": "A browser screenshot emitted by the model during computer use." }, - "EnvironmentFilePageObjectResource": { - "type": "string", - "enum": [ - "page" - ], - "default": "page", - "x-stainless-const": true, - "description": "The object type for a page of files in an execution environment." - }, - "EnvironmentFileResource": { + "ComputerUseCallItemResource": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "agent.environment.file" + "computer_use_call" ], - "default": "agent.environment.file", + "default": "computer_use_call", "x-stainless-const": true, - "description": "The object type. Always `agent.environment.file`." + "description": "The item type. Always `computer_use_call`." }, - "environment_id": { + "id": { "type": "string", "minLength": 0, - "description": "The ID of the environment containing this file." + "description": "The ID of the activity item." }, - "path": { + "turn_id": { "type": "string", "minLength": 0, - "description": "The absolute file path inside the environment's workspace." + "description": "The ID of the turn that contains this item." }, - "size_bytes": { - "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The file size in bytes." + "title": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "A model-generated description of the activity, when available." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The execution status of the activity." + }, + "output": { + "anyOf": [ + { + "$ref": "#/components/schemas/ComputerScreenshotResource" + }, + { + "type": "null" + } + ], + "description": "The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot." } }, "required": [ - "object", - "environment_id", - "path", - "size_bytes" + "type", + "id", + "turn_id", + "title", + "status", + "output" ], "additionalProperties": false, - "description": "A live file in an execution environment." + "description": "One execution of the platform-provided computer-use capability." }, - "EnvironmentFileListResource": { + "BrowserAuthenticationFieldResource": { "type": "object", "properties": { - "object": { - "$ref": "#/components/schemas/EnvironmentFilePageObjectResource", - "description": "The object type. Always `page`." + "id": { + "type": "string", + "minLength": 0, + "description": "The field ID to submit as field_id in a fields entry." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EnvironmentFileResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Files available on the current page." + "label": { + "type": "string", + "minLength": 0, + "description": "The label to display beside the control." }, - "next": { - "type": [ - "string", - "null" - ], + "type": { + "type": "string", "minLength": 0, - "description": "The opaque cursor to use when requesting the next page, if any." + "description": "The rendering type, such as email, password, or text." }, - "has_more": { + "required": { "type": "boolean", - "description": "Whether more files follow this page." + "description": "Whether this control requires a nonempty value." } }, "required": [ - "object", - "data", - "next", - "has_more" + "id", + "label", + "type", + "required" ], "additionalProperties": false, - "description": "A paginated list of live execution environment files." + "description": "A control in a registered browser-login form." }, - "HostedEnvironmentFileParamFileId": { + "BrowserAuthenticationOptionResource": { "type": "object", "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "file_id" - ], - "default": "file_id", - "x-stainless-const": true, - "description": "The type of the object. Always `file_id`." + "minLength": 0, + "description": "The option ID to submit as selected_option." }, - "file_id": { + "label": { "type": "string", - "minLength": 1, - "maxLength": 256, - "description": "The ID of the uploaded file." + "minLength": 0, + "description": "The method label to display." }, - "path": { - "type": "string", - "minLength": 1, - "maxLength": 4096, - "description": "The absolute destination path inside `/workspace`." + "field_ids": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "IDs from the registered fields that this method accepts." } }, "required": [ - "type", - "file_id", - "path" + "id", + "label", + "field_ids" ], "additionalProperties": false, - "description": "A file previously uploaded through the OpenAI Files API." + "description": "A sign-in method and the fields that belong to it." }, - "HostedEnvironmentFileParamInline": { + "BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "browser_authentication" ], - "default": "inline", + "default": "browser_authentication", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "description": "The type of the object. Always `browser_authentication`." }, - "data": { - "type": "string", + "reason": { + "type": [ + "string", + "null" + ], "minLength": 0, - "maxLength": 6990508, - "description": "The standard-base64-encoded file contents." + "description": "Why the agent needs the user to sign in." }, - "path": { - "type": "string", - "minLength": 1, - "maxLength": 4096, - "description": "The absolute destination path inside `/workspace`." + "credential_origin": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The registered form or frame origin where values will be entered." + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BrowserAuthenticationFieldResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Controls to render. All submitted values are sensitive." + }, + "options": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BrowserAuthenticationOptionResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Sign-in methods. Empty for a plain form." } }, "required": [ "type", - "data", - "path" + "reason", + "credential_origin", + "fields", + "options" ], "additionalProperties": false, - "description": "A file supplied directly as standard-base64 data." + "description": "A registered form awaiting the application's response." }, - "HostedEnvironmentFileParam": { + "BrowserAuthenticationHistoryRequestKindResource": { "oneOf": [ { - "$ref": "#/components/schemas/HostedEnvironmentFileParamFileId" - }, - { - "$ref": "#/components/schemas/HostedEnvironmentFileParamInline" + "$ref": "#/components/schemas/BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication" } ], "discriminator": { "propertyName": "type", "mapping": { - "file_id": "#/components/schemas/HostedEnvironmentFileParamFileId", - "inline": "#/components/schemas/HostedEnvironmentFileParamInline" + "browser_authentication": "#/components/schemas/BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication" } }, "x-oai-discriminator-values": [ - "file_id", - "inline" - ], - "description": "A file materialized in an OpenAI-hosted execution environment." + "browser_authentication" + ] }, - "SubagentObjectResource": { - "type": "string", - "enum": [ - "agent.session.subagent" + "BrowserAuthenticationRequestItemResource": { + "type": "object", + "properties": { + "turn_id": { + "type": "string", + "minLength": 0 + }, + "request_id": { + "type": "string", + "minLength": 0 + }, + "request": { + "$ref": "#/components/schemas/BrowserAuthenticationHistoryRequestKindResource" + }, + "id": { + "type": "string", + "minLength": 0, + "description": "The stable history item ID." + }, + "type": { + "type": "string", + "enum": [ + "computer_use_approval_request" + ], + "default": "computer_use_approval_request", + "x-stainless-const": true, + "description": "The item type. Always computer_use_approval_request." + } + }, + "required": [ + "turn_id", + "request_id", + "request", + "id", + "type" ], - "default": "agent.session.subagent", - "x-stainless-const": true, - "description": "The object type for a subagent." + "additionalProperties": false, + "description": "A credential-free history record of the emitted login request." }, - "OutputTextResource": { + "ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "output_text" + "browser_authentication" ], - "default": "output_text", - "x-stainless-const": true, - "description": "The content type. Always `output_text`." + "default": "browser_authentication", + "x-stainless-const": true }, - "text": { + "action": { "type": "string", + "enum": [ + "submit" + ], + "default": "submit", + "x-stainless-const": true + }, + "selected_option": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The text produced by the agent." + "description": "The chosen sign-in method, or null when no options were offered." } }, "required": [ "type", - "text" + "action", + "selected_option" ], - "additionalProperties": false, - "description": "A text content part produced by the agent." + "additionalProperties": false }, - "EncryptedContentResource": { + "ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "encrypted_content" + "browser_authentication" ], - "default": "encrypted_content", - "x-stainless-const": true, - "description": "The content type. Always `encrypted_content`." + "default": "browser_authentication", + "x-stainless-const": true }, - "encrypted_content": { + "action": { "type": "string", - "minLength": 0, - "description": "The encrypted content payload." + "enum": [ + "cancel" + ], + "default": "cancel", + "x-stainless-const": true } }, "required": [ "type", - "encrypted_content" + "action" ], - "additionalProperties": false, - "description": "Encrypted content exchanged between agents." + "additionalProperties": false }, - "AgentContentResource": { + "ComputerUseApprovalResponseKindResource": { "oneOf": [ { - "$ref": "#/components/schemas/OutputTextResource" + "$ref": "#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource" }, { - "$ref": "#/components/schemas/EncryptedContentResource" + "$ref": "#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource" } ], "discriminator": { - "propertyName": "type", + "propertyName": "action", "mapping": { - "output_text": "#/components/schemas/OutputTextResource", - "encrypted_content": "#/components/schemas/EncryptedContentResource" + "submit": "#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource", + "cancel": "#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource" } }, "x-oai-discriminator-values": [ - "output_text", - "encrypted_content" - ], - "description": "A plaintext or encrypted content part exchanged between agents." - }, - "SubagentStatusResource": { - "type": "string", - "enum": [ - "active", - "closed" - ], - "x-enumDescriptions": [ - "The subagent remains available, including while idle between turns.", - "The subagent is closed." - ], - "description": "The current status of a subagent." + "submit", + "cancel" + ] }, - "SubagentResource": { + "ComputerUseApprovalRequestResultItemResource": { "type": "object", "properties": { "id": { "type": "string", "minLength": 0, - "description": "The ID of the subagent." + "description": "The stable history item ID." }, - "object": { - "$ref": "#/components/schemas/SubagentObjectResource", - "description": "The object type. Always `agent.session.subagent`." + "type": { + "type": "string", + "enum": [ + "computer_use_approval_request_result" + ], + "default": "computer_use_approval_request_result", + "x-stainless-const": true }, - "session_id": { + "turn_id": { "type": "string", "minLength": 0, - "description": "The ID of the session that owns the subagent." + "description": "The ID of the turn that contains this item." }, - "name": { + "request_id": { + "type": "string", + "minLength": 0, + "description": "The registered request answered by this item." + }, + "response": { + "$ref": "#/components/schemas/ComputerUseApprovalResponseKindResource", + "description": "The admitted response, without submitted credential values." + } + }, + "required": [ + "id", + "type", + "turn_id", + "request_id", + "response" + ], + "additionalProperties": false, + "description": "A credential-free record of an admitted response, not proof of completion." + }, + "WebSearchActionResourceSearch": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "search" + ], + "default": "search", + "x-stainless-const": true, + "description": "The type of the object. Always `search`." + }, + "query": { "type": [ "string", "null" ], "minLength": 0, - "description": "The runner-assigned nickname, or null when unavailable." + "description": "The search query, when a single query was used." }, - "instructions": { + "queries": { "type": [ "array", "null" ], "items": { - "$ref": "#/components/schemas/AgentContentResource" + "type": "string", + "minLength": 0 }, "minItems": 0, "maxItems": 2000, - "description": "Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available." - }, - "parent_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent that created this subagent." - }, - "status": { - "$ref": "#/components/schemas/SubagentStatusResource", - "description": "The current status of the subagent." - }, - "opened_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it." - }, - "closed_at": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "description": "The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume." + "description": "The search queries, when multiple queries were used." } }, "required": [ - "id", - "object", - "session_id", - "name", - "instructions", - "parent_agent_id", - "status", - "opened_at", - "closed_at" - ], - "additionalProperties": false, - "description": "A subagent created within a session." - }, - "SessionMessageRoleResource": { - "type": "string", - "enum": [ - "user", - "assistant" + "type", + "query", + "queries" ], - "description": "The author of a session message." + "additionalProperties": false, + "description": "A search query or group of search queries." }, - "MessageContentResourceInputText": { + "WebSearchActionResourceOpenPage": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_text" + "open_page" ], - "default": "input_text", + "default": "open_page", "x-stainless-const": true, - "description": "The type of the object. Always `input_text`." + "description": "The type of the object. Always `open_page`." }, - "text": { - "type": "string", + "url": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The text supplied by the user." + "description": "The URL of the page that was opened." } }, "required": [ "type", - "text" + "url" ], "additionalProperties": false, - "description": "Text supplied by the user." + "description": "Opens a web page." }, - "MessageContentResourceInputImage": { + "WebSearchActionResourceFindInPage": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_image" + "find_in_page" ], - "default": "input_image", + "default": "find_in_page", "x-stainless-const": true, - "description": "The type of the object. Always `input_image`." + "description": "The type of the object. Always `find_in_page`." }, - "image_url": { - "type": "string", + "url": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The URL of the image supplied by the user, which may be a base64-encoded data URL." + "description": "The URL of the page that was searched." + }, + "pattern": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The text pattern that was searched for." } }, "required": [ "type", - "image_url" + "url", + "pattern" ], "additionalProperties": false, - "description": "An image supplied by the user." + "description": "Finds text within a web page." }, - "MessageContentResourceOutputText": { + "WebSearchActionResourceOther": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "output_text" + "other" ], - "default": "output_text", + "default": "other", "x-stainless-const": true, - "description": "The type of the object. Always `output_text`." - }, - "text": { - "type": "string", - "minLength": 0, - "description": "The text produced by the assistant." + "description": "The type of the object. Always `other`." } }, "required": [ - "type", - "text" + "type" ], "additionalProperties": false, - "description": "Text produced by the assistant." + "description": "Another web search action." }, - "MessageContentResource": { + "WebSearchActionResource": { "oneOf": [ { - "$ref": "#/components/schemas/MessageContentResourceInputText" + "$ref": "#/components/schemas/WebSearchActionResourceSearch" }, { - "$ref": "#/components/schemas/MessageContentResourceInputImage" + "$ref": "#/components/schemas/WebSearchActionResourceOpenPage" }, { - "$ref": "#/components/schemas/MessageContentResourceOutputText" + "$ref": "#/components/schemas/WebSearchActionResourceFindInPage" + }, + { + "$ref": "#/components/schemas/WebSearchActionResourceOther" } ], "discriminator": { "propertyName": "type", "mapping": { - "input_text": "#/components/schemas/MessageContentResourceInputText", - "input_image": "#/components/schemas/MessageContentResourceInputImage", - "output_text": "#/components/schemas/MessageContentResourceOutputText" + "search": "#/components/schemas/WebSearchActionResourceSearch", + "open_page": "#/components/schemas/WebSearchActionResourceOpenPage", + "find_in_page": "#/components/schemas/WebSearchActionResourceFindInPage", + "other": "#/components/schemas/WebSearchActionResourceOther" } }, "x-oai-discriminator-values": [ - "input_text", - "input_image", - "output_text" - ], - "description": "A content part in a session message." - }, - "OutputItemStatusResource": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete" - ], - "x-enumDescriptions": [ - "The item is in progress.", - "The item is complete.", - "The item stopped before completing." - ], - "description": "The status of an agent output item." - }, - "MessagePhaseResource": { - "type": "string", - "enum": [ - "commentary", - "final_answer" - ], - "x-enumDescriptions": [ - "Commentary produced while the agent works.", - "The agent's final answer." + "search", + "open_page", + "find_in_page", + "other" ], - "description": "The phase of an assistant message." + "description": "An action performed by the web search tool." }, - "MessageItemResource": { + "WebSearchCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "message" + "web_search_call" ], - "default": "message", + "default": "web_search_call", "x-stainless-const": true, - "description": "The item type. Always `message`." + "description": "The item type. Always `web_search_call`." }, "id": { - "type": [ - "string", - "null" - ], + "type": "string", "minLength": 0, - "description": "The ID of this item, or null for legacy user messages whose ID was not recorded." + "description": "The ID of the web search call." }, "turn_id": { "type": "string", "minLength": 0, "description": "The ID of the turn that contains this item." }, - "role": { - "$ref": "#/components/schemas/SessionMessageRoleResource", - "description": "The role of the message author." - }, - "content": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MessageContentResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The content of the message. User messages contain input text or images; assistant messages contain output text." - }, "status": { "$ref": "#/components/schemas/OutputItemStatusResource", - "description": "The status of the message. User messages are always `completed`." + "description": "The status of the web search call." }, - "phase": { + "action": { "anyOf": [ { - "$ref": "#/components/schemas/MessagePhaseResource" + "$ref": "#/components/schemas/WebSearchActionResource" }, { "type": "null" } ], - "description": "The phase of an assistant message. Null for user messages." + "description": "The action performed by the web search tool." } }, "required": [ "type", "id", "turn_id", - "role", - "content", "status", - "phase" + "action" ], "additionalProperties": false, - "description": "A user or assistant message recorded in a session." + "description": "A web search call produced by the agent." }, - "SummaryTextResource": { + "CommandExecutionItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "summary_text" + "command_execution" ], - "default": "summary_text", + "default": "command_execution", "x-stainless-const": true, - "description": "The content type. Always `summary_text`." + "description": "The item type. Always `command_execution`." }, - "text": { + "id": { "type": "string", "minLength": 0, - "description": "The reasoning summary text." + "description": "The ID of the command execution item." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." + }, + "command": { + "type": "string", + "minLength": 0, + "description": "The command that was executed." + }, + "cwd": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The working directory used to execute the command." + }, + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the command execution." + }, + "output": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The command output, if available." + }, + "exit_code": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "description": "The process exit code, if the command completed." + }, + "duration_ms": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "description": "The command duration in milliseconds." } }, "required": [ "type", - "text" + "id", + "turn_id", + "command", + "cwd", + "status", + "output", + "exit_code", + "duration_ms" ], "additionalProperties": false, - "description": "A reasoning summary content part." + "description": "A command execution produced by the agent." }, - "ReasoningItemResource": { + "InterruptSubagentCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "reasoning" + "interrupt_subagent_call" ], - "default": "reasoning", + "default": "interrupt_subagent_call", "x-stainless-const": true, - "description": "The item type. Always `reasoning`." + "description": "The item type. Always `interrupt_subagent_call`." }, "id": { "type": "string", "minLength": 0, - "description": "The ID of the reasoning item." + "description": "The ID of the tool call item." }, "turn_id": { "type": "string", "minLength": 0, "description": "The ID of the turn that contains this item." }, - "summary": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SummaryTextResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The reasoning summaries produced by the agent." - }, "status": { - "anyOf": [ - { - "$ref": "#/components/schemas/OutputItemStatusResource" - }, - { - "type": "null" - } - ], - "description": "The status of the reasoning item." + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." + }, + "sender_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent requesting the interrupt." + }, + "recipient_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent to interrupt." } }, "required": [ "type", "id", "turn_id", - "summary", - "status" + "status", + "sender_agent_id", + "recipient_agent_id" ], "additionalProperties": false, - "description": "A reasoning item produced by the agent." - }, - "FunctionCallStatusResource": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "failed", - "incomplete" - ], - "x-enumDescriptions": [ - "The call is in progress.", - "The call completed successfully.", - "The call failed.", - "The call stopped before completing." - ], - "description": "The status of a tool call." + "description": "A request to interrupt a subagent's current turn. The subagent remains available." }, - "FunctionCallItemResource": { + "CreateSubagentCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "function_call" + "create_subagent_call" ], - "default": "function_call", + "default": "create_subagent_call", "x-stainless-const": true, - "description": "The item type. Always `function_call`." + "description": "The item type. Always `create_subagent_call`." }, "id": { "type": "string", "minLength": 0, - "description": "The ID of the function call item." + "description": "The ID of the tool call item." }, "turn_id": { "type": "string", "minLength": 0, "description": "The ID of the turn that contains this item." }, - "call_id": { - "type": "string", - "minLength": 0, - "description": "The ID used to submit the function result." + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." }, - "name": { + "agent_id": { "type": "string", "minLength": 0, - "description": "The name of the function to call." + "description": "The ID of the agent that requested the subagent." }, - "arguments": { - "description": "The arguments to pass to the function." + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AgentContentResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The task given to the spawned agent." }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the function call." + "model": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The model requested for the spawned agent." + }, + "reasoning_effort": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The reasoning effort requested for the spawned agent." } }, "required": [ "type", "id", "turn_id", - "call_id", - "name", - "arguments", - "status" + "status", + "agent_id", + "content", + "model", + "reasoning_effort" ], "additionalProperties": false, - "description": "A function call produced by the agent." + "description": "A request to spawn a subagent." }, - "InputContentResourceInputText": { + "SendSubagentInputCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_text" + "send_subagent_input_call" ], - "default": "input_text", + "default": "send_subagent_input_call", "x-stainless-const": true, - "description": "The type of the object. Always `input_text`." + "description": "The item type. Always `send_subagent_input_call`." }, - "text": { + "id": { "type": "string", "minLength": 0, - "description": "The text supplied to the agent." - } - }, - "required": [ - "type", - "text" - ], - "additionalProperties": false, - "description": "Text input recorded in a session item." - }, - "InputContentResourceInputImage": { - "type": "object", - "properties": { - "type": { + "description": "The ID of the tool call item." + }, + "turn_id": { "type": "string", - "enum": [ - "input_image" - ], - "default": "input_image", - "x-stainless-const": true, - "description": "The type of the object. Always `input_image`." + "minLength": 0, + "description": "The ID of the turn that contains this item." }, - "image_url": { + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." + }, + "sender_agent_id": { "type": "string", "minLength": 0, - "description": "The URL of the image supplied to the agent, which may be a base64-encoded data URL." - } - }, - "required": [ - "type", - "image_url" - ], - "additionalProperties": false, - "description": "Image input recorded in a session item." - }, - "InputContentResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/InputContentResourceInputText" + "description": "The ID of the agent sending the input." }, - { - "$ref": "#/components/schemas/InputContentResourceInputImage" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "input_text": "#/components/schemas/InputContentResourceInputText", - "input_image": "#/components/schemas/InputContentResourceInputImage" - } - }, - "x-oai-discriminator-values": [ - "input_text", - "input_image" - ], - "description": "User-provided content recorded in a session item." - }, - "FunctionCallOutputResource": { - "oneOf": [ - { + "recipient_agent_id": { "type": "string", - "minLength": 0 + "minLength": 0, + "description": "The ID of the agent receiving the input." }, - { + "content": { "type": "array", "items": { - "$ref": "#/components/schemas/InputContentResource" + "$ref": "#/components/schemas/AgentContentResource" }, "minItems": 0, - "maxItems": 2000 + "maxItems": 2000, + "description": "The input sent to the receiving agent." } + }, + "required": [ + "type", + "id", + "turn_id", + "status", + "sender_agent_id", + "recipient_agent_id", + "content" ], - "description": "The text or model-input content supplied as a function result." + "additionalProperties": false, + "description": "A request to send input to another agent." }, - "FunctionCallOutputItemResource": { + "ResumeSubagentCallItemResource": { "type": "object", "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the function call output item." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." - }, "type": { "type": "string", "enum": [ - "function_call_output" + "resume_subagent_call" ], - "default": "function_call_output", + "default": "resume_subagent_call", "x-stainless-const": true, - "description": "The item type. Always `function_call_output`." + "description": "The item type. Always `resume_subagent_call`." }, - "call_id": { + "id": { "type": "string", "minLength": 0, - "description": "The ID of the function call that produced this output." + "description": "The ID of the tool call item." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that contains this item." }, "status": { "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the function call." + "description": "The status of the tool call." }, - "output": { - "anyOf": [ - { - "$ref": "#/components/schemas/FunctionCallOutputResource" - }, - { - "type": "null" - } - ], - "description": "The function result, if the call succeeded." + "sender_agent_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the agent requesting the resume." }, - "error": { - "type": [ - "string", - "null" - ], + "recipient_agent_id": { + "type": "string", "minLength": 0, - "description": "The error message, if the call failed." + "description": "The ID of the agent to resume." } }, "required": [ + "type", "id", "turn_id", - "type", - "call_id", "status", - "output", - "error" + "sender_agent_id", + "recipient_agent_id" ], "additionalProperties": false, - "description": "The result supplied for a function call." + "description": "A request to resume a subagent." }, - "AgentMessageItemResource": { + "WaitForSubagentsCallItemResource": { "type": "object", "properties": { + "type": { + "type": "string", + "enum": [ + "wait_for_subagents_call" + ], + "default": "wait_for_subagents_call", + "x-stainless-const": true, + "description": "The item type. Always `wait_for_subagents_call`." + }, "id": { "type": "string", "minLength": 0, - "description": "The ID of the message." + "description": "The ID of the tool call item." }, "turn_id": { "type": "string", "minLength": 0, "description": "The ID of the turn that contains this item." }, - "type": { - "type": "string", - "enum": [ - "agent_message" - ], - "default": "agent_message", - "x-stainless-const": true, - "description": "The item type. Always `agent_message`." + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." }, "sender_agent_id": { "type": "string", "minLength": 0, - "description": "The ID or name of the sending agent." - }, - "recipient_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID or name of the receiving agent." + "description": "The ID of the agent waiting for results." }, - "content": { + "recipient_agent_ids": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentContentResource" + "type": "string", + "minLength": 0 }, "minItems": 0, "maxItems": 2000, - "description": "The content exchanged between the agents." + "description": "The IDs of the agents to wait for." } }, "required": [ + "type", "id", "turn_id", - "type", + "status", "sender_agent_id", - "recipient_agent_id", - "content" + "recipient_agent_ids" ], "additionalProperties": false, - "description": "A message exchanged between agent threads." + "description": "A request to wait for one or more subagents." }, - "McpCallItemResource": { + "CloseSubagentCallItemResource": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "mcp_call" + "close_subagent_call" ], - "default": "mcp_call", + "default": "close_subagent_call", "x-stainless-const": true, - "description": "The item type. Always `mcp_call`." + "description": "The item type. Always `close_subagent_call`." }, "id": { "type": "string", "minLength": 0, - "description": "The ID of the MCP call item." + "description": "The ID of the tool call item." }, "turn_id": { "type": "string", "minLength": 0, "description": "The ID of the turn that contains this item." }, - "server_label": { + "status": { + "$ref": "#/components/schemas/FunctionCallStatusResource", + "description": "The status of the tool call." + }, + "sender_agent_id": { "type": "string", "minLength": 0, - "description": "The label of the MCP server." + "description": "The ID of the agent requesting the close." }, - "name": { + "recipient_agent_id": { "type": "string", "minLength": 0, - "description": "The name of the MCP tool." - }, - "arguments": { - "description": "The arguments passed to the MCP tool." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the MCP tool call." - }, - "output": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "description": "The output returned by the MCP tool, if any." - }, - "error": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "description": "The error returned by the MCP tool, if any." + "description": "The ID of the agent to close." } }, "required": [ "type", "id", "turn_id", - "server_label", - "name", - "arguments", "status", - "output", - "error" + "sender_agent_id", + "recipient_agent_id" ], "additionalProperties": false, - "description": "A call to a tool on an MCP server." + "description": "A request to close a subagent." }, - "WebSearchActionResourceSearch": { + "SessionTurnItemResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/MessageItemResource" + }, + { + "$ref": "#/components/schemas/ReasoningItemResource" + }, + { + "$ref": "#/components/schemas/FunctionCallItemResource" + }, + { + "$ref": "#/components/schemas/FunctionCallOutputItemResource" + }, + { + "$ref": "#/components/schemas/AgentMessageItemResource" + }, + { + "$ref": "#/components/schemas/McpCallItemResource" + }, + { + "$ref": "#/components/schemas/ComputerUseCallItemResource" + }, + { + "$ref": "#/components/schemas/BrowserAuthenticationRequestItemResource" + }, + { + "$ref": "#/components/schemas/ComputerUseApprovalRequestResultItemResource" + }, + { + "$ref": "#/components/schemas/WebSearchCallItemResource" + }, + { + "$ref": "#/components/schemas/CommandExecutionItemResource" + }, + { + "$ref": "#/components/schemas/CreateSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/SendSubagentInputCallItemResource" + }, + { + "$ref": "#/components/schemas/ResumeSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/WaitForSubagentsCallItemResource" + }, + { + "$ref": "#/components/schemas/InterruptSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/CloseSubagentCallItemResource" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "message": "#/components/schemas/MessageItemResource", + "reasoning": "#/components/schemas/ReasoningItemResource", + "function_call": "#/components/schemas/FunctionCallItemResource", + "function_call_output": "#/components/schemas/FunctionCallOutputItemResource", + "agent_message": "#/components/schemas/AgentMessageItemResource", + "mcp_call": "#/components/schemas/McpCallItemResource", + "computer_use_call": "#/components/schemas/ComputerUseCallItemResource", + "computer_use_approval_request": "#/components/schemas/BrowserAuthenticationRequestItemResource", + "computer_use_approval_request_result": "#/components/schemas/ComputerUseApprovalRequestResultItemResource", + "web_search_call": "#/components/schemas/WebSearchCallItemResource", + "command_execution": "#/components/schemas/CommandExecutionItemResource", + "interrupt_subagent_call": "#/components/schemas/InterruptSubagentCallItemResource", + "create_subagent_call": "#/components/schemas/CreateSubagentCallItemResource", + "send_subagent_input_call": "#/components/schemas/SendSubagentInputCallItemResource", + "resume_subagent_call": "#/components/schemas/ResumeSubagentCallItemResource", + "wait_for_subagents_call": "#/components/schemas/WaitForSubagentsCallItemResource", + "close_subagent_call": "#/components/schemas/CloseSubagentCallItemResource" + } + }, + "x-oai-discriminator-values": [ + "message", + "reasoning", + "function_call", + "function_call_output", + "agent_message", + "mcp_call", + "computer_use_call", + "computer_use_approval_request", + "computer_use_approval_request_result", + "web_search_call", + "command_execution", + "create_subagent_call", + "send_subagent_input_call", + "resume_subagent_call", + "wait_for_subagents_call", + "interrupt_subagent_call", + "close_subagent_call" + ], + "description": "An item associated with a session turn." + }, + "SessionItemListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "search" + "list" ], - "default": "search", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `search`." + "description": "The object type, which is always `list`." }, - "query": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionTurnItemResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The search query, when a single query was used." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "queries": { + "last_id": { "type": [ - "array", + "string", "null" ], - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "The search queries, when multiple queries were used." + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type", - "query", - "queries" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "A search query or group of search queries." + "description": "A page of messages, reasoning, and tool calls from a session's item history." }, - "WebSearchActionResourceOpenPage": { + "TurnObjectResource": { + "type": "string", + "enum": [ + "agent.session.turn" + ], + "default": "agent.session.turn", + "x-stainless-const": true, + "description": "The object type for a turn." + }, + "TurnStatusResource": { + "type": "string", + "enum": [ + "queued", + "in_progress", + "waiting", + "completed", + "failed", + "cancelled" + ], + "x-enumDescriptions": [ + "The turn is waiting to start.", + "The turn is in progress.", + "The turn is waiting for external input.", + "The turn completed successfully.", + "The turn failed.", + "The turn was cancelled." + ], + "description": "The current status of a turn." + }, + "SessionTurnErrorCodeResource": { + "type": "string", + "enum": [ + "context_length_exceeded", + "session_budget_exceeded", + "usage_limit_exceeded", + "project_spend_limit_exceeded", + "organization_spend_limit_exceeded", + "organization_usage_limit_exceeded", + "billing_not_active", + "credit_balance_exhausted", + "rate_limit_exceeded", + "flex_unavailable", + "server_overloaded", + "cyber_policy", + "misalignment_policy_violation", + "connection_failed", + "server_error", + "authentication_error", + "invalid_request", + "resource_not_found", + "sandbox_error", + "executor_version_incompatible", + "active_turn_not_steerable", + "request_timeout", + "internal_error" + ], + "x-enumDescriptions": [ + "The request exceeds the model's context window.", + "The session has reached its usage budget.", + "The organization has reached a usage, plan, or billing limit.", + "The project has reached its enforced spend limit.", + "The organization has reached its enforced spend limit.", + "The organization has reached its OpenAI-assigned usage limit.", + "Billing is not active for the account.", + "The organization has no API credits remaining.", + "The request exceeds the available rate limit.", + "Flex processing is temporarily unavailable.", + "The model service is temporarily overloaded.", + "The request was rejected by a safety policy.", + "The request was blocked by the safety systems.", + "The request could not connect to the model service.", + "The model service encountered an unexpected error.", + "The API credentials are invalid or lack the required access.", + "The request contains invalid input or configuration.", + "The requested model or resource is unavailable.", + "The request could not complete in its execution environment.", + "The executor must be upgraded before it can run this turn.", + "The session cannot accept additional input while a request is running.", + "The request timed out before the model service responded.", + "An unexpected internal error prevented the session request from completing." + ], + "description": "Stable public categories for session request failures." + }, + "SessionTurnErrorResource": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "open_page" - ], - "default": "open_page", - "x-stainless-const": true, - "description": "The type of the object. Always `open_page`." + "code": { + "$ref": "#/components/schemas/SessionTurnErrorCodeResource", + "description": "A stable, machine-readable failure category." }, - "url": { - "type": [ - "string", - "null" - ], + "message": { + "type": "string", "minLength": 0, - "description": "The URL of the page that was opened." + "description": "A customer-safe explanation of the failure." } }, "required": [ - "type", - "url" + "code", + "message" ], "additionalProperties": false, - "description": "Opens a web page." + "description": "A customer-safe error describing why a session request failed." }, - "WebSearchActionResourceFindInPage": { + "InputTokensDetailsResource-2": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "find_in_page" - ], - "default": "find_in_page", - "x-stainless-const": true, - "description": "The type of the object. Always `find_in_page`." - }, - "url": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The URL of the page that was searched." - }, - "pattern": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The text pattern that was searched for." + "cached_tokens": { + "type": "integer", + "format": "int64", + "description": "The number of input tokens retrieved from the prompt cache." } }, "required": [ - "type", - "url", - "pattern" + "cached_tokens" ], "additionalProperties": false, - "description": "Finds text within a web page." + "description": "A breakdown of input token usage for a session or turn." }, - "WebSearchActionResourceOther": { + "OutputTokensDetailsResource-2": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "other" - ], - "default": "other", - "x-stainless-const": true, - "description": "The type of the object. Always `other`." + "reasoning_tokens": { + "type": "integer", + "format": "int64", + "description": "The number of output tokens used for reasoning." } }, "required": [ - "type" + "reasoning_tokens" ], "additionalProperties": false, - "description": "Another web search action." + "description": "A breakdown of output token usage for a session or turn." }, - "WebSearchActionResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/WebSearchActionResourceSearch" + "TokenUsageResource": { + "type": "object", + "properties": { + "input_tokens": { + "type": "integer", + "format": "int64", + "description": "The number of input tokens used by the agent." }, - { - "$ref": "#/components/schemas/WebSearchActionResourceOpenPage" + "input_tokens_details": { + "$ref": "#/components/schemas/InputTokensDetailsResource-2", + "description": "A breakdown of the agent's input token usage." }, - { - "$ref": "#/components/schemas/WebSearchActionResourceFindInPage" + "output_tokens": { + "type": "integer", + "format": "int64", + "description": "The number of output tokens generated by the agent." }, - { - "$ref": "#/components/schemas/WebSearchActionResourceOther" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "search": "#/components/schemas/WebSearchActionResourceSearch", - "open_page": "#/components/schemas/WebSearchActionResourceOpenPage", - "find_in_page": "#/components/schemas/WebSearchActionResourceFindInPage", - "other": "#/components/schemas/WebSearchActionResourceOther" + "output_tokens_details": { + "$ref": "#/components/schemas/OutputTokensDetailsResource-2", + "description": "A breakdown of the agent's output token usage." + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "description": "The total number of input and output tokens used by the agent." } }, - "x-oai-discriminator-values": [ - "search", - "open_page", - "find_in_page", - "other" + "required": [ + "input_tokens", + "input_tokens_details", + "output_tokens", + "output_tokens_details", + "total_tokens" ], - "description": "An action performed by the web search tool." + "additionalProperties": false, + "description": "Recorded token usage for a session or turn. Usage is best effort and may change." }, - "WebSearchCallItemResource": { + "TurnResource": { "type": "object", "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "web_search_call" - ], - "default": "web_search_call", - "x-stainless-const": true, - "description": "The item type. Always `web_search_call`." + "minLength": 0, + "description": "The ID of the turn." }, - "id": { + "object": { + "$ref": "#/components/schemas/TurnObjectResource", + "description": "The object type. Always `agent.session.turn`." + }, + "session_id": { "type": "string", "minLength": 0, - "description": "The ID of the web search call." + "description": "The ID of the session that owns the turn." }, - "turn_id": { + "agent_id": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." + "description": "The ID of the agent that ran the turn." + }, + "subagent_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the subagent that ran the turn, if applicable." }, "status": { - "$ref": "#/components/schemas/OutputItemStatusResource", - "description": "The status of the web search call." + "$ref": "#/components/schemas/TurnStatusResource", + "description": "The current status of the turn." + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable." + }, + "started_at": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "description": "The Unix timestamp, in seconds, when the turn started." + }, + "completed_at": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "description": "The Unix timestamp, in seconds, when the turn reached a terminal state." + }, + "error": { + "anyOf": [ + { + "$ref": "#/components/schemas/SessionTurnErrorResource" + }, + { + "type": "null" + } + ], + "description": "A customer-safe error. Non-null only for a failed turn." }, - "action": { + "usage": { "anyOf": [ { - "$ref": "#/components/schemas/WebSearchActionResource" + "$ref": "#/components/schemas/TokenUsageResource" }, { "type": "null" } ], - "description": "The action performed by the web search tool." + "description": "Best-effort token usage for the turn, or null if unknown. Recorded usage may change." } }, "required": [ - "type", "id", - "turn_id", + "object", + "session_id", + "agent_id", + "subagent_id", "status", - "action" + "created_at", + "started_at", + "completed_at", + "error", + "usage" ], "additionalProperties": false, - "description": "A web search call produced by the agent." + "description": "The canonical public representation of a session turn." }, - "CommandExecutionItemResource": { + "SessionTurnListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "command_execution" + "list" ], - "default": "command_execution", + "default": "list", "x-stainless-const": true, - "description": "The item type. Always `command_execution`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the command execution item." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." + "description": "The object type, which is always `list`." }, - "command": { - "type": "string", - "minLength": 0, - "description": "The command that was executed." + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TurnResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." }, - "cwd": { + "first_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The working directory used to execute the command." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the command execution." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "output": { + "last_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The command output, if available." - }, - "exit_code": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "description": "The process exit code, if the command completed." + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, - "duration_ms": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "description": "The command duration in milliseconds." + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type", - "id", - "turn_id", - "command", - "cwd", - "status", - "output", - "exit_code", - "duration_ms" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "A command execution produced by the agent." + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "InterruptSubagentCallItemResource": { + "PersistedAgentToolResourceFunction": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "interrupt_subagent_call" + "function" ], - "default": "interrupt_subagent_call", + "default": "function", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `interrupt_subagent_call`." + "description": "The type of the object. Always `function`." }, - "id": { + "name": { "type": "string", "minLength": 0, - "description": "The ID of the tool call item." + "description": "The name of the function." }, - "turn_id": { + "description": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." + "description": "A description of what the function does." }, - "sender_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent requesting the interrupt." + "parameters": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "A JSON Schema object describing the function's arguments." }, - "recipient_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent to interrupt." + "defer_loading": { + "type": "boolean", + "description": "Whether the function is deferred and discovered through tool search." } }, "required": [ "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_id" + "name", + "description", + "parameters", + "defer_loading" ], "additionalProperties": false, - "description": "A request to interrupt a subagent's current turn. The subagent remains available." + "description": "A function defined by the application." }, - "CreateSubagentCallItemResource": { + "PersistedAgentToolResourceToolSearch": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "create_subagent_call" + "tool_search" ], - "default": "create_subagent_call", + "default": "tool_search", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `create_subagent_call`." - }, - "id": { + "description": "The type of the object. Always `tool_search`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Discovers deferred function tools and loads them into the model context." + }, + "PersistedAgentToolResourceProgrammaticToolCalling": { + "type": "object", + "properties": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." + "enum": [ + "programmatic_tool_calling" + ], + "default": "programmatic_tool_calling", + "x-stainless-const": true, + "description": "The type of the object. Always `programmatic_tool_calling`." }, - "turn_id": { + "enabled": { + "type": "boolean", + "description": "Whether tools can be called from model-generated code." + } + }, + "required": [ + "type", + "enabled" + ], + "additionalProperties": false, + "description": "Enables calling tools from model-generated code." + }, + "PersistedMcpTransportResourceHttp": { + "type": "object", + "properties": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." + "enum": [ + "http" + ], + "default": "http", + "x-stainless-const": true, + "description": "The type of the object. Always `http`." }, - "agent_id": { + "server_url": { "type": "string", "minLength": 0, - "description": "The ID of the agent that requested the subagent." + "description": "The URL of the MCP server." }, - "content": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AgentContentResource" + "headers": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 }, - "minItems": 0, - "maxItems": 2000, - "description": "The task given to the spawned agent." - }, - "model": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The model requested for the spawned agent." - }, - "reasoning_effort": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The reasoning effort requested for the spawned agent." + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Non-secret HTTP headers sent to the MCP server." } }, "required": [ "type", - "id", - "turn_id", - "status", - "agent_id", - "content", - "model", - "reasoning_effort" + "server_url", + "headers" ], "additionalProperties": false, - "description": "A request to spawn a subagent." + "description": "Connects to an MCP server over HTTP." }, - "SendSubagentInputCallItemResource": { + "PersistedMcpTransportResourceStdio": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "send_subagent_input_call" + "stdio" ], - "default": "send_subagent_input_call", + "default": "stdio", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `send_subagent_input_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." + "description": "The type of the object. Always `stdio`." }, - "turn_id": { + "command": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." + "description": "The command used to start the MCP server." }, - "sender_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent sending the input." + "args": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "Arguments passed to the MCP server command." }, - "recipient_agent_id": { + "cwd": { "type": "string", "minLength": 0, - "description": "The ID of the agent receiving the input." + "description": "The working directory used to start the MCP server." }, - "content": { + "env_vars": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentContentResource" + "type": "string", + "minLength": 0 }, "minItems": 0, "maxItems": 2000, - "description": "The input sent to the receiving agent." + "description": "Environment variable names inherited from the execution environment." } }, "required": [ "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_id", - "content" + "command", + "args", + "cwd", + "env_vars" ], "additionalProperties": false, - "description": "A request to send input to another agent." + "description": "Starts an MCP server as a local process." }, - "ResumeSubagentCallItemResource": { + "PersistedMcpTransportResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/PersistedMcpTransportResourceHttp" + }, + { + "$ref": "#/components/schemas/PersistedMcpTransportResourceStdio" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "http": "#/components/schemas/PersistedMcpTransportResourceHttp", + "stdio": "#/components/schemas/PersistedMcpTransportResourceStdio" + } + }, + "x-oai-discriminator-values": [ + "http", + "stdio" + ], + "description": "A credential-free transport used to connect to an MCP server." + }, + "PersistedAgentToolResourceMcp": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "resume_subagent_call" + "mcp" ], - "default": "resume_subagent_call", + "default": "mcp", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `resume_subagent_call`." + "description": "The type of the object. Always `mcp`." }, - "id": { + "server_label": { "type": "string", "minLength": 0, - "description": "The ID of the tool call item." + "description": "A label used to identify the MCP server in tool calls." }, - "turn_id": { - "type": "string", + "credential_id": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The ID of the turn that contains this item." + "description": "The vault credential selected for this MCP server, if any." }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." + "transport": { + "$ref": "#/components/schemas/PersistedMcpTransportResource", + "description": "The credential-free transport used to connect to the MCP server." }, - "sender_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent requesting the resume." + "request_metadata": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Metadata included with requests to this MCP server." }, - "recipient_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent to resume." + "allowed_tools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 0, + "maxItems": 2000, + "description": "The MCP tools the agent may call, or null when all server tools are allowed." + }, + "required": { + "type": "boolean", + "description": "Whether this MCP server must initialize before the first turn." + }, + "connection_origin": { + "$ref": "#/components/schemas/McpConnectionOriginResource", + "description": "Where outbound MCP HTTP connections originate." } }, "required": [ "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_id" + "server_label", + "credential_id", + "transport", + "request_metadata", + "allowed_tools", + "required", + "connection_origin" ], "additionalProperties": false, - "description": "A request to resume a subagent." + "description": "Tools provided by a remote MCP server without stored credentials." }, - "WaitForSubagentsCallItemResource": { + "PersistedAgentToolResourceWebSearch": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "wait_for_subagents_call" + "web_search" ], - "default": "wait_for_subagents_call", + "default": "web_search", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `wait_for_subagents_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." + "description": "The type of the object. Always `web_search`." }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." + "mode": { + "$ref": "#/components/schemas/WebSearchModeResource", + "description": "The source used for web search results." }, - "sender_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent waiting for results." + "context_size": { + "$ref": "#/components/schemas/WebSearchContextSizeResource", + "description": "The amount of search context made available to the model. Defaults to `medium`." }, - "recipient_agent_ids": { - "type": "array", + "allowed_domains": { + "type": [ + "array", + "null" + ], "items": { "type": "string", "minLength": 0 }, "minItems": 0, "maxItems": 2000, - "description": "The IDs of the agents to wait for." + "description": "Allowed search domains, or `null` when the search is unrestricted." + }, + "location": { + "anyOf": [ + { + "$ref": "#/components/schemas/WebSearchLocationResource" + }, + { + "type": "null" + } + ], + "description": "Approximate location used to localize search results, if provided." } }, "required": [ "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_ids" + "mode", + "context_size", + "allowed_domains", + "location" ], "additionalProperties": false, - "description": "A request to wait for one or more subagents." + "description": "Web search." }, - "CloseSubagentCallItemResource": { + "PersistedAgentToolResourceComputerUse": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "close_subagent_call" + "computer_use" ], - "default": "close_subagent_call", + "default": "computer_use", "x-stainless-const": true, - "x-enumDescriptions": [ - "The current public item type." - ], - "description": "The item type. Always `close_subagent_call`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the tool call item." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "status": { - "$ref": "#/components/schemas/FunctionCallStatusResource", - "description": "The status of the tool call." - }, - "sender_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent requesting the close." + "description": "The type of the object. Always `computer_use`." }, - "recipient_agent_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the agent to close." + "include_screenshots": { + "type": "boolean", + "description": "Whether computer tool outputs include screenshots." } }, "required": [ "type", - "id", - "turn_id", - "status", - "sender_agent_id", - "recipient_agent_id" + "include_screenshots" ], "additionalProperties": false, - "description": "A request to close a subagent." + "description": "Browser use in an OpenAI-hosted session." }, - "SessionTurnItemResource": { + "PersistedAgentToolResourceAutomations": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "automations" + ], + "default": "automations", + "x-stainless-const": true, + "description": "The type of the object. Always `automations`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Lets the agent manage its own scheduled wakeups." + }, + "PersistedAgentToolResource": { "oneOf": [ { - "$ref": "#/components/schemas/MessageItemResource" + "$ref": "#/components/schemas/PersistedAgentToolResourceFunction" }, { - "$ref": "#/components/schemas/ReasoningItemResource" + "$ref": "#/components/schemas/PersistedAgentToolResourceToolSearch" }, { - "$ref": "#/components/schemas/FunctionCallItemResource" + "$ref": "#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling" }, { - "$ref": "#/components/schemas/FunctionCallOutputItemResource" + "$ref": "#/components/schemas/PersistedAgentToolResourceMcp" }, { - "$ref": "#/components/schemas/AgentMessageItemResource" + "$ref": "#/components/schemas/PersistedAgentToolResourceWebSearch" }, { - "$ref": "#/components/schemas/McpCallItemResource" + "$ref": "#/components/schemas/PersistedAgentToolResourceComputerUse" }, { - "$ref": "#/components/schemas/WebSearchCallItemResource" + "$ref": "#/components/schemas/PersistedAgentToolResourceAutomations" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "function": "#/components/schemas/PersistedAgentToolResourceFunction", + "tool_search": "#/components/schemas/PersistedAgentToolResourceToolSearch", + "programmatic_tool_calling": "#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling", + "mcp": "#/components/schemas/PersistedAgentToolResourceMcp", + "web_search": "#/components/schemas/PersistedAgentToolResourceWebSearch", + "computer_use": "#/components/schemas/PersistedAgentToolResourceComputerUse", + "automations": "#/components/schemas/PersistedAgentToolResourceAutomations" + } + }, + "x-oai-discriminator-values": [ + "function", + "tool_search", + "programmatic_tool_calling", + "mcp", + "web_search", + "computer_use", + "automations" + ], + "description": "A credential-free tool available to a reusable agent." + }, + "AgentResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the reusable agent." }, - { - "$ref": "#/components/schemas/CommandExecutionItemResource" + "object": { + "type": "string", + "enum": [ + "agent" + ], + "default": "agent", + "x-stainless-const": true, + "description": "The object type. Always `agent`." }, - { - "$ref": "#/components/schemas/CreateSubagentCallItemResource" + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the agent was created." }, - { - "$ref": "#/components/schemas/SendSubagentInputCallItemResource" + "updated_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the agent was last updated." }, - { - "$ref": "#/components/schemas/ResumeSubagentCallItemResource" + "name": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "A human-readable name for the agent, or null if it is unnamed." }, - { - "$ref": "#/components/schemas/WaitForSubagentsCallItemResource" + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Custom string key-value pairs attached to the agent." }, - { - "$ref": "#/components/schemas/InterruptSubagentCallItemResource" + "model": { + "type": "string", + "minLength": 0, + "description": "The requested model name used for inference." }, - { - "$ref": "#/components/schemas/CloseSubagentCallItemResource" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "message": "#/components/schemas/MessageItemResource", - "reasoning": "#/components/schemas/ReasoningItemResource", - "function_call": "#/components/schemas/FunctionCallItemResource", - "function_call_output": "#/components/schemas/FunctionCallOutputItemResource", - "agent_message": "#/components/schemas/AgentMessageItemResource", - "mcp_call": "#/components/schemas/McpCallItemResource", - "web_search_call": "#/components/schemas/WebSearchCallItemResource", - "command_execution": "#/components/schemas/CommandExecutionItemResource", - "interrupt_subagent_call": "#/components/schemas/InterruptSubagentCallItemResource", - "create_subagent_call": "#/components/schemas/CreateSubagentCallItemResource", - "send_subagent_input_call": "#/components/schemas/SendSubagentInputCallItemResource", - "resume_subagent_call": "#/components/schemas/ResumeSubagentCallItemResource", - "wait_for_subagents_call": "#/components/schemas/WaitForSubagentsCallItemResource", - "close_subagent_call": "#/components/schemas/CloseSubagentCallItemResource" + "reasoning": { + "$ref": "#/components/schemas/ReasoningResource", + "description": "The resolved reasoning configuration, including the model default for an omitted effort." + }, + "text": { + "$ref": "#/components/schemas/TextResource", + "description": "The resolved configuration for text generated by the agent." + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTierResource", + "description": "The resolved service-tier policy used for model requests." + }, + "instructions": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "Custom instructions appended to the agent's default base instructions." + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PersistedAgentToolResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Tools available to the agent." + }, + "multi_agent": { + "$ref": "#/components/schemas/MultiAgentConfigResource", + "description": "The resolved configuration for creating and coordinating subagents." + }, + "compaction": { + "$ref": "#/components/schemas/CompactionResource", + "description": "The effective context compaction settings." + }, + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigResource", + "description": "The effective experimental settings for the agent." } }, - "x-oai-discriminator-values": [ - "message", + "required": [ + "id", + "object", + "created_at", + "updated_at", + "name", + "metadata", + "model", "reasoning", - "function_call", - "function_call_output", - "agent_message", - "mcp_call", - "web_search_call", - "command_execution", - "create_subagent_call", - "send_subagent_input_call", - "resume_subagent_call", - "wait_for_subagents_call", - "interrupt_subagent_call", - "close_subagent_call" + "text", + "service_tier", + "instructions", + "tools", + "multi_agent" ], - "description": "An item associated with a session turn." + "additionalProperties": false, + "description": "A reusable agent scoped to the caller's project." }, - "SessionItemListResource": { + "AgentListResource": { "type": "object", "properties": { "object": { @@ -78486,7 +104962,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/SessionTurnItemResource" + "$ref": "#/components/schemas/AgentResource" }, "minItems": 0, "maxItems": 2000, @@ -78521,1805 +104997,1935 @@ "has_more" ], "additionalProperties": false, - "description": "A page of messages, reasoning, and tool calls from a session's item history." - }, - "TurnObjectResource": { - "type": "string", - "enum": [ - "agent.session.turn" - ], - "default": "agent.session.turn", - "x-stainless-const": true, - "description": "The object type for a turn." - }, - "TurnStatusResource": { - "type": "string", - "enum": [ - "queued", - "in_progress", - "waiting", - "completed", - "failed", - "cancelled" - ], - "x-enumDescriptions": [ - "The turn is waiting to start.", - "The turn is in progress.", - "The turn is waiting for external input.", - "The turn completed successfully.", - "The turn failed.", - "The turn was cancelled." - ], - "description": "The current status of a turn." + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "SessionTurnErrorCodeResource": { - "type": "string", - "enum": [ - "context_length_exceeded", - "session_budget_exceeded", - "usage_limit_exceeded", - "rate_limit_exceeded", - "server_overloaded", - "cyber_policy", - "connection_failed", - "server_error", - "authentication_error", - "invalid_request", - "resource_not_found", - "sandbox_error", - "executor_version_incompatible", - "active_turn_not_steerable", - "request_timeout", - "internal_error" - ], - "x-enumDescriptions": [ - "The request exceeds the model's context window.", - "The session has reached its usage budget.", - "The organization has reached a usage, plan, or billing limit.", - "The request exceeds the available rate limit.", - "The model service is temporarily overloaded.", - "The request was rejected by a safety policy.", - "The request could not connect to the model service.", - "The model service encountered an unexpected error.", - "The API credentials are invalid or lack the required access.", - "The request contains invalid input or configuration.", - "The requested model or resource is unavailable.", - "The request could not complete in its execution environment.", - "The executor must be upgraded before it can run this turn.", - "The session cannot accept additional input while a request is running.", - "The request timed out before the model service responded.", - "An unexpected internal error prevented the session request from completing." - ], - "description": "Stable public categories for session request failures." + "ExperimentalConfigParam": { + "type": "object", + "properties": { + "time_awareness": { + "type": "boolean", + "default": false, + "description": "Whether to give the model periodic current-time reminders. Defaults to false." + } + }, + "additionalProperties": false, + "description": "Experimental agent settings. These features may change." }, - "SessionTurnErrorResource": { + "PersistedAgentToolConfigParamFunction": { "type": "object", "properties": { - "code": { - "$ref": "#/components/schemas/SessionTurnErrorCodeResource", - "description": "A stable, machine-readable failure category." + "type": { + "type": "string", + "enum": [ + "function" + ], + "default": "function", + "x-stainless-const": true, + "description": "The type of the object. Always `function`." }, - "message": { + "name": { "type": "string", "minLength": 0, - "description": "A customer-safe explanation of the failure." + "maxLength": 1048576, + "description": "The name of the function." + }, + "description": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "A description of what the function does." + }, + "parameters": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "A JSON Schema object describing the function's arguments." + }, + "defer_loading": { + "type": "boolean", + "default": false, + "description": "Whether this function is deferred and discovered through tool search. Defaults to `false`." } }, "required": [ - "code", - "message" + "type", + "name", + "description", + "parameters" ], "additionalProperties": false, - "description": "A customer-safe error describing why a session request failed." + "description": "A function defined by the application." }, - "InputTokensDetailsResource": { + "PersistedAgentToolConfigParamToolSearch": { "type": "object", "properties": { - "cached_tokens": { - "type": "integer", - "format": "int64", - "description": "The number of input tokens retrieved from the prompt cache." + "type": { + "type": "string", + "enum": [ + "tool_search" + ], + "default": "tool_search", + "x-stainless-const": true, + "description": "The type of the object. Always `tool_search`." } }, "required": [ - "cached_tokens" + "type" ], "additionalProperties": false, - "description": "A breakdown of input token usage for a session or turn." + "description": "Discovers deferred function tools and loads them into the model context." }, - "OutputTokensDetailsResource": { + "PersistedAgentToolConfigParamProgrammaticToolCalling": { "type": "object", "properties": { - "reasoning_tokens": { - "type": "integer", - "format": "int64", - "description": "The number of output tokens used for reasoning." + "type": { + "type": "string", + "enum": [ + "programmatic_tool_calling" + ], + "default": "programmatic_tool_calling", + "x-stainless-const": true, + "description": "The type of the object. Always `programmatic_tool_calling`." + }, + "enabled": { + "type": "boolean", + "default": true, + "description": "Whether tools can be called from model-generated code. Defaults to `true`." } }, "required": [ - "reasoning_tokens" + "type" ], "additionalProperties": false, - "description": "A breakdown of output token usage for a session or turn." + "description": "Enables calling tools from model-generated code." }, - "TokenUsageResource": { + "PersistedMcpTransportConfigParamHttp": { "type": "object", "properties": { - "input_tokens": { - "type": "integer", - "format": "int64", - "description": "The number of input tokens used by the agent." - }, - "input_tokens_details": { - "$ref": "#/components/schemas/InputTokensDetailsResource", - "description": "A breakdown of the agent's input token usage." - }, - "output_tokens": { - "type": "integer", - "format": "int64", - "description": "The number of output tokens generated by the agent." + "type": { + "type": "string", + "enum": [ + "http" + ], + "default": "http", + "x-stainless-const": true, + "description": "The type of the object. Always `http`." }, - "output_tokens_details": { - "$ref": "#/components/schemas/OutputTokensDetailsResource", - "description": "A breakdown of the agent's output token usage." + "server_url": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The URL of the MCP server." }, - "total_tokens": { - "type": "integer", - "format": "int64", - "description": "The total number of input and output tokens used by the agent." + "headers": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Non-secret HTTP headers sent to the MCP server." } }, "required": [ - "input_tokens", - "input_tokens_details", - "output_tokens", - "output_tokens_details", - "total_tokens" + "type", + "server_url" ], "additionalProperties": false, - "description": "Recorded token usage for a session or turn. Usage is best effort and may change." + "description": "Connects to an MCP server over HTTP." }, - "TurnResource": { + "PersistedMcpTransportConfigParamStdio": { "type": "object", "properties": { - "id": { + "type": { + "type": "string", + "enum": [ + "stdio" + ], + "default": "stdio", + "x-stainless-const": true, + "description": "The type of the object. Always `stdio`." + }, + "command": { "type": "string", "minLength": 0, - "description": "The ID of the turn." + "maxLength": 1048576, + "description": "The command used to start the MCP server." }, - "object": { - "$ref": "#/components/schemas/TurnObjectResource", - "description": "The object type. Always `agent.session.turn`." + "args": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Arguments passed to the MCP server command." }, - "session_id": { + "cwd": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The working directory used to start the MCP server." + }, + "env_vars": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Environment variable names to inherit from the selected execution environment." + } + }, + "required": [ + "type", + "command", + "cwd" + ], + "additionalProperties": false, + "description": "Starts an MCP server as a local process." + }, + "PersistedMcpTransportConfigParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/PersistedMcpTransportConfigParamHttp" + }, + { + "$ref": "#/components/schemas/PersistedMcpTransportConfigParamStdio" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "http": "#/components/schemas/PersistedMcpTransportConfigParamHttp", + "stdio": "#/components/schemas/PersistedMcpTransportConfigParamStdio" + } + }, + "x-oai-discriminator-values": [ + "http", + "stdio" + ], + "description": "A credential-free transport used to connect to an MCP server." + }, + "PersistedAgentToolConfigParamMcp": { + "type": "object", + "properties": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the session that owns the turn." + "enum": [ + "mcp" + ], + "default": "mcp", + "x-stainless-const": true, + "description": "The type of the object. Always `mcp`." }, - "agent_id": { + "server_label": { "type": "string", "minLength": 0, - "description": "The ID of the agent that ran the turn." + "maxLength": 1048576, + "description": "A label used to identify the MCP server in tool calls." }, - "subagent_id": { + "credential_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the subagent that ran the turn, if applicable." - }, - "status": { - "$ref": "#/components/schemas/TurnStatusResource", - "description": "The current status of the turn." + "maxLength": 1048576, + "description": "The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL." }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable." + "transport": { + "$ref": "#/components/schemas/PersistedMcpTransportConfigParam", + "description": "The credential-free transport used to connect to the MCP server." }, - "started_at": { + "request_metadata": { "type": [ - "integer", + "object", "null" ], - "format": "int64", - "description": "The Unix timestamp, in seconds, when the turn started." + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Metadata included with requests to this MCP server." }, - "completed_at": { + "allowed_tools": { "type": [ - "integer", + "array", "null" ], - "format": "int64", - "description": "The Unix timestamp, in seconds, when the turn reached a terminal state." + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "The MCP tools the agent may call. All server tools are allowed when omitted." }, - "error": { - "anyOf": [ - { - "$ref": "#/components/schemas/SessionTurnErrorResource" - }, - { - "type": "null" - } - ], - "description": "A customer-safe error. Non-null only for a failed turn." + "required": { + "type": "boolean", + "default": false, + "description": "Whether this MCP server must initialize before the first turn. Defaults to `false`." }, - "usage": { + "connection_origin": { "anyOf": [ { - "$ref": "#/components/schemas/TokenUsageResource" + "$ref": "#/components/schemas/McpConnectionOriginParam" }, { "type": "null" } ], - "description": "Best-effort token usage for the turn, or null if unknown. Recorded usage may change." + "description": "Selects where outbound MCP HTTP connections originate." } }, "required": [ - "id", - "object", - "session_id", - "agent_id", - "subagent_id", - "status", - "created_at", - "started_at", - "completed_at", - "error", - "usage" + "type", + "server_label", + "transport" ], "additionalProperties": false, - "description": "The canonical public representation of a session turn." + "description": "Tools provided by a remote MCP server without stored credentials." }, - "SessionTurnListResource": { + "PersistedAgentToolConfigParamWebSearch": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "web_search" ], - "default": "list", + "default": "web_search", "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TurnResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." - }, - "first_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "description": "The type of the object. Always `web_search`." }, - "last_id": { - "type": [ - "string", - "null" + "mode": { + "anyOf": [ + { + "$ref": "#/components/schemas/WebSearchModeParam" + }, + { + "type": "null" + } ], - "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "description": "The source used for web search results. Defaults to `live`." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." - }, - "ReasoningEffortResource": { - "type": "string", - "enum": [ - "none", - "minimal", - "low", - "medium", - "high", - "xhigh", - "max" - ], - "description": "The amount of reasoning effort used by an agent." - }, - "ReasoningSummaryResource": { - "type": "string", - "enum": [ - "concise", - "detailed", - "auto" - ], - "x-enumDescriptions": [ - "Returns a concise reasoning summary when supported.", - "Returns a detailed reasoning summary when supported.", - "Automatically selects the most detailed summary supported by the model." - ], - "description": "The reasoning summary format requested from an agent." - }, - "ReasoningResource": { - "type": "object", - "properties": { - "effort": { + "context_size": { "anyOf": [ { - "$ref": "#/components/schemas/ReasoningEffortResource" + "$ref": "#/components/schemas/WebSearchContextSizeParam" }, { "type": "null" } ], - "description": "The requested reasoning effort, or `null` when the model selects its own default." + "description": "The amount of search context made available to the model. Defaults to `medium`." }, - "summary": { + "allowed_domains": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Domains the search may include." + }, + "location": { "anyOf": [ { - "$ref": "#/components/schemas/ReasoningSummaryResource" + "$ref": "#/components/schemas/WebSearchLocationParam" }, { "type": "null" } ], - "description": "The requested reasoning summary format, or `null` when summaries are disabled." + "description": "Approximate location used to localize search results." } }, "required": [ - "effort", - "summary" + "type" ], "additionalProperties": false, - "description": "The reasoning configuration used by an agent." + "description": "Web search." }, - "TextFormatResourceText": { + "PersistedAgentToolConfigParamComputerUse": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "text" + "computer_use" ], - "default": "text", + "default": "computer_use", "x-stainless-const": true, - "description": "The type of the object. Always `text`." + "description": "The type of the object. Always `computer_use`." + }, + "include_screenshots": { + "type": "boolean", + "default": false, + "description": "Whether computer tool outputs include screenshots. Defaults to `false`." } }, "required": [ "type" ], "additionalProperties": false, - "description": "Generates ordinary text without a structured-output constraint." + "description": "Browser use in an OpenAI-hosted session." }, - "TextFormatResourceJsonSchema": { + "PersistedAgentToolConfigParamAutomations": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "json_schema" + "automations" ], - "default": "json_schema", + "default": "automations", "x-stainless-const": true, - "description": "The type of the object. Always `json_schema`." - }, - "schema": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "The JSON Schema that generated text must match." + "description": "The type of the object. Always `automations`." } }, "required": [ - "type", - "schema" + "type" ], "additionalProperties": false, - "description": "Constrains generated text to a JSON Schema." + "description": "Lets the agent manage its own scheduled wakeups." }, - "TextFormatResource": { + "PersistedAgentToolConfigParam": { "oneOf": [ { - "$ref": "#/components/schemas/TextFormatResourceText" + "$ref": "#/components/schemas/PersistedAgentToolConfigParamFunction" }, { - "$ref": "#/components/schemas/TextFormatResourceJsonSchema" + "$ref": "#/components/schemas/PersistedAgentToolConfigParamToolSearch" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamMcp" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamWebSearch" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamComputerUse" + }, + { + "$ref": "#/components/schemas/PersistedAgentToolConfigParamAutomations" } ], "discriminator": { "propertyName": "type", "mapping": { - "text": "#/components/schemas/TextFormatResourceText", - "json_schema": "#/components/schemas/TextFormatResourceJsonSchema" + "function": "#/components/schemas/PersistedAgentToolConfigParamFunction", + "tool_search": "#/components/schemas/PersistedAgentToolConfigParamToolSearch", + "programmatic_tool_calling": "#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling", + "mcp": "#/components/schemas/PersistedAgentToolConfigParamMcp", + "web_search": "#/components/schemas/PersistedAgentToolConfigParamWebSearch", + "computer_use": "#/components/schemas/PersistedAgentToolConfigParamComputerUse", + "automations": "#/components/schemas/PersistedAgentToolConfigParamAutomations" } }, "x-oai-discriminator-values": [ - "text", - "json_schema" - ], - "description": "The effective output format for generated text." - }, - "VerbosityResource": { - "type": "string", - "enum": [ - "low", - "medium", - "high" + "function", + "tool_search", + "programmatic_tool_calling", + "mcp", + "web_search", + "computer_use", + "automations" ], - "description": "The amount of text produced by an agent." + "description": "A tool that can be stored on a reusable agent without session credentials." }, - "TextResource": { + "CreateAgentParams": { "type": "object", "properties": { - "format": { - "$ref": "#/components/schemas/TextFormatResource", - "description": "The effective output format. Defaults to ordinary text." + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigParam", + "default": { + "time_awareness": false + }, + "description": "Experimental agent settings. All experimental features default to disabled." }, - "verbosity": { - "$ref": "#/components/schemas/VerbosityResource", - "description": "The amount of text produced by the agent. Defaults to `medium`." + "metadata": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map." + }, + "name": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 128, + "description": "A human-readable name for the agent. Omission or null leaves the agent unnamed." + }, + "model": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The model to use for the agent. The requested model name is preserved." + }, + "reasoning": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for model reasoning. Omission uses the model's default effort." + }, + "text": { + "anyOf": [ + { + "$ref": "#/components/schemas/TextParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for generated text. Defaults to the `text` format and medium verbosity." + }, + "service_tier": { + "anyOf": [ + { + "$ref": "#/components/schemas/ServiceTierParam" + }, + { + "type": "null" + } + ], + "description": "The service tier used for model requests. Defaults to `auto`." + }, + "instructions": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions." + }, + "tools": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/PersistedAgentToolConfigParam" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Tools available to the agent. Defaults to an empty list. The tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON." + }, + "multi_agent": { + "anyOf": [ + { + "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for creating and coordinating subagents. Subagent tools are disabled by default." + }, + "compaction": { + "anyOf": [ + { + "$ref": "#/components/schemas/CompactionParam" + }, + { + "type": "null" + } + ], + "description": "Context compaction settings. Omission or null enables background compaction." } }, "required": [ - "format", - "verbosity" + "model" ], "additionalProperties": false, - "description": "The text configuration used by an agent." - }, - "ServiceTierResource": { - "type": "string", - "enum": [ - "auto", - "default", - "flex", - "priority", - "fast" - ], - "description": "The service-tier policy configured for an agent." + "description": "Parameters for creating a reusable agent." }, - "PersistedAgentToolResourceFunction": { + "UpdateAgentParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "function" - ], - "default": "function", - "x-stainless-const": true, - "description": "The type of the object. Always `function`." + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigOverridesParam", + "default": {}, + "description": "Experimental settings to merge by key. Omitted settings keep their current values." }, - "name": { + "model": { "type": "string", "minLength": 0, - "description": "The name of the function." + "maxLength": 1048576, + "description": "The model to use for the agent. The requested model name is preserved." }, - "description": { - "type": "string", + "reasoning": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort." + }, + "text": { + "anyOf": [ + { + "$ref": "#/components/schemas/TextParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for text generated by the agent." + }, + "service_tier": { + "anyOf": [ + { + "$ref": "#/components/schemas/ServiceTierParam" + }, + { + "type": "null" + } + ], + "description": "The service tier used for model requests." + }, + "instructions": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "A description of what the function does." + "maxLength": 1048576, + "description": "Additional instructions appended to the agent's default base instructions. Omit to leave unchanged." }, - "parameters": { - "type": "object", - "additionalProperties": {}, + "multi_agent": { + "anyOf": [ + { + "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" + }, + { + "type": "null" + } + ], + "description": "Configuration for creating and coordinating subagents." + }, + "compaction": { + "anyOf": [ + { + "$ref": "#/components/schemas/CompactionParam" + }, + { + "type": "null" + } + ], + "description": "Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction." + }, + "metadata": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, "propertyNames": { "type": "string", - "minLength": 0 + "minLength": 1, + "maxLength": 64 }, "minProperties": 0, - "description": "A JSON Schema object describing the function's arguments." + "maxProperties": 16, + "description": "Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." }, - "defer_loading": { - "type": "boolean", - "description": "Whether the function is deferred and discovered through tool search." - } - }, - "required": [ - "type", - "name", - "description", - "parameters", - "defer_loading" - ], - "additionalProperties": false, - "description": "A function defined by the application." - }, - "PersistedAgentToolResourceToolSearch": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "tool_search" + "name": { + "type": [ + "string", + "null" ], - "default": "tool_search", - "x-stainless-const": true, - "description": "The type of the object. Always `tool_search`." + "minLength": 0, + "maxLength": 128, + "description": "A replacement name. Omit to leave unchanged, or pass null to clear it." + }, + "tools": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/PersistedAgentToolConfigParam" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Replaces the tool list. Omit to leave it unchanged, or pass null to clear it. The replacement must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON." } }, - "required": [ - "type" - ], "additionalProperties": false, - "description": "Discovers deferred function tools and loads them into the model context." + "description": "Fields to replace on an existing reusable agent." }, - "PersistedAgentToolResourceProgrammaticToolCalling": { + "DeletedAgentResource": { "type": "object", "properties": { - "type": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the deleted agent." + }, + "object": { "type": "string", "enum": [ - "programmatic_tool_calling" + "agent.deleted" ], - "default": "programmatic_tool_calling", + "default": "agent.deleted", "x-stainless-const": true, - "description": "The type of the object. Always `programmatic_tool_calling`." + "description": "The object type. Always `agent.deleted`." }, - "enabled": { + "deleted": { "type": "boolean", - "description": "Whether tools can be called from model-generated code." + "description": "Whether the agent was deleted. Always `true`." } }, "required": [ - "type", - "enabled" + "id", + "object", + "deleted" ], "additionalProperties": false, - "description": "Enables calling tools from model-generated code." + "description": "A deleted reusable agent." }, - "PersistedMcpTransportResourceHttp": { + "EnvironmentTemplateResource": { "type": "object", "properties": { - "type": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the reusable environment template." + }, + "name": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "An optional human-readable display name for the template." + }, + "object": { "type": "string", "enum": [ - "http" + "agent.environment.template" ], - "default": "http", + "default": "agent.environment.template", "x-stainless-const": true, - "description": "The type of the object. Always `http`." + "description": "The object type. Always `agent.environment.template`." }, - "server_url": { - "type": "string", - "minLength": 0, - "description": "The URL of the MCP server." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the template was created." }, - "headers": { - "type": "object", - "additionalProperties": { + "updated_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the template was last updated." + }, + "packages": { + "$ref": "#/components/schemas/EnvironmentPackagesResource", + "description": "Packages installed in each fresh OpenAI-hosted environment." + }, + "network": { + "$ref": "#/components/schemas/NetworkPolicyResource", + "description": "Runtime network access for each OpenAI-hosted environment." + }, + "desktop": { + "$ref": "#/components/schemas/DesktopResource", + "description": "Desktop configuration for each OpenAI-hosted environment." + }, + "capability_directories": { + "type": "array", + "items": { "type": "string", "minLength": 0 }, - "propertyNames": { - "type": "string", - "minLength": 0 + "minItems": 0, + "maxItems": 2000, + "description": "Directories that expose capabilities to the agent." + }, + "skills": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedTemplateSkillResource" }, - "minProperties": 0, - "description": "Non-secret HTTP headers sent to the MCP server." + "minItems": 0, + "maxItems": 200, + "description": "Safe skill metadata, preserving unresolved version selectors." + }, + "plugins": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedPluginResource" + }, + "minItems": 0, + "maxItems": 32, + "description": "Safe plugin metadata, excluding inline archive contents." + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedTemplateFileResource" + }, + "minItems": 0, + "maxItems": 50, + "description": "Safe file metadata, excluding contents and session-scoped file IDs." } }, "required": [ - "type", - "server_url", - "headers" + "id", + "name", + "object", + "created_at", + "updated_at", + "packages", + "network", + "desktop", + "capability_directories", + "skills", + "plugins", + "files" ], "additionalProperties": false, - "description": "Connects to an MCP server over HTTP." + "description": "Reusable configuration that provisions a fresh OpenAI-hosted environment for each session." }, - "PersistedMcpTransportResourceStdio": { + "EnvironmentTemplateListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "stdio" + "list" ], - "default": "stdio", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `stdio`." - }, - "command": { - "type": "string", - "minLength": 0, - "description": "The command used to start the MCP server." + "description": "The object type, which is always `list`." }, - "args": { + "data": { "type": "array", "items": { - "type": "string", - "minLength": 0 + "$ref": "#/components/schemas/EnvironmentTemplateResource" }, "minItems": 0, "maxItems": 2000, - "description": "Arguments passed to the MCP server command." + "description": "The resources returned in this page, in the requested sort order." }, - "cwd": { - "type": "string", + "first_id": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The working directory used to start the MCP server." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "env_vars": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Environment variable names inherited from the execution environment." + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type", - "command", - "args", - "cwd", - "env_vars" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "Starts an MCP server as a local process." - }, - "PersistedMcpTransportResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/PersistedMcpTransportResourceHttp" - }, - { - "$ref": "#/components/schemas/PersistedMcpTransportResourceStdio" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "http": "#/components/schemas/PersistedMcpTransportResourceHttp", - "stdio": "#/components/schemas/PersistedMcpTransportResourceStdio" - } - }, - "x-oai-discriminator-values": [ - "http", - "stdio" - ], - "description": "A credential-free transport used to connect to an MCP server." - }, - "McpConnectionOriginResource": { - "type": "string", - "enum": [ - "service", - "environment" - ], - "description": "Where outbound MCP HTTP connections originate." + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "PersistedAgentToolResourceMcp": { + "CreateEnvironmentTemplateParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "mcp" + "packages": { + "anyOf": [ + { + "$ref": "#/components/schemas/EnvironmentPackagesParam" + }, + { + "type": "null" + } ], - "default": "mcp", - "x-stainless-const": true, - "description": "The type of the object. Always `mcp`." - }, - "server_label": { - "type": "string", - "minLength": 0, - "description": "A label used to identify the MCP server in tool calls." + "description": "Packages to install in the environment. Defaults to empty package lists." }, - "credential_id": { + "setup_commands": { "type": [ - "string", + "array", "null" ], - "minLength": 0, - "description": "The vault credential selected for this MCP server, if any." + "items": { + "$ref": "#/components/schemas/SetupCommandParam" + }, + "minItems": 0, + "maxItems": 16, + "description": "Ordered, confidential setup commands. Command bodies are never returned." }, - "transport": { - "$ref": "#/components/schemas/PersistedMcpTransportResource", - "description": "The credential-free transport used to connect to the MCP server." + "network": { + "anyOf": [ + { + "$ref": "#/components/schemas/NetworkPolicyParam" + }, + { + "type": "null" + } + ], + "description": "Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled." }, - "request_metadata": { - "type": "object", - "additionalProperties": {}, + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopParam" + }, + { + "type": "null" + } + ], + "description": "Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled." + }, + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, "propertyNames": { "type": "string", - "minLength": 0 + "minLength": 1, + "maxLength": 256 }, "minProperties": 0, - "description": "Metadata included with requests to this MCP server." + "maxProperties": 1024, + "description": "Environment variables made available to the agent." }, - "allowed_tools": { + "capability_directories": { "type": [ "array", "null" ], "items": { "type": "string", - "minLength": 0 + "minLength": 0, + "maxLength": 1048576 }, "minItems": 0, - "maxItems": 2000, - "description": "The MCP tools the agent may call, or null when all server tools are allowed." + "maxItems": 16384, + "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." }, - "required": { - "type": "boolean", - "description": "Whether this MCP server must initialize before the first turn." + "skills": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedSkillParam" + }, + "minItems": 0, + "maxItems": 200, + "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." }, - "connection_origin": { - "$ref": "#/components/schemas/McpConnectionOriginResource", - "description": "Where outbound MCP HTTP connections originate." + "plugins": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedPluginParam" + }, + "minItems": 0, + "maxItems": 32, + "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." + }, + "files": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileParam" + }, + "minItems": 0, + "maxItems": 50, + "description": "Files available before the agent starts. Defaults to an empty list." + }, + "name": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 256, + "description": "An optional human-readable display name for the template." } }, - "required": [ - "type", - "server_label", - "credential_id", - "transport", - "request_metadata", - "allowed_tools", - "required", - "connection_origin" - ], "additionalProperties": false, - "description": "Tools provided by a remote MCP server without stored credentials." - }, - "WebSearchModeResource": { - "type": "string", - "enum": [ - "disabled", - "cached", - "live" - ], - "description": "The source used for web search results." - }, - "WebSearchContextSizeResource": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ], - "description": "The amount of web search context made available to the model." + "description": "Parameters for creating a reusable, project-scoped OpenAI-hosted environment template." }, - "WebSearchLocationResource": { + "UpdateEnvironmentTemplateParams": { "type": "object", "properties": { - "country": { + "name": { "type": [ "string", "null" ], - "minLength": 0, - "description": "The two-letter ISO country code, such as `US`." + "minLength": 1, + "maxLength": 256, + "description": "A replacement human-readable display name, or `null` to clear the name." + }, + "packages": { + "anyOf": [ + { + "$ref": "#/components/schemas/EnvironmentPackagesParam" + }, + { + "type": "null" + } + ], + "description": "Packages installed before the runtime network policy applies." + }, + "setup_commands": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/SetupCommandParam" + }, + "minItems": 0, + "maxItems": 16, + "description": "Replacement confidential setup commands, never included in returned resources." + }, + "network": { + "anyOf": [ + { + "$ref": "#/components/schemas/NetworkPolicyParam" + }, + { + "type": "null" + } + ], + "description": "Network access available after setup completes. Omit to preserve the current policy, or pass `null` to reset to the default policy." + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/components/schemas/DesktopParam" + }, + { + "type": "null" + } + ], + "description": "Replacement desktop configuration, or null to disable the desktop." + }, + "env": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Replacement confidential environment values." + }, + "capability_directories": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 0, + "maxItems": 16384, + "description": "Directories that expose capabilities to the agent." }, - "region": { + "skills": { "type": [ - "string", + "array", "null" ], - "minLength": 0, - "description": "The region or state name." + "items": { + "$ref": "#/components/schemas/HostedSkillParam" + }, + "minItems": 0, + "maxItems": 200, + "description": "Replacement skill configuration installed for each new session." }, - "city": { + "plugins": { "type": [ - "string", + "array", "null" ], - "minLength": 0, - "description": "The city name." + "items": { + "$ref": "#/components/schemas/HostedPluginParam" + }, + "minItems": 0, + "maxItems": 32, + "description": "Replacement plugin configuration installed for each new session." }, - "timezone": { + "files": { "type": [ - "string", + "array", "null" ], - "minLength": 0, - "description": "The IANA timezone, such as `America/Los_Angeles`." + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileParam" + }, + "minItems": 0, + "maxItems": 50, + "description": "Replacement file configuration materialized for each new session." } }, - "required": [ - "country", - "region", - "city", - "timezone" - ], "additionalProperties": false, - "description": "Approximate user location used to localize web search results." + "description": "Fields to replace on an existing reusable OpenAI-hosted environment template." }, - "PersistedAgentToolResourceWebSearch": { + "DeletedEnvironmentTemplateResource": { "type": "object", "properties": { - "type": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the deleted environment template." + }, + "object": { "type": "string", "enum": [ - "web_search" + "agent.environment.template.deleted" ], - "default": "web_search", + "default": "agent.environment.template.deleted", "x-stainless-const": true, - "description": "The type of the object. Always `web_search`." - }, - "mode": { - "$ref": "#/components/schemas/WebSearchModeResource", - "description": "The source used for web search results." - }, - "context_size": { - "$ref": "#/components/schemas/WebSearchContextSizeResource", - "description": "The amount of search context made available to the model. Defaults to `medium`." - }, - "allowed_domains": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Allowed search domains, or `null` when the search is unrestricted." + "description": "The object type. Always `agent.environment.template.deleted`." }, - "location": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchLocationResource" - }, - { - "type": "null" - } - ], - "description": "Approximate location used to localize search results, if provided." + "deleted": { + "type": "boolean", + "description": "Whether the environment template was deleted. Always `true`." } }, "required": [ - "type", - "mode", - "context_size", - "allowed_domains", - "location" + "id", + "object", + "deleted" ], "additionalProperties": false, - "description": "Web search." + "description": "A deleted reusable environment template." }, - "PersistedAgentToolResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/PersistedAgentToolResourceFunction" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolResourceToolSearch" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolResourceMcp" - }, - { - "$ref": "#/components/schemas/PersistedAgentToolResourceWebSearch" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "function": "#/components/schemas/PersistedAgentToolResourceFunction", - "tool_search": "#/components/schemas/PersistedAgentToolResourceToolSearch", - "programmatic_tool_calling": "#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling", - "mcp": "#/components/schemas/PersistedAgentToolResourceMcp", - "web_search": "#/components/schemas/PersistedAgentToolResourceWebSearch" - } - }, - "x-oai-discriminator-values": [ - "function", - "tool_search", - "programmatic_tool_calling", - "mcp", - "web_search" + "SessionReviewResource": { + "type": "string", + "enum": [ + "none", + "auto_review" ], - "description": "A credential-free tool available to a reusable agent." + "description": "The configured action review mode." }, - "MultiAgentConfigResource": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether subagent tools are enabled. Defaults to false." - }, - "max_concurrent_subagents": { - "type": [ - "integer", - "null" - ], - "format": "int64", - "minimum": 1, - "maximum": 4294967295, - "description": "Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled." - } - }, - "required": [ - "enabled", - "max_concurrent_subagents" + "SessionStatusResource": { + "type": "string", + "enum": [ + "idle", + "in_progress", + "requires_action", + "failed" ], - "additionalProperties": false, - "description": "The resolved configuration for creating and coordinating subagents." + "x-enumDescriptions": [ + "The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.", + "The session is processing a turn.", + "The session is waiting for one or more required actions.", + "The session failed." + ], + "description": "The current status of a session." }, - "AgentResource": { + "ComputerUseApprovalRequestKindResourceBrowserAuthentication": { "type": "object", "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the reusable agent." - }, - "object": { + "type": { "type": "string", "enum": [ - "agent" + "browser_authentication" ], - "default": "agent", + "default": "browser_authentication", "x-stainless-const": true, - "description": "The object type. Always `agent`." + "description": "The type of the object. Always `browser_authentication`." }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the agent was created." - }, - "updated_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the agent was last updated." - }, - "name": { + "reason": { "type": [ "string", "null" ], "minLength": 0, - "description": "A human-readable name for the agent, or null if it is unnamed." - }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string", - "minLength": 0 - }, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "Custom string key-value pairs attached to the agent." - }, - "model": { - "type": "string", - "minLength": 0, - "description": "The requested model name used for inference." - }, - "reasoning": { - "$ref": "#/components/schemas/ReasoningResource", - "description": "The resolved reasoning configuration, including the model default for an omitted effort." - }, - "text": { - "$ref": "#/components/schemas/TextResource", - "description": "The resolved configuration for text generated by the agent." - }, - "service_tier": { - "$ref": "#/components/schemas/ServiceTierResource", - "description": "The resolved service-tier policy used for model requests." + "description": "Why the agent needs the user to sign in." }, - "instructions": { + "credential_origin": { "type": [ "string", "null" ], "minLength": 0, - "description": "Custom instructions appended to the agent's default base instructions." + "description": "The registered form or frame origin where values will be entered." }, - "tools": { + "fields": { "type": "array", "items": { - "$ref": "#/components/schemas/PersistedAgentToolResource" + "$ref": "#/components/schemas/BrowserAuthenticationFieldResource" }, "minItems": 0, "maxItems": 2000, - "description": "Tools available to the agent." + "description": "Controls to render. All submitted values are sensitive." }, - "multi_agent": { - "$ref": "#/components/schemas/MultiAgentConfigResource", - "description": "The resolved configuration for creating and coordinating subagents." + "options": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BrowserAuthenticationOptionResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Sign-in methods. Empty for a plain form." } }, "required": [ - "id", - "object", - "created_at", - "updated_at", - "name", - "metadata", - "model", - "reasoning", - "text", - "service_tier", - "instructions", - "tools", - "multi_agent" + "type", + "reason", + "credential_origin", + "fields", + "options" ], "additionalProperties": false, - "description": "A reusable agent scoped to the caller's project." + "description": "A registered form awaiting the application's response." }, - "AgentListResource": { + "ComputerUseApprovalRequestKindResourceBrowserOriginAccess": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "browser_origin_access" ], - "default": "list", + "default": "browser_origin_access", "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AgentResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." + "description": "The type of the object. Always `browser_origin_access`." }, - "first_id": { + "reason": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "description": "The browser's explanation for this request, or null when unavailable." }, - "last_id": { - "type": [ - "string", - "null" - ], + "origin": { + "type": "string", "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." - }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "description": "The origin the browser needs permission to access." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type", + "reason", + "origin" ], "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." - }, - "ReasoningEffortParam": { - "type": "string", - "enum": [ - "none", - "minimal", - "low", - "medium", - "high", - "xhigh", - "max" - ], - "description": "The amount of reasoning effort the model should use." + "description": "A browser origin awaiting the application's approval decision." }, - "ReasoningSummaryParam": { - "type": "string", - "enum": [ - "concise", - "detailed", - "auto" - ], - "x-enumDescriptions": [ - "Returns a concise reasoning summary when supported.", - "Returns a detailed reasoning summary when supported.", - "Automatically selects the most detailed summary supported by the model." + "ComputerUseApprovalRequestKindResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserAuthentication" + }, + { + "$ref": "#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserOriginAccess" + } ], - "description": "The reasoning summary format requested from the model." + "discriminator": { + "propertyName": "type", + "mapping": { + "browser_authentication": "#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserAuthentication", + "browser_origin_access": "#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserOriginAccess" + } + }, + "x-oai-discriminator-values": [ + "browser_authentication", + "browser_origin_access" + ] }, - "ReasoningParam": { + "SessionRequiredActionResourceComputerUseApprovalRequest": { "type": "object", "properties": { - "effort": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningEffortParam" - }, - { - "type": "null" - } + "type": { + "type": "string", + "enum": [ + "computer_use_approval_request" ], - "description": "The amount of reasoning effort the model should use. Omission lets the model select it." + "default": "computer_use_approval_request", + "x-stainless-const": true, + "description": "The type of the object. Always `computer_use_approval_request`." }, - "summary": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningSummaryParam" - }, - { - "type": "null" - } - ], - "description": "Controls whether the response includes a reasoning summary." + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The turn that requested approval." + }, + "request_id": { + "type": "string", + "minLength": 0, + "description": "The registered request ID to echo when responding." + }, + "request": { + "$ref": "#/components/schemas/ComputerUseApprovalRequestKindResource", + "description": "The information needed to render the request." } }, + "required": [ + "type", + "turn_id", + "request_id", + "request" + ], "additionalProperties": false, - "description": "Reasoning configuration for the agent." + "description": "Respond to a computer-use request." }, - "TextFormatParamText": { + "SessionRequiredActionResourceFunctionCall": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "text" + "function_call" ], - "default": "text", + "default": "function_call", "x-stainless-const": true, - "description": "The type of the object. Always `text`." + "description": "The type of the object. Always `function_call`." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn that requested the function call." + }, + "call_id": { + "type": "string", + "minLength": 0, + "description": "The ID to include when submitting the function result." + }, + "name": { + "type": "string", + "minLength": 0, + "description": "The function name." + }, + "arguments": { + "description": "The arguments supplied by the model." } }, "required": [ - "type" + "type", + "turn_id", + "call_id", + "name", + "arguments" ], "additionalProperties": false, - "description": "Generates ordinary text without a structured-output constraint." + "description": "Run a function tool and submit its result." }, - "TextFormatParamJsonSchema": { + "SessionRequiredActionResourceEnvironmentConnection": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "json_schema" + "environment_connection" ], - "default": "json_schema", + "default": "environment_connection", "x-stainless-const": true, - "description": "The type of the object. Always `json_schema`." + "description": "The type of the object. Always `environment_connection`." }, - "schema": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "The JSON Schema that generated text must match." + "environment_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the environment to reconnect." } }, "required": [ "type", - "schema" + "environment_id" ], "additionalProperties": false, - "description": "Constrains generated text to a JSON Schema." + "description": "Reconnect a session environment." }, - "TextFormatParam": { + "SessionRequiredActionResource": { "oneOf": [ { - "$ref": "#/components/schemas/TextFormatParamText" + "$ref": "#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest" }, { - "$ref": "#/components/schemas/TextFormatParamJsonSchema" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "text": "#/components/schemas/TextFormatParamText", - "json_schema": "#/components/schemas/TextFormatParamJsonSchema" - } - }, - "x-oai-discriminator-values": [ - "text", - "json_schema" - ], - "description": "The output format for generated text." - }, - "VerbosityParam": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ], - "x-enumDescriptions": [ - "Produces less text.", - "Uses the default amount of text.", - "Produces more text." - ], - "description": "The amount of text the model should produce." - }, - "TextParam": { - "type": "object", - "properties": { - "format": { - "anyOf": [ - { - "$ref": "#/components/schemas/TextFormatParam" - }, - { - "type": "null" - } - ], - "description": "The output format. Omission uses ordinary text (`{\"type\": \"text\"}`)." + "$ref": "#/components/schemas/SessionRequiredActionResourceFunctionCall" }, - "verbosity": { - "anyOf": [ - { - "$ref": "#/components/schemas/VerbosityParam" - }, - { - "type": "null" - } - ], - "description": "The amount of text the model should produce. Defaults to `medium`, matching Responses." + { + "$ref": "#/components/schemas/SessionRequiredActionResourceEnvironmentConnection" } - }, - "additionalProperties": false, - "description": "Configuration for text generated by the agent." - }, - "ServiceTierParam": { - "type": "string", - "enum": [ - "auto", - "default", - "flex", - "priority", - "fast" ], - "x-enumDescriptions": [ - "Selects the service tier automatically.", - "Uses the default service tier.", - "Uses the flex service tier.", - "Uses the priority service tier.", - "Uses the fast service tier." + "discriminator": { + "propertyName": "type", + "mapping": { + "computer_use_approval_request": "#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest", + "function_call": "#/components/schemas/SessionRequiredActionResourceFunctionCall", + "environment_connection": "#/components/schemas/SessionRequiredActionResourceEnvironmentConnection" + } + }, + "x-oai-discriminator-values": [ + "computer_use_approval_request", + "function_call", + "environment_connection" ], - "description": "The service tier used for model requests." + "description": "An action that must be completed before a session can continue." }, - "PersistedAgentToolConfigParamFunction": { + "SessionAgentResource": { "type": "object", "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "function" - ], - "default": "function", - "x-stainless-const": true, - "description": "The type of the object. Always `function`." + "minLength": 0, + "description": "The ID of the agent." }, "name": { - "type": "string", + "type": [ + "string", + "null" + ], "minLength": 0, - "maxLength": 1048576, - "description": "The name of the function." + "description": "The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value." }, - "description": { + "model": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "A description of what the function does." + "description": "The model used by the agent." }, - "parameters": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 + "reasoning": { + "$ref": "#/components/schemas/ReasoningResource", + "description": "The agent's reasoning configuration." + }, + "text": { + "$ref": "#/components/schemas/TextResource", + "description": "Configuration for text generated by the agent." + }, + "service_tier": { + "$ref": "#/components/schemas/ServiceTierResource", + "description": "The effective service-tier policy for model requests. Defaults to `auto`." + }, + "instructions": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "Custom instructions appended to the agent's default base instructions." + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AgentToolResource" }, - "minProperties": 0, - "maxProperties": 1024, - "description": "A JSON Schema object describing the function's arguments." + "minItems": 0, + "maxItems": 2000, + "description": "Tools available to the agent." }, - "defer_loading": { - "type": "boolean", - "default": false, - "description": "Whether this function is deferred and discovered through tool search. Defaults to `false`." + "multi_agent": { + "$ref": "#/components/schemas/MultiAgentConfigResource", + "description": "Configuration for creating and coordinating subagents." + }, + "compaction": { + "$ref": "#/components/schemas/CompactionResource", + "description": "The effective context compaction settings." + }, + "experimental": { + "$ref": "#/components/schemas/ExperimentalConfigResource", + "description": "The effective experimental settings for the agent." } }, "required": [ - "type", + "id", "name", - "description", - "parameters" - ], - "additionalProperties": false, - "description": "A function defined by the application." - }, - "PersistedAgentToolConfigParamToolSearch": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "tool_search" - ], - "default": "tool_search", - "x-stainless-const": true, - "description": "The type of the object. Always `tool_search`." - } - }, - "required": [ - "type" + "model", + "reasoning", + "text", + "service_tier", + "instructions", + "tools", + "multi_agent" ], "additionalProperties": false, - "description": "Discovers deferred function tools and loads them into the model context." + "description": "The effective agent configuration for a session." }, - "PersistedAgentToolConfigParamProgrammaticToolCalling": { + "EnvironmentResourceNone": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "programmatic_tool_calling" + "none" ], - "default": "programmatic_tool_calling", + "default": "none", "x-stainless-const": true, - "description": "The type of the object. Always `programmatic_tool_calling`." - }, - "enabled": { - "type": "boolean", - "default": true, - "description": "Whether tools can be called from model-generated code. Defaults to `true`." + "description": "The type of the object. Always `none`." } }, "required": [ "type" ], "additionalProperties": false, - "description": "Enables calling tools from model-generated code." + "description": "The session talks to CCA without selecting or provisioning an execution environment." }, - "PersistedMcpTransportConfigParamHttp": { + "EnvironmentResourceOpenaiHosted": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "http" + "openai_hosted" ], - "default": "http", + "default": "openai_hosted", "x-stainless-const": true, - "description": "The type of the object. Always `http`." + "description": "The type of the object. Always `openai_hosted`." }, - "server_url": { + "id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The URL of the MCP server." + "description": "The public ID of the environment." }, - "headers": { - "type": [ - "object", - "null" + "container_size": { + "anyOf": [ + { + "$ref": "#/components/schemas/ContainerSizeResource" + }, + { + "type": "null" + } ], - "additionalProperties": { + "description": "The effective CPU and memory tier, or null when unknown or outside the public tiers." + }, + "packages": { + "$ref": "#/components/schemas/EnvironmentPackagesResource", + "description": "Packages installed in the environment." + }, + "network": { + "$ref": "#/components/schemas/NetworkPolicyResource", + "description": "The effective network access policy for the environment." + }, + "desktop": { + "$ref": "#/components/schemas/DesktopResource", + "description": "The effective desktop configuration." + }, + "capability_directories": { + "type": "array", + "items": { "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 0 }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 + "minItems": 0, + "maxItems": 2000, + "description": "Directories that contain capabilities exposed to the agent." + }, + "skills": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedSkillResource" }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Non-secret HTTP headers sent to the MCP server." + "minItems": 0, + "maxItems": 2000, + "description": "Skills installed in the environment, excluding their archive contents." + }, + "plugins": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedPluginResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Plugins installed in the environment, excluding their archive contents." + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HostedEnvironmentFileResource" + }, + "minItems": 0, + "maxItems": 50, + "description": "Files available in the environment, excluding their contents." } }, "required": [ "type", - "server_url" + "id", + "packages", + "network", + "desktop", + "capability_directories", + "skills", + "plugins", + "files" ], "additionalProperties": false, - "description": "Connects to an MCP server over HTTP." + "description": "An environment hosted by OpenAI." }, - "PersistedMcpTransportConfigParamStdio": { + "EnvironmentResourceSelfHosted": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "stdio" + "self_hosted" ], - "default": "stdio", + "default": "self_hosted", "x-stainless-const": true, - "description": "The type of the object. Always `stdio`." + "description": "The type of the object. Always `self_hosted`." }, - "command": { + "remote_url": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The command used to start the MCP server." + "description": "Pass this URL unchanged to `codex exec-server --remote` when connecting this environment." }, - "args": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Arguments passed to the MCP server command." + "id": { + "type": "string", + "minLength": 0, + "description": "The public ID of the environment." }, - "cwd": { + "workspace_directory": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The working directory used to start the MCP server." + "description": "The absolute project directory inside the environment. Defaults to `/workspace`." }, - "env_vars": { - "type": [ - "array", - "null" - ], + "capability_directories": { + "type": "array", "items": { "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 0 }, "minItems": 0, - "maxItems": 16384, - "description": "Environment variable names to inherit from the selected execution environment." + "maxItems": 2000, + "description": "Directories that contain capabilities exposed to the agent." } }, "required": [ "type", - "command", - "cwd" + "remote_url", + "id", + "workspace_directory", + "capability_directories" ], "additionalProperties": false, - "description": "Starts an MCP server as a local process." + "description": "An environment hosted by the application." }, - "PersistedMcpTransportConfigParam": { + "EnvironmentResource": { "oneOf": [ { - "$ref": "#/components/schemas/PersistedMcpTransportConfigParamHttp" + "$ref": "#/components/schemas/EnvironmentResourceNone" }, { - "$ref": "#/components/schemas/PersistedMcpTransportConfigParamStdio" + "$ref": "#/components/schemas/EnvironmentResourceOpenaiHosted" + }, + { + "$ref": "#/components/schemas/EnvironmentResourceSelfHosted" } ], "discriminator": { "propertyName": "type", "mapping": { - "http": "#/components/schemas/PersistedMcpTransportConfigParamHttp", - "stdio": "#/components/schemas/PersistedMcpTransportConfigParamStdio" + "none": "#/components/schemas/EnvironmentResourceNone", + "openai_hosted": "#/components/schemas/EnvironmentResourceOpenaiHosted", + "self_hosted": "#/components/schemas/EnvironmentResourceSelfHosted" } }, "x-oai-discriminator-values": [ - "http", - "stdio" - ], - "description": "A credential-free transport used to connect to an MCP server." - }, - "McpConnectionOriginParam": { - "type": "string", - "enum": [ - "service", - "environment" - ], - "x-enumDescriptions": [ - "Uses the Managed Agents service network.", - "Uses the session's execution environment." + "none", + "openai_hosted", + "self_hosted" ], - "description": "Where outbound MCP HTTP connections originate." + "description": "The execution environment for a session." }, - "PersistedAgentToolConfigParamMcp": { + "SessionResource": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "mcp" - ], - "default": "mcp", - "x-stainless-const": true, - "description": "The type of the object. Always `mcp`." - }, - "server_label": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "A label used to identify the MCP server in tool calls." - }, - "credential_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL." - }, - "transport": { - "$ref": "#/components/schemas/PersistedMcpTransportConfigParam", - "description": "The credential-free transport used to connect to the MCP server." + "review": { + "$ref": "#/components/schemas/SessionReviewResource", + "description": "Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none." }, - "request_metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": {}, - "propertyNames": { + "metadata": { + "type": "object", + "additionalProperties": { "type": "string", - "minLength": 1, - "maxLength": 256 + "minLength": 0 }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Metadata included with requests to this MCP server." - }, - "allowed_tools": { - "type": [ - "array", - "null" - ], - "items": { + "propertyNames": { "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 0 }, - "minItems": 0, - "maxItems": 16384, - "description": "The MCP tools the agent may call. All server tools are allowed when omitted." - }, - "required": { - "type": "boolean", - "default": false, - "description": "Whether this MCP server must initialize before the first turn. Defaults to `false`." - }, - "connection_origin": { - "anyOf": [ - { - "$ref": "#/components/schemas/McpConnectionOriginParam" - }, - { - "type": "null" - } - ], - "description": "Selects where outbound MCP HTTP connections originate." - } - }, - "required": [ - "type", - "server_label", - "transport" - ], - "additionalProperties": false, - "description": "Tools provided by a remote MCP server without stored credentials." - }, - "WebSearchModeParam": { - "type": "string", - "enum": [ - "disabled", - "cached", - "live" - ], - "x-enumDescriptions": [ - "Disables web search.", - "Uses cached search results.", - "Searches the live web." - ], - "description": "The source used for web search results." - }, - "WebSearchContextSizeParam": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ], - "description": "The amount of web search context made available to the model." - }, - "WebSearchLocationParam": { - "type": "object", - "properties": { - "country": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The two-letter ISO country code, such as `US`." - }, - "region": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The region or state name." + "minProperties": 0, + "description": "Custom string key-value pairs attached to the session." }, - "city": { - "type": [ - "string", - "null" - ], + "id": { + "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The city name." + "description": "The ID of the session." }, - "timezone": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The IANA timezone, such as `America/Los_Angeles`." - } - }, - "additionalProperties": false, - "description": "Approximate user location used to localize web search results." - }, - "PersistedAgentToolConfigParamWebSearch": { - "type": "object", - "properties": { - "type": { + "object": { "type": "string", "enum": [ - "web_search" + "agent.session" ], - "default": "web_search", + "default": "agent.session", "x-stainless-const": true, - "description": "The type of the object. Always `web_search`." + "description": "The object type. Always `agent.session`." }, - "mode": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchModeParam" - }, - { - "type": "null" - } - ], - "description": "The source used for web search results. Defaults to `live`." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the session was created." }, - "context_size": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchContextSizeParam" - }, - { - "type": "null" - } - ], - "description": "The amount of search context made available to the model. Defaults to `medium`." + "last_active_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the session was last active." }, - "allowed_domains": { + "status": { + "$ref": "#/components/schemas/SessionStatusResource", + "description": "The current status of the session." + }, + "required_actions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionRequiredActionResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "Actions that must be completed before the session can continue." + }, + "error": { + "description": "The error that caused the session to fail, if any.", "type": [ - "array", + "string", "null" ], + "minLength": 0 + }, + "agent": { + "$ref": "#/components/schemas/SessionAgentResource", + "description": "The agent running in the session." + }, + "environment": { + "$ref": "#/components/schemas/EnvironmentResource", + "description": "The execution environment for the session." + }, + "vault_ids": { + "type": "array", "items": { "type": "string", - "minLength": 0, - "maxLength": 1048576 + "minLength": 0 }, "minItems": 0, - "maxItems": 16384, - "description": "Domains the search may include." + "maxItems": 2000, + "description": "The IDs of vaults made available to the session." }, - "location": { + "usage": { "anyOf": [ { - "$ref": "#/components/schemas/WebSearchLocationParam" + "$ref": "#/components/schemas/TokenUsageResource" }, { "type": "null" } ], - "description": "Approximate location used to localize search results." + "description": "Best-effort token usage for the session, or null if unknown. Recorded usage may change." } }, "required": [ - "type" + "metadata", + "id", + "object", + "created_at", + "last_active_at", + "status", + "required_actions", + "error", + "agent", + "environment", + "vault_ids", + "usage" ], "additionalProperties": false, - "description": "Web search." + "description": "A Managed Agents session." }, - "PersistedAgentToolConfigParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamFunction" + "SessionListResource": { + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "default": "list", + "x-stainless-const": true, + "description": "The object type, which is always `list`." }, - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamToolSearch" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." }, - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling" + "first_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamMcp" + "last_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, - { - "$ref": "#/components/schemas/PersistedAgentToolConfigParamWebSearch" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "function": "#/components/schemas/PersistedAgentToolConfigParamFunction", - "tool_search": "#/components/schemas/PersistedAgentToolConfigParamToolSearch", - "programmatic_tool_calling": "#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling", - "mcp": "#/components/schemas/PersistedAgentToolConfigParamMcp", - "web_search": "#/components/schemas/PersistedAgentToolConfigParamWebSearch" + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, - "x-oai-discriminator-values": [ - "function", - "tool_search", - "programmatic_tool_calling", - "mcp", - "web_search" + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" ], - "description": "A tool that can be stored on a reusable agent without session credentials." + "additionalProperties": false, + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "MultiAgentConfigCurrentParam": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "description": "Whether subagent tools are enabled." + "SessionReviewParam": { + "type": "string", + "enum": [ + "none", + "auto_review" + ], + "x-enumDescriptions": [ + "Keep the existing execution behavior without automatic action review.", + "Review eligible actions automatically. Deny manual approval fallbacks." + ], + "description": "Review applied to eligible actions in a session." + }, + "CreateSessionInputParam": { + "oneOf": [ + { + "type": "string", + "minLength": 1, + "maxLength": 1048576 }, - "max_concurrent_subagents": { - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 4294967295, - "description": "Maximum number of subagents that may run concurrently. Defaults to 6." + { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputMessageParam" + }, + "minItems": 0, + "maxItems": 16384 } - }, - "required": [ - "enabled" ], - "additionalProperties": false, - "description": "Explicit configuration for creating and coordinating subagents." + "description": "Initial input submitted when creating a session." }, - "CreateAgentParams": { + "CreateAgentSessionParams": { "type": "object", "properties": { + "review": { + "$ref": "#/components/schemas/SessionReviewParam", + "description": "Action review mode. Omit to use none." + }, "metadata": { "type": [ "object", @@ -80339,2246 +106945,2205 @@ "maxProperties": 16, "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map." }, - "name": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 128, - "description": "A human-readable name for the agent. Omission or null leaves the agent unnamed." + "agent": { + "$ref": "#/components/schemas/SessionAgentConfigParam", + "description": "Agent configuration. With `agent_id`, supplied fields override the saved agent for this session. Without `agent_id`, `model` is required." }, - "model": { + "agent_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The model to use for the agent. The requested model name is preserved." - }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for model reasoning. Omission uses the model's default effort." - }, - "text": { - "anyOf": [ - { - "$ref": "#/components/schemas/TextParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for generated text. Defaults to the `text` format and medium verbosity." - }, - "service_tier": { - "anyOf": [ - { - "$ref": "#/components/schemas/ServiceTierParam" - }, - { - "type": "null" - } - ], - "description": "The service tier used for model requests. Defaults to `auto`." + "maxLength": 64, + "description": "The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged." }, - "instructions": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions." + "environment": { + "$ref": "#/components/schemas/EnvironmentParam", + "description": "An inline execution environment or a reference to an environment template." }, - "tools": { + "vault_ids": { "type": [ "array", "null" ], "items": { - "$ref": "#/components/schemas/PersistedAgentToolConfigParam" + "type": "string", + "minLength": 0, + "maxLength": 1048576 }, "minItems": 0, - "maxItems": 2000, - "description": "Tools available to the agent. Defaults to an empty list." + "maxItems": 16384, + "description": "The IDs of vaults made available to the session." }, - "multi_agent": { + "input": { "anyOf": [ { - "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" + "$ref": "#/components/schemas/CreateSessionInputParam" }, { "type": "null" } ], - "description": "Configuration for creating and coordinating subagents. Subagent tools are disabled by default." + "description": "Initial input to submit when the session is created. A string is shorthand for a single user message. Required when `environment.type` is `none`, or when `stream` is `true` for an environment that is not `self_hosted`; optional for self-hosted and non-streaming execution environments." + }, + "stream": { + "type": "boolean", + "default": false, + "description": "Whether to stream session events as server-sent events. Defaults to `false`." } }, "required": [ - "model" + "environment" ], "additionalProperties": false, - "description": "Parameters for creating a reusable agent." + "description": "Parameters for creating a Managed Agents session." }, - "UpdateAgentParams": { + "SessionEventAgentSessionTurnReasoningSummaryTextDelta": { "type": "object", "properties": { - "model": { + "type": { "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The model to use for the agent. The requested model name is preserved." - }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningParam" - }, - { - "type": "null" - } + "enum": [ + "agent.session.turn.reasoning_summary_text.delta" ], - "description": "Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort." + "default": "agent.session.turn.reasoning_summary_text.delta", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`." }, - "text": { - "anyOf": [ - { - "$ref": "#/components/schemas/TextParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for text generated by the agent." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "service_tier": { - "anyOf": [ - { - "$ref": "#/components/schemas/ServiceTierParam" - }, - { - "type": "null" - } - ], - "description": "The service tier used for model requests." + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." }, - "instructions": { + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 1048576, - "description": "Additional instructions appended to the agent's default base instructions. Omit to leave unchanged." + "description": "The ID of the turn associated with the event, when applicable." }, - "multi_agent": { - "anyOf": [ - { - "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for creating and coordinating subagents." + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the reasoning item." }, - "metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 512 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 64 - }, - "minProperties": 0, - "maxProperties": 16, - "description": "Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." }, - "name": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 128, - "description": "A replacement name. Omit to leave unchanged, or pass null to clear it." + "summary_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the summary content part." }, - "tools": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/PersistedAgentToolConfigParam" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Tools available to the agent." + "delta": { + "type": "string", + "minLength": 0, + "description": "The summary text that was appended." } }, + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "summary_index", + "delta" + ], "additionalProperties": false, - "description": "Fields to replace on an existing reusable agent." + "description": "Emitted when text is appended to a reasoning summary." }, - "DeletedAgentResource": { + "SessionEventAgentSessionTurnReasoningSummaryPartDone": { "type": "object", "properties": { - "id": { + "type": { + "type": "string", + "enum": [ + "agent.session.turn.reasoning_summary_part.done" + ], + "default": "agent.session.turn.reasoning_summary_part.done", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.turn.reasoning_summary_part.done`." + }, + "event_id": { "type": "string", "minLength": 0, - "description": "The ID of the deleted agent." + "description": "The unique ID of the event." }, - "object": { + "session_id": { "type": "string", - "enum": [ - "agent.deleted" + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" ], - "default": "agent.deleted", - "x-stainless-const": true, - "description": "The object type. Always `agent.deleted`." + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "deleted": { - "type": "boolean", - "description": "Whether the agent was deleted. Always `true`." - } - }, - "required": [ - "id", - "object", - "deleted" - ], - "additionalProperties": false, - "description": "A deleted reusable agent." - }, - "EnvironmentPackagesResource": { - "type": "object", - "properties": { - "python": { - "type": "array", - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Python packages installed in the environment." + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the reasoning item." }, - "system": { - "type": "array", - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "System packages installed in the environment." + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." }, - "npm": { - "type": "array", - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "npm packages installed globally in the environment." - } - }, - "required": [ - "python", - "system", - "npm" - ], - "additionalProperties": false, - "description": "Packages installed in an OpenAI-hosted environment." - }, - "NetworkAccessResource": { - "type": "string", - "enum": [ - "enabled", - "disabled", - "restricted" - ], - "x-enumDescriptions": [ - "Allows unrestricted network access.", - "Disables network access.", - "Allows access only to configured domains." - ], - "description": "The network access mode for an OpenAI-hosted environment." - }, - "NetworkPolicyResource": { - "type": "object", - "properties": { - "access": { - "$ref": "#/components/schemas/NetworkAccessResource", - "description": "The environment's network access mode." + "summary_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the summary part." }, - "allowed_domains": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Domains the environment may access when network access is restricted." + "part": { + "$ref": "#/components/schemas/SummaryTextResource", + "description": "The completed summary part." + }, + "status": { + "type": [ + "string", + "null" + ], + "enum": [ + "incomplete", + null + ], + "description": "Present as `incomplete` when summary generation was interrupted.", + "x-stainless-const": true } }, "required": [ - "access", - "allowed_domains" + "type", + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "summary_index", + "part", + "status" ], "additionalProperties": false, - "description": "Network access for an OpenAI-hosted environment." + "description": "Emitted when a reasoning summary part is complete." }, - "HostedTemplateSkillResourceSkillReference": { + "SessionEventAgentSessionTurnReasoningSummaryTextDone": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "skill_reference" + "agent.session.turn.reasoning_summary_text.done" ], - "default": "skill_reference", + "default": "agent.session.turn.reasoning_summary_text.done", "x-stainless-const": true, - "description": "The type of the object. Always `skill_reference`." + "description": "The type of the object. Always `agent.session.turn.reasoning_summary_text.done`." }, - "skill_id": { + "event_id": { "type": "string", "minLength": 0, - "description": "The referenced skill ID." + "description": "The unique ID of the event." }, - "version": { + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The requested version selector, including `latest`." + "description": "The ID of the turn associated with the event, when applicable." + }, + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the reasoning item." + }, + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." + }, + "summary_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the summary content part." + }, + "text": { + "type": "string", + "minLength": 0, + "description": "The complete reasoning summary text." } }, "required": [ "type", - "skill_id", - "version" + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "summary_index", + "text" ], "additionalProperties": false, - "description": "A skill resolved afresh from the Skills API whenever a session starts." + "description": "Emitted when a reasoning summary content part is complete." }, - "HostedTemplateSkillResourceInline": { + "SessionErrorResource": { "type": "object", "properties": { "type": { "type": "string", - "enum": [ - "inline" + "minLength": 0, + "description": "The error type." + }, + "code": { + "type": [ + "string", + "null" ], - "default": "inline", - "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "minLength": 0, + "description": "The machine-readable error code, if any." }, - "name": { + "message": { "type": "string", "minLength": 0, - "description": "The skill name declared in `SKILL.md`." + "description": "A customer-safe explanation of the error." }, - "description": { - "type": "string", + "param": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The skill description declared in `SKILL.md`." + "description": "The request parameter associated with the error, if any." } }, "required": [ "type", - "name", - "description" + "code", + "message", + "param" ], "additionalProperties": false, - "description": "Safe metadata for an inline skill archive." - }, - "HostedTemplateSkillResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/HostedTemplateSkillResourceSkillReference" - }, - { - "$ref": "#/components/schemas/HostedTemplateSkillResourceInline" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "skill_reference": "#/components/schemas/HostedTemplateSkillResourceSkillReference", - "inline": "#/components/schemas/HostedTemplateSkillResourceInline" - } - }, - "x-oai-discriminator-values": [ - "skill_reference", - "inline" - ], - "description": "Safe metadata for a skill configured by an environment template." + "description": "An error payload with the same public fields as Responses API streaming errors." }, - "HostedTemplateFileResourceFileId": { + "SessionEventError": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "file_id" + "error" ], - "default": "file_id", + "default": "error", "x-stainless-const": true, - "description": "The type of the object. Always `file_id`." + "description": "The type of the object. Always `error`." }, - "file_id": { + "event_id": { "type": "string", "minLength": 0, - "description": "The ID of the uploaded file." + "description": "The unique ID of the event." }, - "path": { + "session_id": { "type": "string", "minLength": 0, - "description": "The file's absolute path inside the environment." + "description": "The ID of the session associated with the event." + }, + "error": { + "$ref": "#/components/schemas/SessionErrorResource", + "description": "The error that occurred." } }, "required": [ "type", - "file_id", - "path" + "event_id", + "session_id", + "error" ], "additionalProperties": false, - "description": "A project-scoped Files API reference resolved separately for each session." + "description": "Emitted when a turn or session fails.", + "x-oaiMeta": { + "example": { + "type": "error", + "event_id": "event_123", + "session_id": "sess_123", + "error": { + "type": "server_error", + "code": null, + "message": "The session failed due to an internal server error.", + "param": null + } + } + } }, - "HostedTemplateFileResourceInline": { + "SessionEnvironmentStatusResource": { + "type": "string", + "enum": [ + "pending", + "ready", + "connected", + "disconnected", + "suspended", + "expired", + "failed" + ], + "x-enumDescriptions": [ + "The environment is being prepared.", + "The environment is ready to connect.", + "The environment is connected.", + "The environment is disconnected.", + "The environment is stopped and can be resumed from its private checkpoint.", + "The environment and its private checkpoint have expired.", + "The environment failed to connect." + ], + "description": "The connection status of a session environment." + }, + "SessionEnvironmentErrorResource": { "type": "object", "properties": { "type": { "type": "string", - "enum": [ - "inline" - ], - "default": "inline", - "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "minLength": 0, + "description": "The error type." }, - "path": { + "code": { "type": "string", "minLength": 0, - "description": "The file's absolute path inside the environment." + "description": "A machine-readable error code." }, - "size_bytes": { - "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The decoded size of the inline file in bytes." + "message": { + "type": "string", + "minLength": 0, + "description": "A human-readable error message." } }, "required": [ "type", - "path", - "size_bytes" + "code", + "message" ], "additionalProperties": false, - "description": "Metadata for confidential inline file contents." - }, - "HostedTemplateFileResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/HostedTemplateFileResourceFileId" - }, - { - "$ref": "#/components/schemas/HostedTemplateFileResourceInline" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "file_id": "#/components/schemas/HostedTemplateFileResourceFileId", - "inline": "#/components/schemas/HostedTemplateFileResourceInline" - } - }, - "x-oai-discriminator-values": [ - "file_id", - "inline" - ], - "description": "Safe metadata for a file configured by an environment template." + "description": "An error reported while preparing a session environment." }, - "EnvironmentTemplateResource": { + "SessionEnvironmentStateResource": { "type": "object", "properties": { "id": { "type": "string", "minLength": 0, - "description": "The ID of the reusable environment template." - }, - "name": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "An optional human-readable display name for the template." + "description": "The public ID of the environment." }, - "object": { + "type": { "type": "string", - "enum": [ - "agent.environment.template" - ], - "default": "agent.environment.template", - "x-stainless-const": true, - "description": "The object type. Always `agent.environment.template`." - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the template was created." - }, - "updated_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the template was last updated." - }, - "packages": { - "$ref": "#/components/schemas/EnvironmentPackagesResource", - "description": "Packages installed in each fresh OpenAI-hosted environment." - }, - "network": { - "$ref": "#/components/schemas/NetworkPolicyResource", - "description": "Runtime network access for each OpenAI-hosted environment." - }, - "capability_directories": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Directories that expose capabilities to the agent." - }, - "skills": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedTemplateSkillResource" - }, - "minItems": 0, - "maxItems": 200, - "description": "Safe skill metadata, preserving unresolved version selectors." + "minLength": 0, + "description": "The environment type." }, - "plugins": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedPluginResource" - }, - "minItems": 0, - "maxItems": 32, - "description": "Safe plugin metadata, excluding inline archive contents." + "status": { + "$ref": "#/components/schemas/SessionEnvironmentStatusResource", + "description": "The environment's connection status." }, - "files": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedTemplateFileResource" - }, - "minItems": 0, - "maxItems": 50, - "description": "Safe file metadata, excluding contents and session-scoped file IDs." + "error": { + "anyOf": [ + { + "$ref": "#/components/schemas/SessionEnvironmentErrorResource" + }, + { + "type": "null" + } + ], + "description": "The error reported while preparing the environment, if any." } }, "required": [ "id", - "name", - "object", - "created_at", - "updated_at", - "packages", - "network", - "capability_directories", - "skills", - "plugins", - "files" + "type", + "status", + "error" ], "additionalProperties": false, - "description": "Reusable configuration that provisions a fresh OpenAI-hosted environment for each session." + "description": "The current state of a session environment." }, - "EnvironmentTemplateListResource": { + "SessionEventAgentSessionEnvironmentReady": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "agent.session.environment.ready" ], - "default": "list", + "default": "agent.session.environment.ready", "x-stainless-const": true, - "description": "The object type, which is always `list`." + "description": "The type of the object. Always `agent.session.environment.ready`." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EnvironmentTemplateResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "first_id": { - "type": [ - "string", - "null" - ], + "session_id": { + "type": "string", "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "description": "The ID of the session associated with the event." }, - "last_id": { + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "description": "The ID of the turn associated with the event, when applicable." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type", + "event_id", + "session_id", + "turn_id", + "environment" ], "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "description": "Emitted when a hosted session environment is ready to connect." }, - "EnvironmentPackagesParam": { + "SessionEventAgentSessionEnvironmentSuspended": { "type": "object", "properties": { - "python": { - "type": [ - "array", - "null" + "type": { + "type": "string", + "enum": [ + "agent.session.environment.suspended" ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Python packages to install. Defaults to an empty list." + "default": "agent.session.environment.suspended", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.environment.suspended`." }, - "system": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "System packages to install. Defaults to an empty list." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "npm": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "npm packages to install globally. Defaults to an empty list." - } - }, - "additionalProperties": false, - "description": "Packages to install in an OpenAI-hosted environment." - }, - "SetupCommandParam": { - "type": "object", - "properties": { - "command": { + "session_id": { "type": "string", "minLength": 0, - "maxLength": 65536, - "description": "The shell command to execute." + "description": "The ID of the session associated with the event." }, - "cwd": { + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 4096, - "description": "The absolute working directory. Defaults to `/workspace`." - } - }, - "required": [ - "command" - ], - "additionalProperties": false, - "description": "A confidential setup command executed before the hosted agent starts." - }, - "NetworkAccessParam": { - "type": "string", - "enum": [ - "enabled", - "disabled", - "restricted" - ], - "x-enumDescriptions": [ - "Allows unrestricted network access, matching an omitted network policy.", - "Disables network access.", - "Allows access only to configured domains." - ], - "description": "The network access mode for an OpenAI-hosted environment." - }, - "NetworkPolicyParam": { - "type": "object", - "properties": { - "access": { - "$ref": "#/components/schemas/NetworkAccessParam", - "description": "The environment's network access mode." + "description": "The ID of the turn associated with the event, when applicable." }, - "allowed_domains": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Domains the environment may access when network access is restricted." + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." } }, "required": [ - "access" + "type", + "event_id", + "session_id", + "turn_id", + "environment" ], "additionalProperties": false, - "description": "Network access for an OpenAI-hosted environment." + "description": "Emitted after an idle hosted session environment is checkpointed and stopped." }, - "HostedSkillParamSkillReference": { + "SessionEventAgentSessionEnvironmentExpired": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "skill_reference" + "agent.session.environment.expired" ], - "default": "skill_reference", + "default": "agent.session.environment.expired", "x-stainless-const": true, - "description": "The type of the object. Always `skill_reference`." + "description": "The type of the object. Always `agent.session.environment.expired`." }, - "skill_id": { + "event_id": { "type": "string", - "minLength": 1, - "maxLength": 64, - "description": "The ID of the skill created through `/v1/skills`." + "minLength": 0, + "description": "The unique ID of the event." }, - "version": { + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 1048576, - "description": "The skill version, a positive integer or `latest`; omission selects the default." + "description": "The ID of the turn associated with the event, when applicable." + }, + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." } }, "required": [ "type", - "skill_id" + "event_id", + "session_id", + "turn_id", + "environment" ], "additionalProperties": false, - "description": "References a skill uploaded through the Skills API." + "description": "Emitted after a suspended hosted session environment and its checkpoint expire." }, - "InlineCapabilitySourceParamBase64": { + "SessionEventAgentSessionEnvironmentReset": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "base64" + "agent.session.environment.reset" ], - "default": "base64", + "default": "agent.session.environment.reset", "x-stainless-const": true, - "description": "The type of the object. Always `base64`." + "description": "The type of the object. Always `agent.session.environment.reset`." }, - "media_type": { + "event_id": { "type": "string", - "enum": [ - "application/zip" - ], - "default": "application/zip", - "x-stainless-const": true, - "x-enumDescriptions": [ - "A ZIP archive." + "minLength": 0, + "description": "The unique ID of the event." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" ], - "description": "The archive media type, always `application/zip`." + "minLength": 0, + "description": "The associated turn, when applicable." }, - "data": { + "environment_id": { "type": "string", - "minLength": 1, - "maxLength": 70254592, - "description": "Standard-base64 encoded ZIP archive bytes." + "minLength": 0, + "description": "The stable environment ID, retained across sandbox replacements." + }, + "reset_count": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "Monotonically increasing reset number. Repeated notifications share this number." } }, "required": [ "type", - "media_type", - "data" + "event_id", + "session_id", + "turn_id", + "environment_id", + "reset_count" ], "additionalProperties": false, - "description": "Provides ZIP bytes encoded with standard base64." - }, - "InlineCapabilitySourceParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/InlineCapabilitySourceParamBase64" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "base64": "#/components/schemas/InlineCapabilitySourceParamBase64" - } - }, - "x-oai-discriminator-values": [ - "base64" - ], - "description": "The encoded ZIP archive for an inline skill or plugin." + "description": "Emitted after a hosted sandbox is replaced. Conversation history survives; changes to the previous sandbox's files and processes do not." }, - "HostedSkillParamInline": { + "SessionEventAgentOutputCommandExecutionOutputDelta": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "agent.output.command_execution_output.delta" ], - "default": "inline", + "default": "agent.output.command_execution_output.delta", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." + "description": "The type of the object. Always `agent.output.command_execution_output.delta`." }, - "name": { + "event_id": { "type": "string", - "minLength": 1, - "maxLength": 64, - "description": "The skill name declared in `SKILL.md`." + "minLength": 0, + "description": "The unique ID of the event." }, - "description": { + "session_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The skill description declared in `SKILL.md`." + "description": "The ID of the session associated with the event." }, - "source": { - "$ref": "#/components/schemas/InlineCapabilitySourceParam", - "description": "The inline ZIP archive." + "turn_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." + }, + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the command execution item." + }, + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." + }, + "delta": { + "type": "string", + "minLength": 0, + "description": "The output text that was appended." } }, "required": [ "type", - "name", - "description", - "source" + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "delta" ], "additionalProperties": false, - "description": "Supplies a skill ZIP directly in the session request." - }, - "HostedSkillParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/HostedSkillParamSkillReference" - }, - { - "$ref": "#/components/schemas/HostedSkillParamInline" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "skill_reference": "#/components/schemas/HostedSkillParamSkillReference", - "inline": "#/components/schemas/HostedSkillParamInline" - } - }, - "x-oai-discriminator-values": [ - "skill_reference", - "inline" - ], - "description": "A skill installed in an OpenAI-hosted environment." + "description": "Emitted when command execution produces an output delta." }, - "HostedPluginParamInline": { + "SessionEventAgentSessionCreated": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "inline" + "agent.session.created" ], - "default": "inline", + "default": "agent.session.created", "x-stainless-const": true, - "description": "The type of the object. Always `inline`." - }, - "name": { - "type": "string", - "minLength": 1, - "maxLength": 64, - "description": "The plugin name declared in `.codex-plugin/plugin.json`." + "description": "The type of the object. Always `agent.session.created`." }, - "description": { + "event_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The plugin description declared in `.codex-plugin/plugin.json`." + "description": "The unique ID of the event." }, - "source": { - "$ref": "#/components/schemas/InlineCapabilitySourceParam", - "description": "The inline ZIP archive." + "session": { + "$ref": "#/components/schemas/SessionResource", + "description": "The session that was created." } }, "required": [ "type", - "name", - "description", - "source" + "event_id", + "session" ], "additionalProperties": false, - "description": "Supplies a plugin ZIP directly in the session request." - }, - "HostedPluginParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/HostedPluginParamInline" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "inline": "#/components/schemas/HostedPluginParamInline" - } - }, - "x-oai-discriminator-values": [ - "inline" - ], - "description": "A plugin installed in an OpenAI-hosted environment." + "description": "Emitted when a session is created." }, - "CreateEnvironmentTemplateParams": { + "SessionEventAgentSessionTurnCreated": { "type": "object", "properties": { - "packages": { - "anyOf": [ - { - "$ref": "#/components/schemas/EnvironmentPackagesParam" - }, - { - "type": "null" - } - ], - "description": "Packages to install in the environment. Defaults to empty package lists." - }, - "setup_commands": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/SetupCommandParam" - }, - "minItems": 0, - "maxItems": 16, - "description": "Ordered, confidential setup commands. Command bodies are never returned." - }, - "network": { - "anyOf": [ - { - "$ref": "#/components/schemas/NetworkPolicyParam" - }, - { - "type": "null" - } - ], - "description": "Network access policy for the environment. Defaults to enabled." - }, - "env": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Environment variables made available to the agent." - }, - "capability_directories": { - "type": [ - "array", - "null" + "type": { + "type": "string", + "enum": [ + "agent.session.turn.created" ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + "default": "agent.session.turn.created", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.turn.created`." }, - "skills": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedSkillParam" - }, - "minItems": 0, - "maxItems": 200, - "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "plugins": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedPluginParam" - }, - "minItems": 0, - "maxItems": 32, - "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." }, - "files": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileParam" - }, - "minItems": 0, - "maxItems": 50, - "description": "Files available before the agent starts. Defaults to an empty list." + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn associated with the event." }, - "name": { - "type": [ - "string", - "null" - ], - "minLength": 1, - "maxLength": 256, - "description": "An optional human-readable display name for the template." + "turn": { + "$ref": "#/components/schemas/TurnResource", + "description": "The turn at the time it was created." } }, + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "turn" + ], "additionalProperties": false, - "description": "Parameters for creating a reusable, project-scoped OpenAI-hosted environment template." + "description": "Emitted when a turn is created." }, - "UpdateEnvironmentTemplateParams": { + "SessionEventAgentSessionTurnInProgress": { "type": "object", "properties": { - "name": { - "type": [ - "string", - "null" - ], - "minLength": 1, - "maxLength": 256, - "description": "A replacement human-readable display name, or `null` to clear the name." - }, - "packages": { - "anyOf": [ - { - "$ref": "#/components/schemas/EnvironmentPackagesParam" - }, - { - "type": "null" - } - ], - "description": "Packages installed before the runtime network policy applies." - }, - "setup_commands": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/SetupCommandParam" - }, - "minItems": 0, - "maxItems": 16, - "description": "Replacement confidential setup commands, never included in returned resources." - }, - "network": { - "anyOf": [ - { - "$ref": "#/components/schemas/NetworkPolicyParam" - }, - { - "type": "null" - } - ], - "description": "Network access available after setup completes." - }, - "env": { - "type": [ - "object", - "null" + "type": { + "type": "string", + "enum": [ + "agent.session.turn.in_progress" ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Replacement confidential environment values." + "default": "agent.session.turn.in_progress", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.turn.in_progress`." }, - "capability_directories": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Directories that expose capabilities to the agent." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "skills": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedSkillParam" - }, - "minItems": 0, - "maxItems": 200, - "description": "Replacement skill configuration installed for each new session." + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." }, - "plugins": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedPluginParam" - }, - "minItems": 0, - "maxItems": 32, - "description": "Replacement plugin configuration installed for each new session." + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn associated with the event." }, - "files": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileParam" - }, - "minItems": 0, - "maxItems": 50, - "description": "Replacement file configuration materialized for each new session." + "turn": { + "$ref": "#/components/schemas/TurnResource", + "description": "The turn at the time it started running." } }, + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "turn" + ], "additionalProperties": false, - "description": "Fields to replace on an existing reusable OpenAI-hosted environment template." + "description": "Emitted when a turn starts running." }, - "DeletedEnvironmentTemplateResource": { + "SessionEventAgentSessionTurnCompleted": { "type": "object", "properties": { - "id": { + "type": { + "type": "string", + "enum": [ + "agent.session.turn.completed" + ], + "default": "agent.session.turn.completed", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.turn.completed`." + }, + "event_id": { "type": "string", "minLength": 0, - "description": "The ID of the deleted environment template." + "description": "The unique ID of the event." }, - "object": { + "session_id": { "type": "string", - "enum": [ - "agent.environment.template.deleted" - ], - "default": "agent.environment.template.deleted", - "x-stainless-const": true, - "description": "The object type. Always `agent.environment.template.deleted`." + "minLength": 0, + "description": "The ID of the session associated with the event." }, - "deleted": { - "type": "boolean", - "description": "Whether the environment template was deleted. Always `true`." + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn associated with the event." + }, + "turn": { + "$ref": "#/components/schemas/TurnResource", + "description": "The completed turn." + }, + "usage": { + "anyOf": [ + { + "$ref": "#/components/schemas/TokenUsageResource" + }, + { + "type": "null" + } + ], + "description": "Token usage by the root agent during the turn, when available." } }, "required": [ - "id", - "object", - "deleted" + "type", + "event_id", + "session_id", + "turn_id", + "turn", + "usage" ], "additionalProperties": false, - "description": "A deleted reusable environment template." - }, - "SessionStatusResource": { - "type": "string", - "enum": [ - "idle", - "in_progress", - "requires_action", - "failed" - ], - "x-enumDescriptions": [ - "The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.", - "The session is processing a turn.", - "The session is waiting for one or more required actions.", - "The session failed." - ], - "description": "The current status of a session." + "description": "Emitted when a turn completes." }, - "SessionRequiredActionResourceFunctionCall": { + "SessionEventAgentSessionTurnFailed": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "function_call" + "agent.session.turn.failed" ], - "default": "function_call", + "default": "agent.session.turn.failed", "x-stainless-const": true, - "description": "The type of the object. Always `function_call`." + "description": "The type of the object. Always `agent.session.turn.failed`." }, - "turn_id": { + "event_id": { "type": "string", "minLength": 0, - "description": "The ID of the turn that requested the function call." + "description": "The unique ID of the event." }, - "call_id": { + "session_id": { "type": "string", "minLength": 0, - "description": "The ID to include when submitting the function result." + "description": "The ID of the session associated with the event." }, - "name": { + "turn_id": { "type": "string", "minLength": 0, - "description": "The function name." + "description": "The ID of the turn associated with the event." }, - "arguments": { - "description": "The arguments supplied by the model." + "turn": { + "$ref": "#/components/schemas/TurnResource", + "description": "The failed turn." + }, + "usage": { + "anyOf": [ + { + "$ref": "#/components/schemas/TokenUsageResource" + }, + { + "type": "null" + } + ], + "description": "Token usage by the root agent during the turn, when available." } }, "required": [ "type", + "event_id", + "session_id", "turn_id", - "call_id", - "name", - "arguments" + "turn", + "usage" ], "additionalProperties": false, - "description": "Run a function tool and submit its result." + "description": "Emitted when a turn fails." }, - "SessionRequiredActionResourceEnvironmentConnection": { + "SessionEventAgentSessionTurnCancelled": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "environment_connection" + "agent.session.turn.cancelled" ], - "default": "environment_connection", + "default": "agent.session.turn.cancelled", "x-stainless-const": true, - "description": "The type of the object. Always `environment_connection`." + "description": "The type of the object. Always `agent.session.turn.cancelled`." }, - "environment_id": { + "event_id": { "type": "string", "minLength": 0, - "description": "The ID of the environment to reconnect." + "description": "The unique ID of the event." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the turn associated with the event." + }, + "turn": { + "$ref": "#/components/schemas/TurnResource", + "description": "The cancelled turn." + }, + "usage": { + "anyOf": [ + { + "$ref": "#/components/schemas/TokenUsageResource" + }, + { + "type": "null" + } + ], + "description": "Token usage by the root agent during the turn, when available." } }, "required": [ "type", - "environment_id" + "event_id", + "session_id", + "turn_id", + "turn", + "usage" ], "additionalProperties": false, - "description": "Reconnect a session environment." - }, - "SessionRequiredActionResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/SessionRequiredActionResourceFunctionCall" - }, - { - "$ref": "#/components/schemas/SessionRequiredActionResourceEnvironmentConnection" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "function_call": "#/components/schemas/SessionRequiredActionResourceFunctionCall", - "environment_connection": "#/components/schemas/SessionRequiredActionResourceEnvironmentConnection" - } - }, - "x-oai-discriminator-values": [ - "function_call", - "environment_connection" - ], - "description": "An action that must be completed before a session can continue." + "description": "Emitted when a turn is cancelled." }, - "AgentToolResourceFunction": { + "SessionEventAgentSessionTurnItemAdded": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "function" + "agent.session.turn.item.added" ], - "default": "function", + "default": "agent.session.turn.item.added", "x-stainless-const": true, - "description": "The type of the object. Always `function`." + "description": "The type of the object. Always `agent.session.turn.item.added`." }, - "name": { + "event_id": { "type": "string", "minLength": 0, - "description": "The name of the function." + "description": "The unique ID of the event." }, - "description": { + "session_id": { "type": "string", "minLength": 0, - "description": "A description of what the function does." + "description": "The ID of the session associated with the event." }, - "parameters": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "A JSON Schema object describing the function's arguments." + "turn_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "defer_loading": { - "type": "boolean", - "description": "Whether the function is deferred and discovered through tool search." + "output_index": { + "type": [ + "integer", + "null" + ], + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output, when the item is agent output." + }, + "item": { + "$ref": "#/components/schemas/SessionTurnItemResource", + "description": "The item that was added." } }, "required": [ "type", - "name", - "description", - "parameters", - "defer_loading" + "event_id", + "session_id", + "turn_id", + "output_index", + "item" ], "additionalProperties": false, - "description": "A function defined by the application." + "description": "Emitted when an item is added to a turn." }, - "AgentToolResourceProgrammaticToolCalling": { + "SessionEventAgentSessionIdle": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "programmatic_tool_calling" + "agent.session.idle" ], - "default": "programmatic_tool_calling", + "default": "agent.session.idle", "x-stainless-const": true, - "description": "The type of the object. Always `programmatic_tool_calling`." + "description": "The type of the object. Always `agent.session.idle`." }, - "enabled": { - "type": "boolean", - "description": "Whether tools can be called from model-generated code." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." + }, + "session": { + "$ref": "#/components/schemas/SessionResource", + "description": "The session that became idle." } }, "required": [ "type", - "enabled" + "event_id", + "session" ], "additionalProperties": false, - "description": "Enables calling tools from model-generated code." + "description": "Emitted when a session becomes idle." }, - "McpTransportResourceHttp": { + "SessionEventAgentSessionInProgress": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "http" + "agent.session.in_progress" ], - "default": "http", + "default": "agent.session.in_progress", "x-stainless-const": true, - "description": "The type of the object. Always `http`." + "description": "The type of the object. Always `agent.session.in_progress`." }, - "server_url": { + "event_id": { "type": "string", "minLength": 0, - "description": "The URL of the MCP server." + "description": "The unique ID of the event." + }, + "session": { + "$ref": "#/components/schemas/SessionResource", + "description": "The session that started processing." } }, "required": [ "type", - "server_url" + "event_id", + "session" ], "additionalProperties": false, - "description": "Connects to an MCP server over HTTP." + "description": "Emitted when a session starts processing a turn." }, - "McpTransportResourceStdio": { + "SessionEventAgentSessionRequiresAction": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "stdio" + "agent.session.requires_action" ], - "default": "stdio", + "default": "agent.session.requires_action", "x-stainless-const": true, - "description": "The type of the object. Always `stdio`." - }, - "command": { - "type": "string", - "minLength": 0, - "description": "The command used to start the MCP server." - }, - "args": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Arguments passed to the MCP server command." + "description": "The type of the object. Always `agent.session.requires_action`." }, - "cwd": { + "event_id": { "type": "string", "minLength": 0, - "description": "The working directory used to start the MCP server." + "description": "The unique ID of the event." }, - "env_vars": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Environment variable names inherited from the execution environment." + "session": { + "$ref": "#/components/schemas/SessionResource", + "description": "The session and its current required actions." } }, "required": [ "type", - "command", - "args", - "cwd", - "env_vars" + "event_id", + "session" ], "additionalProperties": false, - "description": "Starts an MCP server as a local process." - }, - "McpTransportResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/McpTransportResourceHttp" - }, - { - "$ref": "#/components/schemas/McpTransportResourceStdio" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "http": "#/components/schemas/McpTransportResourceHttp", - "stdio": "#/components/schemas/McpTransportResourceStdio" - } - }, - "x-oai-discriminator-values": [ - "http", - "stdio" - ], - "description": "The transport used to connect to an MCP server." + "description": "Emitted when a session is waiting for one or more required actions." }, - "AgentToolResourceMcp": { + "SessionEventAgentSessionFailed": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "mcp" + "agent.session.failed" ], - "default": "mcp", + "default": "agent.session.failed", "x-stainless-const": true, - "description": "The type of the object. Always `mcp`." + "description": "The type of the object. Always `agent.session.failed`." }, - "server_label": { + "event_id": { "type": "string", "minLength": 0, - "description": "A label used to identify the MCP server in tool calls." - }, - "credential_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL." - }, - "transport": { - "$ref": "#/components/schemas/McpTransportResource", - "description": "The transport used to connect to the MCP server." - }, - "request_metadata": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "Metadata included with requests to this MCP server." - }, - "allowed_tools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "The MCP tools the agent may call." - }, - "required": { - "type": "boolean", - "description": "Whether this MCP server must initialize before the first turn." + "description": "The unique ID of the event." }, - "connection_origin": { - "$ref": "#/components/schemas/McpConnectionOriginResource", - "description": "Where outbound MCP HTTP connections originate." + "session": { + "$ref": "#/components/schemas/SessionResource", + "description": "The failed session." } }, "required": [ "type", - "server_label", - "credential_id", - "transport", - "request_metadata", - "allowed_tools", - "required", - "connection_origin" + "event_id", + "session" ], "additionalProperties": false, - "description": "Tools provided by a remote MCP server." + "description": "Emitted when a session fails." }, - "AgentToolResourceWebSearch": { + "SessionEventAgentSessionEnvironmentPending": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "web_search" + "agent.session.environment.pending" ], - "default": "web_search", + "default": "agent.session.environment.pending", "x-stainless-const": true, - "description": "The type of the object. Always `web_search`." + "description": "The type of the object. Always `agent.session.environment.pending`." }, - "mode": { - "$ref": "#/components/schemas/WebSearchModeResource", - "description": "The source used for web search results." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "context_size": { - "$ref": "#/components/schemas/WebSearchContextSizeResource", - "description": "The amount of search context made available to the model. Defaults to `medium`." + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." }, - "allowed_domains": { + "turn_id": { "type": [ - "array", + "string", "null" ], - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Allowed search domains, or `null` when the search is unrestricted." + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "location": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchLocationResource" - }, - { - "type": "null" - } - ], - "description": "Approximate location used to localize search results, if provided." + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." } }, "required": [ "type", - "mode", - "context_size", - "allowed_domains", - "location" + "event_id", + "session_id", + "turn_id", + "environment" ], "additionalProperties": false, - "description": "Web search." + "description": "Emitted while a session environment is being prepared." }, - "AgentToolResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/AgentToolResourceFunction" + "SessionEventAgentSessionEnvironmentConnected": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "agent.session.environment.connected" + ], + "default": "agent.session.environment.connected", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.environment.connected`." }, - { - "$ref": "#/components/schemas/AgentToolResourceProgrammaticToolCalling" + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - { - "$ref": "#/components/schemas/AgentToolResourceMcp" + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." }, - { - "$ref": "#/components/schemas/AgentToolResourceWebSearch" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "function": "#/components/schemas/AgentToolResourceFunction", - "programmatic_tool_calling": "#/components/schemas/AgentToolResourceProgrammaticToolCalling", - "mcp": "#/components/schemas/AgentToolResourceMcp", - "web_search": "#/components/schemas/AgentToolResourceWebSearch" + "turn_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." + }, + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." } }, - "x-oai-discriminator-values": [ - "function", - "programmatic_tool_calling", - "mcp", - "web_search" + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "environment" ], - "description": "A tool available to the agent." + "additionalProperties": false, + "description": "Emitted when a session environment connects." }, - "SessionAgentResource": { + "SessionEventAgentSessionEnvironmentDisconnected": { "type": "object", "properties": { - "id": { + "type": { + "type": "string", + "enum": [ + "agent.session.environment.disconnected" + ], + "default": "agent.session.environment.disconnected", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.environment.disconnected`." + }, + "event_id": { "type": "string", "minLength": 0, - "description": "The ID of the agent." + "description": "The unique ID of the event." }, - "name": { + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value." + "description": "The ID of the turn associated with the event, when applicable." }, - "model": { + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." + } + }, + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "environment" + ], + "additionalProperties": false, + "description": "Emitted when a session environment disconnects." + }, + "SessionEventAgentSessionEnvironmentFailed": { + "type": "object", + "properties": { + "type": { "type": "string", - "minLength": 0, - "description": "The model used by the agent." - }, - "reasoning": { - "$ref": "#/components/schemas/ReasoningResource", - "description": "The agent's reasoning configuration." + "enum": [ + "agent.session.environment.failed" + ], + "default": "agent.session.environment.failed", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.environment.failed`." }, - "text": { - "$ref": "#/components/schemas/TextResource", - "description": "Configuration for text generated by the agent." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "service_tier": { - "$ref": "#/components/schemas/ServiceTierResource", - "description": "The effective service-tier policy for model requests. Defaults to `auto`." + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." }, - "instructions": { + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "Custom instructions appended to the agent's default base instructions." - }, - "tools": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AgentToolResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Tools available to the agent." + "description": "The ID of the turn associated with the event, when applicable." }, - "multi_agent": { - "$ref": "#/components/schemas/MultiAgentConfigResource", - "description": "Configuration for creating and coordinating subagents." + "environment": { + "$ref": "#/components/schemas/SessionEnvironmentStateResource", + "description": "The current environment state." } }, "required": [ - "id", - "name", - "model", - "reasoning", - "text", - "service_tier", - "instructions", - "tools", - "multi_agent" + "type", + "event_id", + "session_id", + "turn_id", + "environment" ], "additionalProperties": false, - "description": "The effective agent configuration for a session." + "description": "Emitted when a session environment fails." }, - "EnvironmentResourceNone": { + "SessionEventAgentSessionSubagentCreated": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "none" + "agent.session.subagent.created" ], - "default": "none", + "default": "agent.session.subagent.created", "x-stainless-const": true, - "description": "The type of the object. Always `none`." + "description": "The type of the object. Always `agent.session.subagent.created`." + }, + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." + }, + "subagent": { + "$ref": "#/components/schemas/SubagentResource", + "description": "The subagent that was created." } }, "required": [ - "type" + "type", + "event_id", + "subagent" ], "additionalProperties": false, - "description": "The session talks to CCA without selecting or provisioning an execution environment." + "description": "Emitted when a subagent is created." }, - "EnvironmentResourceOpenaiHosted": { + "SessionEventAgentSessionSubagentActive": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "openai_hosted" + "agent.session.subagent.active" ], - "default": "openai_hosted", + "default": "agent.session.subagent.active", "x-stainless-const": true, - "description": "The type of the object. Always `openai_hosted`." + "description": "The type of the object. Always `agent.session.subagent.active`." }, - "id": { + "event_id": { "type": "string", "minLength": 0, - "description": "The public ID of the environment." - }, - "packages": { - "$ref": "#/components/schemas/EnvironmentPackagesResource", - "description": "Packages installed in the environment." - }, - "network": { - "$ref": "#/components/schemas/NetworkPolicyResource", - "description": "The effective network access policy for the environment." - }, - "capability_directories": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "Directories that contain capabilities exposed to the agent." - }, - "skills": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedSkillResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Skills installed in the environment, excluding their archive contents." - }, - "plugins": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedPluginResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Plugins installed in the environment, excluding their archive contents." + "description": "The unique ID of the event." }, - "files": { - "type": "array", - "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileResource" - }, - "minItems": 0, - "maxItems": 50, - "description": "Files available in the environment, excluding their contents." + "subagent": { + "$ref": "#/components/schemas/SubagentResource", + "description": "The subagent that resumed." } }, "required": [ "type", - "id", - "packages", - "network", - "capability_directories", - "skills", - "plugins", - "files" + "event_id", + "subagent" ], "additionalProperties": false, - "description": "An environment hosted by OpenAI." + "description": "Emitted when a closed subagent successfully resumes." }, - "EnvironmentResourceSelfHosted": { + "SessionEventAgentSessionSubagentClosed": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "self_hosted" + "agent.session.subagent.closed" ], - "default": "self_hosted", + "default": "agent.session.subagent.closed", "x-stainless-const": true, - "description": "The type of the object. Always `self_hosted`." + "description": "The type of the object. Always `agent.session.subagent.closed`." }, - "remote_url": { + "event_id": { "type": "string", "minLength": 0, - "description": "Pass this URL unchanged to `codex exec-server --remote` when connecting this environment." + "description": "The unique ID of the event." + }, + "subagent": { + "$ref": "#/components/schemas/SubagentResource", + "description": "The subagent that was closed." + } + }, + "required": [ + "type", + "event_id", + "subagent" + ], + "additionalProperties": false, + "description": "Emitted when a subagent is closed." + }, + "AssistantMessageItemResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "message" + ], + "default": "message", + "x-stainless-const": true, + "description": "The item type. Always `message`." }, "id": { "type": "string", "minLength": 0, - "description": "The public ID of the environment." + "description": "The ID of the message." }, - "workspace_directory": { + "turn_id": { "type": "string", "minLength": 0, - "description": "The absolute project directory inside the environment. Defaults to `/workspace`." + "description": "The ID of the turn that contains this item." }, - "capability_directories": { + "role": { + "type": "string", + "enum": [ + "assistant" + ], + "default": "assistant", + "x-stainless-const": true, + "description": "The role of the message author. Always `assistant`." + }, + "status": { + "$ref": "#/components/schemas/OutputItemStatusResource", + "description": "The status of the message." + }, + "content": { "type": "array", "items": { - "type": "string", - "minLength": 0 + "$ref": "#/components/schemas/OutputTextResource" }, "minItems": 0, "maxItems": 2000, - "description": "Directories that contain capabilities exposed to the agent." + "description": "The content of the message." + }, + "phase": { + "anyOf": [ + { + "$ref": "#/components/schemas/MessagePhaseResource" + }, + { + "type": "null" + } + ], + "description": "The phase of the assistant message." } }, "required": [ "type", - "remote_url", "id", - "workspace_directory", - "capability_directories" + "turn_id", + "role", + "status", + "content", + "phase" ], "additionalProperties": false, - "description": "An environment hosted by the application." + "description": "An assistant message produced by the agent." }, - "EnvironmentResource": { + "AgentOutputItemResource": { "oneOf": [ { - "$ref": "#/components/schemas/EnvironmentResourceNone" + "$ref": "#/components/schemas/AssistantMessageItemResource" }, { - "$ref": "#/components/schemas/EnvironmentResourceOpenaiHosted" + "$ref": "#/components/schemas/ReasoningItemResource" }, { - "$ref": "#/components/schemas/EnvironmentResourceSelfHosted" + "$ref": "#/components/schemas/FunctionCallItemResource" + }, + { + "$ref": "#/components/schemas/McpCallItemResource" + }, + { + "$ref": "#/components/schemas/ComputerUseCallItemResource" + }, + { + "$ref": "#/components/schemas/BrowserAuthenticationRequestItemResource" + }, + { + "$ref": "#/components/schemas/WebSearchCallItemResource" + }, + { + "$ref": "#/components/schemas/CommandExecutionItemResource" + }, + { + "$ref": "#/components/schemas/CreateSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/SendSubagentInputCallItemResource" + }, + { + "$ref": "#/components/schemas/ResumeSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/WaitForSubagentsCallItemResource" + }, + { + "$ref": "#/components/schemas/InterruptSubagentCallItemResource" + }, + { + "$ref": "#/components/schemas/CloseSubagentCallItemResource" } ], "discriminator": { "propertyName": "type", "mapping": { - "none": "#/components/schemas/EnvironmentResourceNone", - "openai_hosted": "#/components/schemas/EnvironmentResourceOpenaiHosted", - "self_hosted": "#/components/schemas/EnvironmentResourceSelfHosted" + "message": "#/components/schemas/AssistantMessageItemResource", + "reasoning": "#/components/schemas/ReasoningItemResource", + "function_call": "#/components/schemas/FunctionCallItemResource", + "mcp_call": "#/components/schemas/McpCallItemResource", + "computer_use_call": "#/components/schemas/ComputerUseCallItemResource", + "computer_use_approval_request": "#/components/schemas/BrowserAuthenticationRequestItemResource", + "web_search_call": "#/components/schemas/WebSearchCallItemResource", + "command_execution": "#/components/schemas/CommandExecutionItemResource", + "interrupt_subagent_call": "#/components/schemas/InterruptSubagentCallItemResource", + "create_subagent_call": "#/components/schemas/CreateSubagentCallItemResource", + "send_subagent_input_call": "#/components/schemas/SendSubagentInputCallItemResource", + "resume_subagent_call": "#/components/schemas/ResumeSubagentCallItemResource", + "wait_for_subagents_call": "#/components/schemas/WaitForSubagentsCallItemResource", + "close_subagent_call": "#/components/schemas/CloseSubagentCallItemResource" } }, "x-oai-discriminator-values": [ - "none", - "openai_hosted", - "self_hosted" + "message", + "reasoning", + "function_call", + "mcp_call", + "computer_use_call", + "computer_use_approval_request", + "web_search_call", + "command_execution", + "create_subagent_call", + "send_subagent_input_call", + "resume_subagent_call", + "wait_for_subagents_call", + "interrupt_subagent_call", + "close_subagent_call" ], - "description": "The execution environment for a session." + "description": "An output item produced by an agent." }, - "SessionResource": { + "SessionEventAgentSessionTurnItemDone": { "type": "object", "properties": { - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string", - "minLength": 0 - }, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "Custom string key-value pairs attached to the session." + "type": { + "type": "string", + "enum": [ + "agent.session.turn.item.done" + ], + "default": "agent.session.turn.item.done", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.turn.item.done`." }, - "id": { + "event_id": { "type": "string", "minLength": 0, - "description": "The ID of the session." + "description": "The unique ID of the event." }, - "object": { + "session_id": { "type": "string", - "enum": [ - "agent.session" + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" ], - "default": "agent.session", - "x-stainless-const": true, - "description": "The object type. Always `agent.session`." + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "created_at": { + "output_index": { "type": "integer", "format": "int64", - "description": "The Unix timestamp, in seconds, when the session was created." + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the output item in the turn output." }, - "last_active_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the session was last active." + "item": { + "$ref": "#/components/schemas/AgentOutputItemResource", + "description": "The completed output item." + } + }, + "required": [ + "type", + "event_id", + "session_id", + "turn_id", + "output_index", + "item" + ], + "additionalProperties": false, + "description": "Emitted when an output item is complete." + }, + "SessionEventAgentSessionTurnContentPartAdded": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "agent.session.turn.content_part.added" + ], + "default": "agent.session.turn.content_part.added", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.turn.content_part.added`." }, - "status": { - "$ref": "#/components/schemas/SessionStatusResource", - "description": "The current status of the session." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "required_actions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SessionRequiredActionResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "Actions that must be completed before the session can continue." + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." }, - "error": { + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The error that caused the session to fail, if any." - }, - "agent": { - "$ref": "#/components/schemas/SessionAgentResource", - "description": "The agent running in the session." + "description": "The ID of the turn associated with the event, when applicable." }, - "environment": { - "$ref": "#/components/schemas/EnvironmentResource", - "description": "The execution environment for the session." + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the message item." }, - "vault_ids": { - "type": "array", - "items": { - "type": "string", - "minLength": 0 - }, - "minItems": 0, - "maxItems": 2000, - "description": "The IDs of vaults made available to the session." + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." }, - "usage": { - "anyOf": [ - { - "$ref": "#/components/schemas/TokenUsageResource" - }, - { - "type": "null" - } - ], - "description": "Best-effort token usage for the session, or null if unknown. Recorded usage may change." + "content_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the content part in the message." + }, + "part": { + "$ref": "#/components/schemas/OutputTextResource", + "description": "The initial content part." } }, "required": [ - "metadata", - "id", - "object", - "created_at", - "last_active_at", - "status", - "required_actions", - "error", - "agent", - "environment", - "vault_ids", - "usage" + "type", + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "content_index", + "part" ], "additionalProperties": false, - "description": "A Managed Agents session." + "description": "Emitted when an output text content part is added." }, - "SessionListResource": { + "SessionEventAgentSessionTurnContentPartDone": { "type": "object", "properties": { - "object": { + "type": { "type": "string", "enum": [ - "list" + "agent.session.turn.content_part.done" ], - "default": "list", + "default": "agent.session.turn.content_part.done", "x-stainless-const": true, - "description": "The object type, which is always `list`." + "description": "The type of the object. Always `agent.session.turn.content_part.done`." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SessionResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." + "event_id": { + "type": "string", + "minLength": 0, + "description": "The unique ID of the event." }, - "first_id": { - "type": [ - "string", - "null" - ], + "session_id": { + "type": "string", "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "description": "The ID of the session associated with the event." }, - "last_id": { + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "description": "The ID of the turn associated with the event, when applicable." }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the message item." + }, + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." + }, + "content_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the content part in the message." + }, + "part": { + "$ref": "#/components/schemas/OutputTextResource", + "description": "The completed content part." } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type", + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "content_index", + "part" ], "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "description": "Emitted when an output content part is complete." }, - "AgentToolConfigParamFunction": { + "SessionEventAgentSessionTurnOutputTextDelta": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "function" + "agent.session.turn.output_text.delta" ], - "default": "function", + "default": "agent.session.turn.output_text.delta", "x-stainless-const": true, - "description": "The type of the object. Always `function`." + "description": "The type of the object. Always `agent.session.turn.output_text.delta`." }, - "name": { + "event_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The name of the function." + "description": "The unique ID of the event." }, - "description": { + "session_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "A description of what the function does." + "description": "The ID of the session associated with the event." }, - "parameters": { - "type": "object", - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "A JSON Schema object describing the function's arguments." + "turn_id": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "defer_loading": { - "type": "boolean", - "default": false, - "description": "Whether this function is deferred and discovered through tool search. Defaults to `false`." + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the message item." + }, + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." + }, + "content_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the content part in the message." + }, + "delta": { + "type": "string", + "minLength": 0, + "description": "The text that was appended." } }, "required": [ "type", - "name", - "description", - "parameters" + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "content_index", + "delta" ], "additionalProperties": false, - "description": "A function defined by the application." + "description": "Emitted when text is appended to an output text content part." }, - "AgentToolConfigParamToolSearch": { + "SessionEventAgentSessionTurnOutputTextDone": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "tool_search" + "agent.session.turn.output_text.done" ], - "default": "tool_search", + "default": "agent.session.turn.output_text.done", "x-stainless-const": true, - "description": "The type of the object. Always `tool_search`." - } - }, - "required": [ - "type" - ], - "additionalProperties": false, - "description": "Discovers deferred function tools and loads them into the model context." - }, - "AgentToolConfigParamProgrammaticToolCalling": { - "type": "object", - "properties": { - "type": { + "description": "The type of the object. Always `agent.session.turn.output_text.done`." + }, + "event_id": { "type": "string", - "enum": [ - "programmatic_tool_calling" + "minLength": 0, + "description": "The unique ID of the event." + }, + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { + "type": [ + "string", + "null" ], - "default": "programmatic_tool_calling", - "x-stainless-const": true, - "description": "The type of the object. Always `programmatic_tool_calling`." + "minLength": 0, + "description": "The ID of the turn associated with the event, when applicable." }, - "enabled": { - "type": "boolean", - "default": true, - "description": "Whether tools can be called from model-generated code. Defaults to `true`." + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the message item." + }, + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." + }, + "content_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the content part in the message." + }, + "text": { + "type": "string", + "minLength": 0, + "description": "The complete output text." } }, "required": [ - "type" + "type", + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "content_index", + "text" ], "additionalProperties": false, - "description": "Enables calling tools from model-generated code." + "description": "Emitted when an output text content part is complete." }, - "McpTransportConfigParamHttp": { + "SessionEventAgentSessionTurnReasoningSummaryPartAdded": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "http" + "agent.session.turn.reasoning_summary_part.added" ], - "default": "http", + "default": "agent.session.turn.reasoning_summary_part.added", "x-stainless-const": true, - "description": "The type of the object. Always `http`." + "description": "The type of the object. Always `agent.session.turn.reasoning_summary_part.added`." }, - "server_url": { + "event_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The URL of the MCP server." + "description": "The unique ID of the event." }, - "authorization": { + "session_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session associated with the event." + }, + "turn_id": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 1048576, - "description": "The authorization value sent to the MCP server, if any." + "description": "The ID of the turn associated with the event, when applicable." }, - "headers": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Additional HTTP headers sent to the MCP server." + "item_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the reasoning item." + }, + "output_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the item in the turn output." + }, + "summary_index": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 4294967295, + "description": "The index of the summary content part." + }, + "part": { + "$ref": "#/components/schemas/SummaryTextResource", + "description": "The initial summary part." } }, "required": [ "type", - "server_url" + "event_id", + "session_id", + "turn_id", + "item_id", + "output_index", + "summary_index", + "part" + ], + "additionalProperties": false, + "description": "Emitted when a reasoning summary content part is added." + }, + "SessionEvent": { + "oneOf": [ + { + "$ref": "#/components/schemas/SessionEventError" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentReady" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentSuspended" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentExpired" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentReset" + }, + { + "$ref": "#/components/schemas/SessionEventAgentOutputCommandExecutionOutputDelta" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionCreated" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnCreated" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnInProgress" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnCompleted" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnFailed" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnCancelled" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnItemAdded" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionIdle" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionInProgress" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionRequiresAction" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionFailed" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentPending" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentConnected" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentDisconnected" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentFailed" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionSubagentCreated" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionSubagentActive" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionSubagentClosed" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnItemDone" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnContentPartAdded" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnContentPartDone" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDelta" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDone" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartAdded" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartDone" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDelta" + }, + { + "$ref": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDone" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "agent.session.turn.reasoning_summary_text.delta": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDelta", + "agent.session.turn.reasoning_summary_part.done": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartDone", + "agent.session.turn.reasoning_summary_text.done": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDone", + "error": "#/components/schemas/SessionEventError", + "agent.session.environment.ready": "#/components/schemas/SessionEventAgentSessionEnvironmentReady", + "agent.session.environment.suspended": "#/components/schemas/SessionEventAgentSessionEnvironmentSuspended", + "agent.session.environment.expired": "#/components/schemas/SessionEventAgentSessionEnvironmentExpired", + "agent.session.environment.reset": "#/components/schemas/SessionEventAgentSessionEnvironmentReset", + "agent.output.command_execution_output.delta": "#/components/schemas/SessionEventAgentOutputCommandExecutionOutputDelta", + "agent.session.created": "#/components/schemas/SessionEventAgentSessionCreated", + "agent.session.turn.created": "#/components/schemas/SessionEventAgentSessionTurnCreated", + "agent.session.turn.in_progress": "#/components/schemas/SessionEventAgentSessionTurnInProgress", + "agent.session.turn.completed": "#/components/schemas/SessionEventAgentSessionTurnCompleted", + "agent.session.turn.failed": "#/components/schemas/SessionEventAgentSessionTurnFailed", + "agent.session.turn.cancelled": "#/components/schemas/SessionEventAgentSessionTurnCancelled", + "agent.session.turn.item.added": "#/components/schemas/SessionEventAgentSessionTurnItemAdded", + "agent.session.idle": "#/components/schemas/SessionEventAgentSessionIdle", + "agent.session.in_progress": "#/components/schemas/SessionEventAgentSessionInProgress", + "agent.session.requires_action": "#/components/schemas/SessionEventAgentSessionRequiresAction", + "agent.session.failed": "#/components/schemas/SessionEventAgentSessionFailed", + "agent.session.environment.pending": "#/components/schemas/SessionEventAgentSessionEnvironmentPending", + "agent.session.environment.connected": "#/components/schemas/SessionEventAgentSessionEnvironmentConnected", + "agent.session.environment.disconnected": "#/components/schemas/SessionEventAgentSessionEnvironmentDisconnected", + "agent.session.environment.failed": "#/components/schemas/SessionEventAgentSessionEnvironmentFailed", + "agent.session.subagent.created": "#/components/schemas/SessionEventAgentSessionSubagentCreated", + "agent.session.subagent.active": "#/components/schemas/SessionEventAgentSessionSubagentActive", + "agent.session.subagent.closed": "#/components/schemas/SessionEventAgentSessionSubagentClosed", + "agent.session.turn.item.done": "#/components/schemas/SessionEventAgentSessionTurnItemDone", + "agent.session.turn.content_part.added": "#/components/schemas/SessionEventAgentSessionTurnContentPartAdded", + "agent.session.turn.content_part.done": "#/components/schemas/SessionEventAgentSessionTurnContentPartDone", + "agent.session.turn.output_text.delta": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDelta", + "agent.session.turn.output_text.done": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDone", + "agent.session.turn.reasoning_summary_part.added": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartAdded" + } + }, + "x-oai-discriminator-values": [ + "error", + "agent.session.environment.ready", + "agent.session.environment.suspended", + "agent.session.environment.expired", + "agent.session.environment.reset", + "agent.output.command_execution_output.delta", + "agent.session.created", + "agent.session.turn.created", + "agent.session.turn.in_progress", + "agent.session.turn.completed", + "agent.session.turn.failed", + "agent.session.turn.cancelled", + "agent.session.turn.item.added", + "agent.session.idle", + "agent.session.in_progress", + "agent.session.requires_action", + "agent.session.failed", + "agent.session.environment.pending", + "agent.session.environment.connected", + "agent.session.environment.disconnected", + "agent.session.environment.failed", + "agent.session.subagent.created", + "agent.session.subagent.active", + "agent.session.subagent.closed", + "agent.session.turn.item.done", + "agent.session.turn.content_part.added", + "agent.session.turn.content_part.done", + "agent.session.turn.output_text.delta", + "agent.session.turn.output_text.done", + "agent.session.turn.reasoning_summary_part.added", + "agent.session.turn.reasoning_summary_part.done", + "agent.session.turn.reasoning_summary_text.delta", + "agent.session.turn.reasoning_summary_text.done" ], + "description": "An event emitted by a Managed Agents session." + }, + "UpdateSessionReasoningParam": { + "type": "object", + "properties": { + "effort": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReasoningEffortParam" + }, + { + "type": "null" + } + ], + "description": "Omit to keep the current effort. Null selects the model's default effort." + } + }, "additionalProperties": false, - "description": "Connects to an MCP server over HTTP." + "description": "Reasoning effort for subsequent turns. The reasoning summary stays unchanged." }, - "McpTransportConfigParamStdio": { + "UpdateSessionAgentParam": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "stdio" - ], - "default": "stdio", - "x-stainless-const": true, - "description": "The type of the object. Always `stdio`." - }, - "command": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The command used to start the MCP server." - }, - "args": { + "tools": { "type": [ "array", "null" ], "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "$ref": "#/components/schemas/AgentToolConfigParam" }, "minItems": 0, "maxItems": 16384, - "description": "Arguments passed to the MCP server command." + "description": "Replaces the session tools. Functions and MCP servers change on the next model call. Built-in tools change by the next turn. Omit to keep the current tools, or pass null or an empty array to clear them." }, - "cwd": { + "model": { "type": "string", "minLength": 0, "maxLength": 1048576, - "description": "The working directory used to start the MCP server." + "description": "The model for subsequent turns. Omit to keep the current model." }, - "env": { + "reasoning": { + "$ref": "#/components/schemas/UpdateSessionReasoningParam", + "description": "Reasoning settings to update. Omit to keep the current effort." + }, + "service_tier": { + "anyOf": [ + { + "$ref": "#/components/schemas/ServiceTierParam" + }, + { + "type": "null" + } + ], + "description": "Omit to keep the current tier. Null resets it to auto." + } + }, + "additionalProperties": false, + "description": "Agent settings that can change after session creation." + }, + "UpdateAgentSessionParams": { + "type": "object", + "properties": { + "review": { + "$ref": "#/components/schemas/SessionReviewParam", + "description": "Default action review for new root turns. Existing turns and their subagents keep their review mode." + }, + "agent": { + "$ref": "#/components/schemas/UpdateSessionAgentParam", + "description": "Agent settings to update on this session. Omitted fields stay unchanged." + }, + "metadata": { "type": [ "object", "null" @@ -82586,4206 +109151,4420 @@ "additionalProperties": { "type": "string", "minLength": 0, - "maxLength": 1048576 + "maxLength": 512 }, "propertyNames": { "type": "string", "minLength": 1, - "maxLength": 256 + "maxLength": 64 }, "minProperties": 0, - "maxProperties": 1024, - "description": "Environment variables set for the MCP server process." - }, - "env_vars": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Environment variable names to inherit from the selected execution environment." + "maxProperties": 16, + "description": "Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." } }, - "required": [ - "type", - "command", - "cwd" - ], "additionalProperties": false, - "description": "Starts an MCP server as a local process." + "description": "Fields to update on an existing session." }, - "McpTransportConfigParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/McpTransportConfigParamHttp" + "DeletedSessionResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the deleted session." }, - { - "$ref": "#/components/schemas/McpTransportConfigParamStdio" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "http": "#/components/schemas/McpTransportConfigParamHttp", - "stdio": "#/components/schemas/McpTransportConfigParamStdio" + "object": { + "type": "string", + "enum": [ + "agent.session.deleted" + ], + "default": "agent.session.deleted", + "x-stainless-const": true, + "description": "The object type. Always `agent.session.deleted`." + }, + "deleted": { + "type": "boolean", + "description": "Whether the session has been removed from the public API. Always `true`. Physical cleanup may still be in progress." } }, - "x-oai-discriminator-values": [ - "http", - "stdio" + "required": [ + "id", + "object", + "deleted" ], - "description": "The transport used to connect to an MCP server." + "additionalProperties": false, + "description": "A Managed Agents session removed from the public API. Physical cleanup may continue asynchronously." }, - "AgentToolConfigParamMcp": { + "SessionArtifactResource": { "type": "object", "properties": { - "type": { + "id": { + "type": "string", + "minLength": 0, + "description": "The immutable artifact ID." + }, + "object": { "type": "string", "enum": [ - "mcp" + "agent.session.artifact" ], - "default": "mcp", + "default": "agent.session.artifact", "x-stainless-const": true, - "description": "The type of the object. Always `mcp`." + "description": "The object type. Always `agent.session.artifact`." }, - "server_label": { + "session_id": { "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "A label used to identify the MCP server in tool calls." + "description": "The ID of the session that owns the artifact." }, - "credential_id": { - "type": [ - "string", - "null" - ], + "environment_id": { + "type": "string", "minLength": 0, - "maxLength": 1048576, - "description": "The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL." - }, - "transport": { - "$ref": "#/components/schemas/McpTransportConfigParam", - "description": "The transport used to connect to the MCP server." + "description": "The ID of the environment that produced the artifact." }, - "request_metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": {}, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Metadata included with requests to this MCP server." + "turn_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the completed turn that published the artifact." }, - "allowed_tools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "The MCP tools the agent may call. All server tools are allowed when omitted." + "path": { + "type": "string", + "minLength": 0, + "description": "The original absolute file path in the execution environment." }, - "required": { - "type": "boolean", - "default": false, - "description": "Whether this MCP server must initialize before the first turn. Defaults to `false`." + "size_bytes": { + "type": "integer", + "format": "int64", + "minimum": 0, + "description": "The immutable artifact size in bytes." }, - "connection_origin": { - "anyOf": [ - { - "$ref": "#/components/schemas/McpConnectionOriginParam" - }, - { - "type": "null" - } - ], - "description": "Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the artifact was published." } }, "required": [ - "type", - "server_label", - "transport" + "id", + "object", + "session_id", + "environment_id", + "turn_id", + "path", + "size_bytes", + "created_at" ], "additionalProperties": false, - "description": "Tools provided by a remote MCP server." + "description": "An immutable file published by a completed hosted session turn." }, - "AgentToolConfigParamWebSearch": { + "SessionArtifactListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "web_search" + "list" ], - "default": "web_search", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `web_search`." - }, - "mode": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchModeParam" - }, - { - "type": "null" - } - ], - "description": "The source used for web search results. Defaults to `live`." - }, - "context_size": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchContextSizeParam" - }, - { - "type": "null" - } - ], - "description": "The amount of search context made available to the model. Defaults to `medium`." + "description": "The object type, which is always `list`." }, - "allowed_domains": { - "type": [ - "array", - "null" - ], + "data": { + "type": "array", "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "$ref": "#/components/schemas/SessionArtifactResource" }, "minItems": 0, - "maxItems": 16384, - "description": "Domains the search may include." - }, - "location": { - "anyOf": [ - { - "$ref": "#/components/schemas/WebSearchLocationParam" - }, - { - "type": "null" - } - ], - "description": "Approximate location used to localize search results." - } - }, - "required": [ - "type" - ], - "additionalProperties": false, - "description": "Web search." - }, - "AgentToolConfigParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/AgentToolConfigParamFunction" - }, - { - "$ref": "#/components/schemas/AgentToolConfigParamToolSearch" - }, - { - "$ref": "#/components/schemas/AgentToolConfigParamProgrammaticToolCalling" - }, - { - "$ref": "#/components/schemas/AgentToolConfigParamMcp" - }, - { - "$ref": "#/components/schemas/AgentToolConfigParamWebSearch" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "function": "#/components/schemas/AgentToolConfigParamFunction", - "tool_search": "#/components/schemas/AgentToolConfigParamToolSearch", - "programmatic_tool_calling": "#/components/schemas/AgentToolConfigParamProgrammaticToolCalling", - "mcp": "#/components/schemas/AgentToolConfigParamMcp", - "web_search": "#/components/schemas/AgentToolConfigParamWebSearch" - } - }, - "x-oai-discriminator-values": [ - "function", - "tool_search", - "programmatic_tool_calling", - "mcp", - "web_search" - ], - "description": "A tool available to the agent." - }, - "SessionAgentConfigParam": { - "type": "object", - "properties": { - "model": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The model to use for the agent. The requested model name is preserved." - }, - "reasoning": { - "anyOf": [ - { - "$ref": "#/components/schemas/ReasoningParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort." - }, - "text": { - "anyOf": [ - { - "$ref": "#/components/schemas/TextParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for text generated by the agent." - }, - "service_tier": { - "anyOf": [ - { - "$ref": "#/components/schemas/ServiceTierParam" - }, - { - "type": "null" - } - ], - "description": "The service tier used for model requests." + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." }, - "instructions": { + "first_id": { "type": [ "string", "null" ], "minLength": 0, - "maxLength": 1048576, - "description": "Additional instructions appended to the agent's default base instructions. Omit to leave unchanged." - }, - "multi_agent": { - "anyOf": [ - { - "$ref": "#/components/schemas/MultiAgentConfigCurrentParam" - }, - { - "type": "null" - } - ], - "description": "Configuration for creating and coordinating subagents." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "tools": { + "last_id": { "type": [ - "array", + "string", "null" ], - "items": { - "$ref": "#/components/schemas/AgentToolConfigParam" - }, - "minItems": 0, - "maxItems": 16384, - "description": "Tools available to the agent. Omit to inherit, or pass null to clear them." + "minLength": 0, + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + }, + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ], "additionalProperties": false, - "description": "Agent configuration for a session. Omitted fields inherit from `agent_id` when supplied. Supplied objects and arrays replace the whole field; null resets nullable fields." + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "EnvironmentParamNone": { + "DeletedSessionArtifactResource": { "type": "object", "properties": { - "type": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the deleted session artifact." + }, + "object": { "type": "string", "enum": [ - "none" + "agent.session.artifact.deleted" ], - "default": "none", + "default": "agent.session.artifact.deleted", "x-stainless-const": true, - "description": "The type of the object. Always `none`." + "description": "The object type. Always `agent.session.artifact.deleted`." + }, + "deleted": { + "type": "boolean", + "description": "Whether the session artifact was deleted. Always `true`." } }, "required": [ - "type" + "id", + "object", + "deleted" ], "additionalProperties": false, - "description": "Runs the agent without an execution environment." + "description": "Confirmation that an immutable session artifact was deleted." }, - "EnvironmentParamOpenaiHosted": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "openai_hosted" - ], - "default": "openai_hosted", - "x-stainless-const": true, - "description": "The type of the object. Always `openai_hosted`." - }, - "packages": { - "anyOf": [ - { - "$ref": "#/components/schemas/EnvironmentPackagesParam" - }, - { - "type": "null" - } - ], - "description": "Packages to install in the environment. Defaults to empty package lists." - }, - "setup_commands": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/components/schemas/SetupCommandParam" - }, - "minItems": 0, - "maxItems": 16, - "description": "Ordered, confidential setup commands. Command bodies are never returned." - }, - "network": { - "anyOf": [ - { - "$ref": "#/components/schemas/NetworkPolicyParam" - }, - { - "type": "null" - } - ], - "description": "Network access policy for the environment. Defaults to enabled." - }, - "env": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Environment variables made available to the agent." - }, - "capability_directories": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + "BrowserAuthenticationFieldValueParam": { + "type": "object", + "properties": { + "field_id": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The field ID from the required action." }, - "skills": { - "type": [ - "array", - "null" + "value": { + "type": "string", + "minLength": 0, + "maxLength": 16384, + "description": "The value to enter into the registered control." + } + }, + "required": [ + "field_id", + "value" + ], + "additionalProperties": false, + "description": "One user-entered value, including non-password fields such as an email address." + }, + "ComputerUseApprovalResponseParamBrowserAuthenticationSubmitParam": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "browser_authentication" ], - "items": { - "$ref": "#/components/schemas/HostedSkillParam" - }, - "minItems": 0, - "maxItems": 200, - "description": "Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list." + "default": "browser_authentication", + "x-stainless-const": true }, - "plugins": { - "type": [ - "array", - "null" + "action": { + "type": "string", + "enum": [ + "submit" ], + "default": "submit", + "x-stainless-const": true + }, + "fields": { + "type": "array", "items": { - "$ref": "#/components/schemas/HostedPluginParam" + "$ref": "#/components/schemas/BrowserAuthenticationFieldValueParam" }, "minItems": 0, - "maxItems": 32, - "description": "Plugins provided as inline ZIP archives. Defaults to an empty list." + "maxItems": 6, + "description": "Values for up to six active fields in the required action. The submitted field-value mapping and selected option must fit within 120 KiB of JSON." }, - "files": { + "selected_option": { "type": [ - "array", + "string", "null" ], - "items": { - "$ref": "#/components/schemas/HostedEnvironmentFileParam" - }, - "minItems": 0, - "maxItems": 50, - "description": "Files available before the agent starts. Defaults to an empty list." - }, - "environment_template_id": { - "type": "string", "minLength": 0, - "maxLength": 64, - "description": "A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy." + "maxLength": 1048576, + "description": "The chosen method. Required when the required action contains options." } }, "required": [ - "type" + "type", + "action", + "fields" ], - "additionalProperties": false, - "description": "An OpenAI-hosted environment, optionally based on a reusable template." + "additionalProperties": false }, - "EnvironmentParamSelfHosted": { + "ComputerUseApprovalResponseParamBrowserAuthenticationCancelParam": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "self_hosted" + "browser_authentication" ], - "default": "self_hosted", - "x-stainless-const": true, - "description": "The type of the object. Always `self_hosted`." + "default": "browser_authentication", + "x-stainless-const": true }, - "workspace_directory": { + "action": { "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "Absolute project directory inside the self-hosted environment." - }, - "capability_directories": { - "type": [ - "array", - "null" + "enum": [ + "cancel" ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "Directories that contain capabilities exposed to the agent. Defaults to an empty list." + "default": "cancel", + "x-stainless-const": true } }, "required": [ "type", - "workspace_directory" + "action" ], - "additionalProperties": false, - "description": "An application-hosted environment configured inline." + "additionalProperties": false }, - "EnvironmentParam": { + "ComputerUseApprovalResponseParamBrowserAuthentication": { "oneOf": [ { - "$ref": "#/components/schemas/EnvironmentParamNone" - }, - { - "$ref": "#/components/schemas/EnvironmentParamOpenaiHosted" + "$ref": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthenticationSubmitParam" }, { - "$ref": "#/components/schemas/EnvironmentParamSelfHosted" + "$ref": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthenticationCancelParam" } ], "discriminator": { - "propertyName": "type", + "propertyName": "action", "mapping": { - "none": "#/components/schemas/EnvironmentParamNone", - "openai_hosted": "#/components/schemas/EnvironmentParamOpenaiHosted", - "self_hosted": "#/components/schemas/EnvironmentParamSelfHosted" + "submit": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthenticationSubmitParam", + "cancel": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthenticationCancelParam" } }, "x-oai-discriminator-values": [ - "none", - "openai_hosted", - "self_hosted" + "submit", + "cancel" ], - "description": "The execution environment and optional reusable template for a session." - }, - "InputContentParamInputText": { - "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_text" - ], - "default": "input_text", - "x-stainless-const": true, - "description": "The type of the object. Always `input_text`." - }, - "text": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The text sent to the model." + "browser_authentication" + ] } }, "required": [ - "type", - "text" + "type" + ] + }, + "BrowserOriginAccessDecisionParam": { + "type": "string", + "enum": [ + "approve", + "deny", + "cancel" ], - "additionalProperties": false, - "description": "Text input to the model." + "x-enumDescriptions": [ + "Allow the browser to access this origin.", + "Deny access to this origin.", + "Dismiss this request without approving access." + ], + "description": "The user's decision for a browser origin access request." }, - "InputContentParamInputImage": { + "ComputerUseApprovalResponseParamBrowserOriginAccessParam": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "input_image" + "browser_origin_access" ], - "default": "input_image", - "x-stainless-const": true, - "description": "The type of the object. Always `input_image`." + "default": "browser_origin_access", + "x-stainless-const": true }, - "image_url": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The URL of the image sent to the model." + "decision": { + "$ref": "#/components/schemas/BrowserOriginAccessDecisionParam", + "description": "Whether to allow, deny, or cancel the requested origin access." } }, "required": [ "type", - "image_url" + "decision" ], - "additionalProperties": false, - "description": "Image input to the model." + "additionalProperties": false }, - "InputContentParam": { + "ComputerUseApprovalResponseParam": { "oneOf": [ { - "$ref": "#/components/schemas/InputContentParamInputText" + "$ref": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthentication" }, { - "$ref": "#/components/schemas/InputContentParamInputImage" + "$ref": "#/components/schemas/ComputerUseApprovalResponseParamBrowserOriginAccessParam" } ], "discriminator": { "propertyName": "type", "mapping": { - "input_text": "#/components/schemas/InputContentParamInputText", - "input_image": "#/components/schemas/InputContentParamInputImage" + "browser_authentication": "#/components/schemas/ComputerUseApprovalResponseParamBrowserAuthentication", + "browser_origin_access": "#/components/schemas/ComputerUseApprovalResponseParamBrowserOriginAccessParam" } }, "x-oai-discriminator-values": [ - "input_text", - "input_image" - ], - "description": "Content included in an input message." + "browser_authentication", + "browser_origin_access" + ] }, - "InputMessageParam": { + "SessionInputParamAgentSessionInputComputerUseApprovalRequestResult": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "message" + "agent.session.input.computer_use_approval_request_result" ], - "default": "message", + "default": "agent.session.input.computer_use_approval_request_result", "x-stainless-const": true, - "description": "The type of the input item. Always `message`." + "description": "The type of the object. Always `agent.session.input.computer_use_approval_request_result`." }, - "role": { + "request_id": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The registered request ID from the required action." + }, + "response": { + "$ref": "#/components/schemas/ComputerUseApprovalResponseParam", + "description": "The response for this request type." + } + }, + "required": [ + "type", + "request_id", + "response" + ], + "additionalProperties": false, + "description": "Responds to a pending Computer Use approval request." + }, + "SessionInputParamAgentSessionInputMessage": { + "type": "object", + "properties": { + "type": { "type": "string", "enum": [ - "user" + "agent.session.input.message" ], - "default": "user", + "default": "agent.session.input.message", "x-stainless-const": true, - "description": "The role of the message author. Always `user`." + "description": "The type of the object. Always `agent.session.input.message`." }, - "content": { + "input": { "type": "array", "items": { - "$ref": "#/components/schemas/InputContentParam" + "$ref": "#/components/schemas/InputMessageParam" }, "minItems": 0, "maxItems": 16384, - "description": "The content of the message." + "description": "The user messages to add to the session." } }, "required": [ - "role", - "content" + "type", + "input" ], "additionalProperties": false, - "description": "A user message submitted to a session." + "description": "Adds one or more user messages and starts a turn." }, - "CreateSessionInputParam": { + "SessionInputParamAgentSessionInputCancel": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "agent.session.input.cancel" + ], + "default": "agent.session.input.cancel", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.input.cancel`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Cancels the session's active turn." + }, + "FunctionCallOutputParam": { "oneOf": [ { "type": "string", - "minLength": 1, + "minLength": 0, "maxLength": 1048576 }, { "type": "array", "items": { - "$ref": "#/components/schemas/InputMessageParam" + "$ref": "#/components/schemas/InputContentParam" }, "minItems": 0, "maxItems": 16384 } ], - "description": "Initial input submitted when creating a session." + "description": "A function result represented as text or supported model-input content." }, - "CreateAgentSessionParams": { + "SessionInputParamAgentSessionInputToolResult": { "type": "object", "properties": { - "metadata": { - "type": [ - "object", - "null" + "type": { + "type": "string", + "enum": [ + "agent.session.input.tool_result" ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 512 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 64 - }, - "minProperties": 0, - "maxProperties": 16, - "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map." - }, - "agent": { - "$ref": "#/components/schemas/SessionAgentConfigParam", - "description": "Agent configuration. With `agent_id`, supplied fields override the saved agent for this session. Without `agent_id`, `model` is required." + "default": "agent.session.input.tool_result", + "x-stainless-const": true, + "description": "The type of the object. Always `agent.session.input.tool_result`." }, - "agent_id": { + "turn_id": { "type": "string", "minLength": 0, - "maxLength": 64, - "description": "The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged." + "maxLength": 1048576, + "description": "The ID of the turn that requested the function call." }, - "environment": { - "$ref": "#/components/schemas/EnvironmentParam", - "description": "An inline execution environment or a reference to an environment template." + "call_id": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The ID of the function call." }, - "vault_ids": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "minItems": 0, - "maxItems": 16384, - "description": "The IDs of vaults made available to the session." + "success": { + "type": "boolean", + "description": "Whether the function call succeeded." }, - "input": { + "output": { "anyOf": [ { - "$ref": "#/components/schemas/CreateSessionInputParam" + "$ref": "#/components/schemas/FunctionCallOutputParam" }, { "type": "null" } ], - "description": "Initial input to submit when the session is created. A string is shorthand for a single user message. Required when `environment.type` is `none`, or when `stream` is `true` for an environment that is not `self_hosted`; optional for self-hosted and non-streaming execution environments." + "description": "The function result when the call succeeded." }, - "stream": { - "type": "boolean", - "default": false, - "description": "Whether to stream session events as server-sent events. Defaults to `false`." + "error": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "maxLength": 1048576, + "description": "The error message when the call failed." } }, "required": [ - "environment" + "type", + "turn_id", + "call_id", + "success" ], "additionalProperties": false, - "description": "Parameters for creating a Managed Agents session." + "description": "Submits the result of a function call." }, - "SessionErrorResource": { + "SessionInputParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/SessionInputParamAgentSessionInputComputerUseApprovalRequestResult" + }, + { + "$ref": "#/components/schemas/SessionInputParamAgentSessionInputMessage" + }, + { + "$ref": "#/components/schemas/SessionInputParamAgentSessionInputCancel" + }, + { + "$ref": "#/components/schemas/SessionInputParamAgentSessionInputToolResult" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "agent.session.input.computer_use_approval_request_result": "#/components/schemas/SessionInputParamAgentSessionInputComputerUseApprovalRequestResult", + "agent.session.input.message": "#/components/schemas/SessionInputParamAgentSessionInputMessage", + "agent.session.input.cancel": "#/components/schemas/SessionInputParamAgentSessionInputCancel", + "agent.session.input.tool_result": "#/components/schemas/SessionInputParamAgentSessionInputToolResult" + } + }, + "x-oai-discriminator-values": [ + "agent.session.input.computer_use_approval_request_result", + "agent.session.input.message", + "agent.session.input.cancel", + "agent.session.input.tool_result" + ], + "description": "Input submitted to an existing session." + }, + "CreateSessionEventsParams": { "type": "object", "properties": { - "type": { + "events": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionInputParam" + }, + "minItems": 0, + "maxItems": 16384, + "description": "The input events to submit to the session." + } + }, + "required": [ + "events" + ], + "additionalProperties": false, + "description": "Input events submitted to an existing session." + }, + "SessionTurnTraceResource": { + "type": "object", + "properties": { + "id": { "type": "string", "minLength": 0, - "description": "The error type." + "description": "The root turn ID. Use this ID as the pagination anchor." }, - "code": { - "type": [ - "string", - "null" + "object": { + "type": "string", + "enum": [ + "agent.session.trace" ], - "minLength": 0, - "description": "The machine-readable error code, if any." + "default": "agent.session.trace", + "x-stainless-const": true, + "description": "The object type, which is always `agent.session.trace`." }, - "message": { + "session_id": { "type": "string", "minLength": 0, - "description": "A customer-safe explanation of the error." + "description": "The session that owns this trace." }, - "param": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The request parameter associated with the error, if any." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp in seconds when the root turn was created." + }, + "otlp": { + "type": "object", + "additionalProperties": {}, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "An OTLP JSON ExportTraceServiceRequest containing resourceSpans. Only currently published data is returned; later trace updates are not awaited." } }, "required": [ - "type", - "code", - "message", - "param" + "id", + "object", + "session_id", + "created_at", + "otlp" ], - "additionalProperties": false, - "description": "An error payload with the same public fields as Responses API streaming errors." + "additionalProperties": false }, - "SessionEventError": { + "SessionTraceListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "error" + "list" ], - "default": "error", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `error`." + "description": "The object type, which is always `list`." }, - "event_id": { - "type": "string", + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SessionTurnTraceResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." + }, + "first_id": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The unique ID of the event." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "session_id": { - "type": "string", + "last_id": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The ID of the session associated with the event." + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, - "error": { - "$ref": "#/components/schemas/SessionErrorResource", - "description": "The error that occurred." + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type", - "event_id", - "session_id", - "error" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "Emitted when a turn or session fails.", - "x-oaiMeta": { - "example": { - "type": "error", - "event_id": "event_123", - "session_id": "sess_123", - "error": { - "type": "server_error", - "code": null, - "message": "The session failed due to an internal server error.", - "param": null - } - } - } + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "SessionEnvironmentStatusResource": { + "VaultStatusParam": { "type": "string", "enum": [ - "pending", - "ready", - "connected", - "disconnected", - "failed" - ], - "x-enumDescriptions": [ - "The environment is being prepared.", - "The environment is ready to connect.", - "The environment is connected.", - "The environment is disconnected.", - "The environment failed to connect." + "active", + "archived" ], - "description": "The connection status of a session environment." + "description": "Whether a vault or credential is active or archived." }, - "SessionEnvironmentErrorResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "minLength": 0, - "description": "The error type." - }, - "code": { - "type": "string", - "minLength": 0, - "description": "A machine-readable error code." - }, - "message": { - "type": "string", - "minLength": 0, - "description": "A human-readable error message." + "VaultStatusFilterParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/VaultStatusParam" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/VaultStatusParam" + }, + "minItems": 0, + "maxItems": 16384 } - }, - "required": [ - "type", - "code", - "message" ], - "additionalProperties": false, - "description": "An error reported while preparing a session environment." + "description": "One or more lifecycle statuses to include when listing vaults or credentials." }, - "SessionEnvironmentStateResource": { + "VaultResource": { "type": "object", "properties": { "id": { "type": "string", "minLength": 0, - "description": "The public ID of the environment." + "description": "The ID of the vault." }, - "type": { + "object": { "type": "string", + "enum": [ + "vault" + ], + "default": "vault", + "x-stainless-const": true, + "description": "The object type. Always `vault`." + }, + "name": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The environment type." + "description": "The human-readable name of the vault, if set." }, - "status": { - "$ref": "#/components/schemas/SessionEnvironmentStatusResource", - "description": "The environment's connection status." + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Key-value pairs associated with the vault, such as an application or team identifier." }, - "error": { - "anyOf": [ - { - "$ref": "#/components/schemas/SessionEnvironmentErrorResource" - }, - { - "type": "null" - } - ], - "description": "The error reported while preparing the environment, if any." + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the vault was created." } }, "required": [ "id", - "type", - "status", - "error" + "object", + "name", + "metadata", + "created_at" ], "additionalProperties": false, - "description": "The current state of a session environment." + "description": "A collection of credentials for MCP servers and OpenAI-hosted environments." }, - "SessionEventAgentSessionEnvironmentReady": { + "VaultListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "agent.session.environment.ready" + "list" ], - "default": "agent.session.environment.ready", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.environment.ready`." + "description": "The object type, which is always `list`." }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VaultResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." }, - "session_id": { - "type": "string", + "first_id": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The ID of the session associated with the event." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "turn_id": { + "last_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, - "environment": { - "$ref": "#/components/schemas/SessionEnvironmentStateResource", - "description": "The current environment state." + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "environment" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "Emitted when a hosted session environment is ready to connect." + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "SessionEventAgentOutputCommandExecutionOutputDelta": { + "CreateVaultParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "agent.output.command_execution_output.delta" - ], - "default": "agent.output.command_execution_output.delta", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.output.command_execution_output.delta`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { + "name": { "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." + "minLength": 1, + "maxLength": 1048576, + "description": "The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming." }, - "turn_id": { + "metadata": { "type": [ - "string", + "object", "null" ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the command execution item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "delta": { - "type": "string", - "minLength": 0, - "description": "The output text that was appended." + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minProperties": 0, + "maxProperties": 1024, + "description": "Key-value pairs to associate with the vault, such as an application or team identifier." } }, - "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "delta" - ], "additionalProperties": false, - "description": "Emitted when command execution produces an output delta." + "description": "Parameters for creating a vault to store credentials used by agent tools." }, - "SessionEventAgentSessionCreated": { + "UpdateVaultParams": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.created" - ], - "default": "agent.session.created", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.created`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Replaces all metadata. Omit to leave unchanged, or pass {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." }, - "session": { - "$ref": "#/components/schemas/SessionResource", - "description": "The session that was created." + "name": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 1048576, + "description": "A replacement name. Omit to leave unchanged, or pass null to clear it. The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming." } }, - "required": [ - "type", - "event_id", - "session" - ], "additionalProperties": false, - "description": "Emitted when a session is created." + "description": "Fields to replace on an active vault." }, - "SessionEventAgentSessionTurnCreated": { + "DeletedVaultResource": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.turn.created" - ], - "default": "agent.session.turn.created", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.created`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { + "id": { "type": "string", "minLength": 0, - "description": "The ID of the session associated with the event." + "description": "The ID of the deleted vault." }, - "turn_id": { + "object": { "type": "string", - "minLength": 0, - "description": "The ID of the turn associated with the event." + "enum": [ + "vault.deleted" + ], + "default": "vault.deleted", + "x-stainless-const": true, + "description": "The object type. Always `vault.deleted`." }, - "turn": { - "$ref": "#/components/schemas/TurnResource", - "description": "The turn at the time it was created." + "deleted": { + "type": "boolean", + "description": "Whether the resource was deleted. Always `true`." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "turn" + "id", + "object", + "deleted" ], "additionalProperties": false, - "description": "Emitted when a turn is created." + "description": "Confirmation that a vault was deleted." }, - "SessionEventAgentSessionTurnInProgress": { + "McpOauthTokenEndpointAuthResourceNone": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.in_progress" + "none" ], - "default": "agent.session.turn.in_progress", + "default": "none", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.in_progress`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn associated with the event." - }, - "turn": { - "$ref": "#/components/schemas/TurnResource", - "description": "The turn at the time it started running." + "description": "The type of the object. Always `none`." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "turn" + "type" ], "additionalProperties": false, - "description": "Emitted when a turn starts running." + "description": "Sends the client ID without a client secret." }, - "SessionEventAgentSessionTurnCompleted": { + "McpOauthTokenEndpointAuthResourceClientSecretBasic": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.completed" + "client_secret_basic" ], - "default": "agent.session.turn.completed", + "default": "client_secret_basic", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.completed`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn associated with the event." - }, - "turn": { - "$ref": "#/components/schemas/TurnResource", - "description": "The completed turn." - }, - "usage": { - "anyOf": [ - { - "$ref": "#/components/schemas/TokenUsageResource" - }, - { - "type": "null" - } - ], - "description": "Token usage by the root agent during the turn, when available." + "description": "The type of the object. Always `client_secret_basic`." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "turn", - "usage" + "type" ], "additionalProperties": false, - "description": "Emitted when a turn completes." + "description": "Sends the client ID and secret using HTTP Basic authentication." }, - "SessionEventAgentSessionTurnFailed": { + "McpOauthTokenEndpointAuthResourceClientSecretPost": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.failed" + "client_secret_post" ], - "default": "agent.session.turn.failed", + "default": "client_secret_post", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.failed`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn associated with the event." - }, - "turn": { - "$ref": "#/components/schemas/TurnResource", - "description": "The failed turn." - }, - "usage": { - "anyOf": [ - { - "$ref": "#/components/schemas/TokenUsageResource" - }, - { - "type": "null" - } - ], - "description": "Token usage by the root agent during the turn, when available." + "description": "The type of the object. Always `client_secret_post`." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "turn", - "usage" + "type" ], "additionalProperties": false, - "description": "Emitted when a turn fails." + "description": "Sends the client ID and secret in the token request body." }, - "SessionEventAgentSessionTurnCancelled": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.turn.cancelled" - ], - "default": "agent.session.turn.cancelled", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.cancelled`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the turn associated with the event." + "McpOauthTokenEndpointAuthResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/McpOauthTokenEndpointAuthResourceNone" }, - "turn": { - "$ref": "#/components/schemas/TurnResource", - "description": "The cancelled turn." + { + "$ref": "#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretBasic" }, - "usage": { - "anyOf": [ - { - "$ref": "#/components/schemas/TokenUsageResource" - }, - { - "type": "null" - } - ], - "description": "Token usage by the root agent during the turn, when available." + { + "$ref": "#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretPost" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "none": "#/components/schemas/McpOauthTokenEndpointAuthResourceNone", + "client_secret_basic": "#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretBasic", + "client_secret_post": "#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretPost" } }, - "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "turn", - "usage" + "x-oai-discriminator-values": [ + "none", + "client_secret_basic", + "client_secret_post" ], - "additionalProperties": false, - "description": "Emitted when a turn is cancelled." + "description": "The client authentication method used for OAuth token refresh." }, - "SessionEventAgentSessionTurnItemAdded": { + "McpOauthRefreshResource": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.turn.item.added" - ], - "default": "agent.session.turn.item.added", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.item.added`." - }, - "event_id": { + "token_endpoint": { "type": "string", "minLength": 0, - "description": "The unique ID of the event." + "description": "The HTTPS OAuth token endpoint used for refresh." }, - "session_id": { + "client_id": { "type": "string", "minLength": 0, - "description": "The ID of the session associated with the event." + "description": "The OAuth client ID used when requesting a new access token." }, - "turn_id": { + "resource": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "description": "The resource URI sent to the OAuth token endpoint during refresh, if configured." }, - "output_index": { + "scope": { "type": [ - "integer", + "string", "null" ], - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output, when the item is agent output." + "minLength": 0, + "description": "Space-separated OAuth scopes requested during refresh, if configured." }, - "item": { - "$ref": "#/components/schemas/SessionTurnItemResource", - "description": "The item that was added." + "token_endpoint_auth": { + "$ref": "#/components/schemas/McpOauthTokenEndpointAuthResource", + "description": "How the OAuth client authenticates to the token endpoint, excluding its client secret." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "output_index", - "item" + "token_endpoint", + "client_id", + "resource", + "scope", + "token_endpoint_auth" ], "additionalProperties": false, - "description": "Emitted when an item is added to a turn." + "description": "Configuration used to refresh an MCP OAuth access token, excluding secret values." }, - "SessionEventAgentSessionIdle": { + "VaultCredentialAuthResourceMcpOauth": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.idle" + "mcp_oauth" ], - "default": "agent.session.idle", + "default": "mcp_oauth", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.idle`." + "description": "The type of the object. Always `mcp_oauth`." }, - "event_id": { + "mcp_server_url": { "type": "string", "minLength": 0, - "description": "The unique ID of the event." + "description": "The HTTPS MCP server URL authorized by this credential." }, - "session": { - "$ref": "#/components/schemas/SessionResource", - "description": "The session that became idle." + "expires_at": { + "type": [ + "string", + "null" + ], + "minLength": 0, + "description": "When the OAuth access token expires, as an RFC 3339 timestamp, if known." + }, + "refresh": { + "anyOf": [ + { + "$ref": "#/components/schemas/McpOauthRefreshResource" + }, + { + "type": "null" + } + ], + "description": "Public refresh metadata without refresh tokens or OAuth client secrets." } }, "required": [ "type", - "event_id", - "session" + "mcp_server_url", + "expires_at", + "refresh" ], "additionalProperties": false, - "description": "Emitted when a session becomes idle." + "description": "Public metadata for an OAuth credential; tokens and client secrets are never returned." }, - "SessionEventAgentSessionInProgress": { + "VaultCredentialAuthResourceStaticBearer": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.in_progress" + "static_bearer" ], - "default": "agent.session.in_progress", + "default": "static_bearer", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.in_progress`." + "description": "The type of the object. Always `static_bearer`." }, - "event_id": { + "mcp_server_url": { "type": "string", "minLength": 0, - "description": "The unique ID of the event." - }, - "session": { - "$ref": "#/components/schemas/SessionResource", - "description": "The session that started processing." + "description": "The HTTPS MCP server URL authorized by this credential." } }, "required": [ "type", - "event_id", - "session" + "mcp_server_url" ], "additionalProperties": false, - "description": "Emitted when a session starts processing a turn." + "description": "Metadata for a bearer-token credential, without automatic OAuth refresh." }, - "SessionEventAgentSessionRequiresAction": { + "VaultCredentialNetworkingResourceUnrestricted": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.requires_action" + "unrestricted" ], - "default": "agent.session.requires_action", + "default": "unrestricted", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.requires_action`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session": { - "$ref": "#/components/schemas/SessionResource", - "description": "The session and its current required actions." + "description": "The type of the object. Always `unrestricted`." } }, "required": [ - "type", - "event_id", - "session" + "type" ], "additionalProperties": false, - "description": "Emitted when a session is waiting for one or more required actions." + "description": "Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`." }, - "SessionEventAgentSessionFailed": { + "VaultCredentialNetworkingResourceLimited": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.failed" + "limited" ], - "default": "agent.session.failed", + "default": "limited", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.failed`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." + "description": "The type of the object. Always `limited`." }, - "session": { - "$ref": "#/components/schemas/SessionResource", - "description": "The failed session." + "allowed_hosts": { + "type": "array", + "items": { + "type": "string", + "minLength": 0 + }, + "minItems": 1, + "maxItems": 16, + "description": "The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported." } }, "required": [ "type", - "event_id", - "session" + "allowed_hosts" ], "additionalProperties": false, - "description": "Emitted when a session fails." + "description": "Allows substitution only for the listed hosts. The environment network policy must also allow these hosts." }, - "SessionEventAgentSessionEnvironmentPending": { + "VaultCredentialNetworkingResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/VaultCredentialNetworkingResourceUnrestricted" + }, + { + "$ref": "#/components/schemas/VaultCredentialNetworkingResourceLimited" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "unrestricted": "#/components/schemas/VaultCredentialNetworkingResourceUnrestricted", + "limited": "#/components/schemas/VaultCredentialNetworkingResourceLimited" + } + }, + "x-oai-discriminator-values": [ + "unrestricted", + "limited" + ], + "description": "Destination permissions for an environment-variable credential. These do not grant network access to the environment." + }, + "VaultCredentialAuthResourceEnvironmentVariable": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.environment.pending" + "environment_variable" ], - "default": "agent.session.environment.pending", + "default": "environment_variable", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.environment.pending`." + "description": "The type of the object. Always `environment_variable`." }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { + "secret_name": { "type": "string", "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "description": "The environment variable name that receives the placeholder in the sandbox." }, - "environment": { - "$ref": "#/components/schemas/SessionEnvironmentStateResource", - "description": "The current environment state." + "networking": { + "$ref": "#/components/schemas/VaultCredentialNetworkingResource", + "description": "The destinations where the proxy can substitute the secret, subject to the environment network policy." } }, "required": [ "type", - "event_id", - "session_id", - "turn_id", - "environment" + "secret_name", + "networking" ], "additionalProperties": false, - "description": "Emitted while a session environment is being prepared." + "description": "Metadata for an HTTP credential used only in OpenAI-hosted environments. Sandbox code receives a placeholder. The proxy substitutes the secret for allowed HTTPS destinations on ports 443 and 8443. The real secret is not available to sandbox code for local computation and is never returned in this resource." }, - "SessionEventAgentSessionEnvironmentConnected": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.environment.connected" - ], - "default": "agent.session.environment.connected", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.environment.connected`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." + "VaultCredentialAuthResource": { + "oneOf": [ + { + "$ref": "#/components/schemas/VaultCredentialAuthResourceMcpOauth" }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + { + "$ref": "#/components/schemas/VaultCredentialAuthResourceStaticBearer" }, - "environment": { - "$ref": "#/components/schemas/SessionEnvironmentStateResource", - "description": "The current environment state." + { + "$ref": "#/components/schemas/VaultCredentialAuthResourceEnvironmentVariable" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "mcp_oauth": "#/components/schemas/VaultCredentialAuthResourceMcpOauth", + "static_bearer": "#/components/schemas/VaultCredentialAuthResourceStaticBearer", + "environment_variable": "#/components/schemas/VaultCredentialAuthResourceEnvironmentVariable" } }, - "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "environment" + "x-oai-discriminator-values": [ + "mcp_oauth", + "static_bearer", + "environment_variable" ], - "additionalProperties": false, - "description": "Emitted when a session environment connects." + "description": "The authentication configuration of a vault credential, excluding secrets." }, - "SessionEventAgentSessionEnvironmentDisconnected": { + "VaultCredentialResource": { "type": "object", "properties": { - "type": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the credential." + }, + "object": { "type": "string", "enum": [ - "agent.session.environment.disconnected" + "vault.credential" ], - "default": "agent.session.environment.disconnected", + "default": "vault.credential", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.environment.disconnected`." + "description": "The object type. Always `vault.credential`." }, - "event_id": { + "vault_id": { "type": "string", "minLength": 0, - "description": "The unique ID of the event." + "description": "The ID of the vault containing this credential." }, - "session_id": { + "name": { "type": "string", "minLength": 0, - "description": "The ID of the session associated with the event." + "description": "The human-readable name of the credential." }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "auth": { + "$ref": "#/components/schemas/VaultCredentialAuthResource", + "description": "The authentication method and non-secret configuration of the credential." }, - "environment": { - "$ref": "#/components/schemas/SessionEnvironmentStateResource", - "description": "The current environment state." + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0 + }, + "propertyNames": { + "type": "string", + "minLength": 0 + }, + "minProperties": 0, + "description": "Application-defined key-value pairs associated with this credential." + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the credential was created." + }, + "updated_at": { + "type": "integer", + "format": "int64", + "description": "The Unix timestamp, in seconds, when the credential was last updated." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "environment" + "id", + "object", + "vault_id", + "name", + "auth", + "metadata", + "created_at", + "updated_at" ], "additionalProperties": false, - "description": "Emitted when a session environment disconnects." + "description": "Metadata for a stored credential. Secret values are never returned." }, - "SessionEventAgentSessionEnvironmentFailed": { + "VaultCredentialListResource": { "type": "object", "properties": { - "type": { + "object": { "type": "string", "enum": [ - "agent.session.environment.failed" + "list" ], - "default": "agent.session.environment.failed", + "default": "list", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.environment.failed`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." + "description": "The object type, which is always `list`." }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VaultCredentialResource" + }, + "minItems": 0, + "maxItems": 2000, + "description": "The resources returned in this page, in the requested sort order." }, - "turn_id": { + "first_id": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "description": "The ID of the first resource in `data`, or `null` if the page is empty." }, - "environment": { - "$ref": "#/components/schemas/SessionEnvironmentStateResource", - "description": "The current environment state." - } - }, - "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "environment" - ], - "additionalProperties": false, - "description": "Emitted when a session environment fails." - }, - "SessionEventAgentSessionSubagentCreated": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.subagent.created" + "last_id": { + "type": [ + "string", + "null" ], - "default": "agent.session.subagent.created", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.subagent.created`." - }, - "event_id": { - "type": "string", "minLength": 0, - "description": "The unique ID of the event." + "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." }, - "subagent": { - "$ref": "#/components/schemas/SubagentResource", - "description": "The subagent that was created." + "has_more": { + "type": "boolean", + "description": "Whether there are more resources to retrieve after this page." } }, "required": [ - "type", - "event_id", - "subagent" + "object", + "data", + "first_id", + "last_id", + "has_more" ], "additionalProperties": false, - "description": "Emitted when a subagent is created." + "description": "A page of Agents API resources, with IDs for retrieving additional pages." }, - "SessionEventAgentSessionSubagentActive": { + "CreateMcpOauthTokenEndpointAuthParamNone": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.subagent.active" + "none" ], - "default": "agent.session.subagent.active", + "default": "none", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.subagent.active`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "subagent": { - "$ref": "#/components/schemas/SubagentResource", - "description": "The subagent that resumed." + "description": "The type of the object. Always `none`." } }, "required": [ - "type", - "event_id", - "subagent" + "type" ], "additionalProperties": false, - "description": "Emitted when a closed subagent successfully resumes." + "description": "Sends the client ID without a client secret." }, - "SessionEventAgentSessionSubagentClosed": { + "CreateMcpOauthTokenEndpointAuthParamClientSecretBasic": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.subagent.closed" + "client_secret_basic" ], - "default": "agent.session.subagent.closed", + "default": "client_secret_basic", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.subagent.closed`." + "description": "The type of the object. Always `client_secret_basic`." }, - "event_id": { + "client_secret": { "type": "string", "minLength": 0, - "description": "The unique ID of the event." - }, - "subagent": { - "$ref": "#/components/schemas/SubagentResource", - "description": "The subagent that was closed." + "maxLength": 1048576, + "description": "The OAuth client secret to store. Never returned in credential resources." } }, "required": [ "type", - "event_id", - "subagent" + "client_secret" ], "additionalProperties": false, - "description": "Emitted when a subagent is closed." + "description": "Sends the client ID and secret using HTTP Basic authentication." }, - "AssistantMessageItemResource": { + "CreateMcpOauthTokenEndpointAuthParamClientSecretPost": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "message" + "client_secret_post" ], - "default": "message", + "default": "client_secret_post", "x-stainless-const": true, - "description": "The item type. Always `message`." - }, - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the message." + "description": "The type of the object. Always `client_secret_post`." }, - "turn_id": { + "client_secret": { "type": "string", "minLength": 0, - "description": "The ID of the turn that contains this item." - }, - "role": { - "type": "string", - "enum": [ - "assistant" - ], - "default": "assistant", - "x-stainless-const": true, - "description": "The role of the message author. Always `assistant`." - }, - "status": { - "$ref": "#/components/schemas/OutputItemStatusResource", - "description": "The status of the message." - }, - "content": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OutputTextResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The content of the message." - }, - "phase": { - "anyOf": [ - { - "$ref": "#/components/schemas/MessagePhaseResource" - }, - { - "type": "null" - } - ], - "description": "The phase of the assistant message." + "maxLength": 1048576, + "description": "The OAuth client secret to store. Never returned in credential resources." } }, "required": [ "type", - "id", - "turn_id", - "role", - "status", - "content", - "phase" + "client_secret" ], "additionalProperties": false, - "description": "An assistant message produced by the agent." + "description": "Sends the client ID and secret in the token request body." }, - "AgentOutputItemResource": { + "CreateMcpOauthTokenEndpointAuthParam": { "oneOf": [ { - "$ref": "#/components/schemas/AssistantMessageItemResource" - }, - { - "$ref": "#/components/schemas/ReasoningItemResource" - }, - { - "$ref": "#/components/schemas/FunctionCallItemResource" - }, - { - "$ref": "#/components/schemas/McpCallItemResource" - }, - { - "$ref": "#/components/schemas/WebSearchCallItemResource" - }, - { - "$ref": "#/components/schemas/CommandExecutionItemResource" - }, - { - "$ref": "#/components/schemas/CreateSubagentCallItemResource" - }, - { - "$ref": "#/components/schemas/SendSubagentInputCallItemResource" - }, - { - "$ref": "#/components/schemas/ResumeSubagentCallItemResource" - }, - { - "$ref": "#/components/schemas/WaitForSubagentsCallItemResource" + "$ref": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamNone" }, { - "$ref": "#/components/schemas/InterruptSubagentCallItemResource" + "$ref": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretBasic" }, { - "$ref": "#/components/schemas/CloseSubagentCallItemResource" + "$ref": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretPost" } ], "discriminator": { "propertyName": "type", "mapping": { - "message": "#/components/schemas/AssistantMessageItemResource", - "reasoning": "#/components/schemas/ReasoningItemResource", - "function_call": "#/components/schemas/FunctionCallItemResource", - "mcp_call": "#/components/schemas/McpCallItemResource", - "web_search_call": "#/components/schemas/WebSearchCallItemResource", - "command_execution": "#/components/schemas/CommandExecutionItemResource", - "interrupt_subagent_call": "#/components/schemas/InterruptSubagentCallItemResource", - "create_subagent_call": "#/components/schemas/CreateSubagentCallItemResource", - "send_subagent_input_call": "#/components/schemas/SendSubagentInputCallItemResource", - "resume_subagent_call": "#/components/schemas/ResumeSubagentCallItemResource", - "wait_for_subagents_call": "#/components/schemas/WaitForSubagentsCallItemResource", - "close_subagent_call": "#/components/schemas/CloseSubagentCallItemResource" + "none": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamNone", + "client_secret_basic": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretBasic", + "client_secret_post": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretPost" } }, "x-oai-discriminator-values": [ - "message", - "reasoning", - "function_call", - "mcp_call", - "web_search_call", - "command_execution", - "create_subagent_call", - "send_subagent_input_call", - "resume_subagent_call", - "wait_for_subagents_call", - "interrupt_subagent_call", - "close_subagent_call" + "none", + "client_secret_basic", + "client_secret_post" ], - "description": "An output item produced by an agent." + "description": "Client authentication credentials for OAuth token refresh." }, - "SessionEventAgentSessionTurnItemDone": { + "CreateMcpOauthRefreshParam": { "type": "object", "properties": { - "type": { + "token_endpoint": { "type": "string", - "enum": [ - "agent.session.turn.item.done" - ], - "default": "agent.session.turn.item.done", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.item.done`." + "minLength": 0, + "maxLength": 1048576, + "description": "The HTTPS OAuth token endpoint used to exchange the refresh token for a new access token." }, - "event_id": { + "client_id": { "type": "string", "minLength": 0, - "description": "The unique ID of the event." + "maxLength": 1048576, + "description": "The OAuth client ID used when requesting a new access token." }, - "session_id": { - "type": "string", + "resource": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The ID of the session associated with the event." + "maxLength": 1048576, + "description": "The resource URI to send to the OAuth token endpoint during refresh, if required." }, - "turn_id": { + "scope": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "maxLength": 1048576, + "description": "Space-separated OAuth scopes to request during refresh, if required." }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the output item in the turn output." + "refresh_token": { + "type": "string", + "minLength": 0, + "maxLength": 1048576, + "description": "The refresh token to store. This secret is never returned in credential resources." }, - "item": { - "$ref": "#/components/schemas/AgentOutputItemResource", - "description": "The completed output item." + "token_endpoint_auth": { + "$ref": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParam", + "description": "How the OAuth client authenticates to the token endpoint." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "output_index", - "item" + "token_endpoint", + "client_id", + "refresh_token", + "token_endpoint_auth" ], "additionalProperties": false, - "description": "Emitted when an output item is complete." + "description": "Configuration for refreshing the access token of an MCP OAuth credential." }, - "SessionEventAgentSessionTurnContentPartAdded": { + "CreateVaultCredentialAuthParamMcpOauth": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.content_part.added" + "mcp_oauth" ], - "default": "agent.session.turn.content_part.added", + "default": "mcp_oauth", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.content_part.added`." + "description": "The type of the object. Always `mcp_oauth`." }, - "event_id": { + "mcp_server_url": { "type": "string", "minLength": 0, - "description": "The unique ID of the event." + "maxLength": 1048576, + "description": "The HTTPS MCP server URL authorized by this credential." }, - "session_id": { + "access_token": { "type": "string", "minLength": 0, - "description": "The ID of the session associated with the event." + "maxLength": 1048576, + "description": "A write-only OAuth access token; never returned by credential resources." }, - "turn_id": { + "expires_at": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the message item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "content_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the content part in the message." + "maxLength": 1048576, + "description": "When the OAuth access token expires, as an RFC 3339 timestamp, if known." }, - "part": { - "$ref": "#/components/schemas/OutputTextResource", - "description": "The initial content part." + "refresh": { + "anyOf": [ + { + "$ref": "#/components/schemas/CreateMcpOauthRefreshParam" + }, + { + "type": "null" + } + ], + "description": "Optional refresh configuration for an HTTPS OAuth token endpoint." } }, "required": [ "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "content_index", - "part" + "mcp_server_url", + "access_token" ], "additionalProperties": false, - "description": "Emitted when an output text content part is added." + "description": "An OAuth credential for an HTTPS MCP destination." }, - "SessionEventAgentSessionTurnContentPartDone": { + "CreateVaultCredentialAuthParamStaticBearer": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.content_part.done" + "static_bearer" ], - "default": "agent.session.turn.content_part.done", + "default": "static_bearer", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.content_part.done`." + "description": "The type of the object. Always `static_bearer`." }, - "event_id": { + "mcp_server_url": { "type": "string", "minLength": 0, - "description": "The unique ID of the event." + "maxLength": 1048576, + "description": "The HTTPS MCP server URL authorized by this credential." }, - "session_id": { + "token": { "type": "string", "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": [ - "string", - "null" + "maxLength": 1048576, + "description": "The bearer token to store. This secret is never returned in credential resources." + } + }, + "required": [ + "type", + "mcp_server_url", + "token" + ], + "additionalProperties": false, + "description": "A bearer token for an MCP server, without automatic OAuth refresh." + }, + "VaultCredentialNetworkingParamUnrestricted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "unrestricted" ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { + "default": "unrestricted", + "x-stainless-const": true, + "description": "The type of the object. Always `unrestricted`." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Allows substitution for destinations permitted by the environment network policy. Requires `environment.network.access` to be `restricted`, with explicit `allowed_domains`." + }, + "VaultCredentialNetworkingParamLimited": { + "type": "object", + "properties": { + "type": { "type": "string", - "minLength": 0, - "description": "The ID of the message item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "content_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the content part in the message." + "enum": [ + "limited" + ], + "default": "limited", + "x-stainless-const": true, + "description": "The type of the object. Always `limited`." }, - "part": { - "$ref": "#/components/schemas/OutputTextResource", - "description": "The completed content part." + "allowed_hosts": { + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "maxLength": 1048576 + }, + "minItems": 1, + "maxItems": 16, + "description": "The 1 to 16 distinct allowed hostnames or IPv4 addresses, normalized to lowercase. Entries contain no scheme, path, port, or wildcard. IPv6 addresses are not supported." } }, "required": [ "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "content_index", - "part" + "allowed_hosts" ], "additionalProperties": false, - "description": "Emitted when an output content part is complete." + "description": "Allows substitution only for the listed hosts. The environment network policy must also allow these hosts." }, - "SessionEventAgentSessionTurnOutputTextDelta": { + "VaultCredentialNetworkingParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/VaultCredentialNetworkingParamUnrestricted" + }, + { + "$ref": "#/components/schemas/VaultCredentialNetworkingParamLimited" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "unrestricted": "#/components/schemas/VaultCredentialNetworkingParamUnrestricted", + "limited": "#/components/schemas/VaultCredentialNetworkingParamLimited" + } + }, + "x-oai-discriminator-values": [ + "unrestricted", + "limited" + ], + "description": "Destination permissions for an environment-variable credential. These do not grant network access to the environment." + }, + "CreateVaultCredentialAuthParamEnvironmentVariable": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.output_text.delta" + "environment_variable" ], - "default": "agent.session.turn.output_text.delta", + "default": "environment_variable", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.output_text.delta`." + "description": "The type of the object. Always `environment_variable`." }, - "event_id": { + "secret_name": { "type": "string", - "minLength": 0, - "description": "The unique ID of the event." + "minLength": 1, + "maxLength": 1048576, + "description": "The environment variable name that receives the placeholder, such as `SERVICE_API_KEY`. Use ASCII letters, digits, and underscores, starting with a letter or underscore. Names starting with `CODEX_` and managed proxy or certificate variable names are reserved." }, - "session_id": { + "secret_value": { "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." + "minLength": 1, + "maxLength": 1048576, + "description": "The write-only secret to store. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes." }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "networking": { + "$ref": "#/components/schemas/VaultCredentialNetworkingParam", + "description": "The destinations where the proxy can substitute this secret. The environment network policy must also allow them." + } + }, + "required": [ + "type", + "secret_name", + "secret_value", + "networking" + ], + "additionalProperties": false, + "description": "An HTTP credential for OpenAI-hosted environments only. The sandbox receives an environment variable containing a placeholder, not the secret. Use the placeholder unchanged in outgoing requests. The egress proxy replaces the placeholder with the secret for allowed HTTPS destinations on ports 443 and 8443. Sandbox code cannot read the real secret or use it for local computation, such as signing a request." + }, + "CreateVaultCredentialAuthParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateVaultCredentialAuthParamMcpOauth" }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the message item." + { + "$ref": "#/components/schemas/CreateVaultCredentialAuthParamStaticBearer" }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." + { + "$ref": "#/components/schemas/CreateVaultCredentialAuthParamEnvironmentVariable" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "mcp_oauth": "#/components/schemas/CreateVaultCredentialAuthParamMcpOauth", + "static_bearer": "#/components/schemas/CreateVaultCredentialAuthParamStaticBearer", + "environment_variable": "#/components/schemas/CreateVaultCredentialAuthParamEnvironmentVariable" + } + }, + "x-oai-discriminator-values": [ + "mcp_oauth", + "static_bearer", + "environment_variable" + ], + "description": "Authentication credentials for an MCP server or an OpenAI-hosted environment." + }, + "CreateVaultCredentialParams": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 1048576, + "description": "The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming." }, - "content_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the content part in the message." + "auth": { + "$ref": "#/components/schemas/CreateVaultCredentialAuthParam", + "description": "The authentication method and write-only secret values to store." }, - "delta": { - "type": "string", - "minLength": 0, - "description": "The text that was appended." + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Defaults to an empty map." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "content_index", - "delta" + "auth", + "name" ], "additionalProperties": false, - "description": "Emitted when text is appended to an output text content part." + "description": "Parameters for storing a credential for an MCP server or an OpenAI-hosted environment." }, - "SessionEventAgentSessionTurnOutputTextDone": { + "RotateMcpOauthTokenEndpointAuthParamClientSecretBasic": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.output_text.done" + "client_secret_basic" ], - "default": "agent.session.turn.output_text.done", + "default": "client_secret_basic", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.output_text.done`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." + "description": "The type of the object. Always `client_secret_basic`." }, - "turn_id": { + "client_secret": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the message item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "content_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the content part in the message." - }, - "text": { - "type": "string", - "minLength": 0, - "description": "The complete output text." + "maxLength": 1048576, + "description": "The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "content_index", - "text" + "type" ], "additionalProperties": false, - "description": "Emitted when an output text content part is complete." + "description": "Updates credentials sent using HTTP Basic authentication." }, - "SessionEventAgentSessionTurnReasoningSummaryPartAdded": { + "RotateMcpOauthTokenEndpointAuthParamClientSecretPost": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.reasoning_summary_part.added" + "client_secret_post" ], - "default": "agent.session.turn.reasoning_summary_part.added", + "default": "client_secret_post", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.reasoning_summary_part.added`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." + "description": "The type of the object. Always `client_secret_post`." }, - "session_id": { - "type": "string", + "client_secret": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The ID of the session associated with the event." + "maxLength": 1048576, + "description": "The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Updates credentials sent in the token request body." + }, + "RotateMcpOauthTokenEndpointAuthParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretBasic" }, - "turn_id": { + { + "$ref": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretPost" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "client_secret_basic": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretBasic", + "client_secret_post": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretPost" + } + }, + "x-oai-discriminator-values": [ + "client_secret_basic", + "client_secret_post" + ], + "description": "Client-secret updates that preserve the credential's OAuth authentication method." + }, + "RotateMcpOauthRefreshParam": { + "type": "object", + "properties": { + "refresh_token": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." + "maxLength": 1048576, + "description": "The replacement refresh token. Omit or pass `null` to keep the stored token. This secret is never returned in resources." }, - "item_id": { - "type": "string", + "scope": { + "type": [ + "string", + "null" + ], "minLength": 0, - "description": "The ID of the reasoning item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "summary_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the summary content part." + "maxLength": 1048576, + "description": "Replacement space-separated OAuth scopes for refresh requests. Omit to keep the scopes, or pass `null` to stop sending a scope parameter." }, - "part": { - "$ref": "#/components/schemas/SummaryTextResource", - "description": "The initial summary part." + "token_endpoint_auth": { + "anyOf": [ + { + "$ref": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParam" + }, + { + "type": "null" + } + ], + "description": "Client-secret updates for the existing token endpoint authentication method." } }, - "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "summary_index", - "part" - ], "additionalProperties": false, - "description": "Emitted when a reasoning summary content part is added." + "description": "Updates to an MCP credential's existing OAuth refresh configuration." }, - "SessionEventAgentSessionTurnReasoningSummaryPartDone": { + "RotateVaultCredentialAuthParamMcpOauth": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.reasoning_summary_part.done" + "mcp_oauth" ], - "default": "agent.session.turn.reasoning_summary_part.done", + "default": "mcp_oauth", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.reasoning_summary_part.done`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." + "description": "The type of the object. Always `mcp_oauth`." }, - "turn_id": { + "access_token": { "type": [ "string", "null" ], "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the reasoning item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "summary_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the summary part." - }, - "part": { - "$ref": "#/components/schemas/SummaryTextResource", - "description": "The completed summary part." + "maxLength": 1048576, + "description": "A write-only replacement OAuth access token." }, - "status": { + "expires_at": { "type": [ "string", "null" ], - "enum": [ - "incomplete", - null + "minLength": 0, + "maxLength": 1048576, + "description": "The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting this field preserves the expiry unless a new access token is supplied, in which case the expiry is cleared." + }, + "refresh": { + "anyOf": [ + { + "$ref": "#/components/schemas/RotateMcpOauthRefreshParam" + }, + { + "type": "null" + } ], - "description": "Present as `incomplete` when summary generation was interrupted.", - "x-stainless-const": true + "description": "Optional write-only refresh-token and client-secret updates." } }, "required": [ - "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "summary_index", - "part", - "status" + "type" ], "additionalProperties": false, - "description": "Emitted when a reasoning summary part is complete." + "description": "Rotate an OAuth credential for an HTTPS MCP destination." }, - "SessionEventAgentSessionTurnReasoningSummaryTextDelta": { + "RotateVaultCredentialAuthParamStaticBearer": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.reasoning_summary_text.delta" + "static_bearer" ], - "default": "agent.session.turn.reasoning_summary_text.delta", + "default": "static_bearer", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the reasoning item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "summary_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the summary content part." + "description": "The type of the object. Always `static_bearer`." }, - "delta": { + "token": { "type": "string", "minLength": 0, - "description": "The summary text that was appended." + "maxLength": 1048576, + "description": "The replacement bearer token. This secret is never returned in credential resources." } }, "required": [ "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "summary_index", - "delta" + "token" ], "additionalProperties": false, - "description": "Emitted when text is appended to a reasoning summary." + "description": "Replace the bearer token for the credential's MCP server." }, - "SessionEventAgentSessionTurnReasoningSummaryTextDone": { + "RotateVaultCredentialAuthParamEnvironmentVariable": { "type": "object", "properties": { "type": { "type": "string", "enum": [ - "agent.session.turn.reasoning_summary_text.done" + "environment_variable" ], - "default": "agent.session.turn.reasoning_summary_text.done", + "default": "environment_variable", "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.turn.reasoning_summary_text.done`." - }, - "event_id": { - "type": "string", - "minLength": 0, - "description": "The unique ID of the event." - }, - "session_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the session associated with the event." - }, - "turn_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the turn associated with the event, when applicable." - }, - "item_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the reasoning item." - }, - "output_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the item in the turn output." - }, - "summary_index": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 4294967295, - "description": "The index of the summary content part." + "description": "The type of the object. Always `environment_variable`." }, - "text": { + "secret_value": { "type": "string", - "minLength": 0, - "description": "The complete reasoning summary text." + "minLength": 1, + "maxLength": 1048576, + "description": "The write-only replacement secret. Never returned in credential resources or supplied directly to sandbox code. Must be nonempty and must not contain carriage returns, newlines, or NUL bytes." } }, "required": [ "type", - "event_id", - "session_id", - "turn_id", - "item_id", - "output_index", - "summary_index", - "text" + "secret_value" ], "additionalProperties": false, - "description": "Emitted when a reasoning summary content part is complete." + "description": "Replace the secret for an OpenAI-hosted environment credential. The environment variable name and networking configuration remain unchanged." }, - "SessionEvent": { + "RotateVaultCredentialAuthParam": { "oneOf": [ { - "$ref": "#/components/schemas/SessionEventError" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentReady" - }, - { - "$ref": "#/components/schemas/SessionEventAgentOutputCommandExecutionOutputDelta" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionCreated" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnCreated" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnInProgress" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnCompleted" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnFailed" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnCancelled" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnItemAdded" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionIdle" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionInProgress" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionRequiresAction" - }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionFailed" + "$ref": "#/components/schemas/RotateVaultCredentialAuthParamMcpOauth" }, { - "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentPending" + "$ref": "#/components/schemas/RotateVaultCredentialAuthParamStaticBearer" }, { - "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentConnected" + "$ref": "#/components/schemas/RotateVaultCredentialAuthParamEnvironmentVariable" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "mcp_oauth": "#/components/schemas/RotateVaultCredentialAuthParamMcpOauth", + "static_bearer": "#/components/schemas/RotateVaultCredentialAuthParamStaticBearer", + "environment_variable": "#/components/schemas/RotateVaultCredentialAuthParamEnvironmentVariable" + } + }, + "x-oai-discriminator-values": [ + "mcp_oauth", + "static_bearer", + "environment_variable" + ], + "description": "Updates to a vault credential without changing its authentication method or destination configuration." + }, + "RotateVaultCredentialParams": { + "type": "object", + "properties": { + "auth": { + "$ref": "#/components/schemas/RotateVaultCredentialAuthParam", + "description": "Replacement values for the credential's existing authentication method." }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string", + "minLength": 0, + "maxLength": 512 + }, + "propertyNames": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "minProperties": 0, + "maxProperties": 16, + "description": "Replaces all metadata. Omit to preserve it, or pass {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." + } + }, + "additionalProperties": false, + "description": "Metadata, secret, expiry, and OAuth refresh scope updates for an existing vault credential. Supply at least one of `auth` or `metadata`.", + "minProperties": 1, + "examples": [ { - "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentDisconnected" + "metadata": {} + } + ] + }, + "DeletedVaultCredentialResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the deleted credential." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionEnvironmentFailed" + "object": { + "type": "string", + "enum": [ + "vault.credential.deleted" + ], + "default": "vault.credential.deleted", + "x-stainless-const": true, + "description": "The object type. Always `vault.credential.deleted`." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionSubagentCreated" + "deleted": { + "type": "boolean", + "description": "Whether the resource was deleted. Always `true`." + } + }, + "required": [ + "id", + "object", + "deleted" + ], + "additionalProperties": false, + "description": "Confirmation that a vault credential was deleted." + }, + "WebhookEndpointBody": { + "properties": { + "id": { + "type": "string", + "description": "The unique ID of the webhook endpoint." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionSubagentActive" + "object": { + "type": "string", + "enum": [ + "webhook_endpoint" + ], + "description": "The object type, which is always webhook_endpoint.", + "default": "webhook_endpoint", + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionSubagentClosed" + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp when the endpoint was created." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnItemDone" + "updated_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp of the last endpoint configuration or signing-secret change. Initialized at creation; tests and unchanged updates do not advance it." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnContentPartAdded" + "name": { + "type": "string", + "description": "The human-readable name of the endpoint." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnContentPartDone" + "url": { + "type": "string", + "description": "The HTTPS URL that receives webhook deliveries." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDelta" + "event_types": { + "items": { + "type": "string" + }, + "type": "array", + "description": "The event types that trigger deliveries to this endpoint." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDone" + "signing_secret_hint": { + "anyOf": [ + { + "type": "string", + "description": "A masked hint for the endpoint's signing secret." + }, + { + "type": "null" + } + ] + } + }, + "type": "object", + "required": [ + "id", + "object", + "created_at", + "name", + "url", + "event_types", + "signing_secret_hint" + ] + }, + "WebhookEndpointListResource": { + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The object type, which is always list.", + "default": "list", + "x-stainless-const": true }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartAdded" + "data": { + "items": { + "$ref": "#/components/schemas/WebhookEndpointBody" + }, + "type": "array", + "description": "The webhook endpoints in this page." }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartDone" + "first_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the first endpoint in this page." + }, + { + "type": "null" + } + ] }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDelta" + "last_id": { + "anyOf": [ + { + "type": "string", + "description": "The ID of the last endpoint in this page." + }, + { + "type": "null" + } + ] }, - { - "$ref": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDone" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "error": "#/components/schemas/SessionEventError", - "agent.session.environment.ready": "#/components/schemas/SessionEventAgentSessionEnvironmentReady", - "agent.output.command_execution_output.delta": "#/components/schemas/SessionEventAgentOutputCommandExecutionOutputDelta", - "agent.session.created": "#/components/schemas/SessionEventAgentSessionCreated", - "agent.session.turn.created": "#/components/schemas/SessionEventAgentSessionTurnCreated", - "agent.session.turn.in_progress": "#/components/schemas/SessionEventAgentSessionTurnInProgress", - "agent.session.turn.completed": "#/components/schemas/SessionEventAgentSessionTurnCompleted", - "agent.session.turn.failed": "#/components/schemas/SessionEventAgentSessionTurnFailed", - "agent.session.turn.cancelled": "#/components/schemas/SessionEventAgentSessionTurnCancelled", - "agent.session.turn.item.added": "#/components/schemas/SessionEventAgentSessionTurnItemAdded", - "agent.session.idle": "#/components/schemas/SessionEventAgentSessionIdle", - "agent.session.in_progress": "#/components/schemas/SessionEventAgentSessionInProgress", - "agent.session.requires_action": "#/components/schemas/SessionEventAgentSessionRequiresAction", - "agent.session.failed": "#/components/schemas/SessionEventAgentSessionFailed", - "agent.session.environment.pending": "#/components/schemas/SessionEventAgentSessionEnvironmentPending", - "agent.session.environment.connected": "#/components/schemas/SessionEventAgentSessionEnvironmentConnected", - "agent.session.environment.disconnected": "#/components/schemas/SessionEventAgentSessionEnvironmentDisconnected", - "agent.session.environment.failed": "#/components/schemas/SessionEventAgentSessionEnvironmentFailed", - "agent.session.subagent.created": "#/components/schemas/SessionEventAgentSessionSubagentCreated", - "agent.session.subagent.active": "#/components/schemas/SessionEventAgentSessionSubagentActive", - "agent.session.subagent.closed": "#/components/schemas/SessionEventAgentSessionSubagentClosed", - "agent.session.turn.item.done": "#/components/schemas/SessionEventAgentSessionTurnItemDone", - "agent.session.turn.content_part.added": "#/components/schemas/SessionEventAgentSessionTurnContentPartAdded", - "agent.session.turn.content_part.done": "#/components/schemas/SessionEventAgentSessionTurnContentPartDone", - "agent.session.turn.output_text.delta": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDelta", - "agent.session.turn.output_text.done": "#/components/schemas/SessionEventAgentSessionTurnOutputTextDone", - "agent.session.turn.reasoning_summary_part.added": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartAdded", - "agent.session.turn.reasoning_summary_part.done": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartDone", - "agent.session.turn.reasoning_summary_text.delta": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDelta", - "agent.session.turn.reasoning_summary_text.done": "#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDone" + "has_more": { + "type": "boolean", + "description": "Whether more webhook endpoints are available." } }, - "x-oai-discriminator-values": [ - "error", - "agent.session.environment.ready", - "agent.output.command_execution_output.delta", + "type": "object", + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + }, + "ProjectEventTypeEnum": { + "type": "string", + "enum": [ + "batch.completed", + "batch.failed", + "batch.expired", + "batch.cancelled", + "response.completed", + "response.failed", + "response.cancelled", + "response.incomplete", + "eval.run.succeeded", + "eval.run.failed", + "eval.run.canceled", + "fine_tuning.job.succeeded", + "fine_tuning.job.failed", + "fine_tuning.job.cancelled", + "realtime.call.incoming", + "video.completed", + "video.failed", + "agent.environment.ready", + "agent.environment.failed", + "agent.environment.suspended", + "agent.environment.expired", "agent.session.created", - "agent.session.turn.created", - "agent.session.turn.in_progress", - "agent.session.turn.completed", - "agent.session.turn.failed", - "agent.session.turn.cancelled", - "agent.session.turn.item.added", - "agent.session.idle", + "agent.session.action_required", "agent.session.in_progress", - "agent.session.requires_action", + "agent.session.idle", "agent.session.failed", - "agent.session.environment.pending", - "agent.session.environment.connected", - "agent.session.environment.disconnected", - "agent.session.environment.failed", - "agent.session.subagent.created", - "agent.session.subagent.active", - "agent.session.subagent.closed", - "agent.session.turn.item.done", - "agent.session.turn.content_part.added", - "agent.session.turn.content_part.done", - "agent.session.turn.output_text.delta", - "agent.session.turn.output_text.done", - "agent.session.turn.reasoning_summary_part.added", - "agent.session.turn.reasoning_summary_part.done", - "agent.session.turn.reasoning_summary_text.delta", - "agent.session.turn.reasoning_summary_text.done" - ], - "description": "An event emitted by a Managed Agents session." + "safety.alert.created" + ] }, - "UpdateAgentSessionParams": { + "PublicCreateEndpointBody": { + "properties": { + "name": { + "type": "string", + "maxLength": 256, + "minLength": 1, + "description": "A human-readable name for the webhook endpoint." + }, + "url": { + "type": "string", + "maxLength": 2048, + "pattern": "^https://", + "description": "The HTTPS URL that receives webhook deliveries." + }, + "event_types": { + "items": { + "$ref": "#/components/schemas/ProjectEventTypeEnum" + }, + "type": "array", + "minItems": 1, + "description": "The event types that trigger deliveries to this endpoint." + } + }, "type": "object", + "required": [ + "name", + "url", + "event_types" + ] + }, + "WebhookEndpointWithSecretResource": { "properties": { - "metadata": { - "type": [ - "object", - "null" + "id": { + "type": "string", + "description": "The unique ID of the webhook endpoint." + }, + "object": { + "type": "string", + "enum": [ + "webhook_endpoint" ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 512 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 64 + "description": "The object type, which is always webhook_endpoint.", + "default": "webhook_endpoint", + "x-stainless-const": true + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp when the endpoint was created." + }, + "updated_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp of the last endpoint configuration or signing-secret change. Initialized at creation; tests and unchanged updates do not advance it." + }, + "name": { + "type": "string", + "description": "The human-readable name of the endpoint." + }, + "url": { + "type": "string", + "description": "The HTTPS URL that receives webhook deliveries." + }, + "event_types": { + "items": { + "type": "string" }, - "minProperties": 0, - "maxProperties": 16, - "description": "Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters." + "type": "array", + "description": "The event types that trigger deliveries to this endpoint." + }, + "signing_secret_hint": { + "anyOf": [ + { + "type": "string", + "description": "A masked hint for the endpoint's signing secret." + }, + { + "type": "null" + } + ] + }, + "signing_secret": { + "type": "string", + "description": "The endpoint's signing secret. This is returned only when the endpoint is created or the secret is rotated." } }, - "additionalProperties": false, - "description": "Fields to update on an existing session." + "type": "object", + "required": [ + "id", + "object", + "created_at", + "name", + "url", + "event_types", + "signing_secret_hint", + "signing_secret" + ] }, - "DeletedSessionResource": { + "PublicUpdateEndpointBody": { + "properties": { + "name": { + "type": "string", + "maxLength": 256, + "minLength": 1, + "description": "A new human-readable name for the webhook endpoint." + }, + "url": { + "type": "string", + "maxLength": 2048, + "pattern": "^https://", + "description": "A new HTTPS URL that receives webhook deliveries." + }, + "event_types": { + "items": { + "$ref": "#/components/schemas/ProjectEventTypeEnum" + }, + "type": "array", + "minItems": 1, + "description": "The complete set of event types that should trigger deliveries." + } + }, "type": "object", + "required": [] + }, + "DeletedWebhookEndpointResource": { "properties": { "id": { "type": "string", - "minLength": 0, - "description": "The ID of the deleted session." + "description": "The ID of the deleted webhook endpoint." }, "object": { "type": "string", "enum": [ - "agent.session.deleted" + "webhook_endpoint.deleted" ], - "default": "agent.session.deleted", - "x-stainless-const": true, - "description": "The object type. Always `agent.session.deleted`." + "description": "The object type, which is always webhook_endpoint.deleted.", + "default": "webhook_endpoint.deleted", + "x-stainless-const": true }, "deleted": { "type": "boolean", - "description": "Whether the session has been removed from the public API. Always `true`. Physical cleanup may still be in progress." + "description": "Whether the endpoint was deleted." } }, + "type": "object", "required": [ "id", "object", "deleted" - ], - "additionalProperties": false, - "description": "A Managed Agents session removed from the public API. Physical cleanup may continue asynchronously." + ] }, - "SessionArtifactResource": { + "PublicRotateSecretBody": { + "properties": { + "keep_old_secret_active_for_24_hours": { + "type": "boolean", + "description": "Whether to keep the previous signing secret valid for 24 hours after rotation. Defaults to false, which invalidates the previous secret immediately." + } + }, "type": "object", + "required": [] + }, + "PublicTestEndpointBody": { "properties": { - "id": { + "event_type": { + "$ref": "#/components/schemas/ProjectEventTypeEnum", + "description": "The event type to send as a sample delivery." + } + }, + "type": "object", + "required": [ + "event_type" + ] + }, + "WebhookEndpointTestResultResource": { + "properties": { + "object": { "type": "string", - "minLength": 0, - "description": "The immutable artifact ID." + "enum": [ + "webhook_endpoint.test" + ], + "description": "The object type, which is always webhook_endpoint.test.", + "default": "webhook_endpoint.test", + "x-stainless-const": true + }, + "webhook_endpoint_id": { + "type": "string", + "description": "The ID of the webhook endpoint that received the test." + }, + "event_type": { + "type": "string", + "description": "The event type sent in the test." + }, + "status_code": { + "type": "integer", + "description": "The HTTP status code returned by the endpoint." }, + "success": { + "type": "boolean", + "enum": [ + true + ], + "description": "Whether the test request completed. Always true for returned results; use status_code to determine the endpoint response.", + "default": true, + "x-stainless-const": true + } + }, + "type": "object", + "required": [ + "object", + "webhook_endpoint_id", + "event_type", + "status_code", + "success" + ] + }, + "WebhookEventTypeListResource": { + "properties": { "object": { "type": "string", "enum": [ - "agent.session.artifact" + "list" ], - "default": "agent.session.artifact", - "x-stainless-const": true, - "description": "The object type. Always `agent.session.artifact`." + "description": "The object type, which is always list.", + "default": "list", + "x-stainless-const": true }, - "session_id": { + "data": { + "items": { + "type": "string" + }, + "type": "array", + "description": "The webhook event types available to the authenticated project." + } + }, + "type": "object", + "required": [ + "object", + "data" + ] + }, + "AgentEnvironmentEvent": { + "type": "object", + "properties": { + "id": { "type": "string", "minLength": 0, - "description": "The ID of the session that owns the artifact." + "description": "The ID of the environment." + } + }, + "required": [ + "id" + ], + "additionalProperties": false, + "description": "Identifies the environment whose lifecycle changed." + }, + "AgentSessionRequiredActionTypeResource": { + "type": "string", + "enum": [ + "computer_use_approval_request", + "function_call", + "environment_connection" + ] + }, + "AgentSessionRequiredActionPayloadResource": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/AgentSessionRequiredActionTypeResource" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "AgentSessionActionRequiredPayloadResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session." + }, + "required_action": { + "$ref": "#/components/schemas/AgentSessionRequiredActionPayloadResource", + "description": "The action type. Retrieve the session for action details." + } + }, + "required": [ + "id", + "required_action" + ], + "additionalProperties": false + }, + "AgentSessionConnectPayloadResource": { + "type": "object", + "properties": { + "remote_url": { + "type": "string", + "minLength": 0, + "description": "The URL used to connect the self-hosted environment." + } + }, + "required": [ + "remote_url" + ], + "additionalProperties": false + }, + "AgentSessionCreatedPayloadResource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "minLength": 0, + "description": "The ID of the session." }, "environment_id": { "type": "string", "minLength": 0, - "description": "The ID of the environment that produced the artifact." + "description": "The ID of the environment, when one exists." }, - "turn_id": { + "environment_type": { "type": "string", "minLength": 0, - "description": "The ID of the completed turn that published the artifact." + "description": "The environment type: `none`, `openai_hosted`, or `self_hosted`." }, - "path": { + "connect": { + "$ref": "#/components/schemas/AgentSessionConnectPayloadResource" + } + }, + "required": [ + "id", + "environment_type" + ], + "additionalProperties": false + }, + "AgentSessionEnvironmentPayloadResource": { + "type": "object", + "properties": { + "id": { "type": "string", "minLength": 0, - "description": "The original absolute file path in the execution environment." + "description": "The ID of the session." }, - "size_bytes": { + "environment_id": { + "type": "string", + "minLength": 0, + "description": "The ID of the environment, when one exists." + }, + "environment_type": { + "type": "string", + "minLength": 0, + "description": "The environment type: `none`, `openai_hosted`, or `self_hosted`." + } + }, + "required": [ + "id", + "environment_type" + ], + "additionalProperties": false + }, + "DragPoint": { + "properties": { + "x": { "type": "integer", - "format": "int64", - "minimum": 0, - "description": "The immutable artifact size in bytes." + "description": "The x-coordinate." }, - "created_at": { + "y": { "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the artifact was published." + "description": "The y-coordinate." } }, + "type": "object", "required": [ - "id", - "object", - "session_id", - "environment_id", - "turn_id", - "path", - "size_bytes", - "created_at" + "x", + "y" ], - "additionalProperties": false, - "description": "An immutable file published by a completed hosted session turn." + "title": "Coordinate", + "description": "An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`." }, - "SessionArtifactListResource": { + "LiveSessionAudioFormatPCMParam": { + "description": "Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection.", "type": "object", "properties": { - "object": { + "type": { + "description": "The audio encoding. Always `audio/pcm`.", + "default": "audio/pcm", + "x-stainless-const": true, "type": "string", "enum": [ - "list" - ], - "default": "list", + "audio/pcm" + ] + }, + "rate": { + "description": "Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz.", + "type": "integer", + "minimum": 16000, + "maximum": 24000, + "enum": [ + 16000, + 24000 + ] + } + }, + "required": [ + "type", + "rate" + ] + }, + "LiveSessionAudioFormatPCMUParam": { + "description": "Raw, mono G.711 μ-law audio for a Live WebSocket connection.", + "type": "object", + "properties": { + "type": { + "description": "The audio encoding. Always `audio/pcmu`.", + "default": "audio/pcmu", "x-stainless-const": true, - "description": "The object type, which is always `list`." + "type": "string", + "enum": [ + "audio/pcmu" + ] }, - "data": { + "rate": { + "description": "Audio sample rate in hertz. G.711 audio uses 8000 Hz.", + "type": "integer", + "minimum": 8000, + "maximum": 8000 + } + }, + "required": [ + "type", + "rate" + ] + }, + "LiveSessionAudioFormatPCMAParam": { + "description": "Raw, mono G.711 A-law audio for a Live WebSocket connection.", + "type": "object", + "properties": { + "type": { + "description": "The audio encoding. Always `audio/pcma`.", + "default": "audio/pcma", + "x-stainless-const": true, + "type": "string", + "enum": [ + "audio/pcma" + ] + }, + "rate": { + "description": "Audio sample rate in hertz. G.711 audio uses 8000 Hz.", + "type": "integer", + "minimum": 8000, + "maximum": 8000 + } + }, + "required": [ + "type", + "rate" + ] + }, + "LiveAudioFormat": { + "description": "Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveSessionAudioFormatPCMParam" + }, + { + "$ref": "#/components/schemas/LiveSessionAudioFormatPCMUParam" + }, + { + "$ref": "#/components/schemas/LiveSessionAudioFormatPCMAParam" + } + ] + }, + "LiveInitialSessionAudioParam": { + "description": "Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup.", + "type": "object", + "properties": { + "format": { + "description": "Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately.", + "$ref": "#/components/schemas/LiveAudioFormat" + }, + "output": { + "description": "The voice used for speech generated by the Live model.", + "$ref": "#/components/schemas/LiveInitialSessionAudioOutputParam" + } + }, + "required": [] + }, + "LiveSessionCreateParams": { + "description": "Initial configuration for a Live session, including its model, conversation instructions, audio, and delegated task handling.", + "type": "object", + "properties": { + "model": { + "$ref": "#/components/schemas/ModelIdsLive" + }, + "instructions": { + "anyOf": [ + { + "description": "Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "input": { + "description": "Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and a configured rendered-token limit (8,192 by default).", "type": "array", "items": { - "$ref": "#/components/schemas/SessionArtifactResource" + "$ref": "#/components/schemas/LiveInitialItem" }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." + "maxItems": 128 }, - "first_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." + "audio": { + "description": "Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup.", + "$ref": "#/components/schemas/LiveInitialSessionAudioParam" }, - "last_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "delegation": { + "anyOf": [ + { + "description": "Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` or `decisions` to delegate to the corresponding API.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveClientDelegationParam" + }, + { + "$ref": "#/components/schemas/LiveResponsesDelegationParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionsDelegationParam" + } + ] + }, + { + "type": "null" + } + ] }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "triggers": { + "description": "At most one Decisions trigger per transcript event type. Triggers run independently of delegation. On update, omit triggers to keep the current configuration, send a list to replace it, or send an empty list to disable triggers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionTriggerInputParam" + }, + "maxItems": 2 + }, + "store": { + "description": "Whether to store the session for later forking and recording download. Defaults to false for new sessions.", + "type": "boolean" + }, + "client": { + "description": "Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected.", + "$ref": "#/components/schemas/LiveClientConfigParam" } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "model" + ] }, - "DeletedSessionArtifactResource": { - "type": "object", - "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the deleted session artifact." + "LiveSessionStartEvent": { + "description": "Start a Live session on a primary WebSocket. Send this event before other commands and wait for `session.started`.", + "example": { + "type": "session.start", + "event_id": "evt_start_001", + "session": { + "model": "gpt-live-1", + "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", + "audio": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "output": { + "voice": "marin" + } + }, + "delegation": { + "type": "client" + } + } + }, + "type": "object", + "properties": { + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] }, - "object": { + "type": { + "description": "The Live client event type. Always `session.start`.", + "default": "session.start", + "x-stainless-const": true, "type": "string", "enum": [ - "agent.session.artifact.deleted" - ], - "default": "agent.session.artifact.deleted", - "x-stainless-const": true, - "description": "The object type. Always `agent.session.artifact.deleted`." + "session.start" + ] }, - "deleted": { - "type": "boolean", - "description": "Whether the session artifact was deleted. Always `true`." + "session": { + "description": "Initial configuration for a primary WebSocket. Send session.start first and wait for session.started before application commands. WebRTC creation already starts the session; do not send this event again on its data channel.", + "$ref": "#/components/schemas/LiveSessionCreateParams" } }, "required": [ - "id", - "object", - "deleted" + "type", + "session" ], - "additionalProperties": false, - "description": "Confirmation that an immutable session artifact was deleted." + "x-oaiMeta": { + "example": { + "type": "session.start", + "event_id": "evt_start_001", + "session": { + "model": "gpt-live-1", + "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", + "audio": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "output": { + "voice": "marin" + } + }, + "delegation": { + "type": "client" + } + } + } + } }, - "SessionInputParamAgentSessionInputMessage": { + "LiveDecisionsSettingsUpdateParam": { "type": "object", "properties": { - "type": { + "model": { "type": "string", - "enum": [ - "agent.session.input.message" - ], - "default": "agent.session.input.message", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.input.message`." + "minLength": 1 }, - "input": { + "questions": { + "description": "Native Decision API questions evaluated together, in order.", "type": "array", "items": { - "$ref": "#/components/schemas/InputMessageParam" + "$ref": "#/components/schemas/LiveDecisionQuestion" }, - "minItems": 0, - "maxItems": 16384, - "description": "The user messages to add to the session." + "minItems": 1, + "maxItems": 64 } }, - "required": [ - "type", - "input" - ], - "additionalProperties": false, - "description": "Adds one or more user messages and starts a turn." + "required": [] }, - "SessionInputParamAgentSessionInputCancel": { + "LiveDecisionsDelegationUpdateParam": { "type": "object", "properties": { + "acknowledgement_delay_ms": { + "description": "Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations.", + "type": "integer", + "minimum": 0, + "maximum": 800 + }, "type": { + "default": "decisions", + "x-stainless-const": true, "type": "string", "enum": [ - "agent.session.input.cancel" - ], - "default": "agent.session.input.cancel", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.input.cancel`." + "decisions" + ] + }, + "decisions": { + "$ref": "#/components/schemas/LiveDecisionsSettingsUpdateParam" } }, "required": [ "type" - ], - "additionalProperties": false, - "description": "Cancels the session's active turn." + ] }, - "FunctionCallOutputParam": { - "oneOf": [ - { - "type": "string", - "minLength": 0, - "maxLength": 1048576 + "LiveSessionUpdateParams": { + "description": "Changes to an active Live session's delegation settings and transcript triggers.", + "type": "object", + "properties": { + "delegation": { + "anyOf": [ + { + "description": "Delegation settings to update. The delegation type must match the current session; omitted settings retain their values.", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveClientDelegationParam" + }, + { + "$ref": "#/components/schemas/LiveResponsesDelegationUpdateParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionsDelegationUpdateParam" + } + ] + }, + { + "type": "null" + } + ] }, - { + "triggers": { + "description": "At most one Decisions trigger per transcript event type. Triggers run independently of delegation. On update, omit triggers to keep the current configuration, send a list to replace it, or send an empty list to disable triggers.", "type": "array", "items": { - "$ref": "#/components/schemas/InputContentParam" + "$ref": "#/components/schemas/LiveDecisionTriggerInputParam" }, - "minItems": 0, - "maxItems": 16384 + "maxItems": 2 } - ], - "description": "A function result represented as text or supported model-input content." + }, + "required": [] }, - "SessionInputParamAgentSessionInputToolResult": { + "LiveSessionUpdateParam": { + "description": "Update the delegation settings or transcript triggers of an active Live session. The server acknowledges accepted changes with `session.updated`.", + "example": { + "type": "session.update", + "event_id": "evt_update_001", + "session": { + "delegation": { + "type": "responses", + "responses": { + "instructions": "Check restaurant availability. Ask before confirming a booking.", + "max_output_tokens": 1024 + } + } + } + }, "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "agent.session.input.tool_result" - ], - "default": "agent.session.input.tool_result", - "x-stainless-const": true, - "description": "The type of the object. Always `agent.session.input.tool_result`." - }, - "turn_id": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The ID of the turn that requested the function call." - }, - "call_id": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The ID of the function call." - }, - "success": { - "type": "boolean", - "description": "Whether the function call succeeded." - }, - "output": { + "event_id": { "anyOf": [ { - "$ref": "#/components/schemas/FunctionCallOutputParam" + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 }, { "type": "null" } - ], - "description": "The function result when the call succeeded." + ] }, - "error": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The error message when the call failed." + "type": { + "description": "The Live client event type. Always `session.update`.", + "default": "session.update", + "x-stainless-const": true, + "type": "string", + "enum": [ + "session.update" + ] + }, + "session": { + "description": "Sparse delegation and trigger updates. Omitted settings retain their values. The delegation type cannot change. Model, frontend instructions, audio, and startup input are immutable.", + "$ref": "#/components/schemas/LiveSessionUpdateParams" } }, "required": [ "type", - "turn_id", - "call_id", - "success" - ], - "additionalProperties": false, - "description": "Submits the result of a function call." - }, - "SessionInputParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/SessionInputParamAgentSessionInputMessage" - }, - { - "$ref": "#/components/schemas/SessionInputParamAgentSessionInputCancel" - }, - { - "$ref": "#/components/schemas/SessionInputParamAgentSessionInputToolResult" - } + "session" ], - "discriminator": { - "propertyName": "type", - "mapping": { - "agent.session.input.message": "#/components/schemas/SessionInputParamAgentSessionInputMessage", - "agent.session.input.cancel": "#/components/schemas/SessionInputParamAgentSessionInputCancel", - "agent.session.input.tool_result": "#/components/schemas/SessionInputParamAgentSessionInputToolResult" + "x-oaiMeta": { + "example": { + "type": "session.update", + "event_id": "evt_update_001", + "session": { + "delegation": { + "type": "responses", + "responses": { + "instructions": "Check restaurant availability. Ask before confirming a booking.", + "max_output_tokens": 1024 + } + } + } } - }, - "x-oai-discriminator-values": [ - "agent.session.input.message", - "agent.session.input.cancel", - "agent.session.input.tool_result" - ], - "description": "Input submitted to an existing session." + } }, - "CreateSessionEventsParams": { + "LiveInputAudioAppendEvent": { + "description": "Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions send audio over their media transport.", + "example": { + "type": "session.input_audio.append", + "audio": "AACAAIAAAIAAAP9/AIAAgA==" + }, "type": "object", "properties": { - "events": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SessionInputParam" - }, - "minItems": 0, - "maxItems": 16384, - "description": "The input events to submit to the session." + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, + "type": { + "description": "The Live client event type. Always `session.input_audio.append`.", + "default": "session.input_audio.append", + "x-stainless-const": true, + "type": "string", + "enum": [ + "session.input_audio.append" + ] + }, + "audio": { + "description": "Base64-encoded raw audio in the startup-selected format, without a WAV or other container header. Primary WebSocket only; media transports use their audio track. Audio appends have no acknowledgment. Reflected sideband server events reuse this event type and audio key, with no timestamps or event_id; their audio is always mono PCM16LE at 24 kHz.", + "type": "string", + "minLength": 1 } }, "required": [ - "events" - ], - "additionalProperties": false, - "description": "Input events submitted to an existing session." - }, - "VaultStatusParam": { - "type": "string", - "enum": [ - "active", - "archived" + "type", + "audio" ], - "description": "Whether a vault or credential is active or archived." - }, - "VaultStatusFilterParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/VaultStatusParam" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/VaultStatusParam" - }, - "minItems": 0, - "maxItems": 16384 + "x-oaiMeta": { + "example": { + "type": "session.input_audio.append", + "audio": "AACAAIAAAIAAAP9/AIAAgA==" } - ], - "description": "One or more lifecycle statuses to include when listing vaults or credentials." + } }, - "VaultResource": { + "LiveInputAudioMuteParam": { + "description": "Mute audio input to the Live model without closing the session. The server acknowledges with `session.input_audio.muted`.", + "example": { + "type": "session.input_audio.mute", + "event_id": "evt_mute_001" + }, "type": "object", "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the vault." + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] }, - "object": { + "type": { + "description": "The Live client event type. Always `session.input_audio.mute`.", + "default": "session.input_audio.mute", + "x-stainless-const": true, "type": "string", "enum": [ - "vault" - ], - "default": "vault", - "x-stainless-const": true, - "description": "The object type. Always `vault`." - }, - "name": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The human-readable name of the vault, if set." - }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string", - "minLength": 0 - }, - "propertyNames": { - "type": "string", - "minLength": 0 - }, - "minProperties": 0, - "description": "Key-value pairs associated with the vault, such as an application or team identifier." - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the vault was created." + "session.input_audio.mute" + ] } }, "required": [ - "id", - "object", - "name", - "metadata", - "created_at" + "type" ], - "additionalProperties": false, - "description": "A collection of credentials that agent tools can use to authenticate to MCP servers." + "x-oaiMeta": { + "example": { + "type": "session.input_audio.mute", + "event_id": "evt_mute_001" + } + } }, - "VaultListResource": { + "LiveInputAudioUnmuteParam": { + "description": "Resume audio input to a Live model after muting it. The server acknowledges with `session.input_audio.unmuted`. An active audio fixture still pauses inference until playback finishes.", + "example": { + "type": "session.input_audio.unmute", + "event_id": "evt_unmute_001" + }, "type": "object", "properties": { - "object": { + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, + "type": { + "description": "The Live client event type. Always `session.input_audio.unmute`.", + "default": "session.input_audio.unmute", + "x-stainless-const": true, "type": "string", "enum": [ - "list" - ], - "default": "list", - "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VaultResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." - }, - "first_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." - }, - "last_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." - }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "session.input_audio.unmute" + ] } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" + "type" ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "x-oaiMeta": { + "example": { + "type": "session.input_audio.unmute", + "event_id": "evt_unmute_001" + } + } }, - "CreateVaultParams": { + "LiveOutputAudioFixturePlayParam": { + "description": "Play one complete audio fixture through the session output. Send this event over the primary WebSocket or a server sideband. Audio must be raw mono PCM16 little-endian at 24 kHz, regardless of the session audio format, and at most 30 seconds. The entire payload is validated before model speech is interrupted and input is muted. Only one fixture can be active. fixture.playing acknowledges acceptance and fixture.played reports server mixer drain. These notifications are not exact transport-media boundaries. Input arriving during playback is dropped and not replayed.", + "example": { + "type": "session.output_audio.fixture.play", + "event_id": "evt_play_001", + "audio": "AAAAAA==" + }, "type": "object", "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 1048576, - "description": "The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming." + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] }, - "metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": { - "type": "string", - "minLength": 0, - "maxLength": 1048576 - }, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 256 - }, - "minProperties": 0, - "maxProperties": 1024, - "description": "Key-value pairs to associate with the vault, such as an application or team identifier." + "type": { + "default": "session.output_audio.fixture.play", + "x-stainless-const": true, + "type": "string", + "enum": [ + "session.output_audio.fixture.play" + ] + }, + "audio": { + "description": "Base64-encoded raw mono PCM16 audio, little-endian, at 24 kHz. Do not include a WAV or other container header.", + "type": "string", + "minLength": 1, + "maxLength": 1920000 } }, - "additionalProperties": false, - "description": "Parameters for creating a vault to store credentials used by agent tools." + "required": [ + "type", + "audio" + ], + "x-oaiMeta": { + "example": { + "type": "session.output_audio.fixture.play", + "event_id": "evt_play_001", + "audio": "AAAAAA==" + } + } }, - "DeletedVaultResource": { + "LiveInstructionsAppendParam": { + "description": "Append developer instructions to the Live conversation while it is running, optionally associating them with an existing client delegation. Rejected while an audio fixture is active. These instructions remain in conversation history through compaction and are included in future backend delegations. For external audio, describe content already delivered so the assistant does not repeat it.", + "example": { + "type": "session.instructions.append", + "event_id": "evt_instructions_001", + "delegation_id": null, + "content": "The caller prefers outdoor seating." + }, "type": "object", "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the deleted vault." + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] }, - "object": { + "type": { + "description": "The Live client event type. Always `session.instructions.append`.", + "default": "session.instructions.append", + "x-stainless-const": true, "type": "string", "enum": [ - "vault.deleted" - ], - "default": "vault.deleted", - "x-stainless-const": true, - "description": "The object type. Always `vault.deleted`." + "session.instructions.append" + ] }, - "deleted": { - "type": "boolean", - "description": "Whether the resource was deleted. Always `true`." + "delegation_id": { + "anyOf": [ + { + "description": "Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation.", + "type": "string", + "minLength": 1 + }, + { + "type": "null" + } + ] + }, + "content": { + "description": "Instruction text to append, limited to 500 tokens. This is a plain string, not an array of content parts.", + "type": "string" } }, "required": [ - "id", - "object", - "deleted" + "type", + "delegation_id", + "content" ], - "additionalProperties": false, - "description": "Confirmation that a vault was deleted." + "x-oaiMeta": { + "example": { + "type": "session.instructions.append", + "event_id": "evt_instructions_001", + "delegation_id": null, + "content": "The caller prefers outdoor seating." + } + } }, - "McpOauthTokenEndpointAuthResourceNone": { + "LiveThinkingAppendParam": { + "description": "Provide silent reasoning or progress context to the Live model, optionally for an existing client delegation. Rejected while an audio fixture is active.", + "example": { + "type": "session.thinking.append", + "event_id": "evt_thinking_001", + "delegation_id": "del_abc123", + "content": "Checking availability for two guests at 7 PM." + }, "type": "object", "properties": { + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, "type": { + "description": "The Live client event type. Always `session.thinking.append`.", + "default": "session.thinking.append", + "x-stainless-const": true, "type": "string", "enum": [ - "none" - ], - "default": "none", - "x-stainless-const": true, - "description": "The type of the object. Always `none`." + "session.thinking.append" + ] + }, + "delegation_id": { + "anyOf": [ + { + "description": "Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation.", + "type": "string", + "minLength": 1 + }, + { + "type": "null" + } + ] + }, + "content": { + "description": "Silent reasoning or progress context, limited to 500 tokens. It does not directly request speech, but can influence later speech and is not a secrecy boundary.", + "type": "string" } }, "required": [ - "type" + "type", + "delegation_id", + "content" ], - "additionalProperties": false, - "description": "Sends the client ID without a client secret." + "x-oaiMeta": { + "example": { + "type": "session.thinking.append", + "event_id": "evt_thinking_001", + "delegation_id": "del_abc123", + "content": "Checking availability for two guests at 7 PM." + } + } }, - "McpOauthTokenEndpointAuthResourceClientSecretBasic": { + "LiveCommentaryAppendParam": { + "description": "Provide context the Live model can communicate to the user, optionally for an existing client delegation. Rejected while an audio fixture is active.", + "example": { + "type": "session.commentary.append", + "event_id": "evt_commentary_001", + "delegation_id": "del_abc123", + "content": "There is an outdoor table for two at 7 PM. Ask whether to reserve it." + }, "type": "object", "properties": { + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, "type": { + "description": "The Live client event type. Always `session.commentary.append`.", + "default": "session.commentary.append", + "x-stainless-const": true, "type": "string", "enum": [ - "client_secret_basic" - ], - "default": "client_secret_basic", - "x-stainless-const": true, - "description": "The type of the object. Always `client_secret_basic`." + "session.commentary.append" + ] + }, + "delegation_id": { + "anyOf": [ + { + "description": "Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation.", + "type": "string", + "minLength": 1 + }, + { + "type": "null" + } + ] + }, + "content": { + "description": "Speakable context for the Live model, limited to 500 tokens. Use this for a result the model should communicate; use session.thinking.append for silent context.", + "type": "string" } }, "required": [ - "type" + "type", + "delegation_id", + "content" ], - "additionalProperties": false, - "description": "Sends the client ID and secret using HTTP Basic authentication." + "x-oaiMeta": { + "example": { + "type": "session.commentary.append", + "event_id": "evt_commentary_001", + "delegation_id": "del_abc123", + "content": "There is an outdoor table for two at 7 PM. Ask whether to reserve it." + } + } }, - "McpOauthTokenEndpointAuthResourceClientSecretPost": { + "LiveDecisionCreateParam": { + "description": "Evaluate the configured questions using the current conversation and Decision inputs. Reusing an event_id is rejected for the lifetime of the session.", + "example": { + "type": "decision.create", + "event_id": "decision_1" + }, "type": "object", "properties": { + "event_id": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, "type": { + "default": "decision.create", + "x-stainless-const": true, "type": "string", "enum": [ - "client_secret_post" - ], - "default": "client_secret_post", - "x-stainless-const": true, - "description": "The type of the object. Always `client_secret_post`." + "decision.create" + ] } }, "required": [ + "event_id", "type" ], - "additionalProperties": false, - "description": "Sends the client ID and secret in the token request body." - }, - "McpOauthTokenEndpointAuthResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/McpOauthTokenEndpointAuthResourceNone" - }, - { - "$ref": "#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretBasic" - }, - { - "$ref": "#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretPost" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "none": "#/components/schemas/McpOauthTokenEndpointAuthResourceNone", - "client_secret_basic": "#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretBasic", - "client_secret_post": "#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretPost" + "x-oaiMeta": { + "example": { + "type": "decision.create", + "event_id": "decision_1" } - }, - "x-oai-discriminator-values": [ - "none", - "client_secret_basic", - "client_secret_post" - ], - "description": "The client authentication method used for OAuth token refresh." + } }, - "McpOauthRefreshResource": { + "LiveDecisionUserInputTextParam": { "type": "object", "properties": { - "token_endpoint": { + "type": { + "default": "input_text", + "x-stainless-const": true, "type": "string", - "minLength": 0, - "description": "The HTTPS OAuth token endpoint used for refresh." + "enum": [ + "input_text" + ] }, - "client_id": { + "text": { + "description": "The text input to the model.", "type": "string", - "minLength": 0, - "description": "The OAuth client ID used when requesting a new access token." - }, - "resource": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The resource URI sent to the OAuth token endpoint during refresh, if configured." - }, - "scope": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "Space-separated OAuth scopes requested during refresh, if configured." - }, - "token_endpoint_auth": { - "$ref": "#/components/schemas/McpOauthTokenEndpointAuthResource", - "description": "How the OAuth client authenticates to the token endpoint, excluding its client secret." + "maxLength": 10485760 } }, "required": [ - "token_endpoint", - "client_id", - "resource", - "scope", - "token_endpoint_auth" - ], - "additionalProperties": false, - "description": "Configuration used to refresh an MCP OAuth access token, excluding secret values." + "type", + "text" + ] }, - "VaultCredentialAuthResourceMcpOauth": { + "LiveDecisionUserInputImageParam": { "type": "object", "properties": { "type": { + "default": "input_image", + "x-stainless-const": true, "type": "string", "enum": [ - "mcp_oauth" - ], - "default": "mcp_oauth", - "x-stainless-const": true, - "description": "The type of the object. Always `mcp_oauth`." + "input_image" + ] }, - "mcp_server_url": { + "image_url": { + "description": "A base64-encoded image data URL or a publicly accessible HTTP(S) image URL.", "type": "string", - "minLength": 0, - "description": "The HTTPS MCP server URL authorized by this credential." - }, - "expires_at": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "When the OAuth access token expires, as an RFC 3339 timestamp, if known." + "maxLength": 20971520, + "pattern": "^(data:|https?://)" }, - "refresh": { + "detail": { "anyOf": [ { - "$ref": "#/components/schemas/McpOauthRefreshResource" + "description": "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.", + "$ref": "#/components/schemas/LiveDetailEnum" }, { "type": "null" } - ], - "description": "Public refresh metadata without refresh tokens or OAuth client secrets." + ] } }, "required": [ "type", - "mcp_server_url", - "expires_at", - "refresh" - ], - "additionalProperties": false, - "description": "Public metadata for an OAuth credential; tokens and client secrets are never returned." + "image_url" + ] }, - "VaultCredentialAuthResourceStaticBearer": { + "LiveDecisionUserMessageParam": { "type": "object", "properties": { + "id": { + "anyOf": [ + { + "description": "The unique ID of this message item.", + "type": "string" + }, + { + "type": "null" + } + ] + }, "type": { + "default": "message", + "x-stainless-const": true, "type": "string", "enum": [ - "static_bearer" - ], - "default": "static_bearer", - "x-stainless-const": true, - "description": "The type of the object. Always `static_bearer`." + "message" + ] }, - "mcp_server_url": { + "role": { + "description": "The message role. Always `user`.", + "default": "user", + "x-stainless-const": true, "type": "string", - "minLength": 0, - "description": "The HTTPS MCP server URL authorized by this credential." - } - }, - "required": [ - "type", - "mcp_server_url" - ], - "additionalProperties": false, - "description": "Metadata for a bearer-token credential, without automatic OAuth refresh." - }, - "VaultCredentialAuthResource": { - "oneOf": [ - { - "$ref": "#/components/schemas/VaultCredentialAuthResourceMcpOauth" + "enum": [ + "user" + ] }, - { - "$ref": "#/components/schemas/VaultCredentialAuthResourceStaticBearer" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "mcp_oauth": "#/components/schemas/VaultCredentialAuthResourceMcpOauth", - "static_bearer": "#/components/schemas/VaultCredentialAuthResourceStaticBearer" + "content": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionUserInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionUserInputImageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputJsonParam" + } + ] + } + } + ] } }, - "x-oai-discriminator-values": [ - "mcp_oauth", - "static_bearer" - ], - "description": "The MCP server and authentication configuration of a vault credential, excluding secrets." + "required": [ + "role", + "content" + ] }, - "VaultCredentialResource": { + "LiveDecisionDeveloperMessageParam": { "type": "object", "properties": { "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the credential." + "anyOf": [ + { + "description": "The unique ID of this message item.", + "type": "string" + }, + { + "type": "null" + } + ] }, - "object": { - "type": "string", - "enum": [ - "vault.credential" - ], - "default": "vault.credential", + "type": { + "default": "message", "x-stainless-const": true, - "description": "The object type. Always `vault.credential`." - }, - "vault_id": { - "type": "string", - "minLength": 0, - "description": "The ID of the vault containing this credential." - }, - "name": { "type": "string", - "minLength": 0, - "description": "The human-readable name of the credential." - }, - "auth": { - "$ref": "#/components/schemas/VaultCredentialAuthResource", - "description": "The authentication method and non-secret configuration for the MCP server." - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the credential was created." + "enum": [ + "message" + ] }, - "updated_at": { - "type": "integer", - "format": "int64", - "description": "The Unix timestamp, in seconds, when the credential was last updated." - } - }, - "required": [ - "id", - "object", - "vault_id", - "name", - "auth", - "created_at", - "updated_at" - ], - "additionalProperties": false, - "description": "Metadata for a stored MCP server credential. Secret values are never returned." - }, - "VaultCredentialListResource": { - "type": "object", - "properties": { - "object": { + "role": { + "default": "developer", + "x-stainless-const": true, "type": "string", "enum": [ - "list" - ], - "default": "list", - "x-stainless-const": true, - "description": "The object type, which is always `list`." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VaultCredentialResource" - }, - "minItems": 0, - "maxItems": 2000, - "description": "The resources returned in this page, in the requested sort order." - }, - "first_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the first resource in `data`, or `null` if the page is empty." - }, - "last_id": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "description": "The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters." + "developer" + ] }, - "has_more": { - "type": "boolean", - "description": "Whether there are more resources to retrieve after this page." + "content": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + } + } + ] } }, "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ], - "additionalProperties": false, - "description": "A page of Agents API resources, with IDs for retrieving additional pages." + "role", + "content" + ] }, - "CreateMcpOauthTokenEndpointAuthParamNone": { + "LiveDecisionSystemMessageParam": { "type": "object", "properties": { + "id": { + "anyOf": [ + { + "description": "The unique ID of this message item.", + "type": "string" + }, + { + "type": "null" + } + ] + }, "type": { + "default": "message", + "x-stainless-const": true, "type": "string", "enum": [ - "none" - ], - "default": "none", + "message" + ] + }, + "role": { + "default": "system", "x-stainless-const": true, - "description": "The type of the object. Always `none`." + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + } + } + ] } }, "required": [ - "type" - ], - "additionalProperties": false, - "description": "Sends the client ID without a client secret." + "role", + "content" + ] }, - "CreateMcpOauthTokenEndpointAuthParamClientSecretBasic": { + "LiveDecisionOutputTextParam": { "type": "object", "properties": { "type": { + "default": "output_text", + "x-stainless-const": true, "type": "string", "enum": [ - "client_secret_basic" - ], - "default": "client_secret_basic", - "x-stainless-const": true, - "description": "The type of the object. Always `client_secret_basic`." + "output_text" + ] }, - "client_secret": { + "text": { + "description": "The text content.", "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The OAuth client secret to store. Never returned in credential resources." + "maxLength": 10485760 } }, "required": [ "type", - "client_secret" - ], - "additionalProperties": false, - "description": "Sends the client ID and secret using HTTP Basic authentication." + "text" + ] }, - "CreateMcpOauthTokenEndpointAuthParamClientSecretPost": { + "LiveDecisionRefusalParam": { "type": "object", "properties": { "type": { + "default": "refusal", + "x-stainless-const": true, "type": "string", "enum": [ - "client_secret_post" - ], - "default": "client_secret_post", - "x-stainless-const": true, - "description": "The type of the object. Always `client_secret_post`." + "refusal" + ] }, - "client_secret": { + "refusal": { + "description": "The refusal text.", "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The OAuth client secret to store. Never returned in credential resources." + "maxLength": 10485760 } }, "required": [ "type", - "client_secret" - ], - "additionalProperties": false, - "description": "Sends the client ID and secret in the token request body." + "refusal" + ] }, - "CreateMcpOauthTokenEndpointAuthParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamNone" - }, - { - "$ref": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretBasic" - }, - { - "$ref": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretPost" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "none": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamNone", - "client_secret_basic": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretBasic", - "client_secret_post": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretPost" - } - }, - "x-oai-discriminator-values": [ - "none", - "client_secret_basic", - "client_secret_post" - ], - "description": "Client authentication credentials for OAuth token refresh." + "LiveMessagePhase": { + "type": "string", + "enum": [ + "commentary", + "final_answer" + ] }, - "CreateMcpOauthRefreshParam": { + "LiveDecisionAssistantMessageParam": { "type": "object", "properties": { - "token_endpoint": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The HTTPS OAuth token endpoint used to exchange the refresh token for a new access token." - }, - "client_id": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The OAuth client ID used when requesting a new access token." - }, - "resource": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The resource URI to send to the OAuth token endpoint during refresh, if required." - }, - "scope": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "Space-separated OAuth scopes to request during refresh, if required." - }, - "refresh_token": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The refresh token to store. This secret is never returned in credential resources." + "id": { + "anyOf": [ + { + "description": "The unique ID of this message item.", + "type": "string" + }, + { + "type": "null" + } + ] }, - "token_endpoint_auth": { - "$ref": "#/components/schemas/CreateMcpOauthTokenEndpointAuthParam", - "description": "How the OAuth client authenticates to the token endpoint." - } - }, - "required": [ - "token_endpoint", - "client_id", - "refresh_token", - "token_endpoint_auth" - ], - "additionalProperties": false, - "description": "Configuration for refreshing the access token of an MCP OAuth credential." - }, - "CreateVaultCredentialAuthParamMcpOauth": { - "type": "object", - "properties": { "type": { - "type": "string", - "enum": [ - "mcp_oauth" - ], - "default": "mcp_oauth", + "default": "message", "x-stainless-const": true, - "description": "The type of the object. Always `mcp_oauth`." - }, - "mcp_server_url": { "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The HTTPS MCP server URL authorized by this credential." + "enum": [ + "message" + ] }, - "access_token": { + "role": { + "default": "assistant", + "x-stainless-const": true, "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "A write-only OAuth access token; never returned by credential resources." + "enum": [ + "assistant" + ] }, - "expires_at": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "When the OAuth access token expires, as an RFC 3339 timestamp, if known." + "content": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionOutputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionRefusalParam" + } + ] + } + } + ] }, - "refresh": { + "phase": { "anyOf": [ { - "$ref": "#/components/schemas/CreateMcpOauthRefreshParam" + "description": "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.", + "$ref": "#/components/schemas/LiveMessagePhase" }, { "type": "null" } - ], - "description": "Optional refresh configuration for an HTTPS OAuth token endpoint." + ] } }, "required": [ - "type", - "mcp_server_url", - "access_token" - ], - "additionalProperties": false, - "description": "An OAuth credential for an HTTPS MCP destination." + "role", + "content" + ] }, - "CreateVaultCredentialAuthParamStaticBearer": { + "LiveFunctionCallItemStatus": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete" + ] + }, + "LiveDecisionFunctionCallParam": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "static_bearer" - ], - "default": "static_bearer", - "x-stainless-const": true, - "description": "The type of the object. Always `static_bearer`." + "id": { + "anyOf": [ + { + "description": "The local Decision item ID.", + "type": "string" + }, + { + "type": "null" + } + ] }, - "mcp_server_url": { + "call_id": { + "description": "The unique ID of the function tool call generated by the model.", "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The HTTPS MCP server URL authorized by this credential." + "minLength": 1, + "maxLength": 64 }, - "token": { + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/LiveFunctionCallItemStatus" + }, + { + "type": "null" + } + ] + }, + "type": { + "description": "The item type. Always `function_call`.", + "default": "function_call", + "x-stainless-const": true, "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The bearer token to store. This secret is never returned in credential resources." - } - }, - "required": [ - "type", - "mcp_server_url", - "token" - ], - "additionalProperties": false, - "description": "A bearer token for an MCP server, without automatic OAuth refresh." - }, - "CreateVaultCredentialAuthParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/CreateVaultCredentialAuthParamMcpOauth" + "enum": [ + "function_call" + ] }, - { - "$ref": "#/components/schemas/CreateVaultCredentialAuthParamStaticBearer" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "mcp_oauth": "#/components/schemas/CreateVaultCredentialAuthParamMcpOauth", - "static_bearer": "#/components/schemas/CreateVaultCredentialAuthParamStaticBearer" - } - }, - "x-oai-discriminator-values": [ - "mcp_oauth", - "static_bearer" - ], - "description": "Authentication credentials for an MCP server used by agent tools." - }, - "CreateVaultCredentialParams": { - "type": "object", - "properties": { "name": { "type": "string", "minLength": 1, - "maxLength": 1048576, - "description": "The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming." + "maxLength": 128, + "pattern": "^[a-zA-Z0-9_.-]+$" }, - "auth": { - "$ref": "#/components/schemas/CreateVaultCredentialAuthParam", - "description": "The authentication method and secret values to store for the MCP server." + "namespace": { + "anyOf": [ + { + "description": "The namespace of the function to call.", + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" + }, + { + "type": "null" + } + ] + }, + "arguments": { + "description": "The function arguments as a JSON string.", + "type": "string" } }, "required": [ - "auth", - "name" - ], - "additionalProperties": false, - "description": "Parameters for storing a credential that authorizes access to an MCP server." + "call_id", + "type", + "name", + "arguments" + ] }, - "RotateMcpOauthTokenEndpointAuthParamClientSecretBasic": { + "LiveDecisionFunctionCallOutputParam": { "type": "object", "properties": { - "type": { + "id": { + "anyOf": [ + { + "description": "The local Decision item ID.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "call_id": { + "description": "The unique ID of the function tool call generated by the model.", "type": "string", - "enum": [ - "client_secret_basic" - ], - "default": "client_secret_basic", - "x-stainless-const": true, - "description": "The type of the object. Always `client_secret_basic`." + "minLength": 1, + "maxLength": 64 + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/LiveFunctionCallItemStatus" + }, + { + "type": "null" + } + ] }, - "client_secret": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources." - } - }, - "required": [ - "type" - ], - "additionalProperties": false, - "description": "Updates credentials sent using HTTP Basic authentication." - }, - "RotateMcpOauthTokenEndpointAuthParamClientSecretPost": { - "type": "object", - "properties": { "type": { + "description": "The type of the function tool call output. Always `function_call_output`.", + "default": "function_call_output", + "x-stainless-const": true, "type": "string", "enum": [ - "client_secret_post" - ], - "default": "client_secret_post", - "x-stainless-const": true, - "description": "The type of the object. Always `client_secret_post`." + "function_call_output" + ] }, - "client_secret": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources." + "output": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputImageParam" + } + ] + } + } + ] } }, "required": [ - "type" - ], - "additionalProperties": false, - "description": "Updates credentials sent in the token request body." - }, - "RotateMcpOauthTokenEndpointAuthParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretBasic" - }, - { - "$ref": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretPost" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "client_secret_basic": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretBasic", - "client_secret_post": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretPost" - } - }, - "x-oai-discriminator-values": [ - "client_secret_basic", - "client_secret_post" - ], - "description": "Client-secret updates that preserve the credential's OAuth authentication method." - }, - "RotateMcpOauthRefreshParam": { - "type": "object", - "properties": { - "refresh_token": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The replacement refresh token. Omit or pass `null` to keep the stored token. This secret is never returned in resources." + "call_id", + "type", + "output" + ] + }, + "LiveDecisionCustomToolCallParam": { + "type": "object", + "properties": { + "id": { + "anyOf": [ + { + "description": "The local Decision item ID.", + "type": "string" + }, + { + "type": "null" + } + ] }, - "scope": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "Replacement space-separated OAuth scopes for refresh requests. Omit to keep the scopes, or pass `null` to stop sending a scope parameter." + "call_id": { + "description": "The unique ID of the function tool call generated by the model.", + "type": "string", + "minLength": 1, + "maxLength": 64 }, - "token_endpoint_auth": { + "status": { "anyOf": [ { - "$ref": "#/components/schemas/RotateMcpOauthTokenEndpointAuthParam" + "$ref": "#/components/schemas/LiveFunctionCallItemStatus" }, { "type": "null" } - ], - "description": "Client-secret updates for the existing token endpoint authentication method." - } - }, - "additionalProperties": false, - "description": "Updates to an MCP credential's existing OAuth refresh configuration." - }, - "RotateVaultCredentialAuthParamMcpOauth": { - "type": "object", - "properties": { + ] + }, "type": { + "description": "The item type. Always `custom_tool_call`.", + "default": "custom_tool_call", + "x-stainless-const": true, "type": "string", "enum": [ - "mcp_oauth" - ], - "default": "mcp_oauth", - "x-stainless-const": true, - "description": "The type of the object. Always `mcp_oauth`." - }, - "access_token": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "A write-only replacement OAuth access token." + "custom_tool_call" + ] }, - "expires_at": { - "type": [ - "string", - "null" - ], - "minLength": 0, - "maxLength": 1048576, - "description": "The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting this field preserves the expiry unless a new access token is supplied, in which case the expiry is cleared." + "name": { + "description": "The name of the custom tool to call.", + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" }, - "refresh": { + "namespace": { "anyOf": [ { - "$ref": "#/components/schemas/RotateMcpOauthRefreshParam" + "description": "The namespace of the function to call.", + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" }, { "type": "null" } - ], - "description": "Optional write-only refresh-token and client-secret updates." + ] + }, + "input": { + "description": "The input to the custom tool call.", + "type": "string" } }, "required": [ - "type" - ], - "additionalProperties": false, - "description": "Rotate an OAuth credential for an HTTPS MCP destination." + "call_id", + "type", + "name", + "input" + ] }, - "RotateVaultCredentialAuthParamStaticBearer": { + "LiveDecisionCustomToolCallOutputParam": { "type": "object", "properties": { + "id": { + "anyOf": [ + { + "description": "The local Decision item ID.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "call_id": { + "description": "The unique ID of the function tool call generated by the model.", + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/LiveFunctionCallItemStatus" + }, + { + "type": "null" + } + ] + }, "type": { + "default": "custom_tool_call_output", + "x-stainless-const": true, "type": "string", "enum": [ - "static_bearer" - ], - "default": "static_bearer", - "x-stainless-const": true, - "description": "The type of the object. Always `static_bearer`." + "custom_tool_call_output" + ] }, - "token": { - "type": "string", - "minLength": 0, - "maxLength": 1048576, - "description": "The replacement bearer token. This secret is never returned in credential resources." + "output": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputImageParam" + } + ] + } + } + ] } }, "required": [ + "call_id", "type", - "token" - ], - "additionalProperties": false, - "description": "Replace the bearer token for the credential's MCP server." + "output" + ] }, - "RotateVaultCredentialAuthParam": { + "LiveDecisionInputItemParam": { + "discriminator": { + "propertyName": "type" + }, "oneOf": [ { - "$ref": "#/components/schemas/RotateVaultCredentialAuthParamMcpOauth" + "discriminator": { + "propertyName": "role" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionUserMessageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionDeveloperMessageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionSystemMessageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionAssistantMessageParam" + } + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "message" + ] + } + } }, { - "$ref": "#/components/schemas/RotateVaultCredentialAuthParamStaticBearer" + "$ref": "#/components/schemas/LiveDecisionFunctionCallParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionFunctionCallOutputParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionCustomToolCallParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionCustomToolCallOutputParam" } ], - "discriminator": { - "propertyName": "type", - "mapping": { - "mcp_oauth": "#/components/schemas/RotateVaultCredentialAuthParamMcpOauth", - "static_bearer": "#/components/schemas/RotateVaultCredentialAuthParamStaticBearer" + "x-oai-default-discriminator-value": "message" + }, + "LiveDecisionItemCreateParam": { + "description": "Append an input item for future decisions without starting an evaluation or changing Live voice context.", + "example": { + "type": "decision.item.create", + "event_id": "browser_1", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Wikipedia is open." + } + ] } }, - "x-oai-discriminator-values": [ - "mcp_oauth", - "static_bearer" - ], - "description": "Updates to a vault credential without changing its authentication method or MCP server." - }, - "RotateVaultCredentialParams": { "type": "object", "properties": { - "auth": { - "$ref": "#/components/schemas/RotateVaultCredentialAuthParam", - "description": "Replacement values for the credential's existing authentication method." + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, + "type": { + "default": "decision.item.create", + "x-stainless-const": true, + "type": "string", + "enum": [ + "decision.item.create" + ] + }, + "item": { + "$ref": "#/components/schemas/LiveDecisionInputItemParam" } }, "required": [ - "auth" + "type", + "item" ], - "additionalProperties": false, - "description": "Secret, expiry, and OAuth refresh scope updates for an existing vault credential." + "x-oaiMeta": { + "example": { + "type": "decision.item.create", + "event_id": "browser_1", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Wikipedia is open." + } + ] + } + } + } }, - "DeletedVaultCredentialResource": { + "LiveDecisionItemDeleteParam": { + "description": "Delete an input item from future decisions without starting an evaluation or changing Live voice context.", + "example": { + "type": "decision.item.delete", + "event_id": "remove_browser_1", + "item_id": "msg_browser_1" + }, "type": "object", "properties": { - "id": { - "type": "string", - "minLength": 0, - "description": "The ID of the deleted credential." + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] }, - "object": { + "type": { + "default": "decision.item.delete", + "x-stainless-const": true, "type": "string", "enum": [ - "vault.credential.deleted" - ], - "default": "vault.credential.deleted", - "x-stainless-const": true, - "description": "The object type. Always `vault.credential.deleted`." + "decision.item.delete" + ] }, - "deleted": { - "type": "boolean", - "description": "Whether the resource was deleted. Always `true`." + "item_id": { + "type": "string", + "minLength": 1 } }, "required": [ - "id", - "object", - "deleted" + "type", + "item_id" ], - "additionalProperties": false, - "description": "Confirmation that a vault credential was deleted." + "x-oaiMeta": { + "example": { + "type": "decision.item.delete", + "event_id": "remove_browser_1", + "item_id": "msg_browser_1" + } + } }, - "DragPoint": { - "properties": { - "x": { - "type": "integer", - "description": "The x-coordinate." - }, - "y": { - "type": "integer", - "description": "The y-coordinate." + "LiveResponseItemCreateParam": { + "description": "Add an input item to the Live session’s Responses backend. Requires Responses delegation; use `response.create` to request a response.", + "example": { + "type": "response.item.create", + "event_id": "evt_item_001", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Please check for a table for two at 7 PM." + } + ] } }, "type": "object", - "required": [ - "x", - "y" - ], - "title": "Coordinate", - "description": "An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`." - }, - "LiveSessionAudioFormatPCMParam": { - "description": "Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection.", - "type": "object", "properties": { + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, "type": { - "description": "The audio encoding. Always `audio/pcm`.", - "default": "audio/pcm", + "description": "The Live client event type. Always `response.item.create`.", + "default": "response.item.create", "x-stainless-const": true, "type": "string", "enum": [ - "audio/pcm" + "response.item.create" ] }, - "rate": { - "description": "Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz.", - "type": "integer", - "minimum": 16000, - "maximum": 24000, - "enum": [ - 16000, - 24000 - ] + "item": { + "description": "An input item to append to the Responses backend conversation, such as a user message or a function tool result.", + "$ref": "#/components/schemas/InputItem" } }, "required": [ "type", - "rate" - ] + "item" + ], + "x-oaiMeta": { + "example": { + "type": "response.item.create", + "event_id": "evt_item_001", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Please check for a table for two at 7 PM." + } + ] + } + } + } }, - "LiveSessionAudioFormatPCMUParam": { - "description": "Raw, mono G.711 μ-law audio for a Live WebSocket connection.", + "LiveResponseCreateParam": { + "description": "Request a response from the Live session’s Responses backend, or continue a delegated response waiting for tool results. Requires Responses delegation.", + "example": { + "type": "response.create", + "event_id": "evt_response_001" + }, "type": "object", "properties": { + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, "type": { - "description": "The audio encoding. Always `audio/pcmu`.", - "default": "audio/pcmu", + "description": "The Live client event type. Always `response.create`.", + "default": "response.create", "x-stainless-const": true, "type": "string", "enum": [ - "audio/pcmu" + "response.create" ] - }, - "rate": { - "description": "Audio sample rate in hertz. G.711 audio uses 8000 Hz.", - "type": "integer", - "minimum": 8000, - "maximum": 8000 } }, "required": [ - "type", - "rate" - ] + "type" + ], + "x-oaiMeta": { + "example": { + "type": "response.create", + "event_id": "evt_response_001" + } + } }, - "LiveSessionAudioFormatPCMAParam": { - "description": "Raw, mono G.711 A-law audio for a Live WebSocket connection.", + "LiveSessionCloseParam": { + "description": "Request that the Live session close. The terminal `session.closed` event contains the close reason and final usage.", + "example": { + "type": "session.close", + "event_id": "evt_close_001" + }, "type": "object", "properties": { + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, "type": { - "description": "The audio encoding. Always `audio/pcma`.", - "default": "audio/pcma", + "description": "The Live client event type. Always `session.close`.", + "default": "session.close", "x-stainless-const": true, "type": "string", "enum": [ - "audio/pcma" + "session.close" ] - }, - "rate": { - "description": "Audio sample rate in hertz. G.711 audio uses 8000 Hz.", - "type": "integer", - "minimum": 8000, - "maximum": 8000 } }, "required": [ - "type", - "rate" - ] + "type" + ], + "x-oaiMeta": { + "example": { + "type": "session.close", + "event_id": "evt_close_001" + } + } }, - "LiveAudioFormat": { - "description": "Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately.", - "discriminator": { - "propertyName": "type" + "LiveForkAudioParam": { + "description": "Audio format for the new WebSocket connection to a forked Live session. The stored voice is preserved.", + "type": "object", + "properties": { + "format": { + "description": "Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately.", + "$ref": "#/components/schemas/LiveAudioFormat" + } }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveSessionAudioFormatPCMParam" + "required": [] + }, + "LiveForkSessionConfigParam": { + "description": "Overrides for a stored session after connecting to the fork WebSocket. An empty object inherits the stored configuration; do not supply a new model. audio.format applies only to the new WebSocket connection. client overrides are only supported for WebRTC forks.", + "type": "object", + "properties": { + "audio": { + "description": "Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and must omit this field.", + "$ref": "#/components/schemas/LiveForkAudioParam" }, - { - "$ref": "#/components/schemas/LiveSessionAudioFormatPCMUParam" + "delegation": { + "description": "Overrides for the stored session’s Responses backend. Only supported when the stored session already uses Responses delegation; the delegation type cannot change.", + "$ref": "#/components/schemas/LiveResponsesDelegationUpdateParam" }, - { - "$ref": "#/components/schemas/LiveSessionAudioFormatPCMAParam" + "store": { + "description": "Whether to store the forked session. Omission inherits the stored session's setting.", + "type": "boolean" + }, + "client": { + "description": "Frontend data-channel permissions for a WebRTC fork. Omitted permissions inherit the stored values. Not supported for WebSocket forks.", + "$ref": "#/components/schemas/LiveClientConfigParam" } - ] + }, + "required": [] }, - "LiveInitialSessionAudioParam": { - "description": "Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup.", + "LiveForkSessionStartEvent": { + "description": "Start a Live session after connecting to a stored session’s fork WebSocket. Send an empty `session` object to use the stored configuration.", + "example": { + "type": "session.start", + "session": {} + }, "type": "object", "properties": { - "format": { - "description": "Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately.", - "$ref": "#/components/schemas/LiveAudioFormat" + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] }, - "output": { - "description": "The voice used for speech generated by the Live model.", - "$ref": "#/components/schemas/LiveInitialSessionAudioOutputParam" + "type": { + "description": "The Live client event type. Always `session.start`.", + "default": "session.start", + "x-stainless-const": true, + "type": "string", + "enum": [ + "session.start" + ] + }, + "session": { + "description": "Overrides for a stored session after connecting to the fork WebSocket. An empty object inherits the stored configuration; do not supply a new model. audio.format applies only to the new WebSocket connection. client overrides are only supported for WebRTC forks.", + "$ref": "#/components/schemas/LiveForkSessionConfigParam" } }, - "required": [] + "required": [ + "type", + "session" + ], + "x-oaiMeta": { + "example": { + "type": "session.start", + "session": {} + } + } }, - "LiveSessionCreateParams": { - "description": "Initial configuration for a Live session, including its model, conversation instructions, audio, and delegated task handling.", + "LiveSessionResourceParam": { + "description": "The resolved Live session configuration and server-assigned session metadata.", "type": "object", "properties": { "model": { @@ -86803,7 +113582,7 @@ ] }, "input": { - "description": "Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.", + "description": "Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and a configured rendered-token limit (8,192 by default).", "type": "array", "items": { "$ref": "#/components/schemas/LiveInitialItem" @@ -86817,7 +113596,7 @@ "delegation": { "anyOf": [ { - "description": "Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` to let the API manage a Responses backend.", + "description": "Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` or `decisions` to delegate to the corresponding API.", "discriminator": { "propertyName": "type" }, @@ -86827,6 +113606,9 @@ }, { "$ref": "#/components/schemas/LiveResponsesDelegationParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionsDelegationParam" } ] }, @@ -86835,6 +113617,14 @@ } ] }, + "triggers": { + "description": "At most one Decisions trigger per transcript event type. Triggers run independently of delegation. On update, omit triggers to keep the current configuration, send a list to replace it, or send an empty list to disable triggers.", + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionTriggerInputParam" + }, + "maxItems": 2 + }, "store": { "description": "Whether to store the session for later forking and recording download. Defaults to false for new sessions.", "type": "boolean" @@ -86842,20 +113632,45 @@ "client": { "description": "Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected.", "$ref": "#/components/schemas/LiveClientConfigParam" + }, + "id": { + "description": "The unique ID of the Live session. Use this ID for sideband connections, forking, and recording download.", + "type": "string" + }, + "expires_at": { + "description": "The Unix timestamp, in seconds, at which the Live session expires.", + "type": "integer" + }, + "status": { + "description": "The status of the session snapshot. Always `active`, including the final snapshot in session.closed; use the event type to determine that the session has closed.", + "default": "active", + "x-stainless-const": true, + "type": "string", + "enum": [ + "active" + ] } }, "required": [ - "model" + "model", + "id", + "expires_at", + "status" ] }, - "LiveSessionStartEvent": { - "description": "Start a Live session on a primary WebSocket. Send this event before other commands and wait for `session.started`.", + "LiveSessionStarted": { + "description": "Returned when a Live session has started. Contains the resolved session configuration, including server defaults.", "example": { - "type": "session.start", - "event_id": "evt_start_001", + "type": "session.started", + "event_id": "evt_started_001", + "client_event_id": "evt_start_001", "session": { + "id": "live_abc123", "model": "gpt-live-1", + "status": "active", + "expires_at": 1788555600, "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", + "input": [], "audio": { "format": { "type": "audio/pcm", @@ -86872,43 +113687,44 @@ }, "type": "object", "properties": { - "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] - }, "type": { - "description": "The Live client event type. Always `session.start`.", - "default": "session.start", + "description": "The event type, always `session.started`.", + "default": "session.started", "x-stainless-const": true, "type": "string", "enum": [ - "session.start" + "session.started" ] }, + "event_id": { + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" + }, "session": { - "description": "Initial configuration for a primary WebSocket. Send session.start first and wait for session.started before application commands. WebRTC creation already starts the session; do not send this event again on its data channel.", - "$ref": "#/components/schemas/LiveSessionCreateParams" + "$ref": "#/components/schemas/LiveSessionResourceParam" } }, "required": [ "type", + "event_id", "session" ], "x-oaiMeta": { "example": { - "type": "session.start", - "event_id": "evt_start_001", + "type": "session.started", + "event_id": "evt_started_001", + "client_event_id": "evt_start_001", "session": { + "id": "live_abc123", "model": "gpt-live-1", + "status": "active", + "expires_at": 1788555600, "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", + "input": [], "audio": { "format": { "type": "audio/pcm", @@ -86925,755 +113741,679 @@ } } }, - "LiveSessionUpdateParams": { - "description": "Changes to an active Live session. Only delegation backend settings can be updated after startup.", - "type": "object", - "properties": { - "delegation": { - "anyOf": [ - { - "description": "Delegation settings to update. The delegation type must match the current session; omitted settings retain their values.", - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveClientDelegationParam" - }, - { - "$ref": "#/components/schemas/LiveResponsesDelegationUpdateParam" - } - ] - }, - { - "type": "null" - } - ] - } - }, - "required": [] - }, - "LiveSessionUpdateParam": { - "description": "Update the delegation settings of an active Live session. The server acknowledges accepted changes with `session.updated`.", + "LiveSessionUpdated": { + "description": "Returned when a Live session update is accepted. Contains the resolved session configuration after the update.", "example": { - "type": "session.update", - "event_id": "evt_update_001", + "type": "session.updated", + "event_id": "evt_updated_001", + "client_event_id": "evt_update_001", "session": { + "id": "live_def456", + "model": "gpt-live-1", + "status": "active", + "expires_at": 1788555600, + "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", + "input": [], + "audio": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "output": { + "voice": "marin" + } + }, "delegation": { "type": "responses", "responses": { + "model": "gpt-6-astra", "instructions": "Check restaurant availability. Ask before confirming a booking.", - "max_output_tokens": 1024 + "max_output_tokens": 1024, + "tools": [] } } } }, "type": "object", "properties": { - "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] - }, "type": { - "description": "The Live client event type. Always `session.update`.", - "default": "session.update", + "description": "The event type, always `session.updated`.", + "default": "session.updated", "x-stainless-const": true, "type": "string", "enum": [ - "session.update" + "session.updated" ] }, + "event_id": { + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" + }, "session": { - "description": "Sparse delegation updates. Omitted settings retain their values. The delegation type cannot change, including resetting Responses delegation to null or client. Model, frontend instructions, audio, and startup input are immutable.", - "$ref": "#/components/schemas/LiveSessionUpdateParams" + "$ref": "#/components/schemas/LiveSessionResourceParam" } }, "required": [ "type", + "event_id", "session" ], "x-oaiMeta": { "example": { - "type": "session.update", - "event_id": "evt_update_001", + "type": "session.updated", + "event_id": "evt_updated_001", + "client_event_id": "evt_update_001", "session": { + "id": "live_def456", + "model": "gpt-live-1", + "status": "active", + "expires_at": 1788555600, + "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", + "input": [], + "audio": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "output": { + "voice": "marin" + } + }, "delegation": { "type": "responses", "responses": { + "model": "gpt-6-astra", "instructions": "Check restaurant availability. Ask before confirming a booking.", - "max_output_tokens": 1024 + "max_output_tokens": 1024, + "tools": [] } } } } } }, - "LiveInputAudioAppendEvent": { - "description": "Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions send audio over their media transport.", + "LiveInputAudioMuted": { + "description": "Acknowledges a session.input_audio.mute command. An independent input mute sends silence to the model and preserves sideband audio reflection. Fixture playback does not emit this event.", "example": { - "type": "session.input_audio.append", - "audio": "AACAAIAAAIAAAP9/AIAAgA==" + "type": "session.input_audio.muted", + "event_id": "evt_muted_001", + "client_event_id": "evt_mute_001" }, "type": "object", "properties": { "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" }, "type": { - "description": "The Live client event type. Always `session.input_audio.append`.", - "default": "session.input_audio.append", + "description": "The event type, always `session.input_audio.muted`.", + "default": "session.input_audio.muted", "x-stainless-const": true, "type": "string", "enum": [ - "session.input_audio.append" + "session.input_audio.muted" ] - }, - "audio": { - "description": "Base64-encoded raw audio in the startup-selected format, without a WAV or other container header. Primary WebSocket only; media transports use their audio track. Audio appends have no acknowledgment. Reflected sideband server events reuse this event type and audio key, with no timestamps or event_id; their audio is always mono PCM16LE at 24 kHz.", - "type": "string", - "minLength": 1 } }, "required": [ - "type", - "audio" + "event_id", + "type" ], "x-oaiMeta": { "example": { - "type": "session.input_audio.append", - "audio": "AACAAIAAAIAAAP9/AIAAgA==" + "type": "session.input_audio.muted", + "event_id": "evt_muted_001", + "client_event_id": "evt_mute_001" } } }, - "LiveInputAudioMuteParam": { - "description": "Mute audio input to the Live model without closing the session. The server acknowledges with `session.input_audio.muted`.", + "LiveInputAudioUnmuted": { + "description": "Acknowledges a session.input_audio.unmute command, removing the independent input mute. An active audio fixture still pauses inference until playback finishes. Fixture playback does not emit this event.", "example": { - "type": "session.input_audio.mute", - "event_id": "evt_mute_001" + "type": "session.input_audio.unmuted", + "event_id": "evt_unmuted_001", + "client_event_id": "evt_unmute_001" }, "type": "object", "properties": { "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" }, "type": { - "description": "The Live client event type. Always `session.input_audio.mute`.", - "default": "session.input_audio.mute", + "description": "The event type, always `session.input_audio.unmuted`.", + "default": "session.input_audio.unmuted", "x-stainless-const": true, "type": "string", "enum": [ - "session.input_audio.mute" + "session.input_audio.unmuted" ] } }, "required": [ + "event_id", "type" ], "x-oaiMeta": { "example": { - "type": "session.input_audio.mute", - "event_id": "evt_mute_001" + "type": "session.input_audio.unmuted", + "event_id": "evt_unmuted_001", + "client_event_id": "evt_unmute_001" } } }, - "LiveInputAudioUnmuteParam": { - "description": "Resume audio input to a Live model after muting it. The server acknowledges with `session.input_audio.unmuted`.", + "LiveOutputAudioFixturePlaying": { + "description": "The existing playback path has accepted the validated audio fixture. This acknowledgment does not identify when the listener receives the first sample. The optional client_event_id echoes the play command.", "example": { - "type": "session.input_audio.unmute", - "event_id": "evt_unmute_001" + "type": "session.output_audio.fixture.playing", + "event_id": "evt_playing_001", + "client_event_id": "evt_play_001" }, "type": "object", "properties": { "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" }, "type": { - "description": "The Live client event type. Always `session.input_audio.unmute`.", - "default": "session.input_audio.unmute", + "default": "session.output_audio.fixture.playing", "x-stainless-const": true, "type": "string", "enum": [ - "session.input_audio.unmute" + "session.output_audio.fixture.playing" ] } }, "required": [ + "event_id", "type" ], "x-oaiMeta": { "example": { - "type": "session.input_audio.unmute", - "event_id": "evt_unmute_001" + "type": "session.output_audio.fixture.playing", + "event_id": "evt_playing_001", + "client_event_id": "evt_play_001" } } }, - "LiveInstructionsAppendParam": { - "description": "Append instructions to the Live conversation while it is running, optionally associating them with an existing client delegation.", + "LiveOutputAudioFixturePlayed": { + "description": "The complete audio fixture has drained from the server mixer and normal inference has resumed. Transport buffers may still contain audio; this event does not prove listener-side completion. The optional client_event_id echoes the play command. This event is not emitted for canceled or failed playback.", "example": { - "type": "session.instructions.append", - "event_id": "evt_instructions_001", - "delegation_id": null, - "content": "The caller prefers outdoor seating." + "type": "session.output_audio.fixture.played", + "event_id": "evt_played_001", + "client_event_id": "evt_play_001" }, "type": "object", "properties": { "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" }, "type": { - "description": "The Live client event type. Always `session.instructions.append`.", - "default": "session.instructions.append", + "default": "session.output_audio.fixture.played", "x-stainless-const": true, "type": "string", "enum": [ - "session.instructions.append" + "session.output_audio.fixture.played" ] - }, - "delegation_id": { - "anyOf": [ - { - "description": "Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation.", - "type": "string", - "minLength": 1 - }, - { - "type": "null" - } - ] - }, - "content": { - "description": "Instruction text to append, limited to 500 tokens. This is a plain string, not an array of content parts.", - "type": "string" } }, "required": [ - "type", - "delegation_id", - "content" + "event_id", + "type" ], "x-oaiMeta": { "example": { - "type": "session.instructions.append", - "event_id": "evt_instructions_001", - "delegation_id": null, - "content": "The caller prefers outdoor seating." + "type": "session.output_audio.fixture.played", + "event_id": "evt_played_001", + "client_event_id": "evt_play_001" } } }, - "LiveThinkingAppendParam": { - "description": "Provide silent reasoning or progress context to the Live model, optionally for an existing client delegation.", + "LiveInstructionsAppended": { + "description": "Returned when a session.instructions.append command is accepted into the Live session timeline. Acknowledges the appended instructions without guaranteeing that the model has acted on them.", "example": { - "type": "session.thinking.append", - "event_id": "evt_thinking_001", - "delegation_id": "del_abc123", - "content": "Checking availability for two guests at 7 PM." + "type": "session.instructions.appended", + "event_id": "evt_instructions_002", + "client_event_id": "evt_instructions_001", + "start_ms": 1200, + "end_ms": 1400 }, "type": "object", "properties": { "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" + }, + "start_ms": { + "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", + "type": "integer" + }, + "end_ms": { + "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", + "type": "integer" }, "type": { - "description": "The Live client event type. Always `session.thinking.append`.", - "default": "session.thinking.append", + "description": "The event type, always `session.instructions.appended`.", + "default": "session.instructions.appended", "x-stainless-const": true, "type": "string", "enum": [ - "session.thinking.append" - ] - }, - "delegation_id": { - "anyOf": [ - { - "description": "Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation.", - "type": "string", - "minLength": 1 - }, - { - "type": "null" - } + "session.instructions.appended" ] + } + }, + "required": [ + "event_id", + "start_ms", + "end_ms", + "type" + ], + "x-oaiMeta": { + "example": { + "type": "session.instructions.appended", + "event_id": "evt_instructions_002", + "client_event_id": "evt_instructions_001", + "start_ms": 1200, + "end_ms": 1400 + } + } + }, + "LiveThinkingAppended": { + "description": "Returned when a session.thinking.append command is accepted into the Live session timeline. Acknowledges the added reasoning context without guaranteeing any spoken output.", + "example": { + "type": "session.thinking.appended", + "event_id": "evt_thinking_002", + "client_event_id": "evt_thinking_001", + "start_ms": 4600, + "end_ms": 4800 + }, + "type": "object", + "properties": { + "event_id": { + "description": "The unique ID of the Live server event.", + "type": "string" }, - "content": { - "description": "Silent reasoning or progress context, limited to 500 tokens. It does not directly request speech, but can influence later speech and is not a secrecy boundary.", + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", "type": "string" + }, + "start_ms": { + "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", + "type": "integer" + }, + "end_ms": { + "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", + "type": "integer" + }, + "type": { + "description": "The event type, always `session.thinking.appended`.", + "default": "session.thinking.appended", + "x-stainless-const": true, + "type": "string", + "enum": [ + "session.thinking.appended" + ] } }, "required": [ - "type", - "delegation_id", - "content" + "event_id", + "start_ms", + "end_ms", + "type" ], "x-oaiMeta": { "example": { - "type": "session.thinking.append", - "event_id": "evt_thinking_001", - "delegation_id": "del_abc123", - "content": "Checking availability for two guests at 7 PM." + "type": "session.thinking.appended", + "event_id": "evt_thinking_002", + "client_event_id": "evt_thinking_001", + "start_ms": 4600, + "end_ms": 4800 } } }, - "LiveCommentaryAppendParam": { - "description": "Provide context the Live model can communicate to the user, optionally for an existing client delegation.", + "LiveCommentaryAppended": { + "description": "Returned when a session.commentary.append command is accepted into the Live session timeline. Acknowledges the added commentary without guaranteeing exact wording or completed audio playback.", "example": { - "type": "session.commentary.append", - "event_id": "evt_commentary_001", - "delegation_id": "del_abc123", - "content": "There is an outdoor table for two at 7 PM. Ask whether to reserve it." + "type": "session.commentary.appended", + "event_id": "evt_commentary_002", + "client_event_id": "evt_commentary_001", + "start_ms": 5200, + "end_ms": 5400 }, "type": "object", "properties": { "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" + }, + "start_ms": { + "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", + "type": "integer" + }, + "end_ms": { + "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", + "type": "integer" }, "type": { - "description": "The Live client event type. Always `session.commentary.append`.", - "default": "session.commentary.append", + "description": "The event type, always `session.commentary.appended`.", + "default": "session.commentary.appended", "x-stainless-const": true, "type": "string", "enum": [ - "session.commentary.append" - ] - }, - "delegation_id": { - "anyOf": [ - { - "description": "Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation.", - "type": "string", - "minLength": 1 - }, - { - "type": "null" - } + "session.commentary.appended" ] - }, - "content": { - "description": "Speakable context for the Live model, limited to 500 tokens. Use this for a result the model should communicate; use session.thinking.append for silent context.", - "type": "string" } }, "required": [ - "type", - "delegation_id", - "content" + "event_id", + "start_ms", + "end_ms", + "type" ], "x-oaiMeta": { "example": { - "type": "session.commentary.append", - "event_id": "evt_commentary_001", - "delegation_id": "del_abc123", - "content": "There is an outdoor table for two at 7 PM. Ask whether to reserve it." + "type": "session.commentary.appended", + "event_id": "evt_commentary_002", + "client_event_id": "evt_commentary_001", + "start_ms": 5200, + "end_ms": 5400 } } }, - "LiveResponseItemCreateParam": { - "description": "Add an input item to the Live session’s Responses backend. Requires Responses delegation; use `response.create` to request a response.", + "LiveInputAudioAppend": { + "description": "Input audio received from the primary transport and reflected to a Live sideband connection before model-input muting.", "example": { - "type": "response.item.create", - "event_id": "evt_item_001", - "item": { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Please check for a table for two at 7 PM." - } - ] - } + "type": "session.input_audio.append", + "audio": "AACAAIAAAIAAAP9/AIAAgA==" }, "type": "object", "properties": { - "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] - }, "type": { - "description": "The Live client event type. Always `response.item.create`.", - "default": "response.item.create", + "description": "The event type, always `session.input_audio.append`.", + "default": "session.input_audio.append", "x-stainless-const": true, "type": "string", "enum": [ - "response.item.create" + "session.input_audio.append" ] }, - "item": { - "description": "An input item to append to the Responses backend conversation, such as a user message or a function tool result.", - "$ref": "#/components/schemas/InputItem" + "audio": { + "description": "Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, reflected to the sideband before model-input muting. This server event uses the same audio key as the client command, but is not an acknowledgment of it.", + "type": "string" } }, "required": [ "type", - "item" + "audio" ], "x-oaiMeta": { "example": { - "type": "response.item.create", - "event_id": "evt_item_001", - "item": { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Please check for a table for two at 7 PM." - } - ] - } + "type": "session.input_audio.append", + "audio": "AACAAIAAAIAAAP9/AIAAgA==" } } }, - "LiveResponseCreateParam": { - "description": "Request a response from the Live session’s Responses backend, or continue a delegated response waiting for tool results. Requires Responses delegation.", + "LiveOutputAudioDelta": { + "description": "An audio chunk generated by the Live model. Decode and play primary WebSocket chunks in delivery order using the configured session audio format. Sideband connections receive reflected output audio with timestamps.", "example": { - "type": "response.create", - "event_id": "evt_response_001" + "type": "session.output_audio.delta", + "delta": "AACAAIAAAIAAAP9/AIAAgA==", + "start_ms": 1000, + "end_ms": 1200 }, "type": "object", "properties": { - "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] - }, "type": { - "description": "The Live client event type. Always `response.create`.", - "default": "response.create", + "description": "The event type, always `session.output_audio.delta`.", + "default": "session.output_audio.delta", "x-stainless-const": true, "type": "string", "enum": [ - "response.create" + "session.output_audio.delta" ] + }, + "delta": { + "description": "Base64-encoded raw audio. Primary WebSocket events use the session's configured format; reflected sideband events use mono PCM16LE at 24 kHz.", + "type": "string" + }, + "start_ms": { + "description": "Inclusive session-relative start in milliseconds. Required on reflected sideband events; omitted on the primary WebSocket.", + "type": "integer" + }, + "end_ms": { + "description": "Exclusive session-relative end in milliseconds. Required on reflected sideband events; omitted on the primary WebSocket. Dropped output frames leave gaps between reflected ranges.", + "type": "integer" } }, "required": [ - "type" + "type", + "delta" ], "x-oaiMeta": { "example": { - "type": "response.create", - "event_id": "evt_response_001" + "type": "session.output_audio.delta", + "delta": "AACAAIAAAIAAAP9/AIAAgA==", + "start_ms": 1000, + "end_ms": 1200 } } }, - "LiveSessionCloseParam": { - "description": "Request that the Live session close. The terminal `session.closed` event contains the close reason and final usage.", + "LiveInputTranscriptDelta": { + "description": "A transcript fragment for user input audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event.", "example": { - "type": "session.close", - "event_id": "evt_close_001" + "type": "session.input_transcript.delta", + "event_id": "evt_input_transcript_001", + "delta": "A table for two at seven, please.", + "start_ms": 1600, + "end_ms": 3400 }, "type": "object", "properties": { "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "description": "The unique ID of the Live server event.", + "type": "string" + }, + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" + }, + "start_ms": { + "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", + "type": "integer" + }, + "end_ms": { + "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", + "type": "integer" + }, + "delta": { + "description": "The transcript text fragment for the audio in this time range. Append fragments in delivery order to build the transcript.", + "type": "string" }, "type": { - "description": "The Live client event type. Always `session.close`.", - "default": "session.close", + "description": "The event type, always `session.input_transcript.delta`.", + "default": "session.input_transcript.delta", "x-stainless-const": true, "type": "string", "enum": [ - "session.close" + "session.input_transcript.delta" ] } }, "required": [ + "event_id", + "start_ms", + "end_ms", + "delta", "type" ], "x-oaiMeta": { "example": { - "type": "session.close", - "event_id": "evt_close_001" + "type": "session.input_transcript.delta", + "event_id": "evt_input_transcript_001", + "delta": "A table for two at seven, please.", + "start_ms": 1600, + "end_ms": 3400 } } }, - "LiveForkAudioParam": { - "description": "Audio format for the new WebSocket connection to a forked Live session. The stored voice is preserved.", - "type": "object", - "properties": { - "format": { - "description": "Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately.", - "$ref": "#/components/schemas/LiveAudioFormat" - } + "LiveOutputTranscriptDelta": { + "description": "A transcript fragment for assistant output audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event.", + "example": { + "type": "session.output_transcript.delta", + "event_id": "evt_output_transcript_001", + "delta": "Would you like me to reserve that table?", + "start_ms": 5400, + "end_ms": 7200 }, - "required": [] - }, - "LiveForkSessionConfigParam": { - "description": "Overrides for a stored session after connecting to the fork WebSocket. An empty object inherits the stored configuration; do not supply a new model. audio.format applies only to the new WebSocket connection. client overrides are only supported for WebRTC forks.", "type": "object", "properties": { - "audio": { - "description": "Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and must omit this field.", - "$ref": "#/components/schemas/LiveForkAudioParam" + "event_id": { + "description": "The unique ID of the Live server event.", + "type": "string" }, - "delegation": { - "description": "Overrides for the stored session’s Responses backend. Only supported when the stored session already uses Responses delegation; the delegation type cannot change.", - "$ref": "#/components/schemas/LiveResponsesDelegationUpdateParam" + "client_event_id": { + "description": "The event_id of the client command associated with this server event, when supplied.", + "type": "string" }, - "store": { - "description": "Whether to store the forked session. Omission inherits the stored session's setting.", - "type": "boolean" + "start_ms": { + "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", + "type": "integer" }, - "client": { - "description": "Frontend data-channel permissions for a WebRTC fork. Omitted permissions inherit the stored values. Not supported for WebSocket forks.", - "$ref": "#/components/schemas/LiveClientConfigParam" - } - }, - "required": [] - }, - "LiveForkSessionStartEvent": { - "description": "Start a Live session after connecting to a stored session’s fork WebSocket. Send an empty `session` object to use the stored configuration.", - "example": { - "type": "session.start", - "session": {} - }, - "type": "object", - "properties": { - "event_id": { - "anyOf": [ - { - "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", - "type": "string", - "maxLength": 512 - }, - { - "type": "null" - } - ] + "end_ms": { + "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", + "type": "integer" + }, + "delta": { + "description": "The transcript text fragment for the audio in this time range. Append fragments in delivery order to build the transcript.", + "type": "string" }, "type": { - "description": "The Live client event type. Always `session.start`.", - "default": "session.start", + "description": "The event type, always `session.output_transcript.delta`.", + "default": "session.output_transcript.delta", "x-stainless-const": true, "type": "string", "enum": [ - "session.start" + "session.output_transcript.delta" ] - }, - "session": { - "description": "Overrides for a stored session after connecting to the fork WebSocket. An empty object inherits the stored configuration; do not supply a new model. audio.format applies only to the new WebSocket connection. client overrides are only supported for WebRTC forks.", - "$ref": "#/components/schemas/LiveForkSessionConfigParam" } }, "required": [ - "type", - "session" + "event_id", + "start_ms", + "end_ms", + "delta", + "type" ], "x-oaiMeta": { "example": { - "type": "session.start", - "session": {} + "type": "session.output_transcript.delta", + "event_id": "evt_output_transcript_001", + "delta": "Would you like me to reserve that table?", + "start_ms": 5400, + "end_ms": 7200 } } }, - "LiveSessionResourceParam": { - "description": "The resolved Live session configuration and server-assigned session metadata.", + "LiveDelegationItem": { + "description": "Metadata for work delegated by the Live model to your application, Responses, or Decisions.", "type": "object", "properties": { - "model": { - "$ref": "#/components/schemas/ModelIdsLive" + "id": { + "description": "The unique ID of the delegation. Use this as delegation_id when replying to client-owned work or correlating backend events.", + "type": "string" }, - "instructions": { - "anyOf": [ - { - "description": "Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup.", - "type": "string" - }, - { - "type": "null" - } + "type": { + "description": "The object type, always `delegation`.", + "default": "delegation", + "x-stainless-const": true, + "type": "string", + "enum": [ + "delegation" ] }, - "input": { - "description": "Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.", - "type": "array", - "items": { - "$ref": "#/components/schemas/LiveInitialItem" - }, - "maxItems": 128 - }, - "audio": { - "description": "Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup.", - "$ref": "#/components/schemas/LiveInitialSessionAudioParam" - }, - "delegation": { - "anyOf": [ + "target": { + "description": "Where the Live model delegated the work: `client`, `responses`, or `decisions`.", + "oneOf": [ { - "description": "Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` to let the API manage a Responses backend.", - "discriminator": { - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/LiveClientDelegationParam" - }, - { - "$ref": "#/components/schemas/LiveResponsesDelegationParam" - } + "default": "client", + "x-stainless-const": true, + "type": "string", + "enum": [ + "client" ] }, { - "type": "null" + "default": "responses", + "x-stainless-const": true, + "type": "string", + "enum": [ + "responses" + ] + }, + { + "default": "decisions", + "x-stainless-const": true, + "type": "string", + "enum": [ + "decisions" + ] } ] }, - "store": { - "description": "Whether to store the session for later forking and recording download. Defaults to false for new sessions.", - "type": "boolean" - }, - "client": { - "description": "Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected.", - "$ref": "#/components/schemas/LiveClientConfigParam" - }, - "id": { - "description": "The unique ID of the Live session. Use this ID for sideband connections, forking, and recording download.", + "response_id": { + "description": "The ID of the Responses API response associated with a Responses delegation. Omitted for client delegations.", "type": "string" - }, - "expires_at": { - "description": "The Unix timestamp, in seconds, at which the Live session expires.", - "type": "integer" - }, - "status": { - "description": "The status of the session snapshot. Always `active`, including the final snapshot in session.closed; use the event type to determine that the session has closed.", - "default": "active", - "x-stainless-const": true, - "type": "string", - "enum": [ - "active" - ] } }, "required": [ - "model", "id", - "expires_at", - "status" + "type", + "target" ] }, - "LiveSessionStarted": { - "description": "Returned when a Live session has started. Contains the resolved session configuration, including server defaults.", + "LiveDelegationCreated": { + "description": "Returned when the Live model delegates work to your application, Responses, or Decisions. Contains delegation metadata and the position on the session timeline where the work was delegated.", "example": { - "type": "session.started", - "event_id": "evt_started_001", - "client_event_id": "evt_start_001", - "session": { - "id": "live_abc123", - "model": "gpt-live-1", - "status": "active", - "expires_at": 1788555600, - "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", - "input": [], - "audio": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "output": { - "voice": "marin" - } - }, - "delegation": { - "type": "client" - } + "type": "session.delegation.created", + "event_id": "evt_delegation_001", + "offset_ms": 3600, + "delegation": { + "id": "del_abc123", + "type": "delegation", + "target": "client" } }, "type": "object", "properties": { - "type": { - "description": "The event type, always `session.started`.", - "default": "session.started", - "x-stainless-const": true, - "type": "string", - "enum": [ - "session.started" - ] - }, "event_id": { "description": "The unique ID of the Live server event.", "type": "string" @@ -87682,72 +114422,95 @@ "description": "The event_id of the client command associated with this server event, when supplied.", "type": "string" }, - "session": { - "$ref": "#/components/schemas/LiveSessionResourceParam" + "type": { + "description": "The event type, always `session.delegation.created`.", + "default": "session.delegation.created", + "x-stainless-const": true, + "type": "string", + "enum": [ + "session.delegation.created" + ] + }, + "offset_ms": { + "description": "The position on the Live session timeline where the delegation was created, in milliseconds from the beginning of the session.", + "type": "integer" + }, + "delegation": { + "description": "The delegated work identifier and destination. This object contains metadata, not the task text.", + "$ref": "#/components/schemas/LiveDelegationItem" } }, "required": [ - "type", "event_id", - "session" + "type", + "offset_ms", + "delegation" ], "x-oaiMeta": { "example": { - "type": "session.started", - "event_id": "evt_started_001", - "client_event_id": "evt_start_001", - "session": { - "id": "live_abc123", - "model": "gpt-live-1", - "status": "active", - "expires_at": 1788555600, - "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", - "input": [], - "audio": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "output": { - "voice": "marin" - } - }, - "delegation": { - "type": "client" - } + "type": "session.delegation.created", + "event_id": "evt_delegation_001", + "offset_ms": 3600, + "delegation": { + "id": "del_abc123", + "type": "delegation", + "target": "client" } } - } + } + }, + "LiveDecisionCompleted": { + "type": "object", + "properties": { + "type": { + "default": "decision.completed", + "x-stainless-const": true, + "type": "string", + "enum": [ + "decision.completed" + ] + }, + "decision": { + "description": "The native Decision API response, including its model, ordered answers, and token usage.", + "$ref": "#/components/schemas/DecisionResponse" + } + }, + "required": [ + "type", + "decision" + ] }, - "LiveSessionUpdated": { - "description": "Returned when a Live session update is accepted. Contains the resolved session configuration after the update.", + "LiveDecisionEvent": { + "description": "A Decision API event for a Live delegation or transcript trigger. For a trigger, source_event_id identifies the transcript delta that caused this evaluation.", "example": { - "type": "session.updated", - "event_id": "evt_updated_001", - "client_event_id": "evt_update_001", - "session": { - "id": "live_def456", - "model": "gpt-live-1", - "status": "active", - "expires_at": 1788555600, - "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", - "input": [], - "audio": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "output": { - "voice": "marin" - } - }, - "delegation": { - "type": "responses", - "responses": { - "model": "gpt-6-astra", - "instructions": "Check restaurant availability. Ask before confirming a booking.", - "max_output_tokens": 1024, - "tools": [] + "type": "decision.event", + "event_id": "evt_decision_1", + "delegation_id": "del_abc123", + "trigger_id": null, + "source_event_type": null, + "source_event_id": null, + "event": { + "type": "decision.completed", + "decision": { + "model": "gpt-6-luna", + "answers": [ + { + "type": "predicate", + "name": "damaged", + "probability": 0.95 + } + ], + "usage": { + "input_tokens": 42, + "input_tokens_details": { + "cached_tokens": 0, + "cache_write_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 42 } } } @@ -87755,446 +114518,657 @@ "type": "object", "properties": { "type": { - "description": "The event type, always `session.updated`.", - "default": "session.updated", + "default": "decision.event", "x-stainless-const": true, "type": "string", "enum": [ - "session.updated" + "decision.event" ] }, "event_id": { - "description": "The unique ID of the Live server event.", + "description": "The unique ID of this Live server event.", "type": "string" }, - "client_event_id": { - "description": "The event_id of the client command associated with this server event, when supplied.", - "type": "string" + "delegation_id": { + "anyOf": [ + { + "description": "The Live delegation ID, or null for a transcript trigger.", + "type": "string" + }, + { + "type": "null" + } + ] }, - "session": { - "$ref": "#/components/schemas/LiveSessionResourceParam" + "trigger_id": { + "anyOf": [ + { + "description": "The Live-assigned ID of this trigger firing, or null for a delegation.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "source_event_type": { + "anyOf": [ + { + "oneOf": [ + { + "default": "session.input_transcript.delta", + "x-stainless-const": true, + "type": "string", + "enum": [ + "session.input_transcript.delta" + ] + }, + { + "default": "session.output_transcript.delta", + "x-stainless-const": true, + "type": "string", + "enum": [ + "session.output_transcript.delta" + ] + } + ] + }, + { + "type": "null" + } + ] + }, + "source_event_id": { + "anyOf": [ + { + "description": "The event_id of the transcript delta that fired this trigger, or null for a delegation.", + "type": "string" + }, + { + "type": "null" + } + ] + }, + "event": { + "$ref": "#/components/schemas/LiveDecisionCompleted" } }, "required": [ "type", "event_id", - "session" + "delegation_id", + "trigger_id", + "source_event_type", + "source_event_id", + "event" ], "x-oaiMeta": { "example": { - "type": "session.updated", - "event_id": "evt_updated_001", - "client_event_id": "evt_update_001", - "session": { - "id": "live_def456", - "model": "gpt-live-1", - "status": "active", - "expires_at": 1788555600, - "instructions": "Help the caller plan a restaurant reservation. Confirm details before booking.", - "input": [], - "audio": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "output": { - "voice": "marin" - } - }, - "delegation": { - "type": "responses", - "responses": { - "model": "gpt-6-astra", - "instructions": "Check restaurant availability. Ask before confirming a booking.", - "max_output_tokens": 1024, - "tools": [] + "type": "decision.event", + "event_id": "evt_decision_1", + "delegation_id": "del_abc123", + "trigger_id": null, + "source_event_type": null, + "source_event_id": null, + "event": { + "type": "decision.completed", + "decision": { + "model": "gpt-6-luna", + "answers": [ + { + "type": "predicate", + "name": "damaged", + "probability": 0.95 + } + ], + "usage": { + "input_tokens": 42, + "input_tokens_details": { + "cached_tokens": 0, + "cache_write_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 42 } } } } } }, - "LiveInputAudioMuted": { - "description": "Returned when a session.input_audio.mute command is accepted. Input audio is no longer sent to the model; sideband audio reflection continues.", - "example": { - "type": "session.input_audio.muted", - "event_id": "evt_muted_001", - "client_event_id": "evt_mute_001" - }, + "LiveDecisionStoredUserMessageParam": { "type": "object", "properties": { - "event_id": { - "description": "The unique ID of the Live server event.", - "type": "string" - }, - "client_event_id": { - "description": "The event_id of the client command associated with this server event, when supplied.", + "id": { "type": "string" }, "type": { - "description": "The event type, always `session.input_audio.muted`.", - "default": "session.input_audio.muted", + "default": "message", "x-stainless-const": true, "type": "string", "enum": [ - "session.input_audio.muted" + "message" + ] + }, + "role": { + "description": "The message role. Always `user`.", + "default": "user", + "x-stainless-const": true, + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionUserInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionUserInputImageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputJsonParam" + } + ] + } + } ] } }, "required": [ - "event_id", - "type" - ], - "x-oaiMeta": { - "example": { - "type": "session.input_audio.muted", - "event_id": "evt_muted_001", - "client_event_id": "evt_mute_001" - } - } + "role", + "content", + "id" + ] }, - "LiveInputAudioUnmuted": { - "description": "Returned when a session.input_audio.unmute command is accepted. Input audio is sent to the model again.", - "example": { - "type": "session.input_audio.unmuted", - "event_id": "evt_unmuted_001", - "client_event_id": "evt_unmute_001" - }, + "LiveDecisionStoredDeveloperMessageParam": { "type": "object", "properties": { - "event_id": { - "description": "The unique ID of the Live server event.", - "type": "string" - }, - "client_event_id": { - "description": "The event_id of the client command associated with this server event, when supplied.", + "id": { "type": "string" }, "type": { - "description": "The event type, always `session.input_audio.unmuted`.", - "default": "session.input_audio.unmuted", + "default": "message", "x-stainless-const": true, "type": "string", "enum": [ - "session.input_audio.unmuted" + "message" + ] + }, + "role": { + "default": "developer", + "x-stainless-const": true, + "type": "string", + "enum": [ + "developer" + ] + }, + "content": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + } + } ] } }, "required": [ - "event_id", - "type" - ], - "x-oaiMeta": { - "example": { - "type": "session.input_audio.unmuted", - "event_id": "evt_unmuted_001", - "client_event_id": "evt_unmute_001" - } - } + "role", + "content", + "id" + ] }, - "LiveInstructionsAppended": { - "description": "Returned when a session.instructions.append command is accepted into the Live session timeline. Acknowledges the appended instructions without guaranteeing that the model has acted on them.", - "example": { - "type": "session.instructions.appended", - "event_id": "evt_instructions_002", - "client_event_id": "evt_instructions_001", - "start_ms": 1200, - "end_ms": 1400 - }, + "LiveDecisionStoredSystemMessageParam": { "type": "object", "properties": { - "event_id": { - "description": "The unique ID of the Live server event.", - "type": "string" - }, - "client_event_id": { - "description": "The event_id of the client command associated with this server event, when supplied.", + "id": { "type": "string" }, - "start_ms": { - "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", - "type": "integer" - }, - "end_ms": { - "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", - "type": "integer" - }, "type": { - "description": "The event type, always `session.instructions.appended`.", - "default": "session.instructions.appended", + "default": "message", "x-stainless-const": true, "type": "string", "enum": [ - "session.instructions.appended" + "message" + ] + }, + "role": { + "default": "system", + "x-stainless-const": true, + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + } + } ] } }, "required": [ - "event_id", - "start_ms", - "end_ms", - "type" - ], - "x-oaiMeta": { - "example": { - "type": "session.instructions.appended", - "event_id": "evt_instructions_002", - "client_event_id": "evt_instructions_001", - "start_ms": 1200, - "end_ms": 1400 - } - } + "role", + "content", + "id" + ] }, - "LiveThinkingAppended": { - "description": "Returned when a session.thinking.append command is accepted into the Live session timeline. Acknowledges the added reasoning context without guaranteeing any spoken output.", - "example": { - "type": "session.thinking.appended", - "event_id": "evt_thinking_002", - "client_event_id": "evt_thinking_001", - "start_ms": 4600, - "end_ms": 4800 - }, + "LiveDecisionStoredAssistantMessageParam": { "type": "object", "properties": { - "event_id": { - "description": "The unique ID of the Live server event.", - "type": "string" - }, - "client_event_id": { - "description": "The event_id of the client command associated with this server event, when supplied.", + "id": { "type": "string" }, - "start_ms": { - "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", - "type": "integer" - }, - "end_ms": { - "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", - "type": "integer" - }, "type": { - "description": "The event type, always `session.thinking.appended`.", - "default": "session.thinking.appended", + "default": "message", "x-stainless-const": true, "type": "string", "enum": [ - "session.thinking.appended" + "message" + ] + }, + "role": { + "default": "assistant", + "x-stainless-const": true, + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionOutputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionRefusalParam" + } + ] + } + } + ] + }, + "phase": { + "anyOf": [ + { + "description": "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages.", + "$ref": "#/components/schemas/LiveMessagePhase" + }, + { + "type": "null" + } ] } }, "required": [ - "event_id", - "start_ms", - "end_ms", - "type" - ], - "x-oaiMeta": { - "example": { - "type": "session.thinking.appended", - "event_id": "evt_thinking_002", - "client_event_id": "evt_thinking_001", - "start_ms": 4600, - "end_ms": 4800 - } - } + "role", + "content", + "id" + ] }, - "LiveCommentaryAppended": { - "description": "Returned when a session.commentary.append command is accepted into the Live session timeline. Acknowledges the added commentary without guaranteeing exact wording or completed audio playback.", - "example": { - "type": "session.commentary.appended", - "event_id": "evt_commentary_002", - "client_event_id": "evt_commentary_001", - "start_ms": 5200, - "end_ms": 5400 - }, + "LiveDecisionStoredFunctionCallParam": { "type": "object", "properties": { - "event_id": { - "description": "The unique ID of the Live server event.", - "type": "string" - }, - "client_event_id": { - "description": "The event_id of the client command associated with this server event, when supplied.", + "id": { "type": "string" }, - "start_ms": { - "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", - "type": "integer" + "call_id": { + "description": "The unique ID of the function tool call generated by the model.", + "type": "string", + "minLength": 1, + "maxLength": 64 }, - "end_ms": { - "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", - "type": "integer" + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/LiveFunctionCallItemStatus" + }, + { + "type": "null" + } + ] }, "type": { - "description": "The event type, always `session.commentary.appended`.", - "default": "session.commentary.appended", + "description": "The item type. Always `function_call`.", + "default": "function_call", "x-stainless-const": true, "type": "string", "enum": [ - "session.commentary.appended" + "function_call" + ] + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "pattern": "^[a-zA-Z0-9_.-]+$" + }, + "namespace": { + "anyOf": [ + { + "description": "The namespace of the function to call.", + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" + }, + { + "type": "null" + } ] + }, + "arguments": { + "description": "The function arguments as a JSON string.", + "type": "string" } }, "required": [ - "event_id", - "start_ms", - "end_ms", - "type" - ], - "x-oaiMeta": { - "example": { - "type": "session.commentary.appended", - "event_id": "evt_commentary_002", - "client_event_id": "evt_commentary_001", - "start_ms": 5200, - "end_ms": 5400 - } - } + "call_id", + "type", + "name", + "arguments", + "id" + ] }, - "LiveInputAudioAppend": { - "description": "Input audio received from the primary transport and reflected to a Live sideband connection before model-input muting.", - "example": { - "type": "session.input_audio.append", - "audio": "AACAAIAAAIAAAP9/AIAAgA==" - }, + "LiveDecisionStoredFunctionCallOutputParam": { "type": "object", "properties": { - "type": { - "description": "The event type, always `session.input_audio.append`.", - "default": "session.input_audio.append", + "id": { + "type": "string" + }, + "call_id": { + "description": "The unique ID of the function tool call generated by the model.", + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/LiveFunctionCallItemStatus" + }, + { + "type": "null" + } + ] + }, + "type": { + "description": "The type of the function tool call output. Always `function_call_output`.", + "default": "function_call_output", "x-stainless-const": true, "type": "string", "enum": [ - "session.input_audio.append" + "function_call_output" ] }, - "audio": { - "description": "Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, reflected to the sideband before model-input muting. This server event uses the same audio key as the client command, but is not an acknowledgment of it.", - "type": "string" + "output": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputImageParam" + } + ] + } + } + ] } }, "required": [ + "call_id", "type", - "audio" - ], - "x-oaiMeta": { - "example": { - "type": "session.input_audio.append", - "audio": "AACAAIAAAIAAAP9/AIAAgA==" - } - } + "output", + "id" + ] }, - "LiveOutputAudioDelta": { - "description": "An audio chunk generated by the Live model. Decode and play primary WebSocket chunks in delivery order using the configured session audio format. Sideband connections receive reflected output audio with timestamps.", - "example": { - "type": "session.output_audio.delta", - "delta": "AACAAIAAAIAAAP9/AIAAgA==", - "start_ms": 1000, - "end_ms": 1200 - }, + "LiveDecisionStoredCustomToolCallParam": { "type": "object", "properties": { + "id": { + "type": "string" + }, + "call_id": { + "description": "The unique ID of the function tool call generated by the model.", + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/LiveFunctionCallItemStatus" + }, + { + "type": "null" + } + ] + }, "type": { - "description": "The event type, always `session.output_audio.delta`.", - "default": "session.output_audio.delta", + "description": "The item type. Always `custom_tool_call`.", + "default": "custom_tool_call", "x-stainless-const": true, "type": "string", "enum": [ - "session.output_audio.delta" + "custom_tool_call" ] }, - "delta": { - "description": "Base64-encoded raw audio. Primary WebSocket events use the session's configured format; reflected sideband events use mono PCM16LE at 24 kHz.", - "type": "string" + "name": { + "description": "The name of the custom tool to call.", + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" }, - "start_ms": { - "description": "Inclusive session-relative start in milliseconds. Required on reflected sideband events; omitted on the primary WebSocket.", - "type": "integer" + "namespace": { + "anyOf": [ + { + "description": "The namespace of the function to call.", + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[a-zA-Z0-9_-]+$" + }, + { + "type": "null" + } + ] }, - "end_ms": { - "description": "Exclusive session-relative end in milliseconds. Required on reflected sideband events; omitted on the primary WebSocket. Dropped output frames leave gaps between reflected ranges.", - "type": "integer" + "input": { + "description": "The input to the custom tool call.", + "type": "string" } }, "required": [ + "call_id", "type", - "delta" - ], - "x-oaiMeta": { - "example": { - "type": "session.output_audio.delta", - "delta": "AACAAIAAAIAAAP9/AIAAgA==", - "start_ms": 1000, - "end_ms": 1200 - } - } + "name", + "input", + "id" + ] }, - "LiveInputTranscriptDelta": { - "description": "A transcript fragment for user input audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event.", - "example": { - "type": "session.input_transcript.delta", - "event_id": "evt_input_transcript_001", - "delta": "A table for two at seven, please.", - "start_ms": 1600, - "end_ms": 3400 - }, + "LiveDecisionStoredCustomToolCallOutputParam": { "type": "object", "properties": { - "event_id": { - "description": "The unique ID of the Live server event.", - "type": "string" - }, - "client_event_id": { - "description": "The event_id of the client command associated with this server event, when supplied.", + "id": { "type": "string" }, - "start_ms": { - "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", - "type": "integer" - }, - "end_ms": { - "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", - "type": "integer" + "call_id": { + "description": "The unique ID of the function tool call generated by the model.", + "type": "string", + "minLength": 1, + "maxLength": 64 }, - "delta": { - "description": "The transcript text fragment for the audio in this time range. Append fragments in delivery order to build the transcript.", - "type": "string" + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/LiveFunctionCallItemStatus" + }, + { + "type": "null" + } + ] }, "type": { - "description": "The event type, always `session.input_transcript.delta`.", - "default": "session.input_transcript.delta", + "default": "custom_tool_call_output", "x-stainless-const": true, "type": "string", "enum": [ - "session.input_transcript.delta" + "custom_tool_call_output" + ] + }, + "output": { + "oneOf": [ + { + "description": "The text input to the model.", + "type": "string", + "maxLength": 10485760 + }, + { + "type": "array", + "items": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionInputTextParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionInputImageParam" + } + ] + } + } ] } }, "required": [ - "event_id", - "start_ms", - "end_ms", - "delta", - "type" - ], - "x-oaiMeta": { - "example": { - "type": "session.input_transcript.delta", - "event_id": "evt_input_transcript_001", - "delta": "A table for two at seven, please.", - "start_ms": 1600, - "end_ms": 3400 + "call_id", + "type", + "output", + "id" + ] + }, + "LiveDecisionStoredInputItemParam": { + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "discriminator": { + "propertyName": "role" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LiveDecisionStoredUserMessageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionStoredDeveloperMessageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionStoredSystemMessageParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionStoredAssistantMessageParam" + } + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "message" + ] + } + } + }, + { + "$ref": "#/components/schemas/LiveDecisionStoredFunctionCallParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionStoredFunctionCallOutputParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionStoredCustomToolCallParam" + }, + { + "$ref": "#/components/schemas/LiveDecisionStoredCustomToolCallOutputParam" } - } + ], + "x-oai-default-discriminator-value": "message" }, - "LiveOutputTranscriptDelta": { - "description": "A transcript fragment for assistant output audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event.", + "LiveDecisionItemCreated": { + "description": "An input item was appended for future decisions.", "example": { - "type": "session.output_transcript.delta", - "event_id": "evt_output_transcript_001", - "delta": "Would you like me to reserve that table?", - "start_ms": 5400, - "end_ms": 7200 + "type": "decision.item.created", + "event_id": "evt_item_1", + "client_event_id": "browser_1", + "item": { + "id": "msg_browser_1", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Wikipedia is open." + } + ] + } }, "type": "object", "properties": { @@ -88206,105 +115180,49 @@ "description": "The event_id of the client command associated with this server event, when supplied.", "type": "string" }, - "start_ms": { - "description": "The start of this event on the Live session timeline, in milliseconds from the beginning of the session.", - "type": "integer" - }, - "end_ms": { - "description": "The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms.", - "type": "integer" - }, - "delta": { - "description": "The transcript text fragment for the audio in this time range. Append fragments in delivery order to build the transcript.", - "type": "string" - }, "type": { - "description": "The event type, always `session.output_transcript.delta`.", - "default": "session.output_transcript.delta", + "default": "decision.item.created", "x-stainless-const": true, "type": "string", "enum": [ - "session.output_transcript.delta" + "decision.item.created" ] + }, + "item": { + "$ref": "#/components/schemas/LiveDecisionStoredInputItemParam" } }, "required": [ "event_id", - "start_ms", - "end_ms", - "delta", - "type" + "type", + "item" ], "x-oaiMeta": { "example": { - "type": "session.output_transcript.delta", - "event_id": "evt_output_transcript_001", - "delta": "Would you like me to reserve that table?", - "start_ms": 5400, - "end_ms": 7200 + "type": "decision.item.created", + "event_id": "evt_item_1", + "client_event_id": "browser_1", + "item": { + "id": "msg_browser_1", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Wikipedia is open." + } + ] + } } } }, - "LiveDelegationItem": { - "description": "Metadata for work delegated by the Live model. Client delegations are handled by your application; Responses delegations run on the configured backend.", - "type": "object", - "properties": { - "id": { - "description": "The unique ID of the delegation. Use this as delegation_id when replying to client-owned work or correlating Responses events.", - "type": "string" - }, - "type": { - "description": "The object type, always `delegation`.", - "default": "delegation", - "x-stainless-const": true, - "type": "string", - "enum": [ - "delegation" - ] - }, - "target": { - "description": "Where the Live model delegated the work: `client` for your application, or `responses` for the configured Responses backend.", - "oneOf": [ - { - "default": "client", - "x-stainless-const": true, - "type": "string", - "enum": [ - "client" - ] - }, - { - "default": "responses", - "x-stainless-const": true, - "type": "string", - "enum": [ - "responses" - ] - } - ] - }, - "response_id": { - "description": "The ID of the Responses API response associated with a Responses delegation. Omitted for client delegations.", - "type": "string" - } - }, - "required": [ - "id", - "type", - "target" - ] - }, - "LiveDelegationCreated": { - "description": "Returned when the Live model delegates work to your application or a Responses backend. Contains delegation metadata and the position on the session timeline where the work was delegated.", + "LiveDecisionItemDeleted": { + "description": "An input item was removed from future decisions.", "example": { - "type": "session.delegation.created", - "event_id": "evt_delegation_001", - "offset_ms": 3600, - "delegation": { - "id": "del_abc123", - "type": "delegation", - "target": "client" - } + "type": "decision.item.deleted", + "event_id": "evt_item_deleted_1", + "client_event_id": "remove_browser_1", + "item_id": "msg_browser_1" }, "type": "object", "properties": { @@ -88317,39 +115235,28 @@ "type": "string" }, "type": { - "description": "The event type, always `session.delegation.created`.", - "default": "session.delegation.created", + "default": "decision.item.deleted", "x-stainless-const": true, "type": "string", "enum": [ - "session.delegation.created" + "decision.item.deleted" ] }, - "offset_ms": { - "description": "The position on the Live session timeline where the delegation was created, in milliseconds from the beginning of the session.", - "type": "integer" - }, - "delegation": { - "description": "The delegated work identifier and destination. This object contains metadata, not the task text.", - "$ref": "#/components/schemas/LiveDelegationItem" + "item_id": { + "type": "string" } }, "required": [ "event_id", "type", - "offset_ms", - "delegation" + "item_id" ], "x-oaiMeta": { "example": { - "type": "session.delegation.created", - "event_id": "evt_delegation_001", - "offset_ms": 3600, - "delegation": { - "id": "del_abc123", - "type": "delegation", - "target": "client" - } + "type": "decision.item.deleted", + "event_id": "evt_item_deleted_1", + "client_event_id": "remove_browser_1", + "item_id": "msg_browser_1" } } }, @@ -88831,21 +115738,21 @@ } } }, - "LiveTransportDTMFSend": { - "description": "A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to sideband observers; this is not a client command.", + "LiveTransportDTMFSent": { + "description": "A SIP DTMF keypress successfully sent to the SIP trunk. Delivered only to sideband observers; this is not a client command.", "example": { - "type": "transport.dtmf.send", + "type": "transport.dtmf.sent", "event_id": "event_dtmf_2", "event": "#" }, "type": "object", "properties": { "type": { - "default": "transport.dtmf.send", + "default": "transport.dtmf.sent", "x-stainless-const": true, "type": "string", "enum": [ - "transport.dtmf.send" + "transport.dtmf.sent" ] }, "event_id": { @@ -88856,6 +115763,10 @@ "minLength": 1, "maxLength": 1, "pattern": "^[0-9A-D*#]$" + }, + "client_event_id": { + "description": "The event_id of the client command, when supplied.", + "type": "string" } }, "required": [ @@ -88865,7 +115776,7 @@ ], "x-oaiMeta": { "example": { - "type": "transport.dtmf.send", + "type": "transport.dtmf.sent", "event_id": "event_dtmf_2", "event": "#" } @@ -89048,6 +115959,12 @@ { "$ref": "#/components/schemas/LiveInputAudioUnmuted" }, + { + "$ref": "#/components/schemas/LiveOutputAudioFixturePlaying" + }, + { + "$ref": "#/components/schemas/LiveOutputAudioFixturePlayed" + }, { "$ref": "#/components/schemas/LiveInstructionsAppended" }, @@ -89072,6 +115989,15 @@ { "$ref": "#/components/schemas/LiveDelegationCreated" }, + { + "$ref": "#/components/schemas/LiveDecisionEvent" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemCreated" + }, + { + "$ref": "#/components/schemas/LiveDecisionItemDeleted" + }, { "$ref": "#/components/schemas/LiveResponseEvent" }, @@ -89091,7 +116017,7 @@ "$ref": "#/components/schemas/LiveTransportDTMFReceived" }, { - "$ref": "#/components/schemas/LiveTransportDTMFSend" + "$ref": "#/components/schemas/LiveTransportDTMFSent" }, { "$ref": "#/components/schemas/LiveTransportRinging" @@ -89104,6 +116030,55 @@ } ] }, + "LiveTransportDTMFSendParam": { + "description": "Send one DTMF keypress to the SIP trunk through a Live sideband connection. This command is supported only for SIP calls. A successful send emits `transport.dtmf.sent` on sideband. If you provide `event_id`, the success notification includes it as `client_event_id`; a failure includes it as `error.client_event_id`. Send separate events for multiple keypresses.", + "example": { + "type": "transport.dtmf.send", + "event_id": "evt_dtmf_001", + "event": "#" + }, + "type": "object", + "properties": { + "event_id": { + "anyOf": [ + { + "description": "Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.", + "type": "string", + "maxLength": 512 + }, + { + "type": "null" + } + ] + }, + "type": { + "default": "transport.dtmf.send", + "x-stainless-const": true, + "type": "string", + "enum": [ + "transport.dtmf.send" + ] + }, + "event": { + "description": "The DTMF key to send: one of `0`–`9`, `A`–`D`, `*`, or `#`.", + "type": "string", + "minLength": 1, + "maxLength": 1, + "pattern": "^[0-9A-D*#]$" + } + }, + "required": [ + "type", + "event" + ], + "x-oaiMeta": { + "example": { + "type": "transport.dtmf.send", + "event_id": "evt_dtmf_001", + "event": "#" + } + } + }, "UserMessageItemParam": { "properties": { "id": { @@ -89834,7 +116809,10 @@ { "$ref": "#/components/schemas/BetaResponseFormatJsonObject" } - ] + ], + "discriminator": { + "propertyName": "type" + } }, "BetaResponseFormatJsonObject": { "type": "object", @@ -89855,6 +116833,7 @@ ] }, "BetaTextResponseFormatJsonSchema": { + "x-openai-structured-output": "json_schema_default_strict", "type": "object", "title": "JSON schema", "description": "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs).\n", @@ -90034,7 +117013,7 @@ "anyOf": [ { "$ref": "#/components/schemas/BetaApproximateLocation", - "description": "The user's location." + "description": "The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass `{\"type\": \"approximate\"}` without location fields. To localize results, provide the relevant location fields." }, { "type": "null" @@ -90450,7 +117429,8 @@ "required": [ "name", "type" - ] + ], + "x-openai-structured-output": "function" }, "BetaFunctionShellToolParam": { "properties": { @@ -90879,8 +117859,13 @@ "gpt-image-2.5-flare", "gpt-image-2.5-flare-2026-09-08" ], - "description": "The image generation model to use. One of `gpt-image-1`,\n`gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,\n`gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,\n`gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`. Default:\n`gpt-image-1`.\n", - "default": "gpt-image-1" + "x-openai-enum-deprecations": { + "gpt-image-1": { + "message": "GPT Image 1 was shut down on October 23, 2026. Use gpt-image-2.5-sunburst or gpt-image-2.5-flare instead." + } + }, + "description": "The image generation model to use. One of `gpt-image-1-mini`,\n`gpt-image-1.5`, `gpt-image-2`,\n`gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,\n`gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,\n`gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`. Default:\n`gpt-image-2`.\n\n`gpt-image-1` was shut down on October 23, 2026. Use\n`gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.\n", + "default": "gpt-image-2" } ] }, @@ -90912,7 +117897,7 @@ ] } ], - "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`.", + "description": "The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing.", "default": "auto" }, "output_format": { @@ -91007,7 +117992,7 @@ "high", "low" ], - "description": "Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`." + "description": "Control how much effort the model will exert to match the style and features, especially facial features, of input images. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models." }, "BetaProgrammaticToolCallingParam": { "properties": { @@ -91149,6 +118134,7 @@ }, "connector_id": { "type": "string", + "deprecated": true, "enum": [ "connector_dropbox", "connector_gmail", @@ -91159,7 +118145,7 @@ "connector_outlookemail", "connector_sharepoint" ], - "description": "Identifier for service connectors, like those available in ChatGPT. One of\n`server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more\nabout service connectors [here](https://developers.openai.com/api/docs/guides/tools-connectors-mcp#connectors).\n\nCurrently supported `connector_id` values are:\n\n- Dropbox: `connector_dropbox`\n- Gmail: `connector_gmail`\n- Google Calendar: `connector_googlecalendar`\n- Google Drive: `connector_googledrive`\n- Microsoft Teams: `connector_microsoftteams`\n- Outlook Calendar: `connector_outlookcalendar`\n- Outlook Email: `connector_outlookemail`\n- SharePoint: `connector_sharepoint`\n" + "description": "Identifier for service connectors, like those available in ChatGPT. One of\n`server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more\nabout service connectors [here](https://developers.openai.com/api/docs/guides/tools-connectors-mcp#connectors).\n\nThis field is deprecated for models released after September 1, 2026.\nUse `server_url` to connect to a remote MCP server, or `tunnel_id` to\nconnect through a Secure MCP Tunnel.\n\nCurrently supported `connector_id` values are:\n\n- Dropbox: `connector_dropbox`\n- Gmail: `connector_gmail`\n- Google Calendar: `connector_googlecalendar`\n- Google Drive: `connector_googledrive`\n- Microsoft Teams: `connector_microsoftteams`\n- Outlook Calendar: `connector_outlookcalendar`\n- Outlook Email: `connector_outlookemail`\n- SharePoint: `connector_sharepoint`\n" }, "tunnel_id": { "type": "string", @@ -91343,7 +118329,8 @@ ] }, "user_location": { - "$ref": "#/components/schemas/BetaWebSearchApproximateLocation" + "$ref": "#/components/schemas/BetaWebSearchApproximateLocation", + "description": "The approximate location of the user. If omitted or null, defaults to the\nUnited States. To avoid this fallback, pass `{\"type\": \"approximate\"}` without\nlocation fields. To localize results, provide the relevant location fields.\n" }, "search_context_size": { "type": "string", @@ -91547,7 +118534,6 @@ ] }, "BetaCompoundFilter": { - "$recursiveAnchor": true, "type": "object", "additionalProperties": false, "title": "Compound Filter", @@ -91570,7 +118556,7 @@ "$ref": "#/components/schemas/BetaComparisonFilter" }, { - "$recursiveRef": "#" + "$ref": "#/components/schemas/BetaCompoundFilter" } ], "discriminator": { @@ -91784,7 +118770,8 @@ "parameters" ], "title": "Function", - "description": "Defines a function in your own code the model can choose to call. Learn more about [function calling](https://developers.openai.com/api/docs/guides/function-calling)." + "description": "Defines a function in your own code the model can choose to call. Learn more about [function calling](https://developers.openai.com/api/docs/guides/function-calling).", + "x-openai-structured-output": "function" }, "BetaInputItem": { "oneOf": [ @@ -92406,6 +119393,14 @@ "description": "The breakpoint mode. Always `explicit`.", "default": "explicit", "x-stainless-const": true + }, + "ttl": { + "type": "string", + "enum": [ + "30m", + "12h" + ], + "description": "The minimum lifetime of this cache breakpoint. Defaults to the request TTL." } }, "type": "object", @@ -92413,7 +119408,7 @@ "mode" ], "title": "Prompt cache breakpoint", - "description": "Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." + "description": "Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." }, "BetaInputImageContent": { "properties": { @@ -93899,6 +120894,10 @@ } ] }, + "error": { + "$ref": "#/components/schemas/BetaImageGenToolCallError", + "description": "Details of a moderation failure, when available." + }, "size": { "anyOf": [ { @@ -94015,6 +121014,76 @@ "auto" ] }, + "BetaImageGenToolCallError": { + "properties": { + "code": { + "anyOf": [ + { + "type": "string", + "description": "The error code." + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string", + "description": "The error type." + }, + "message": { + "type": "string", + "description": "A description of the error." + }, + "param": { + "anyOf": [ + { + "type": "string", + "description": "The related request parameter." + }, + { + "type": "null" + } + ] + }, + "moderation_details": { + "$ref": "#/components/schemas/BetaImageGenToolCallModerationDetails", + "description": "Public details for a `moderation_blocked` error, when available." + } + }, + "type": "object", + "required": [ + "code", + "type", + "message", + "param" + ] + }, + "BetaImageGenToolCallModerationDetails": { + "properties": { + "moderation_stage": { + "type": "string", + "enum": [ + "input", + "output", + "unknown" + ], + "description": "The stage where moderation blocked the image generation call." + }, + "categories": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Public moderation categories. New category values may be added over time." + } + }, + "type": "object", + "required": [ + "moderation_stage", + "categories" + ] + }, "BetaCompactionSummaryItemParam": { "properties": { "agent": { @@ -94051,7 +121120,7 @@ }, "encrypted_content": { "type": "string", - "maxLength": 20971520, + "maxLength": 104857600, "description": "The encrypted content of the compaction summary." } }, @@ -94182,7 +121251,7 @@ }, "BetaResponseConfigurationUpdateItemParam": { "type": "object", - "description": "An update to the conversation's response configuration. The configuration\nremains in effect for subsequent responses until it is replaced by another\nconfiguration update.\n", + "description": "An update to the conversation's response configuration. Supply reasoning,\ntext, or both. Each setting stays in effect until a later update replaces it.\n", "properties": { "agent": { "anyOf": [ @@ -94225,6 +121294,29 @@ "description": "The reasoning effort to use for subsequent responses until another\nconfiguration update replaces it.\n" } } + }, + "text": { + "type": "object", + "description": "The text output configuration for subsequent responses.", + "properties": { + "format": { + "description": "Use a JSON schema for structured output or text to return to plain text.", + "oneOf": [ + { + "$ref": "#/components/schemas/BetaResponseFormatText" + }, + { + "$ref": "#/components/schemas/BetaTextResponseFormatJsonSchema" + } + ], + "discriminator": { + "propertyName": "type" + } + } + }, + "required": [ + "format" + ] } }, "required": [ @@ -94342,7 +121434,7 @@ }, "tools": { "items": { - "$ref": "#/components/schemas/BetaTool" + "$ref": "#/components/schemas/BetaToolSearchOutputTool" }, "type": "array", "description": "The loaded tool definitions returned by the tool search output." @@ -94373,6 +121465,204 @@ "incomplete" ] }, + "BetaToolSearchOutputTool": { + "description": "A tool definition returned by a tool search output.\n", + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/BetaFunctionTool" + }, + { + "$ref": "#/components/schemas/BetaFileSearchTool" + }, + { + "$ref": "#/components/schemas/BetaComputerTool" + }, + { + "$ref": "#/components/schemas/BetaComputerUsePreviewTool" + }, + { + "$ref": "#/components/schemas/BetaWebSearchTool" + }, + { + "$ref": "#/components/schemas/BetaMCPTool" + }, + { + "$ref": "#/components/schemas/BetaCodeInterpreterTool" + }, + { + "$ref": "#/components/schemas/BetaProgrammaticToolCallingParam" + }, + { + "$ref": "#/components/schemas/BetaImageGenTool" + }, + { + "$ref": "#/components/schemas/BetaLocalShellToolParam" + }, + { + "$ref": "#/components/schemas/BetaFunctionShellToolParam" + }, + { + "$ref": "#/components/schemas/BetaCustomToolParam" + }, + { + "$ref": "#/components/schemas/BetaToolSearchOutputNamespaceToolParam" + }, + { + "$ref": "#/components/schemas/BetaToolSearchToolParam" + }, + { + "$ref": "#/components/schemas/BetaWebSearchPreviewTool" + }, + { + "$ref": "#/components/schemas/BetaApplyPatchToolParam" + } + ] + }, + "BetaToolSearchOutputNamespaceToolParam": { + "properties": { + "type": { + "type": "string", + "enum": [ + "namespace" + ], + "description": "The type of the tool. Always `namespace`.", + "default": "namespace", + "x-stainless-const": true + }, + "name": { + "type": "string", + "minLength": 1, + "description": "The namespace name used in tool calls (for example, `crm`)." + }, + "description": { + "type": "string", + "description": "A description of the namespace shown to the model." + }, + "tools": { + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/BetaToolSearchOutputFunctionToolParam" + }, + { + "$ref": "#/components/schemas/BetaCustomToolParam" + } + ], + "description": "A function or custom tool loaded into a namespace by tool search.", + "discriminator": { + "propertyName": "type" + } + }, + "type": "array", + "minItems": 1, + "description": "The function/custom tools loaded inside this namespace." + } + }, + "type": "object", + "required": [ + "type", + "name", + "description", + "tools" + ], + "title": "Namespace", + "description": "Groups function/custom tools under a shared namespace." + }, + "BetaToolSearchOutputFunctionToolParam": { + "properties": { + "name": { + "type": "string", + "maxLength": 128, + "minLength": 1, + "pattern": "^(?![\\s\\S]*[\\r\\n])[a-zA-Z0-9_.-]+$", + "description": "The name of the loaded function tool." + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "parameters": { + "anyOf": [ + { + "$ref": "#/components/schemas/BetaEmptyModelParam" + }, + { + "type": "null" + } + ] + }, + "strict": { + "anyOf": [ + { + "type": "boolean", + "description": "Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise." + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string", + "enum": [ + "function" + ], + "default": "function", + "x-stainless-const": true + }, + "async": { + "type": "boolean", + "description": "Whether the tool response can be returned asynchronously versus immediately returned on next response creation." + }, + "output_schema": { + "anyOf": [ + { + "additionalProperties": {}, + "type": "object", + "description": "A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.", + "x-oaiTypeLabel": "map" + }, + { + "type": "null" + } + ] + }, + "defer_loading": { + "type": "boolean", + "description": "Whether this function should be deferred and discovered via tool search." + }, + "allowed_callers": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/BetaCallableToolAllowedCaller" + }, + "type": "array", + "minItems": 1, + "description": "The tool invocation context(s)." + }, + { + "type": "null" + } + ] + } + }, + "type": "object", + "required": [ + "name", + "type" + ], + "x-openai-structured-output": "function" + }, "BetaToolSearchCallItemParam": { "properties": { "agent": { @@ -94915,6 +122205,14 @@ "description": "The breakpoint mode. Always `explicit`.", "default": "explicit", "x-stainless-const": true + }, + "ttl": { + "type": "string", + "enum": [ + "30m", + "12h" + ], + "description": "The minimum lifetime of this cache breakpoint. Defaults to the request TTL." } }, "type": "object", @@ -94922,7 +122220,7 @@ "mode" ], "title": "Prompt cache breakpoint", - "description": "Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." + "description": "Marks the exact end of a reusable prompt prefix. When `ttl` is omitted, the breakpoint inherits the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block." }, "BetaDetailEnum": { "type": "string", @@ -95321,8 +122619,7 @@ "required": [ "id", "type", - "status", - "action" + "status" ] }, "BetaWebSearchActionFind": { @@ -95339,9 +122636,16 @@ "x-stainless-const": true }, "url": { - "type": "string", - "format": "uri", - "description": "The URL of the page searched for the pattern.\n" + "anyOf": [ + { + "type": "string", + "format": "uri" + }, + { + "type": "null" + } + ], + "description": "The URL of the page searched for the pattern, when available.\n" }, "pattern": { "type": "string", @@ -95350,7 +122654,6 @@ }, "required": [ "type", - "url", "pattern" ] }, @@ -96528,7 +123831,7 @@ }, "index": { "type": "integer", - "description": "The index of the file in the list of files." + "description": "The index in the output text at which to insert the file citation." }, "filename": { "type": "string", @@ -96725,6 +124028,10 @@ } ] }, + "image": { + "$ref": "#/components/schemas/BetaImageOptionsParam", + "description": "Request level image options." + }, "prompt_cache_key": { "anyOf": [ { @@ -96822,6 +124129,26 @@ "24h" ] }, + "BetaImageOptionsParam": { + "properties": { + "context_compression": { + "$ref": "#/components/schemas/BetaImageContextCompression", + "description": "Controls image context optimization. Defaults to `auto`, which uses the model, transport, and input to select a policy. Use `enabled` to require compression support or `disabled` to turn it off." + } + }, + "additionalProperties": false, + "type": "object", + "required": [], + "description": "Request level image options." + }, + "BetaImageContextCompression": { + "type": "string", + "enum": [ + "auto", + "enabled", + "disabled" + ] + }, "BetaModelIdsCompaction": { "anyOf": [ { @@ -96864,8 +124191,53 @@ "gpt-5.1-codex-max", "gpt-daybreak-blue-latest", "gpt-daybreak-red-latest", - "gpt-5.6-cyber" - ] + "gpt-5.6-cyber", + "gpt-rosalind-research" + ], + "x-openai-enum-deprecations": { + "o1-pro": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-pro-2025-03-19": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-pro-2025-06-10": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-deep-research": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-deep-research-2025-06-26": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o4-mini-deep-research": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o4-mini-deep-research-2025-06-26": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "computer-use-preview": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "computer-use-preview-2025-03-11": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-codex": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-pro-2025-10-06": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-codex-max": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-pro": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-pro": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + } + } } ] }, @@ -96879,6 +124251,10 @@ "type": "string", "enum": [ "gpt-6-astra", + "gpt-6.1-sol", + "gpt-6.1-terra", + "gpt-6-sol", + "gpt-6-luna", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", @@ -96929,6 +124305,8 @@ "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", + "gpt-audio-mini", + "gpt-audio-mini-2025-12-15", "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", @@ -96962,8 +124340,240 @@ "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613" - ] + ], + "x-openai-enum-deprecations": { + "gpt-5.4-nano": { + "message": "Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1": { + "message": "Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-2025-11-13": { + "message": "Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.4-nano-2026-03-17": { + "message": "Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-2025-04-14": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-mini": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-mini-2025-04-14": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-2024-08-06": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-2024-11-20": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-2024-07-18": { + "message": "Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.3-chat-latest": { + "message": "Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.2-chat-latest": { + "message": "Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-codex": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-chat-latest": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-mini-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-nano-2025-08-07": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-chat-latest": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-nano": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4.1-nano-2025-04-14": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o4-mini": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o4-mini-2025-04-16": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-2025-04-16": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-mini": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3-mini-2025-01-31": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-2024-12-17": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-2024-05-13": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-search-preview-2025-03-11": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-search-preview-2025-03-11": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-turbo": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-turbo-2024-04-09": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-0125-preview": { + "message": "Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-turbo-preview": { + "message": "Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-1106-preview": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-0314": { + "message": "Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-0613": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-1106": { + "message": "Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-0125": { + "message": "Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-0301": { + "message": "Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-0613": { + "message": "Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-16k": { + "message": "Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-3.5-turbo-16k-0613": { + "message": "Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-vision-preview": { + "message": "Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-32k": { + "message": "Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-32k-0314": { + "message": "Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4-32k-0613": { + "message": "Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-preview": { + "message": "Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-preview-2024-09-12": { + "message": "Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-audio-preview-2024-10-01": { + "message": "Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-mini": { + "message": "Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o1-mini-2024-09-12": { + "message": "Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "codex-mini-latest": { + "message": "Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "chatgpt-4o-latest": { + "message": "Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-audio-preview": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-audio-preview": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-audio-preview-2024-12-17": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-audio-preview-2025-06-03": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-audio-preview-2024-12-17": { + "message": "Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-search-preview": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-4o-mini-search-preview": { + "message": "Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-mini": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5-nano": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "o3": { + "message": "Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-audio-mini-2025-12-15": { + "message": "Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements." + }, + "gpt-5.1-mini": { + "message": "Not a supported model ID. Retained for SDK compatibility." + } + } + } + ] + }, + "BetaErrorResponse": { + "type": "object", + "properties": { + "error": { + "$ref": "#/components/schemas/BetaError" } + }, + "required": [ + "error" ] }, "BetaError": { @@ -97008,6 +124618,23 @@ }, "BetaMisalignmentErrorDetailsResource": { "properties": { + "review_target": { + "anyOf": [ + { + "not": { + "pattern": "[^A-Za-z0-9._~:-]" + }, + "type": "string", + "maxLength": 96, + "minLength": 1, + "pattern": "^[A-Za-z0-9._~:-]+$", + "description": "An opaque target for explicitly continuing this review, or null when unavailable." + }, + { + "type": "null" + } + ] + }, "error_type": { "$ref": "#/components/schemas/Beta_MisalignmentErrorType", "description": "An optional classification; clients must accept additional values." @@ -98027,7 +125654,7 @@ }, "BetaResponseConfigurationUpdate": { "type": "object", - "description": "A configuration update that applies to subsequent responses until it is\nreplaced by another configuration update.\n", + "description": "A configuration update for subsequent responses. Each setting stays in effect\nuntil a later update replaces that setting.\n", "properties": { "agent": { "$ref": "#/components/schemas/BetaAgentTag", @@ -98056,6 +125683,29 @@ "description": "The reasoning effort used for subsequent responses until another\nconfiguration update replaces it.\n" } } + }, + "text": { + "type": "object", + "description": "The text output configuration for subsequent responses.", + "properties": { + "format": { + "description": "Use a JSON schema for structured output or text to return to plain text.", + "oneOf": [ + { + "$ref": "#/components/schemas/BetaResponseFormatText" + }, + { + "$ref": "#/components/schemas/BetaTextResponseFormatJsonSchema" + } + ], + "discriminator": { + "propertyName": "type" + } + } + }, + "required": [ + "format" + ] } }, "required": [ @@ -98655,10 +126305,6 @@ { "type": "object", "properties": { - "id": { - "type": "string", - "description": "The unique ID of the computer call tool output.\n" - }, "status": { "description": "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n", "$ref": "#/components/schemas/BetaComputerCallOutputStatus" @@ -98764,6 +126410,9 @@ }, "BetaCompactResource": { "properties": { + "image": { + "$ref": "#/components/schemas/BetaResolvedImageOptions" + }, "id": { "type": "string", "description": "The unique identifier for the compacted response." @@ -98806,8 +126455,13 @@ "example": { "id": "resp_001", "object": "response.compaction", + "image": { + "context_compression": "disabled" + }, "output": [ { + "id": "msg_001", + "status": "completed", "type": "message", "role": "user", "content": [ @@ -98818,6 +126472,8 @@ ] }, { + "id": "msg_002", + "status": "completed", "type": "message", "role": "user", "content": [ @@ -98836,8 +126492,15 @@ "created_at": 1731459200, "usage": { "input_tokens": 42897, + "input_tokens_details": { + "cached_tokens": 0, + "cache_write_tokens": 0 + }, "output_tokens": 12000, - "total_tokens": 54912 + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 54897 } } }, @@ -99107,6 +126770,25 @@ "incomplete" ] }, + "BetaResolvedImageOptions": { + "properties": { + "context_compression": { + "$ref": "#/components/schemas/BetaResolvedImageContextCompressionEnum", + "description": "Effective image context optimization policy." + } + }, + "type": "object", + "required": [ + "context_compression" + ] + }, + "BetaResolvedImageContextCompressionEnum": { + "type": "string", + "enum": [ + "enabled", + "disabled" + ] + }, "BetaResponseCustomToolCallInputDoneEvent": { "title": "ResponseCustomToolCallInputDone", "type": "object", @@ -99158,7 +126840,7 @@ "x-oaiMeta": { "name": "response.custom_tool_call_input.done", "group": "responses", - "example": "{\n \"type\": \"response.custom_tool_call_input.done\",\n \"output_index\": 0,\n \"item_id\": \"ctc_1234567890abcdef\",\n \"input\": \"final complete input text\"\n}\n" + "example": "{\n \"type\": \"response.custom_tool_call_input.done\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"ctc_1234567890abcdef\",\n \"input\": \"final complete input text\"\n}\n" } }, "BetaResponseCustomToolCallInputDeltaEvent": { @@ -99212,7 +126894,7 @@ "x-oaiMeta": { "name": "response.custom_tool_call_input.delta", "group": "responses", - "example": "{\n \"type\": \"response.custom_tool_call_input.delta\",\n \"output_index\": 0,\n \"item_id\": \"ctc_1234567890abcdef\",\n \"delta\": \"partial input text\"\n}\n" + "example": "{\n \"type\": \"response.custom_tool_call_input.delta\",\n \"sequence_number\": 1,\n \"output_index\": 0,\n \"item_id\": \"ctc_1234567890abcdef\",\n \"delta\": \"partial input text\"\n}\n" } }, "BetaResponseQueuedEvent": { @@ -99256,7 +126938,7 @@ "x-oaiMeta": { "name": "response.queued", "group": "responses", - "example": "{\n \"type\": \"response.queued\",\n \"response\": {\n \"id\": \"res_123\",\n \"status\": \"queued\",\n \"created_at\": \"2021-01-01T00:00:00Z\",\n \"updated_at\": \"2021-01-01T00:00:00Z\"\n },\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.queued\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1609459200,\n \"status\": \"queued\",\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"temperature\": 1,\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" } }, "BetaResponse": { @@ -99271,6 +126953,9 @@ { "type": "object", "properties": { + "image": { + "$ref": "#/components/schemas/BetaResolvedImageOptions" + }, "service_tier": { "$ref": "#/components/schemas/BetaServiceTierResponses" }, @@ -99314,6 +126999,16 @@ "incomplete" ] }, + "access_programs": { + "anyOf": [ + { + "$ref": "#/components/schemas/BetaAccessProgramsBody" + }, + { + "type": "null" + } + ] + }, "created_at": { "type": "number", "format": "unixtime", @@ -99414,7 +127109,18 @@ ] }, "usage": { - "$ref": "#/components/schemas/BetaResponseUsage" + "anyOf": [ + { + "$ref": "#/components/schemas/BetaResponseUsage" + }, + { + "type": "null" + } + ] + }, + "tool_usage": { + "$ref": "#/components/schemas/BetaResponseToolUsage", + "description": "Usage reported by hosted tools, separate from base model `usage`. The field\ncan be omitted when tool usage is unavailable. When present, tool families\nwith no recorded usage have zero counts.\n\n`image_gen` sums available token counts across image generation calls.\nCalls with missing or incomplete usage records may be skipped. Output\ntoken details and cached input counts can be omitted. An omitted cache\ncount means cache usage is unknown.\n\n`web_search.num_requests` counts billable searches. Discounted searches\nand actions such as opening a page are excluded. Use billing records to\nreconcile final charges.\n" }, "prompt_cache_options": { "$ref": "#/components/schemas/BetaPromptCacheOptions" @@ -99462,6 +127168,7 @@ } }, "required": [ + "access_programs", "id", "object", "created_at", @@ -99482,6 +127189,7 @@ "example": { "id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41", "object": "response", + "access_programs": null, "created_at": 1741476777, "status": "completed", "completed_at": 1741476778, @@ -99500,7 +127208,8 @@ { "type": "output_text", "text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.", - "annotations": [] + "annotations": [], + "logprobs": [] } ] } @@ -99535,6 +127244,24 @@ }, "total_tokens": 380 }, + "tool_usage": { + "image_gen": { + "input_tokens": 0, + "input_tokens_details": { + "text_tokens": 0, + "image_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "text_tokens": 0, + "image_tokens": 0 + }, + "total_tokens": 0 + }, + "web_search": { + "num_requests": 0 + } + }, "user": null, "metadata": {} } @@ -99829,6 +127556,129 @@ "title": "Prompt cache options", "description": "The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models." }, + "BetaResponseToolUsage": { + "properties": { + "image_gen": { + "$ref": "#/components/schemas/BetaImageGenToolUsage", + "description": "Aggregated usage statistics for image generation tool calls." + }, + "web_search": { + "$ref": "#/components/schemas/BetaWebSearchUsage", + "description": "Aggregated billable usage statistics for web search tool calls." + } + }, + "type": "object", + "required": [ + "image_gen", + "web_search" + ], + "title": "Response tool usage", + "description": "Aggregated usage details for billable tools that ran while generating the response." + }, + "BetaWebSearchUsage": { + "properties": { + "num_requests": { + "type": "integer", + "description": "The number of billable web search requests issued." + } + }, + "type": "object", + "required": [ + "num_requests" + ], + "title": "Web search usage", + "description": "Usage details for web search requests that ran while generating the response." + }, + "BetaImageGenToolUsage": { + "properties": { + "input_tokens": { + "type": "integer", + "description": "The number of tokens (images and text) in the input prompt." + }, + "total_tokens": { + "type": "integer", + "description": "The total number of tokens (images and text) used for the image generation." + }, + "output_tokens": { + "type": "integer", + "description": "The number of output tokens generated by the model." + }, + "output_tokens_details": { + "$ref": "#/components/schemas/BetaImageGenOutputTokensDetails" + }, + "input_tokens_details": { + "$ref": "#/components/schemas/BetaImageGenInputUsageDetails" + }, + "cached_tokens": { + "type": "integer" + }, + "cached_tokens_details": { + "$ref": "#/components/schemas/BetaCachedUsageDetails" + } + }, + "type": "object", + "required": [ + "input_tokens", + "total_tokens", + "output_tokens", + "input_tokens_details" + ], + "title": "Image generation tool usage", + "description": "Token usage for image generation tool calls in a response." + }, + "BetaCachedUsageDetails": { + "properties": { + "cached_text_tokens": { + "type": "integer" + }, + "cached_image_tokens": { + "type": "integer" + } + }, + "type": "object", + "required": [ + "cached_text_tokens", + "cached_image_tokens" + ] + }, + "BetaImageGenInputUsageDetails": { + "properties": { + "text_tokens": { + "type": "integer", + "description": "The number of text tokens in the input prompt." + }, + "image_tokens": { + "type": "integer", + "description": "The number of image tokens in the input prompt." + } + }, + "type": "object", + "required": [ + "text_tokens", + "image_tokens" + ], + "title": "Input usage details", + "description": "The input tokens detailed information for the image generation." + }, + "BetaImageGenOutputTokensDetails": { + "properties": { + "image_tokens": { + "type": "integer", + "description": "The number of image output tokens generated by the model." + }, + "text_tokens": { + "type": "integer", + "description": "The number of text output tokens generated by the model." + } + }, + "type": "object", + "required": [ + "image_tokens", + "text_tokens" + ], + "title": "Image generation output token details", + "description": "The output token details for the image generation." + }, "BetaOutputItem": { "oneOf": [ { @@ -99935,6 +127785,28 @@ "type": "object", "description": "An error object returned when the model fails to generate a Response.\n", "properties": { + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The original error type, or null if it was not recorded." + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The request parameter associated with the error, or null if none was recorded." + }, "code": { "$ref": "#/components/schemas/BetaResponseErrorCode" }, @@ -99983,6 +127855,26 @@ "image_file_not_found" ] }, + "BetaAccessProgramsBody": { + "properties": { + "cyber": { + "$ref": "#/components/schemas/BetaCyberAccessProgramEnum", + "description": "The effective Cyber access program used for this response." + } + }, + "type": "object", + "required": [ + "cyber" + ] + }, + "BetaCyberAccessProgramEnum": { + "type": "string", + "enum": [ + "standard", + "daybreak_blue", + "daybreak_red" + ] + }, "BetaServiceTierResponses": { "anyOf": [ { @@ -100182,7 +128074,10 @@ ] }, "user": { - "type": "string", + "type": [ + "string", + "null" + ], "example": "user-1234", "deprecated": true, "description": "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" @@ -100191,9 +128086,9 @@ "anyOf": [ { "type": "string", - "maxLength": 64, + "maxLength": 128, "example": "safety-identifier-1234", - "description": "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" + "description": "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).\n" }, { "type": "null" @@ -101394,7 +129289,7 @@ "x-oaiMeta": { "name": "response.output_text.done", "group": "responses", - "example": "{\n \"type\": \"response.output_text.done\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.output_text.done\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"sequence_number\": 1,\n \"logprobs\": []\n}\n" } }, "BetaResponseLogProb": { @@ -101495,7 +129390,7 @@ "x-oaiMeta": { "name": "response.output_text.delta", "group": "responses", - "example": "{\n \"type\": \"response.output_text.delta\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"In\",\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.output_text.delta\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"delta\": \"In\",\n \"sequence_number\": 1,\n \"logprobs\": []\n}\n" } }, "BetaResponseRefusalDoneEvent": { @@ -101659,7 +129554,7 @@ "x-oaiMeta": { "name": "response.output_item.done", "group": "responses", - "example": "{\n \"type\": \"response.output_item.done\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_123\",\n \"status\": \"completed\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": []\n }\n ]\n },\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.output_item.done\",\n \"output_index\": 0,\n \"item\": {\n \"id\": \"msg_123\",\n \"status\": \"completed\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ]\n },\n \"sequence_number\": 1\n}\n" } }, "BetaResponseOutputItemAddedEvent": { @@ -101750,7 +129645,7 @@ "x-oaiMeta": { "name": "response.in_progress", "group": "responses", - "example": "{\n \"type\": \"response.in_progress\",\n \"response\": {\n \"id\": \"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c\",\n \"object\": \"response\",\n \"created_at\": 1741487325,\n \"status\": \"in_progress\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.in_progress\",\n \"response\": {\n \"id\": \"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741487325,\n \"status\": \"in_progress\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" } }, "BetaResponseShellCallOutputContentDoneStreamingEvent": { @@ -102103,7 +129998,7 @@ "x-oaiMeta": { "name": "response.function_call_arguments.delta", "group": "responses", - "example": "{\n \"type\": \"response.function_call_arguments.delta\",\n \"item_id\": \"item-abc\",\n \"output_index\": 0,\n \"delta\": \"{ \\\"arg\\\":\"\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.function_call_arguments.delta\",\n \"item_id\": \"item-abc\",\n \"output_index\": 0,\n \"delta\": \"{ \\\"arg\\\":\",\n \"sequence_number\": 1\n}\n" } }, "BetaResponseFileSearchCallSearchingEvent": { @@ -102357,7 +130252,7 @@ "x-oaiMeta": { "name": "response.created", "group": "responses", - "example": "{\n \"type\": \"response.created\",\n \"response\": {\n \"id\": \"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c\",\n \"object\": \"response\",\n \"created_at\": 1741487325,\n \"status\": \"in_progress\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.created\",\n \"response\": {\n \"id\": \"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1741487325,\n \"status\": \"in_progress\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"store\": true,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" } }, "BetaResponseContentPartDoneEvent": { @@ -102415,7 +130310,7 @@ "x-oaiMeta": { "name": "response.content_part.done", "group": "responses", - "example": "{\n \"type\": \"response.content_part.done\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"sequence_number\": 1,\n \"part\": {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": []\n }\n}\n" + "example": "{\n \"type\": \"response.content_part.done\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"sequence_number\": 1,\n \"part\": {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n}\n" } }, "BetaOutputContent": { @@ -102489,7 +130384,7 @@ "x-oaiMeta": { "name": "response.content_part.added", "group": "responses", - "example": "{\n \"type\": \"response.content_part.added\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"output_text\",\n \"text\": \"\",\n \"annotations\": []\n },\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.content_part.added\",\n \"item_id\": \"msg_123\",\n \"output_index\": 0,\n \"content_index\": 0,\n \"part\": {\n \"type\": \"output_text\",\n \"text\": \"\",\n \"annotations\": [],\n \"logprobs\": []\n },\n \"sequence_number\": 1\n}\n" } }, "BetaResponseCompletedEvent": { @@ -102532,9 +130427,47 @@ "x-oaiMeta": { "name": "response.completed", "group": "responses", - "example": "{\n \"type\": \"response.completed\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"created_at\": 1740855869,\n \"status\": \"completed\",\n \"completed_at\": 1740855870,\n \"error\": null,\n \"incomplete_details\": null,\n \"input\": [],\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"id\": \"msg_123\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 0,\n \"output_tokens\": 0,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 0\n },\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.completed\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1740855869,\n \"status\": \"completed\",\n \"completed_at\": 1740855870,\n \"error\": null,\n \"incomplete_details\": null,\n \"input\": [],\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [\n {\n \"id\": \"msg_123\",\n \"type\": \"message\",\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.\",\n \"annotations\": [],\n \"logprobs\": []\n }\n ],\n \"status\": \"completed\"\n }\n ],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 0,\n \"output_tokens\": 0,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 0,\n \"input_tokens_details\": {\n \"cached_tokens\": 0,\n \"cache_write_tokens\": 0\n }\n },\n \"user\": null,\n \"metadata\": {},\n \"parallel_tool_calls\": true\n },\n \"sequence_number\": 1\n}\n" } }, + "BetaResponseCompactionCompactingStreamingEvent": { + "properties": { + "type": { + "type": "string", + "enum": [ + "response.compaction.compacting" + ], + "description": "The type of the event, always `response.compaction.compacting`.", + "default": "response.compaction.compacting", + "x-stainless-const": true + }, + "sequence_number": { + "type": "integer", + "description": "The sequence number of the event that was emitted." + }, + "agent": { + "$ref": "#/components/schemas/BetaAgentTag", + "description": "The agent that owns this multi-agent streaming event." + }, + "output_index": { + "type": "integer", + "description": "The index of the compaction output item." + }, + "item_id": { + "type": "string", + "description": "The ID of the compaction output item." + } + }, + "type": "object", + "required": [ + "type", + "sequence_number", + "output_index", + "item_id" + ], + "title": "Response compaction compacting event", + "description": "Emitted when new summary content is sampled for a compaction trigger. Contains no summary content." + }, "BetaResponseCodeInterpreterCallInterpretingEvent": { "type": "object", "description": "Emitted when the code interpreter is actively interpreting the code snippet.", @@ -102990,7 +130923,7 @@ "x-oaiMeta": { "name": "response.incomplete", "group": "responses", - "example": "{\n \"type\": \"response.incomplete\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"created_at\": 1740855869,\n \"status\": \"incomplete\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": {\n \"reason\": \"max_tokens\"\n },\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n },\n \"sequence_number\": 1\n}\n" + "example": "{\n \"type\": \"response.incomplete\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1740855869,\n \"status\": \"incomplete\",\n \"completed_at\": null,\n \"error\": null,\n \"incomplete_details\": {\n \"reason\": \"max_output_tokens\"\n },\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {},\n \"parallel_tool_calls\": true\n },\n \"sequence_number\": 1\n}\n" } }, "BetaResponseFailedEvent": { @@ -103033,7 +130966,7 @@ "x-oaiMeta": { "name": "response.failed", "group": "responses", - "example": "{\n \"type\": \"response.failed\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"created_at\": 1740855869,\n \"status\": \"failed\",\n \"completed_at\": null,\n \"error\": {\n \"code\": \"server_error\",\n \"message\": \"The model failed to generate a response.\"\n },\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {}\n }\n}\n" + "example": "{\n \"type\": \"response.failed\",\n \"response\": {\n \"id\": \"resp_123\",\n \"object\": \"response\",\n \"access_programs\": null,\n \"created_at\": 1740855869,\n \"status\": \"failed\",\n \"completed_at\": null,\n \"error\": {\n \"code\": \"server_error\",\n \"message\": \"The model failed to generate a response.\"\n },\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"model\": \"gpt-6-astra\",\n \"output\": [],\n \"previous_response_id\": null,\n \"reasoning_effort\": null,\n \"store\": false,\n \"temperature\": 1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_p\": 1,\n \"truncation\": \"disabled\",\n \"usage\": null,\n \"user\": null,\n \"metadata\": {},\n \"parallel_tool_calls\": true\n },\n \"sequence_number\": 1\n}\n" } }, "BetaResponseWebSearchCallCompletedEvent": { @@ -104030,6 +131963,24 @@ } ] }, + { + "title": "BetaResponseCompactionWsCompacting", + "description": "Emitted when new summary content is sampled for a compaction trigger. Contains no summary content.", + "allOf": [ + { + "$ref": "#/components/schemas/BetaResponseCompactionCompactingStreamingEvent" + }, + { + "type": "object", + "properties": { + "stream_id": { + "type": "string", + "description": "The WebSocket lane that emitted this event. This field is present\nwhen the originating `response.create` event supplied a\n`stream_id`.\n" + } + } + } + ] + }, { "title": "BetaResponseWsCompleted", "description": "Emitted when the model response is complete.", @@ -105157,6 +133108,9 @@ { "$ref": "#/components/schemas/BetaResponseCodeInterpreterCallInterpretingEvent" }, + { + "$ref": "#/components/schemas/BetaResponseCompactionCompactingStreamingEvent" + }, { "$ref": "#/components/schemas/BetaResponseCompletedEvent" }, @@ -105383,6 +133337,10 @@ "description": "The type of the client event. Always `response.create`.\n", "x-stainless-const": true }, + "generate": { + "type": "boolean", + "description": "Whether to generate output for this response. Defaults to true when omitted.\nSet to false to prepare request state without model output; the response\nID can be used as previous_response_id on a later turn.\n" + }, "stream_id": { "type": "string", "minLength": 1, @@ -105415,6 +133373,12 @@ { "type": "object", "properties": { + "access_programs": { + "$ref": "#/components/schemas/BetaAccessProgramsParam" + }, + "image": { + "$ref": "#/components/schemas/BetaImageOptionsParam" + }, "prompt_cache_options": { "$ref": "#/components/schemas/BetaResponsePromptCacheOptionsParam" }, @@ -105540,6 +133504,12 @@ "anyOf": [ { "type": "array", + "example": [ + { + "type": "compaction", + "compact_threshold": 1000 + } + ], "description": "Context management configuration for this request.\n", "minItems": 1, "items": { @@ -105626,7 +133596,6 @@ { "description": "Options for streaming responses. Only set this when you set `stream: true`.\n", "type": "object", - "default": null, "properties": { "include_obfuscation": { "type": "boolean", @@ -105721,6 +133690,10 @@ "$ref": "#/components/schemas/BetaPromptCacheModeEnum", "description": "Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching." }, + "prewarm": { + "type": "boolean", + "description": "Prepares the prompt cache without generating output. Defaults to `false`. When set to `true`, overrides the `generate` field to `false`." + }, "comparison_response_id": { "anyOf": [ { @@ -105739,6 +133712,18 @@ "title": "Prompt cache options", "description": "Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details." }, + "BetaAccessProgramsParam": { + "properties": { + "cyber": { + "$ref": "#/components/schemas/BetaCyberAccessProgramEnum", + "description": "The Cyber access program to use for this request. Supported values are `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves the program from the model's Cyber tier and your organization and project access, subject to model-specific eligibility restrictions. By default, models without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when authorized; otherwise they fall back to Standard unless the model requires Daybreak access. Red-tier models use Daybreak Red and require authorization. Requests that require unavailable Daybreak access return 403. An implicit Standard fallback is represented by null in the response's access_programs field, rather than an explicit Standard selection." + } + }, + "additionalProperties": false, + "type": "object", + "required": [], + "description": "Domain-specific access programs to use for this request." + }, "BetaCreateModelResponseProperties": { "allOf": [ { @@ -105790,6 +133775,9 @@ { "$ref": "#/components/schemas/BetaResponseCodeInterpreterCallInterpretingEvent" }, + { + "$ref": "#/components/schemas/BetaResponseCompactionCompactingStreamingEvent" + }, { "$ref": "#/components/schemas/BetaResponseCompletedEvent" }, @@ -106099,7 +134087,7 @@ { "id": "responses-streaming", "title": "Streaming events", - "description": "When you [create a Response](https://developers.openai.com/api/reference/resources/responses/methods/create) with\n`stream` set to `true`, the server will emit server-sent events to the\nclient as the Response is generated. This section contains the events that\nare emitted by the server.\n\n[Learn more about streaming responses](https://developers.openai.com/api/docs/guides/streaming-responses).\n", + "description": "When you [create a Response](https://developers.openai.com/api/reference/resources/responses/methods/create) with\n`stream` set to `true`, the server will emit server-sent events to the\nclient as the Response is generated. This section contains the events that\nare emitted by the server.\n\nWhen processing a `compaction_trigger`, `response.compaction.compacting`\nreports newly sampled summary output at most once every 30 seconds. It\ncarries no summary content and does not modify the compaction output item.\nThe existing `response.output_item.added` and `response.output_item.done`\nevents mark that item's lifecycle; `response.output_item.done` carries its\nfinal encrypted content. A short compaction may finish without emitting a\nprogress event.\n\n[Learn more about streaming responses](https://developers.openai.com/api/docs/guides/streaming-responses).\n", "navigationGroup": "responses", "sections": [ { @@ -106137,6 +134125,11 @@ "key": "ResponseOutputItemDoneEvent", "path": "" }, + { + "type": "object", + "key": "ResponseCompactionCompactingEvent", + "path": "" + }, { "type": "object", "key": "ResponseContentPartAddedEvent", @@ -106393,7 +134386,7 @@ { "id": "responses-websocket-shared-events", "title": "Server events", - "description": "These events use the same payloads over WebSocket and\n[HTTP streaming](https://developers.openai.com/api/reference/resources/responses/streaming-events).\n", + "description": "These events use the same payloads over WebSocket and\n[HTTP streaming](https://developers.openai.com/api/reference/resources/responses/streaming-events).\nCompaction progress follows the same cadence and output-item lifecycle\ndescribed in HTTP streaming.\n", "navigationGroup": "responses", "sections": [ { @@ -106431,6 +134424,11 @@ "key": "ResponseOutputItemDoneEvent", "path": "" }, + { + "type": "object", + "key": "ResponseCompactionCompactingEvent", + "path": "" + }, { "type": "object", "key": "ResponseContentPartAddedEvent", @@ -106643,6 +134641,24 @@ } ] }, + { + "id": "safety-cases", + "title": "Safety Cases", + "description": "Retrieve details about a safety warning or deactivation using the case ID\nfrom a `safety.warning_issued` or `safety.deactivation_issued` webhook event.\nCases belong to an organization and require an API key with `api.safety.read`.\n", + "navigationGroup": "endpoints", + "sections": [ + { + "type": "endpoint", + "key": "Getsafetycase", + "path": "retrieve" + }, + { + "type": "object", + "key": "SafetyCaseResource", + "path": "object" + } + ] + }, { "id": "safety-alerts", "title": "Safety Alerts", @@ -106752,6 +134768,16 @@ "key": "WebhookLiveTransportIncoming", "path": "" }, + { + "type": "object", + "key": "WebhookSafetyWarningIssued", + "path": "" + }, + { + "type": "object", + "key": "WebhookSafetyDeactivationIssued", + "path": "" + }, { "type": "object", "key": "WebhookSafetyAlertCreated", @@ -107493,6 +135519,11 @@ "key": "LiveInputAudioUnmuteParam", "path": "" }, + { + "type": "object", + "key": "LiveOutputAudioFixturePlayParam", + "path": "" + }, { "type": "object", "key": "LiveInstructionsAppendParam", @@ -107508,6 +135539,21 @@ "key": "LiveCommentaryAppendParam", "path": "" }, + { + "type": "object", + "key": "LiveDecisionCreateParam", + "path": "" + }, + { + "type": "object", + "key": "LiveDecisionItemCreateParam", + "path": "" + }, + { + "type": "object", + "key": "LiveDecisionItemDeleteParam", + "path": "" + }, { "type": "object", "key": "LiveResponseItemCreateParam", @@ -107531,6 +135577,21 @@ "description": "Live server events. Responses delegation lifecycle events arrive inside response.event, not as top-level response events. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) to design frontend instructions and delegation policy; see [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt) for tools and business rules.", "navigationGroup": "live", "sections": [ + { + "type": "object", + "key": "LiveTransportRinging", + "path": "" + }, + { + "type": "object", + "key": "LiveTransportAnswered", + "path": "" + }, + { + "type": "object", + "key": "LiveTransportFailed", + "path": "" + }, { "type": "object", "key": "LiveSessionStarted", @@ -107551,6 +135612,16 @@ "key": "LiveInputAudioUnmuted", "path": "" }, + { + "type": "object", + "key": "LiveOutputAudioFixturePlaying", + "path": "" + }, + { + "type": "object", + "key": "LiveOutputAudioFixturePlayed", + "path": "" + }, { "type": "object", "key": "LiveInstructionsAppended", @@ -107586,6 +135657,21 @@ "key": "LiveDelegationCreated", "path": "" }, + { + "type": "object", + "key": "LiveDecisionEvent", + "path": "" + }, + { + "type": "object", + "key": "LiveDecisionItemCreated", + "path": "" + }, + { + "type": "object", + "key": "LiveDecisionItemDeleted", + "path": "" + }, { "type": "object", "key": "LiveResponseEvent", @@ -107614,5 +135700,18 @@ ] } ] + }, + "x-openai-structured-output-limits": { + "version": 1, + "max_object_properties": 5000, + "max_nesting_depth": 10, + "max_enum_values": 1000, + "max_string_characters": 120000, + "large_enum_threshold": 250, + "max_large_enum_string_characters": 15000, + "string_length_unit": "unicode_code_points", + "non_string_enum_characters": false, + "property_count_scope": "root_or_definition", + "references": "count_definition_once" } } diff --git a/contracts/agents-api/v1/official.gen.go b/contracts/agents-api/v1/official.gen.go index f46878b35..f95766d7c 100644 --- a/contracts/agents-api/v1/official.gen.go +++ b/contracts/agents-api/v1/official.gen.go @@ -23,9 +23,11 @@ type Agent struct { MultiAgent MultiAgentConfig `json:"multi_agent" binding:"required"` Name *string `json:"name" binding:"required" extensions:"x-nullable"` Reasoning Reasoning `json:"reasoning" binding:"required"` - ServiceTier string `json:"service_tier" binding:"required" enums:"auto,default,flex,priority,fast"` + ServiceTier string `json:"service_tier" binding:"required" enums:"auto,default,flex,priority,fast,ultrafast"` Text TextConfig `json:"text" binding:"required"` Tools []json.RawMessage `json:"tools" binding:"required" swaggertype:"array,object"` + Compaction json.RawMessage `json:"compaction,omitempty" swaggertype:"object"` + Experimental json.RawMessage `json:"experimental,omitempty" swaggertype:"object"` } // AgentContent projects AgentContentResource. @@ -61,9 +63,11 @@ type CreateAgentRequest struct { Metadata map[string]*string `json:"metadata,omitempty" extensions:"x-nullable"` MultiAgent json.RawMessage `json:"multi_agent,omitempty" extensions:"x-nullable" swaggertype:"object"` Reasoning *Reasoning `json:"reasoning,omitempty" extensions:"x-nullable"` - ServiceTier *string `json:"service_tier,omitempty" extensions:"x-nullable" enums:"auto,default,flex,priority,fast"` + ServiceTier *string `json:"service_tier,omitempty" extensions:"x-nullable" enums:"auto,default,flex,priority,fast,ultrafast"` Text *TextConfigInput `json:"text,omitempty" extensions:"x-nullable"` Tools []json.RawMessage `json:"tools,omitempty" extensions:"x-nullable" swaggertype:"array,object"` + Experimental json.RawMessage `json:"experimental,omitempty" swaggertype:"object"` + Compaction json.RawMessage `json:"compaction,omitempty" extensions:"x-nullable" swaggertype:"object"` } // CreateSessionRequest projects CreateAgentSessionParams. @@ -76,6 +80,7 @@ type CreateSessionRequest struct { Metadata map[string]string `json:"metadata,omitempty" extensions:"x-nullable"` Stream bool `json:"stream,omitempty"` VaultIDs []string `json:"vault_ids,omitempty" extensions:"x-nullable"` + Review *string `json:"review,omitempty" enums:"none,auto_review"` } // CreateSubagentCallItem projects CreateSubagentCallItemResource. @@ -92,40 +97,47 @@ type CreateSubagentCallItem struct { // Credential projects VaultCredentialResource. type Credential struct { - ID string `json:"id" binding:"required"` - VaultID string `json:"vault_id" binding:"required"` - Name string `json:"name" binding:"required"` - Object string `json:"object" binding:"required" enums:"vault.credential"` - Auth CredentialAuth `json:"auth" binding:"required"` - CreatedAt int64 `json:"created_at" binding:"required"` - UpdatedAt int64 `json:"updated_at" binding:"required"` + ID string `json:"id" binding:"required"` + VaultID string `json:"vault_id" binding:"required"` + Name string `json:"name" binding:"required"` + Object string `json:"object" binding:"required" enums:"vault.credential"` + Auth CredentialAuth `json:"auth" binding:"required"` + CreatedAt int64 `json:"created_at" binding:"required"` + UpdatedAt int64 `json:"updated_at" binding:"required"` + Metadata map[string]string `json:"metadata" binding:"required"` } // CredentialAuth projects VaultCredentialAuthResource. type CredentialAuth struct { - Type string `json:"type" binding:"required" enums:"mcp_oauth,static_bearer"` - MCPServerURL string `json:"mcp_server_url" binding:"required"` + Type string `json:"type" binding:"required" enums:"mcp_oauth,static_bearer,environment_variable"` + MCPServerURL string `json:"mcp_server_url"` ExpiresAt *string `json:"expires_at" extensions:"x-nullable"` Refresh *OAuthCredentialRefresh `json:"refresh" extensions:"x-nullable"` + SecretName *string `json:"secret_name,omitempty"` + Networking json.RawMessage `json:"networking,omitempty" swaggertype:"object"` } // CredentialAuthInput projects CreateVaultCredentialAuthParam. type CredentialAuthInput struct { - Type string `json:"type" binding:"required" enums:"mcp_oauth,static_bearer"` - MCPServerURL *string `json:"mcp_server_url" binding:"required"` + Type string `json:"type" binding:"required" enums:"mcp_oauth,static_bearer,environment_variable"` + MCPServerURL *string `json:"mcp_server_url,omitempty"` Token *string `json:"token,omitempty"` AccessToken *string `json:"access_token,omitempty"` ExpiresAt *string `json:"expires_at,omitempty" extensions:"x-nullable"` Refresh *OAuthCredentialRefreshInput `json:"refresh,omitempty" extensions:"x-nullable"` + SecretName *string `json:"secret_name,omitempty"` + SecretValue *string `json:"secret_value,omitempty"` + Networking json.RawMessage `json:"networking,omitempty" swaggertype:"object"` } // CredentialAuthReplacement projects RotateVaultCredentialAuthParam. type CredentialAuthReplacement struct { - Type string `json:"type" binding:"required" enums:"mcp_oauth,static_bearer"` + Type string `json:"type" binding:"required" enums:"mcp_oauth,static_bearer,environment_variable"` Token *string `json:"token,omitempty"` AccessToken *string `json:"access_token,omitempty" extensions:"x-nullable"` ExpiresAt json.RawMessage `json:"expires_at,omitempty" extensions:"x-nullable" swaggertype:"object"` Refresh *OAuthCredentialRefreshReplacement `json:"refresh,omitempty" extensions:"x-nullable"` + SecretValue *string `json:"secret_value,omitempty"` } // CredentialDeleted projects DeletedVaultCredentialResource. @@ -157,6 +169,9 @@ type Environment struct { WorkspaceDirectory string `json:"workspace_directory,omitempty"` CapabilityDirectories []string `json:"capability_directories,omitempty" extensions:"x-nullable"` Network *EnvironmentNetworkInput `json:"network,omitempty" extensions:"x-nullable"` + Desktop json.RawMessage `json:"desktop,omitempty" extensions:"x-nullable" swaggertype:"object"` + EnvironmentID *string `json:"environment_id,omitempty"` + ContainerSize *string `json:"container_size,omitempty" enums:"small,medium,large"` } // EnvironmentConnectionAction projects SessionRequiredActionResourceEnvironmentConnection. @@ -194,7 +209,7 @@ type EnvironmentInfo struct { ID string `json:"id" binding:"required"` Object string `json:"object" binding:"required" enums:"agent.environment"` Type string `json:"type" binding:"required" enums:"openai_hosted,self_hosted"` - Status string `json:"status" binding:"required" enums:"pending,connected,disconnected,expired,failed"` + Status string `json:"status" binding:"required" enums:"pending,ready,connected,disconnected,suspended,expired,failed"` Files []json.RawMessage `json:"files" binding:"required" swaggertype:"array,object"` Plugins []json.RawMessage `json:"plugins" binding:"required" swaggertype:"array,object"` Skills []json.RawMessage `json:"skills" binding:"required" swaggertype:"array,object"` @@ -210,6 +225,7 @@ type EnvironmentNetwork struct { type EnvironmentNetworkInput struct { Access string `json:"access" binding:"required" enums:"enabled,disabled,restricted"` AllowedDomains []string `json:"allowed_domains,omitempty" extensions:"x-nullable"` + BlockedDomains []string `json:"blocked_domains,omitempty" extensions:"x-nullable"` } // EnvironmentPackages projects EnvironmentPackagesParam. @@ -238,6 +254,7 @@ type EnvironmentTemplate struct { Files []json.RawMessage `json:"files" binding:"required" swaggertype:"array,object"` Plugins []json.RawMessage `json:"plugins" binding:"required" swaggertype:"array,object"` Skills []json.RawMessage `json:"skills" binding:"required" swaggertype:"array,object"` + Desktop json.RawMessage `json:"desktop" binding:"required" swaggertype:"object"` } // EnvironmentTemplateDeleted projects DeletedEnvironmentTemplateResource. @@ -286,9 +303,11 @@ type InlineAgent struct { Instructions *string `json:"instructions,omitempty" extensions:"x-nullable"` MultiAgent json.RawMessage `json:"multi_agent,omitempty" extensions:"x-nullable" swaggertype:"object"` Reasoning *Reasoning `json:"reasoning,omitempty" extensions:"x-nullable"` - ServiceTier *string `json:"service_tier,omitempty" extensions:"x-nullable" enums:"auto,default,flex,priority,fast"` + ServiceTier *string `json:"service_tier,omitempty" extensions:"x-nullable" enums:"auto,default,flex,priority,fast,ultrafast"` Text *TextConfigInput `json:"text,omitempty" extensions:"x-nullable"` Tools []json.RawMessage `json:"tools,omitempty" extensions:"x-nullable" swaggertype:"array,object"` + Experimental json.RawMessage `json:"experimental,omitempty" swaggertype:"object"` + Compaction json.RawMessage `json:"compaction,omitempty" extensions:"x-nullable" swaggertype:"object"` } // InputContent projects InputContentParam. @@ -305,7 +324,7 @@ type InputMessage struct { Content []InputContent `json:"content" binding:"required"` } -// InputTokenDetails projects InputTokensDetailsResource. +// InputTokenDetails projects InputTokensDetailsResource-2. type InputTokenDetails struct { CachedTokens int64 `json:"cached_tokens" binding:"required"` } @@ -314,7 +333,7 @@ type InputTokenDetails struct { type Item struct { ID string `json:"id" binding:"required" extensions:"x-nullable"` TurnID string `json:"turn_id" binding:"required"` - Type string `json:"type" binding:"required" enums:"message,reasoning,function_call,function_call_output,agent_message,mcp_call,web_search_call,command_execution,create_subagent_call,send_subagent_input_call,resume_subagent_call,wait_for_subagents_call,interrupt_subagent_call,close_subagent_call"` + Type string `json:"type" binding:"required" enums:"message,reasoning,function_call,function_call_output,agent_message,mcp_call,computer_use_call,computer_use_approval_request,computer_use_approval_request_result,web_search_call,command_execution,create_subagent_call,send_subagent_input_call,resume_subagent_call,wait_for_subagents_call,interrupt_subagent_call,close_subagent_call"` Status string `json:"status" extensions:"x-nullable" enums:"in_progress,completed,incomplete,failed"` Role string `json:"role,omitempty" enums:"user,assistant"` Phase string `json:"phase,omitempty" extensions:"x-nullable" enums:"commentary,final_answer"` @@ -337,6 +356,10 @@ type Item struct { Model *string `json:"model,omitempty" extensions:"x-nullable"` ReasoningEffort *string `json:"reasoning_effort,omitempty" extensions:"x-nullable"` Summary []SummaryText `json:"summary,omitempty"` + Title *string `json:"title,omitempty" extensions:"x-nullable"` + RequestID *string `json:"request_id,omitempty"` + Request json.RawMessage `json:"request,omitempty" swaggertype:"object"` + Response json.RawMessage `json:"response,omitempty" swaggertype:"object"` } // ItemContent projects MessageContentResource, EncryptedContentResource, SummaryTextResource. @@ -471,7 +494,7 @@ type OAuthEndpointAuthReplacement struct { ClientSecret *string `json:"client_secret,omitempty" extensions:"x-nullable"` } -// OutputTokenDetails projects OutputTokensDetailsResource. +// OutputTokenDetails projects OutputTokensDetailsResource-2. type OutputTokenDetails struct { ReasoningTokens int64 `json:"reasoning_tokens" binding:"required"` } @@ -493,12 +516,14 @@ type ReasoningItem struct { // RequiredAction projects SessionRequiredActionResource. type RequiredAction struct { - Type string `json:"type" binding:"required" enums:"function_call,environment_connection"` - Arguments any `json:"arguments,omitempty"` - CallID string `json:"call_id,omitempty"` - Name string `json:"name,omitempty"` - TurnID string `json:"turn_id,omitempty"` - EnvironmentID string `json:"environment_id,omitempty"` + Type string `json:"type" binding:"required" enums:"computer_use_approval_request,function_call,environment_connection"` + Arguments any `json:"arguments,omitempty"` + CallID string `json:"call_id,omitempty"` + Name string `json:"name,omitempty"` + TurnID string `json:"turn_id,omitempty"` + EnvironmentID string `json:"environment_id,omitempty"` + RequestID *string `json:"request_id,omitempty"` + Request json.RawMessage `json:"request,omitempty" swaggertype:"object"` } // SavedAgent projects AgentResource. @@ -519,9 +544,11 @@ type SavedAgentConfiguration struct { Instructions *string `json:"instructions" binding:"required" extensions:"x-nullable"` MultiAgent MultiAgentConfig `json:"multi_agent" binding:"required"` Reasoning Reasoning `json:"reasoning" binding:"required"` - ServiceTier string `json:"service_tier" binding:"required" enums:"auto,default,flex,priority,fast"` + ServiceTier string `json:"service_tier" binding:"required" enums:"auto,default,flex,priority,fast,ultrafast"` Text TextConfig `json:"text" binding:"required"` Tools []json.RawMessage `json:"tools" binding:"required" swaggertype:"array,object"` + Compaction json.RawMessage `json:"compaction,omitempty" swaggertype:"object"` + Experimental json.RawMessage `json:"experimental,omitempty" swaggertype:"object"` } // SavedAgentList projects AgentListResource. @@ -559,6 +586,7 @@ type Session struct { Status string `json:"status" binding:"required" enums:"idle,in_progress,requires_action,failed"` Usage *TokenUsage `json:"usage" binding:"required" extensions:"x-nullable"` VaultIDs []string `json:"vault_ids" binding:"required"` + Review *string `json:"review,omitempty" enums:"none,auto_review"` } // SessionArtifact projects SessionArtifactResource. @@ -608,48 +636,54 @@ type SessionEnvironment struct { Files *[]json.RawMessage `json:"files,omitempty" swaggertype:"array,object"` Plugins *[]json.RawMessage `json:"plugins,omitempty" swaggertype:"array,object"` Skills *[]json.RawMessage `json:"skills,omitempty" swaggertype:"array,object"` + ContainerSize json.RawMessage `json:"container_size,omitempty" extensions:"x-nullable" swaggertype:"object"` + Desktop json.RawMessage `json:"desktop,omitempty" swaggertype:"object"` } // SessionEnvironmentState projects SessionEnvironmentStateResource. type SessionEnvironmentState struct { ID string `json:"id" binding:"required"` Type string `json:"type" binding:"required"` - Status string `json:"status" binding:"required" enums:"pending,ready,connected,disconnected,failed"` + Status string `json:"status" binding:"required" enums:"pending,ready,connected,disconnected,suspended,expired,failed"` Error *StreamError `json:"error" binding:"required" extensions:"x-nullable"` } // SessionEvent projects SessionEvent. type SessionEvent struct { - Subagent *Subagent `json:"subagent,omitempty"` - Type string `json:"type" binding:"required" enums:"error,agent.session.environment.ready,agent.output.command_execution_output.delta,agent.session.created,agent.session.turn.created,agent.session.turn.in_progress,agent.session.turn.completed,agent.session.turn.failed,agent.session.turn.cancelled,agent.session.turn.item.added,agent.session.idle,agent.session.in_progress,agent.session.requires_action,agent.session.failed,agent.session.environment.pending,agent.session.environment.connected,agent.session.environment.disconnected,agent.session.environment.failed,agent.session.subagent.created,agent.session.subagent.active,agent.session.subagent.closed,agent.session.turn.item.done,agent.session.turn.content_part.added,agent.session.turn.content_part.done,agent.session.turn.output_text.delta,agent.session.turn.output_text.done,agent.session.turn.reasoning_summary_part.added,agent.session.turn.reasoning_summary_part.done,agent.session.turn.reasoning_summary_text.delta,agent.session.turn.reasoning_summary_text.done"` - EventID string `json:"event_id" binding:"required"` - SessionID string `json:"session_id,omitempty"` - TurnID string `json:"turn_id,omitempty" extensions:"x-nullable"` - Session *Session `json:"session,omitempty"` - Turn *Turn `json:"turn,omitempty"` - Item *Item `json:"item,omitempty"` - ItemID string `json:"item_id,omitempty"` - OutputIndex *int32 `json:"output_index,omitempty" extensions:"x-nullable"` - ContentIndex *int `json:"content_index,omitempty"` - Part *ItemContent `json:"part,omitempty"` - Delta *string `json:"delta,omitempty"` - Text *string `json:"text,omitempty"` - Error *StreamError `json:"error,omitempty"` - Environment *SessionEnvironmentState `json:"environment,omitempty"` - Usage *TokenUsage `json:"usage,omitempty" extensions:"x-nullable"` - SummaryIndex *int64 `json:"summary_index,omitempty"` - Status *string `json:"status,omitempty" extensions:"x-nullable" enums:"incomplete"` + Subagent *Subagent `json:"subagent,omitempty"` + Type string `json:"type" binding:"required" enums:"error,agent.session.environment.ready,agent.session.environment.suspended,agent.session.environment.expired,agent.session.environment.reset,agent.output.command_execution_output.delta,agent.session.created,agent.session.turn.created,agent.session.turn.in_progress,agent.session.turn.completed,agent.session.turn.failed,agent.session.turn.cancelled,agent.session.turn.item.added,agent.session.idle,agent.session.in_progress,agent.session.requires_action,agent.session.failed,agent.session.environment.pending,agent.session.environment.connected,agent.session.environment.disconnected,agent.session.environment.failed,agent.session.subagent.created,agent.session.subagent.active,agent.session.subagent.closed,agent.session.turn.item.done,agent.session.turn.content_part.added,agent.session.turn.content_part.done,agent.session.turn.output_text.delta,agent.session.turn.output_text.done,agent.session.turn.reasoning_summary_part.added,agent.session.turn.reasoning_summary_part.done,agent.session.turn.reasoning_summary_text.delta,agent.session.turn.reasoning_summary_text.done"` + EventID string `json:"event_id" binding:"required"` + SessionID string `json:"session_id,omitempty"` + TurnID string `json:"turn_id,omitempty" extensions:"x-nullable"` + Session *Session `json:"session,omitempty"` + Turn *Turn `json:"turn,omitempty"` + Item *Item `json:"item,omitempty"` + ItemID string `json:"item_id,omitempty"` + OutputIndex *int32 `json:"output_index,omitempty" extensions:"x-nullable"` + ContentIndex *int `json:"content_index,omitempty"` + Part *ItemContent `json:"part,omitempty"` + Delta *string `json:"delta,omitempty"` + Text *string `json:"text,omitempty"` + Error *StreamError `json:"error,omitempty"` + Environment *SessionEnvironmentState `json:"environment,omitempty"` + Usage *TokenUsage `json:"usage,omitempty" extensions:"x-nullable"` + EnvironmentID *string `json:"environment_id,omitempty"` + ResetCount *int64 `json:"reset_count,omitempty"` + SummaryIndex *int64 `json:"summary_index,omitempty"` + Status *string `json:"status,omitempty" extensions:"x-nullable" enums:"incomplete"` } // SessionInput projects SessionInputParam. type SessionInput struct { - Type string `json:"type" binding:"required" enums:"agent.session.input.message,agent.session.input.cancel,agent.session.input.tool_result"` - Input []InputMessage `json:"input,omitempty"` - CallID string `json:"call_id,omitempty"` - TurnID string `json:"turn_id,omitempty"` - Success *bool `json:"success,omitempty"` - Error json.RawMessage `json:"error,omitempty" extensions:"x-nullable" swaggertype:"object"` - Output any `json:"output,omitempty" extensions:"x-nullable"` + Type string `json:"type" binding:"required" enums:"agent.session.input.computer_use_approval_request_result,agent.session.input.message,agent.session.input.cancel,agent.session.input.tool_result"` + Input []InputMessage `json:"input,omitempty"` + CallID string `json:"call_id,omitempty"` + TurnID string `json:"turn_id,omitempty"` + Success *bool `json:"success,omitempty"` + Error json.RawMessage `json:"error,omitempty" extensions:"x-nullable" swaggertype:"object"` + Output any `json:"output,omitempty" extensions:"x-nullable"` + RequestID *string `json:"request_id,omitempty"` + Response json.RawMessage `json:"response,omitempty" swaggertype:"object"` } // SessionList projects SessionListResource. @@ -725,7 +759,7 @@ type SkillVersionList struct { type SourceFile struct { ID string `json:"id" binding:"required"` Object string `json:"object" binding:"required" enums:"file"` - Bytes int64 `json:"bytes" binding:"required"` + Bytes *int64 `json:"bytes" binding:"required" extensions:"x-nullable"` CreatedAt int64 `json:"created_at" binding:"required"` Filename string `json:"filename" binding:"required"` Purpose string `json:"purpose" binding:"required" enums:"assistants,assistants_output,batch,batch_output,fine-tune,fine-tune-results,vision,user_data"` @@ -840,7 +874,7 @@ type Turn struct { // TurnError projects SessionTurnErrorResource. type TurnError struct { - Code string `json:"code" binding:"required" enums:"context_length_exceeded,session_budget_exceeded,usage_limit_exceeded,rate_limit_exceeded,server_overloaded,cyber_policy,connection_failed,server_error,authentication_error,invalid_request,resource_not_found,sandbox_error,executor_version_incompatible,active_turn_not_steerable,request_timeout,internal_error"` + Code string `json:"code" binding:"required" enums:"context_length_exceeded,session_budget_exceeded,usage_limit_exceeded,project_spend_limit_exceeded,organization_spend_limit_exceeded,organization_usage_limit_exceeded,billing_not_active,credit_balance_exhausted,rate_limit_exceeded,flex_unavailable,server_overloaded,cyber_policy,misalignment_policy_violation,connection_failed,server_error,authentication_error,invalid_request,resource_not_found,sandbox_error,executor_version_incompatible,active_turn_not_steerable,request_timeout,internal_error"` Message string `json:"message" binding:"required"` } @@ -862,9 +896,11 @@ type UpdateAgentRequest struct { Metadata map[string]*string `json:"metadata,omitempty" extensions:"x-nullable"` MultiAgent json.RawMessage `json:"multi_agent,omitempty" extensions:"x-nullable" swaggertype:"object"` Reasoning *Reasoning `json:"reasoning,omitempty" extensions:"x-nullable"` - ServiceTier *string `json:"service_tier,omitempty" extensions:"x-nullable" enums:"auto,default,flex,priority,fast"` + ServiceTier *string `json:"service_tier,omitempty" extensions:"x-nullable" enums:"auto,default,flex,priority,fast,ultrafast"` Text *TextConfigInput `json:"text,omitempty" extensions:"x-nullable"` Tools []json.RawMessage `json:"tools,omitempty" extensions:"x-nullable" swaggertype:"array,object"` + Experimental json.RawMessage `json:"experimental,omitempty" swaggertype:"object"` + Compaction json.RawMessage `json:"compaction,omitempty" extensions:"x-nullable" swaggertype:"object"` } // Vault projects VaultResource. diff --git a/contracts/agents-api/v1/upstream_contract_test.go b/contracts/agents-api/v1/upstream_contract_test.go index 140dd2c75..1b977097c 100644 --- a/contracts/agents-api/v1/upstream_contract_test.go +++ b/contracts/agents-api/v1/upstream_contract_test.go @@ -104,7 +104,7 @@ func TestPublicOperationsPreserveOfficialContract(t *testing.T) { } delete(published, path) } - if count != 58 || len(published) != 0 { - t.Fatalf("expected pinned 58 operations, got %d, extra paths %v", count, published) + if count != 73 || len(published) != 0 { + t.Fatalf("expected pinned 73 operations, got %d, extra paths %v", count, published) } } diff --git a/contracts/agents-api/vaults.md b/contracts/agents-api/vaults.md index 56c611f33..c46f6ce80 100644 --- a/contracts/agents-api/vaults.md +++ b/contracts/agents-api/vaults.md @@ -44,15 +44,16 @@ All routes are under `/v1`, take a Project API key and require `OpenAI-Beta: age | --- | --- | --- | | Create a Vault | `POST /vaults` | 201 Vault | | Retrieve a Vault | `GET /vaults/{vault_id}` | Vault | +| Update a Vault | `POST /vaults/{vault_id}` | Vault | | List Vaults | `GET /vaults` | List of Vaults | | Delete a Vault | `DELETE /vaults/{vault_id}` | `{id, object: "vault.deleted", deleted: true}` | | Create a Credential | `POST /vaults/{vault_id}/credentials` | 201 Credential | | Retrieve a Credential | `GET /vaults/{vault_id}/credentials/{credential_id}` | Credential | | List Credentials | `GET /vaults/{vault_id}/credentials` | List of Credentials | -| Replace secrets | `POST /vaults/{vault_id}/credentials/{credential_id}` | Credential | +| Update a Credential | `POST /vaults/{vault_id}/credentials/{credential_id}` | Credential | | Delete a Credential | `DELETE /vaults/{vault_id}/credentials/{credential_id}` | `{id, object: "vault.credential.deleted", deleted: true}` | -A malformed, missing or foreign ID returns 404 `not_found_error`, and so does a Credential addressed through a Vault that does not own it. Both lists order by creation time, then ID, and filter by `status` (`active`, `archived` or both); the [list rules](./wire-semantics.md#lists) give the paging and filter details. Core stores the status privately, defaults it to `active` and has no operation that archives a Vault or Credential. A Credential's status is independent of its Vault's. +A malformed, missing or foreign ID returns 404 `not_found_error`, and so does a Credential addressed through a Vault that does not own it. Both lists order by creation time, then ID, and filter by `status` (`active`, `archived` or both) and by `metadata[key]=value`; the [list rules](./wire-semantics.md#lists) give the paging and filter details. Core stores the status privately, defaults it to `active` and has no operation that archives a Vault or Credential. A Credential's status is independent of its Vault's. ## Vaults @@ -61,21 +62,21 @@ A malformed, missing or foreign ID returns 404 `not_found_error`, and so does a | `name` | Optional. Omitted stays `null`; explicit `null` is rejected. A string is trimmed and must then hold 1–256 UTF-8 bytes (param `name`) | | `metadata` | Omitted or `null` becomes `{}`. Values must be strings; another type returns 400 `invalid_request_error` with param `metadata.`. The encoded object is limited to 64 KiB, with no pair-count or length limits | -A Vault reads as `id`, `object: "vault"`, `created_at`, `name` and `metadata`. There is no update route. +A Vault reads as `id`, `object: "vault"`, `created_at`, `name` and `metadata`. An update takes `name` and `metadata`, each optional. The name is validated as on creation and an explicit `null` clears it. `metadata` follows the official update limits of 16 pairs, 64-character keys and 512-character values; an object, including `{}`, replaces all pairs, and an omitted `metadata` keeps them. Deleting a Vault removes it and all its Credentials in one transaction, whatever their status. It needs no storage key and sends no request to any provider. The effects on Sessions are under [Deletion](#deletion). ## Credentials -Creation takes a required `name` (trimmed, 1–256 UTF-8 bytes) and an `auth` object whose `type` is `static_bearer` or `mcp_oauth`. `mcp_server_url` must be an absolute HTTPS URL without userinfo or fragment; Core keeps it byte for byte, including any query, and performs no DNS or HTTP request. Field errors name the field as param, such as `auth.type`, `auth.access_token` or `auth.mcp_server_url`, and an unknown or missing member has the official `Unknown parameter` or `Missing required parameter` message ([request validation](./wire-semantics.md#configuration-validation)). +Creation takes a required `name` (trimmed, 1–256 UTF-8 bytes), an `auth` object whose `type` is `static_bearer` or `mcp_oauth`, and optional `metadata`. Credential `metadata` follows the official limits of 16 pairs, 64-character keys and 512-character values, and non-string values return the same errors as on a Session. The pinned `environment_variable` type is rejected ([unsupported fields](./wire-semantics.md#unsupported-fields)): Core injects a Credential only through an MCP server `credential_id`, never into a process environment. `mcp_server_url` must be an absolute HTTPS URL without userinfo or fragment; Core keeps it byte for byte, including any query, and performs no DNS or HTTP request. Field errors name the field as param, such as `auth.type`, `auth.access_token` or `auth.mcp_server_url`, and an unknown or missing member has the official `Unknown parameter` or `Missing required parameter` message ([request validation](./wire-semantics.md#configuration-validation)). -A Credential reads as `id`, `vault_id`, `name`, `object: "vault.credential"`, `created_at`, `updated_at` and `auth`. `auth` holds `type` and `mcp_server_url`; an OAuth Credential adds `expires_at` and `refresh` with `client_id`, `token_endpoint`, `token_endpoint_auth.type`, `resource` and `scope`. Reads and lists need no storage key. +A Credential reads as `id`, `vault_id`, `name`, `object: "vault.credential"`, `created_at`, `updated_at`, `metadata` and `auth`. `auth` holds `type` and `mcp_server_url`; an OAuth Credential adds `expires_at` and `refresh` with `client_id`, `token_endpoint`, `token_endpoint_auth.type`, `resource` and `scope`. Reads and lists need no storage key. ### Static bearer `auth` is `{type: "static_bearer", mcp_server_url, token}`. `token` is a required nonempty string. Core stores it as opaque bytes without trimming. To run, the token must be an RFC 6750 `b64token`; a Session that selects a stored token with other characters, such as whitespace, fails at dispatch. -Replace the token with `POST /vaults/{vault_id}/credentials/{credential_id}` and exactly `{"auth": {"type": "static_bearer", "token": "…"}}`. A missing, null or empty token or any other field is rejected. Only the token and `updated_at` change; the ID, Vault, name, type, `mcp_server_url`, `created_at` and every Session binding stay. A failed replacement leaves the old token in place. +Replace the token with `POST /vaults/{vault_id}/credentials/{credential_id}` and `{"auth": {"type": "static_bearer", "token": "…"}}`; the same request may carry `metadata`, which replaces all pairs (an `{}` object clears them), and a request with `metadata` only changes just the metadata. A request with neither `auth` nor `metadata` returns 400, as the official `minProperties` requires. A missing, null or empty token or any other `auth` field is rejected. Only the token, `metadata` and `updated_at` change; the ID, Vault, name, type, `mcp_server_url`, `created_at` and every Session binding stay. A failed replacement leaves the old token in place. ### OAuth diff --git a/contracts/agents-api/wire-semantics.md b/contracts/agents-api/wire-semantics.md index 0fbc8d00c..9e0718890 100644 --- a/contracts/agents-api/wire-semantics.md +++ b/contracts/agents-api/wire-semantics.md @@ -18,8 +18,13 @@ The pinned OpenAI Python SDK ([upstream.json](https://github.com/MiniMax-AI/Open | `HEAD` on the event stream, on File, Skill, Skill version and Artifact content, and on the Environment files list | 405, so `HEAD` never holds a stream open or reads content. | | Unsupported method, including unknown methods such as `FOO` | 405, code `unsupported_operation`, message "This API method is not supported.", and an `Allow` header listing the route's methods in the order `GET,HEAD,POST,DELETE`. | | Unknown sub-route under `/v1`, including a trailing slash | 404, code `unsupported_operation`, after the Beta and authentication checks. | +| A pinned route Core does not run | See [unsupported operations](#unsupported-operations). | | `OPTIONS` and CORS | No CORS handling. | +### Unsupported operations + +The Automations routes (all 10), `POST` and `GET /agents/environments` and `GET /agents/sessions/{session_id}/traces` are registered, so they pass the Beta and authentication checks like every pinned route, then answer 404 with code `unsupported_operation` and the message "This API operation is not supported." Environments exist only inside a Session ([ownership](./environments.md#resources-and-states)), and Core has no Automations or trace store. + Creating an Agent, Vault, Credential, Environment Template, Environment file or Session returns 201, also for a streamed Session creation. An empty update body on an Agent or Environment Template advances `updated_at` and changes nothing else; timestamps have one-second precision. ### Headers @@ -108,7 +113,9 @@ Lists return `object: "list"`, `data`, `has_more`, `first_id` and `last_id`; an | Repeated supported key, including a scalar `status` | 400 `invalid_request_error`, null param, "Failed to deserialize query string: duplicate field ``" | 400 `unsupported_parameter` | 400 `duplicate_parameter`, param ``, the official message | | `order` other than `asc` or `desc`, including an explicit empty `order=` | 400 `invalid_request_error`, null param, "Failed to deserialize query string: order: unknown variant ``, expected `asc` or `desc`" | 400, null code, "order must be asc or desc." | 400 `invalid_value`, param `order`, `"Invalid value: ''. Supported values are: 'asc' and 'desc'."` | -The pinned Python SDK drops empty query values, so `list(order="")` sends no `order` and uses the default. `after` is trimmed of surrounding whitespace. Checks run in this order: repeated keys, then `limit`, then `order`; Vault and Credential `status` is checked first. These checks run before any resource lookup. +The Sessions, Vaults and Credentials lists accept `metadata[key]=value` pairs and keep the resources whose metadata holds every pair. A key is nonempty, and at most 16 pairs, 64-character keys and 512-character values apply. + +An empty `order` returns the invalid `order` error, like any value other than `asc` and `desc`. `after` is trimmed of surrounding whitespace. Checks run in this order: repeated keys, then `limit`, then `order`; Vault and Credential `status` is checked first. These checks run before any resource lookup. Vault and Credential lists accept `status` as a scalar, as `status[]` entries, or both, and filter by their union. Both statuses are listed by default. Another value returns 400 `invalid_request_error` with a null param and "Failed to deserialize query string: status: data did not match any variant of untagged enum VaultStatusFilterParam". @@ -116,13 +123,12 @@ Vault and Credential lists accept `status` as a scalar, as `status[]` entries, o | Lists | Default | Accepted | Other values | | --- | --- | --- | --- | -| Agents, Sessions, Items, Environment Templates, Subagent Items, Subagent Turn Items | 20 | 1–100 | 0 becomes 1; above 100 becomes 100 | -| Vaults, Credentials | 20 | 1–100 | 0, negative and larger integers, including overflowing ones, are clamped into 1–100 | +| Agents, Sessions, Items, Turn Items, Environment Templates, Vaults, Credentials, Subagent Items, Subagent Turn Items | 20 | 1–100 | 0 becomes 1; above 100 becomes 100 | | Turns, Subagents, Subagent Turns, Artifacts | 20 | 1–100 | 400 `invalid_request_error`, "limit must be between 1 and 100" | | Skills, Skill versions | 20 | 0–100 | 0 returns an empty page whose `has_more` reports whether a resource follows the cursor. Negative: 400 `integer_below_min_value`, param `limit`. Above 100: 400 `integer_above_max_value`, param `limit` | | Files | 10000 | 1–10000 | 400 with a null code, "limit must be between 1 and 10000." | -A `limit` that is not a decimal integer, including an empty value, returns 400 `invalid_request_error`, "Failed to deserialize query string: limit: invalid digit found in string" on Beta lists; outside Vault and Credential lists, a value above the signed 64-bit range returns "Failed to deserialize query string: limit: number too large to fit in target type". A leading `+` is accepted when encoded as `%2B`; a leading `-` returns the invalid-digit error on Beta lists except Vaults and Credentials. Skills return `invalid_request`, "limit must be an integer between 0 and 100."; Files return `invalid_request` with the Files range message. +A `limit` that is not a decimal integer, including an empty value, returns 400 `invalid_request_error`, "Failed to deserialize query string: limit: invalid digit found in string" on Beta lists, and a value above the signed 64-bit range returns "Failed to deserialize query string: limit: number too large to fit in target type". A leading `+` is accepted when encoded as `%2B`; a leading `-` returns the invalid-digit error on Beta lists. Skills return `invalid_request`, "limit must be an integer between 0 and 100."; Files return `invalid_request` with the Files range message. ### Cursors @@ -131,7 +137,7 @@ A `limit` that is not a decimal integer, including an empty value, returns 400 ` | Lists | Response | | --- | --- | | Agents, Sessions, Turns, Environment Templates, Vaults, Credentials | 404, type and code `not_found_error`, "Resource not found." | -| Session Items, Subagent Items, Subagent Turn Items | 400 `invalid_request_error`, null param, "Invalid session item ID in `after`" | +| Session Items, Turn Items, Subagent Items, Subagent Turn Items | 400 `invalid_request_error`, null param, "Invalid session item ID in `after`" | | Subagents, Subagent Turns | 400 `invalid_request_error`, null param, "Invalid resource ID in `after`" | | Session Artifacts | 400 `invalid_request_error`, null param, "after is not a valid artifact ID" | | Skill versions | A value that does not begin with `skillver`: 400 `invalid_value`, param `after`, `"Invalid 'after': ''. Expected an ID that begins with 'skillver'."` A version of another Skill: the same fields, "Skill version cursor does not match this skill." A malformed `skillver` suffix or a missing, deleted or foreign version: 404 with a null code and param | @@ -155,6 +161,7 @@ Agent create requires `model`. Core saves and returns these values for omitted f | `multi_agent` | Disabled. When enabled without `max_concurrent_subagents`, 6 | | Function `defer_loading` | `false` | | `programmatic_tool_calling.enabled` | `true` | +| `compaction`, `experimental` | Core saves `compaction` only with an explicit `async` and otherwise omits it: an omitted, null or empty `compaction`, or a null `async`, is the official default of background compaction, and the Harness runs its native blocking compaction instead. A null `compaction` on update clears the saved value. `experimental` always reads `{"time_awareness": false}` unless set, an `experimental` object without members keeps the saved value, and an update or Session override changes only the members it sends | | `web_search` | Every pinned mode is saved; see [tool policy](./execution-tools.md#web-search-and-programmatic-tool-calling) | | HTTP MCP transport | Saved with `headers: {}`; nonempty headers are stored as given and an `Authorization` header is rejected. Origin and allowlist defaults are in [public MCP connection origin](./environments.md#public-mcp-connection-origin) | @@ -182,13 +189,29 @@ Within one object Core reports a union's `type` first, then unknown members, the Core saves values the pinned shapes allow even when the selected Harness cannot run them: function names of any length and the reasoning, service tier, web search and programmatic tool calling values a Harness does not declare. +### Unsupported fields + +These official fields have no Core meaning. A request that sets one returns 400 `invalid_request_error` with the field as `param` and no write: + +| Field | Param | +| --- | --- | +| Session update `agent` with any member; `{}` changes nothing | `agent` | +| Session `review: auto_review` on create or update; `none` is accepted and responses omit `review` | `review` | +| `environment.environment_id` | `environment_id` | +| `environment.container_size`; responses carry `container_size: null` | `container_size` | +| `desktop.enabled: true`; responses carry `desktop: {"enabled": false}` | `desktop.enabled` | +| A nonempty `network.blocked_domains` | `network.blocked_domains` | +| Credential `auth.type` `environment_variable` | `auth.type` | +| The Session input `agent.session.input.computer_use_approval_request_result` | `events[N].type` | + ### Session admission A Session's effective configuration must also pass execution admission, which applies to saved and inline configuration alike. Admission reports protocol errors from the table above first, including duplicate tools and schema roots in saved Agents, then these, all 400 `unsupported_or_invalid_configuration` before any write: | Configuration | Message | | --- | --- | -| A `reasoning.effort`, `reasoning.summary`, `service_tier`, `web_search` mode or setting, `programmatic_tool_calling` value or `text.verbosity` the Harness does not declare | A message naming the field, such as `reasoning.effort "max" is not supported by this Harness.`; see [tool policy](./execution-tools.md#web-search-and-programmatic-tool-calling) and [Harness capabilities](./harness-capabilities.md#execution-and-input) | +| A `reasoning.effort`, `reasoning.summary`, `service_tier` (including `ultrafast`), `web_search` mode or setting, `programmatic_tool_calling` value or `text.verbosity` the Harness does not declare | A message naming the field, such as `reasoning.effort "max" is not supported by this Harness.`; see [tool policy](./execution-tools.md#web-search-and-programmatic-tool-calling) and [Harness capabilities](./harness-capabilities.md#execution-and-input) | +| `compaction.async: true`, `experimental.time_awareness: true`, or an `automations` or `computer_use` tool, on every Harness, since none runs them natively | A message naming the field, such as `compaction.async=true is not supported.` | | A function name that is blank or repeated | "Function names must be nonempty and unique." | | A Harness that does not declare `retained_native_history`, on a sandbox provider that keeps every Environment on workspace storage ([Harness capabilities](./harness-capabilities.md)) | "This Session's harness does not retain its native history, which the sandbox provider's workspace storage requires. Use a harness that supports retained_native_history, or a sandbox provider with its own disk." | @@ -228,9 +251,9 @@ Keys are scoped to the Project; any key of the Project, including one issued aft ### Update and list -`POST /agents/sessions/{session_id}` accepts only `metadata`, which is required: null or `{}` clears it and an object replaces all pairs. Execution state and the creation retry identity are unchanged. +`POST /agents/sessions/{session_id}` changes only `metadata`: null or `{}` clears it and an object replaces all pairs. A body with only `review` or an empty `agent` changes nothing and returns the Session; a body with none of `metadata`, `agent` or `review` returns 400. An `agent` with members is rejected ([unsupported fields](#unsupported-fields)). Execution state and the creation retry identity are unchanged. -`GET /agents/sessions` accepts `agent_id`, which matches the Session's immutable root Agent ID, including inline Agent IDs and Agents that were since updated or deleted. The filter applies before pagination; an empty `agent_id` is a filter, not an omission. +`GET /agents/sessions` accepts `agent_id`, which matches the Session's immutable root Agent ID, including inline Agent IDs and Agents that were since updated or deleted. The filter applies before pagination; an empty `agent_id` is a filter, not an omission. The [`metadata` filter](#query-parameters) applies too. ### Delete diff --git a/contracts/agents-api/zh/environment-files.md b/contracts/agents-api/zh/environment-files.md index 7aa6205da..69c107e24 100644 --- a/contracts/agents-api/zh/environment-files.md +++ b/contracts/agents-api/zh/environment-files.md @@ -1,12 +1,12 @@ --- title: "Environment 文件与 Artifact" source: contracts/agents-api/environment-files.md -source_hash: ad6e0c122104ff5600d07305902871253c81aef0525e12358a5cc8abdc42600a +source_hash: 0ed7d7e903ead70f209808a991c15e6156749f7abb111b145b1de1f58d3037d8 --- Session 工作区保存由 agent 及其工具修改的实时文件。`/agents/environments/{environment_id}/files` 列出一个工作区目录,并在其中创建文件。Turn 完成时,Core 将工作区 `outputs/` 目录中的文件复制为不可变 Artifact,通过 `/agents/sessions/{session_id}/artifacts` 读取。Artifact 的生命周期长于 Environment;工作区文件则不是。 -路由遵循 [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json) 中固定版本 SDK:[Environment files 资源](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents/environments/files.py)、[列表参数](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/agents/environments/file_list_params.py)、[EnvironmentFile](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/agents/environments/environment_file.py) 和 [TokenPage](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/pagination.py)。要求 `OpenAI-Beta: agents=v1` 头。 +路由遵循 [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json) 中固定版本 SDK:[Environment files 资源](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents/environments/files.py)、[列表参数](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/agents/environments/file_list_params.py)、[EnvironmentFile](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/agents/environments/environment_file.py) 和 [TokenPage](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/pagination.py)。要求 `OpenAI-Beta: agents=v1` 头。 ## 文件适用范围 {#where-files-work} diff --git a/contracts/agents-api/zh/environments.md b/contracts/agents-api/zh/environments.md index d0d6f4aa3..e85093ea0 100644 --- a/contracts/agents-api/zh/environments.md +++ b/contracts/agents-api/zh/environments.md @@ -1,7 +1,7 @@ --- title: "Environment 与模板" source: contracts/agents-api/environments.md -source_hash: 86e73d81ff9ccf658d542d3424ddee590b5914e868cd756e4f1cf85ba1b7996c +source_hash: 029df42249e47ea130d35b2883572e3f89f10bf2fbd756060f2e53cd63559e11 --- Environment 是 Session 的执行资源,包括 Harness 运行所在的机器、工作区以及已完成准备的能力。Session 通过其 `environment` 配置创建 Environment;不存在独立的 create 调用。Environment 模板是 Session 创建时解析的可复用准备配置。本契约涵盖这两类资源、两种放置方式、输入接纳、能力准备、Skills、Plugins 和 MCP 连接来源。 @@ -20,13 +20,14 @@ Environment 是 Session 的执行资源,包括 Harness 运行所在的机器 | 资源 | 操作 | 规则 | | --- | --- | --- | -| [Environment](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents/environments/environments.py) | `GET /agents/environments/{id}` | 通过 Session 配置创建。返回 `id`、`type`、`status`,以及 Session 创建时记录的 `files`、`plugins` 和 `skills`。 | -| [模板](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents/environments/templates.py) | `POST`、`GET /agents/environments/templates`;`GET`、`POST`、`DELETE /agents/environments/templates/{id}` | 请参阅 [模板](#templates)。 | -| [Files](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents/environments/files.py) | `POST`、`GET /agents/environments/{id}/files` | 请参阅 [Environment files](environment-files.md)。 | +| [Environment](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents/environments/environments.py) | `GET /agents/environments/{id}` | 通过 Session 配置创建。返回 `id`、`type`、`status`,以及 Session 创建时记录的 `files`、`plugins` 和 `skills`。 | +| Environment 集合 | `POST`、`GET /agents/environments` | 不支持:404 `unsupported_operation`([不支持的操作](wire-semantics.md#unsupported-operations))。Environment 只能通过 Session 配置创建。 | +| [模板](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents/environments/templates.py) | `POST`、`GET /agents/environments/templates`;`GET`、`POST`、`DELETE /agents/environments/templates/{id}` | 请参阅 [模板](#templates)。 | +| [Files](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents/environments/files.py) | `POST`、`GET /agents/environments/{id}/files` | 请参阅 [Environment files](environment-files.md)。 | 读取 Environment 时,Core 会在调用方的项目范围内与其实时所属的 Session 联查,并返回持久化的连接状态。它不需要活跃的 Runtime,不会启动任何原生工作,也不会改变连接状态。对于两种放置方式,安装项数组都会列出由 API 管理的文件、Plugins 和 Skills:文件使用 `{id, type, path, file_id, size_bytes}` 且不含内容,Skills 使用 `{type, name, description, skill_id, version}`,Plugins 使用 `{type, name, description}`。在本地能力目录中发现的 Capabilities 不会列出。 -[Session environment input](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/environment_param.py) 与 [output](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/environment.py) 的结构不同: +[Session environment input](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/environment_param.py) 与 [output](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/environment.py) 的结构不同: - `none` 不选择任何 Environment。 - `self_hosted` 输入要求提供 `workspace_directory`;可空的 `capability_directories` 默认为空列表。输出会增加 Environment ID 和仅输出字段 `remote_url`。输出中 `/workspace` 的默认值不会使输入字段变为可选。 @@ -34,10 +35,10 @@ Environment 是 Session 的执行资源,包括 Harness 运行所在的机器 | 投影 | 状态 | | --- | --- | -| [Environment resource](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/agents/environment_info.py) | `pending`、`connected`、`disconnected`、`expired`、`failed` | -| [Session environment event](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/beta/agent_session_environment_state.py) | `pending`、`ready`、`connected`、`disconnected`、`failed`,并带可为 null 的 error | +| [Environment resource](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/agents/environment_info.py) | `pending`、`ready`、`connected`、`disconnected`、`suspended`、`expired`、`failed` | +| [Session environment event](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/beta/agent_session_environment_state.py) | 相同的七种状态,并带可为 null 的 error | -这两套词汇彼此独立;绝不要将其中一套转换为另一套。资源状态按下图变化,失败或过期的 Environment 不再改变: +Core 只在事件中发出 `ready`。它从不报告 `suspended`,即使是它已做检查点并停止的空闲 hosted Environment;它也不发出 `agent.session.environment.suspended`、`.expired` 或 `.reset` 事件;保留期结束的 Environment 读作 `expired`,但没有对应事件。资源状态按下图变化,失败或过期的 Environment 不再改变: ```mermaid stateDiagram-v2 diff --git a/contracts/agents-api/zh/harness-capabilities.md b/contracts/agents-api/zh/harness-capabilities.md index e68726836..ef3cf329a 100644 --- a/contracts/agents-api/zh/harness-capabilities.md +++ b/contracts/agents-api/zh/harness-capabilities.md @@ -1,7 +1,7 @@ --- title: "Harness 能力" source: contracts/agents-api/harness-capabilities.md -source_hash: 3fa50dff498df9d38e50c5081ed7c5448963f21f1522a4503452057954b63125 +source_hash: f83d80711825f65c897822f172f3a979f3e996eb864355f18f128751575f810d --- 本页列出每个 Harness 在每种部署位置支持的能力。Core 根据 `internal/harnessconfig//declaration.go` 中 Harness 的声明决定准入,运行 Session 的 Runtime 也必须声明操作。所链接契约定义各操作;[Harness 接入](harness-onboarding.md#qualify-the-adapter)说明资格验证方法。 @@ -27,8 +27,9 @@ source_hash: 3fa50dff498df9d38e50c5081ed7c5448963f21f1522a4503452057954b63125 | [消息图像](message-content.md#images) | PNG、JPEG data URL:所有位置已验证;其他 data URL:已准入;远程 URL:已拒绝 | PNG、JPEG data URL:所有位置已验证;远程 URL 及 GIF、WebP data URL:已准入 | 已拒绝 | | `reasoning.effort` | `none`、`minimal`、`low`、`medium`、`high`、`xhigh`、`max`:已准入 | `low`、`medium`、`high`、`xhigh`、`max`:已准入 | `none`、`minimal`、`low`、`medium`、`high`、`xhigh`、`max`:已准入 | | `reasoning.summary` | `concise`、`detailed`、`auto`:已准入 | `auto`:已准入 | 已拒绝 | -| 非 `auto` 的 `service_tier` | `default`、`flex`、`priority`、`fast`:已准入 | 已拒绝 | 已拒绝 | +| 非 `auto` 的 `service_tier` | `default`、`flex`、`priority`、`fast`:已准入;`ultrafast` 已拒绝 | 已拒绝 | 已拒绝 | | 非 `medium` 的 `text.verbosity` | 已准入;由原生模型决定 | 已拒绝 | 已拒绝 | +| `compaction.async: true`、`experimental.time_awareness: true`,以及 `automations` 和 `computer_use` 工具 | 已拒绝 | 已拒绝 | 已拒绝 | | [公开 token 用量](sessions-events.md) | 测量计数器 | Null | Null | 各 Harness 原生模型参数及提供商协议见[模型执行](model-execution.md)。 diff --git a/contracts/agents-api/zh/index.md b/contracts/agents-api/zh/index.md index 9ef32d857..e8d5c9326 100644 --- a/contracts/agents-api/zh/index.md +++ b/contracts/agents-api/zh/index.md @@ -1,7 +1,7 @@ --- title: "OpenAI 兼容性" source: contracts/agents-api/index.md -source_hash: bd7dc591ce52a44b12c19d86054cf56ce0f163038361617660203c4f139022ce +source_hash: f2b074b5f3011d44555f0abb890f1426e59f676902206c18e4a79b428e37bc8a --- Core 实现下方固定版本的 OpenAI Agents API。本台账列出各项资源的覆盖情况、相对于官方服务的所有差异以及已知缺口。 @@ -12,8 +12,8 @@ Core 实现下方固定版本的 OpenAI Agents API。本台账列出各项资源 | 文件 | 内容 | | --- | --- | -| [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json) | 固定版本:提交 `d7c41ef` 时的 [openai-python](https://github.com/openai/openai-python/tree/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/beta/agents) 3.13.0;资源位于 `beta/agents` 下;Beta 标头为 `agents=v1` | -| [upstream/openapi.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream/openapi.json) | 未修改的官方 OpenAPI 3.1,固定提交为 `046a2a0f325bf11f97966f2729219f27281ba71e`,发布于 2026-09-10。其中 58 个 Agents、Vaults、Files 和 Skills 操作与固定 SDK 的路由集合一致。`upstream.json` 记录 SHA-256 校验和 | +| [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json) | 固定版本:提交 `9b3458a` 时的 [openai-python](https://github.com/openai/openai-python/tree/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/beta/agents) 3.45.0;资源位于 `beta/agents` 下;Beta 标头为 `agents=v1` | +| [upstream/openapi.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream/openapi.json) | 未修改的官方 OpenAPI 3.1,固定提交为 `820f97adaafea8cadf1e24e19bd3f98463dcb347`,发布于 2026-11-03。其中 73 个 Agents、Vaults、Files 和 Skills 操作与固定 SDK 的路由集合一致。`upstream.json` 记录 SHA-256 校验和 | | [upstream-routes.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream-routes.json) | 从官方 schema 生成的标准化方法和路径清单 | | [openapi.yaml](../openapi.yaml) | 官方公共契约,并在 Agent 和 Session 请求及响应对象上加入 Core 的 `x_agents_core` 扩展 | | [go-bindings.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/go-bindings.json) | Go 名称、字段表示、编码顺序和存储投影;不定义官方字段集合、枚举或约束 | @@ -30,19 +30,22 @@ Core 实现下方固定版本的 OpenAI Agents API。本台账列出各项资源 | 资源 | 操作 | 状态 | 契约 | | --- | --- | --- | --- | | Agents | create, retrieve, update, list, delete | 已实现。所有固定版本设置都会保存;Session 准入只会用到其中一个子集 | [Agents](wire-semantics.md#agents) | -| Sessions | create (JSON 或流式), retrieve, update, list, delete | 已实现。更新仅接受 `metadata`;删除要求 Session 处于空闲或失败状态 | [Sessions](wire-semantics.md#sessions)、[creation streaming](sessions-events.md#creation-streaming) | +| Sessions | create (JSON 或流式), retrieve, update, list, delete | 已实现。更新只修改 `metadata`,并拒绝 `agent`;列表支持按 `metadata[key]=value` 过滤;删除要求 Session 处于空闲或失败状态 | [Sessions](wire-semantics.md#sessions)、[creation streaming](sessions-events.md#creation-streaming) | | Session events | create, stream | 部分实现:支持包含文本和图像的消息、取消和函数结果;流仅支持实时模式 | [Sessions, events and history](sessions-events.md)、[message content](message-content.md) | -| Turns | retrieve, list | 已实现;Session Turn 路由仅承载根级 Turns | [Turns and Items](sessions-events.md#turns-and-items) | +| Turns | retrieve, list; Turn Items | 已实现;Session Turn 路由仅承载根级 Turns | [Turns and Items](sessions-events.md#turns-and-items) | | Items | list | 部分实现:支持消息、命令、MCP 调用、functions、web search、reasoning 和 Subagent 协调 Items;其他原生变体不会被投影 | [Turns and Items](sessions-events.md#turns-and-items) | | Artifacts | retrieve, list, delete, content | 已实现 | [Environment files and Artifacts](environment-files.md) | | Subagents | retrieve, list; Items; Turns retrieve and list; Turn Items | 部分实现:只读子级工作;不支持实时子级进度或可选原生操作 | [Subagents](subagents.md) | -| Environments | retrieve | 已实现;以 Session 为范围([归属](environments.md#resources-and-states))。固定版本契约会拒绝 `environment.environment_id`;已有 hosted Environment 无法跨 Session 关联。跨 Session 共享的工作区属于应用([项目拥有资产](../../../docs/zh/concepts.md#projects-own-assets)) | [Environments](environments.md) | +| Environments | retrieve | 已实现;以 Session 为范围([归属](environments.md#resources-and-states))。Core 拒绝 `environment.environment_id`,因此已有 hosted Environment 无法关联到另一个 Session。跨 Session 共享的工作区属于应用([项目拥有资产](../../../docs/zh/concepts.md#projects-own-assets)) | [Environments](environments.md) | | Environment files | create, list | 已实现;列表不会递归 | [Environment files and Artifacts](environment-files.md) | | Environment 模板 | create, retrieve, update, list, delete | 已实现;执行限制列于 [known gaps](#known-gaps) | [Environment 模板](environments.md#templates) | -| Vaults | create, retrieve, list, delete | 已实现 | [Vaults and Credentials](vaults.md) | -| Vault Credentials | create, retrieve, update, list, delete | 已支持 `static_bearer` 和 `mcp_oauth` | [Vaults and Credentials](vaults.md) | +| Vaults | create, retrieve, update, list, delete | 已实现 | [Vaults and Credentials](vaults.md) | +| Vault Credentials | create, retrieve, update, list, delete | 已支持 `static_bearer` 和 `mcp_oauth`,含 `metadata` | [Vaults and Credentials](vaults.md) | | Files | create, retrieve, list, delete, content | 已支持 `purpose=user_data`;内容下载会被拒绝 | [Files and Skills](source-files.md) | | Skills and Skill versions | create, retrieve, update, list, delete, content | 已实现 | [Files and Skills](source-files.md) | +| Automations | 全部 10 个操作 | 不支持:404 `unsupported_operation` | [不支持的操作](wire-semantics.md#unsupported-operations) | +| Environment 集合 | create, list(`/agents/environments`) | 不支持:404 `unsupported_operation`;Core 的 Environment 以 Session 为范围 | [不支持的操作](wire-semantics.md#unsupported-operations) | +| Session traces | list | 不支持:404 `unsupported_operation` | [不支持的操作](wire-semantics.md#unsupported-operations) | 各 Harness 在不同部署位置支持哪些操作,请参阅 [Harness capabilities](harness-capabilities.md)。[API 行为](wire-semantics.md) 包含适用于各项资源的通用规则:请求、错误和列表。 @@ -68,12 +71,13 @@ Core 自身字段位于 `x_agents_core` 中([Core extensions](../../../docs/zh - 将已删除的 Agent 用作游标时会返回 404;官方服务仍可从该游标继续分页。 - 使用来自其他 Session 的 Turn 游标、与 Vault ID 相等的 Credential 游标,或不是 Skill ID 的 Skills 游标时,都会返回 404。 -- Vault 和 Credential 列表会按照固定版本 SDK 的描述钳制负数 `limit`;官方服务返回 400。 **Agents 和 Sessions**([Agents](wire-semantics.md#agents)、[Sessions](wire-semantics.md#sessions)) - 使用相同 `Idempotency-Key` 重复创建 Session 会返回原 Session;官方服务会创建一个新的 Session。 - 未指定程序化工具调用时,会保留 Harness 的原生行为;官方默认值为启用。 +- 官方默认的压缩方式是后台压缩,Core 改为运行 Harness 原生的阻塞式压缩([Agents](wire-semantics.md#agents))。 +- Core 以 400 拒绝并指出参数的方式处理其没有原生对应的官方字段和输入([不支持的字段](wire-semantics.md#unsupported-fields)),并对其不运行的路由返回 404 `unsupported_operation`([不支持的操作](wire-semantics.md#unsupported-operations))。 - Agent 未声明 `web_search` 工具时,会保留 Harness 的[原生搜索](./execution-tools.md#web-search-and-programmatic-tool-calling);固定的官方契约未定义未声明该工具时是否搜索。 - 工作区位置上的 Claude Code 把 Agent 的 `instructions` 追加到原生系统提示词之后,并运行其[原生工具集](./execution-tools.md#web-search-and-programmatic-tool-calling)。其搜索没有缓存模式,也没有域名、位置和上下文大小设置。 - Claude Code 在原生层丢弃仅含空白的文本块,全空白消息会发送 `(no content)`;Codex 原样交付仅含空白的文本。 @@ -141,7 +145,8 @@ Core 自身字段位于 `x_agents_core` 中([Core extensions](../../../docs/zh **配置和工具** -- 所选 Harness 未声明的 `reasoning.effort`、`reasoning.summary`、`service_tier`、`text.verbosity`、`web_search` 模式或设置、`programmatic_tool_calling` 取值,会被保存,但在 Session 准入时被拒绝([Harness 能力](harness-capabilities.md#execution-and-input))。 +- 所选 Harness 未声明的 `reasoning.effort`、`reasoning.summary`、`service_tier`(含 `ultrafast`)、`text.verbosity`、`web_search` 模式或设置、`programmatic_tool_calling` 取值会被保存,但在 Session 准入时被拒绝([Harness 能力](harness-capabilities.md#execution-and-input))。 +- `compaction.async: true`、`experimental.time_awareness: true` 以及 `automations` 和 `computer_use` 工具会被保存,但对所有 Harness 都在 Session 准入时被拒绝,因为没有 Harness 原生运行它们([Session 准入](wire-semantics.md#session-admission))。 - Harness 对工具、结构化输出、延迟发现、subagents 和 MCP 的支持因 Harness 和部署位置而异;请参阅 [Harness capabilities](harness-capabilities.md)。MiniMax Code 不支持图像输入,且 `instructions` 最多 32 KiB。 - 由模型推导出的推理默认值不会被解析确定。 @@ -161,6 +166,7 @@ Core 自身字段位于 `x_agents_core` 中([Core extensions](../../../docs/zh **Environments 和模板** +- Core 从不报告 `suspended` 状态,也不发出 `suspended`、`expired` 和 `reset` Environment 事件([资源与状态](environments.md#resources-and-states))。 - Hosted 工作区准入受[租户容量策略](../../../docs/zh/configuration.md#tenant-capacity)及既有[输入预留截止时间](environments.md#reservations)限制。 - MiniMax Code 未声明 `retained_native_history`,因此无法在 microsandbox 上运行(其每个 Environment 都使用工作区存储);Core 会拒绝该 Session([Harness 能力](./harness-capabilities.md))。 - 模型提供商在公开地址上的端口从沙箱内始终可达,因为 Harness 运行在那里,私有的模型提供商主机只有在网络上限列出其名称或覆盖它的 `*.` 条目时才可达;`disabled` 下主机 53 端口上的 DNS 服务器仍可达;Environment 中的 MCP 连接遵循部署的[网络上限](sandbox-deployment.md#network)。E2B 沙箱无法访问私有网络,且在任何上限下 `169.254.169.254` 都会在 E2B 沙箱内应答。 @@ -172,7 +178,6 @@ Core 自身字段位于 `x_agents_core` 中([Core extensions](../../../docs/zh **Files 和 Environment files** - Files 仅接受 `purpose=user_data`;不支持其他 `purpose` 值、`expires_after` 和 Uploads API。 -- Skills 创建路由接受单个 `files` 部分,但当 `files` 是单个文件而不是列表时,固定版本的 SDK 不会发送任何部分([上传 bundle](source-files.md#upload-a-bundle))。 - 结果不确定的 Environment file 写入不会自动重试或恢复;它会阻止后续写入以及向 Session 发送消息。 **Vaults 和 Credentials** @@ -183,6 +188,7 @@ Core 自身字段位于 `x_agents_core` 中([Core extensions](../../../docs/zh **Sessions** +- 固定版本 SDK 在 Session 创建和更新中发送 `spend_control`,但固定的 OpenAPI 模式没有定义它;Core 将其作为未知参数拒绝。 - 删除 Session 不会从物理存储中清除已保存的历史记录。 - 对于 `self_hosted`、hosted 和无输入创建的流生命周期,以及创建流重试机制,均由 Core 自行决定。 diff --git a/contracts/agents-api/zh/sessions-events.md b/contracts/agents-api/zh/sessions-events.md index eca247040..ff512094e 100644 --- a/contracts/agents-api/zh/sessions-events.md +++ b/contracts/agents-api/zh/sessions-events.md @@ -1,7 +1,7 @@ --- title: "Session、事件和历史" source: contracts/agents-api/sessions-events.md -source_hash: ffddefb51fd2dcd04532d210f658caf96a6f825057c9025c3c18dbf8eb3ddc5a +source_hash: 180e08dbdd9c85ae85005cc202f73316f2b1b04828cca67df13b804206f49f02 --- 本契约涵盖 Session 内部发生的事情:发送输入、实时事件流,以及读取 Turn、Item 和使用量的持久化历史。Session 资源本身(创建配置、重试标识、更新、列出和删除)见 [API 行为](wire-semantics.md)。消息和函数结果内容见[消息内容](message-content.md)。[Agents API 指南](../../../docs/zh/api/public-agent-api.md)展示了使用 SDK 和 HTTP 的调用方式。 @@ -132,7 +132,7 @@ Turn 和 Item 列表接受 `after`、`limit` 和 `order`([列表规则](wire-s **Turn。** Session Turn 路由只包含根 Turn,按创建时间、再按 ID 排序;在该路由中使用子 Turn ID 会返回 404。失败 Turn 的 `error` 包含官方 `code` 和该 code 对应的固定消息,绝不包含引擎原始诊断信息;[与 OpenAI 的差异](index.md#differences-from-openai)列出 Core 报告的 code。流中的快照与读取返回相同的 `error`。管理员可通过[Session 诊断](session-diagnostics.md)读取失败类别。 -**Item。** Item 按首次观察时间、再按其在 Session 中的位置、最后按 ID 排序。更新和重试绝不会移动 Item,也不会更改其 `output_index`;`output_index` 是 Item 在该 Turn 输出 Item 中从零开始的位置,输入 Item 没有此值。读取操作使用已存储的历史索引,绝不会根据原生日志重新构建该索引。Item 列表包含仍在进行中或尚未完成的 Item。 +**Item。** Item 按首次观察时间、再按其在 Session 中的位置、最后按 ID 排序。更新和重试绝不会移动 Item,也不会更改其 `output_index`;`output_index` 是 Item 在该 Turn 输出 Item 中从零开始的位置,输入 Item 没有此值。读取操作使用已存储的历史索引,绝不会根据原生日志重新构建该索引。Item 列表包含仍在进行中或尚未完成的 Item。`GET /agents/sessions/{session_id}/turns/{turn_id}/items` 只列出该根 Turn 的 Item,分页、排序和游标规则相同;Session 中不存在的 Turn 返回 404。 | Item `type` | 内容 | | --- | --- | diff --git a/contracts/agents-api/zh/source-files.md b/contracts/agents-api/zh/source-files.md index f0edfd5de..843e3e31e 100644 --- a/contracts/agents-api/zh/source-files.md +++ b/contracts/agents-api/zh/source-files.md @@ -1,12 +1,12 @@ --- title: "文件与 Skill" source: contracts/agents-api/source-files.md -source_hash: a87f5745f8d96e7399726fa99cb8c69fc083ee03faf122bce7c4fc33ad95b5d0 +source_hash: d5f0952e765550f370491c52556ae0fee60df3c279c304bdf0bb333319f00eb3 --- Files(`/v1/files`)和 Skills(`/v1/skills`)是具有独立生命周期的项目资源,不依赖 Session。File 保存上传字节,Environment 通过 ID 复制它们。Skill 保存不可变、版本化的包,由模板和 Session 引用。项目的所有 API 密钥共享这些资源。 -这些路由遵循 [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json) 中固定版本 SDK:[Files 资源](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/files.py)、[创建参数](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/file_create_params.py)、[FileObject](https://github.com/openai/openai-python/blob/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/types/file_object.py) 和 [Skills 资源](https://github.com/openai/openai-python/tree/d7c41efee1b0802b79f3f88a678ef2052b06e9ce/src/openai/resources/skills)。要求项目 API 密钥,不要求 `OpenAI-Beta` 头。不存在 ID 与其他项目的 ID 返回相同的 404。 +这些路由遵循 [upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json) 中固定版本 SDK:[Files 资源](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/files.py)、[创建参数](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/file_create_params.py)、[FileObject](https://github.com/openai/openai-python/blob/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/types/file_object.py) 和 [Skills 资源](https://github.com/openai/openai-python/tree/9b3458a2ef563493111a0a4265d4e9e7e14fe840/src/openai/resources/skills)。要求项目 API 密钥,不要求 `OpenAI-Beta` 头。不存在 ID 与其他项目的 ID 返回相同的 404。 ## 文件 {#files} @@ -77,7 +77,7 @@ Core 在自身数据库中以 PostgreSQL 大对象存储 File 字节。上传和 ### 上传包 {#upload-a-bundle} -将一个 ZIP 作为 `files` 部分发送,或将目录作为重复的 `files[]` 部分发送,文件名使用 `report/SKILL.md` 等相对路径。SDK 3.13.0 在 `files` 为单文件而非列表时不发送部分,因此上传单个 ZIP 应使用普通 HTTP: +将一个 ZIP 作为 `files` 部分发送,或将目录作为重复的 `files[]` 部分发送,文件名使用 `report/SKILL.md` 等相对路径。使用普通 HTTP: ```sh curl "$OPENAI_BASE_URL/skills" -H "Authorization: Bearer $OPENAI_API_KEY" -F files=@report.zip diff --git a/contracts/agents-api/zh/vaults.md b/contracts/agents-api/zh/vaults.md index 9ccb10475..ddc72d025 100644 --- a/contracts/agents-api/zh/vaults.md +++ b/contracts/agents-api/zh/vaults.md @@ -1,7 +1,7 @@ --- title: "Vault 与 Credential" source: contracts/agents-api/vaults.md -source_hash: 3ef927a873326ca5a14720843269c8c05053331e616305fcccfdf0e4367f4be2 +source_hash: 675f69ae97615840a79350e16320f90702cdeb72826288945804cf0825c83b92 --- Vault 是项目所有的 Credential 容器。Credential 保存一个 HTTPS MCP server 的秘密:`static_bearer` token 或 `mcp_oauth` grant。Session 在 `vault_ids` 中关联 Vault;Core 在创建 Session 时为每个 HTTP MCP server 选择一个 Credential,只在分派工作时将解密 token 交给 Runtime。秘密只能写入:任何读取都不返回 token、refresh token、client secret 或密文。 @@ -46,15 +46,16 @@ MCP tool 可以通过 `credential_id` 指定 Credential;未指定时,Core | --- | --- | --- | | 创建 Vault | `POST /vaults` | 201 Vault | | 查询 Vault | `GET /vaults/{vault_id}` | Vault | +| 更新 Vault | `POST /vaults/{vault_id}` | Vault | | 列出 Vault | `GET /vaults` | Vault 列表 | | 删除 Vault | `DELETE /vaults/{vault_id}` | `{id, object: "vault.deleted", deleted: true}` | | 创建 Credential | `POST /vaults/{vault_id}/credentials` | 201 Credential | | 查询 Credential | `GET /vaults/{vault_id}/credentials/{credential_id}` | Credential | | 列出 Credential | `GET /vaults/{vault_id}/credentials` | Credential 列表 | -| 替换秘密 | `POST /vaults/{vault_id}/credentials/{credential_id}` | Credential | +| 更新 Credential | `POST /vaults/{vault_id}/credentials/{credential_id}` | Credential | | 删除 Credential | `DELETE /vaults/{vault_id}/credentials/{credential_id}` | `{id, object: "vault.credential.deleted", deleted: true}` | -格式错误、缺失或其他项目的 ID 返回 404 `not_found_error`;通过非所属 Vault 访问 Credential 也一样。两个列表按创建时间、再按 ID 排序,按 `status`(`active`、`archived` 或二者)筛选;[列表规则](wire-semantics.md#lists)说明分页和筛选细节。Core 私有保存 status,默认 `active`,没有归档 Vault 或 Credential 的操作。Credential 的 status 独立于 Vault。 +格式错误、缺失或其他项目的 ID 返回 404 `not_found_error`;通过非所属 Vault 访问 Credential 也一样。两个列表按创建时间、再按 ID 排序,按 `status`(`active`、`archived` 或二者)和 `metadata[key]=value` 筛选;[列表规则](wire-semantics.md#lists)说明分页和筛选细节。Core 私有保存 status,默认 `active`,没有归档 Vault 或 Credential 的操作。Credential 的 status 独立于 Vault。 ## Vault {#vaults} @@ -63,21 +64,21 @@ MCP tool 可以通过 `credential_id` 指定 Credential;未指定时,Core | `name` | 可选;省略保持 `null`,显式 `null` 被拒绝。字符串去除首尾空白后必须为 1–256 UTF-8 字节(param 为 `name`) | | `metadata` | 省略或 `null` 转为 `{}`。值必须为字符串;其他类型返回 400 `invalid_request_error`,param 为 `metadata.`。编码后对象上限 64 KiB,无键值对数量或长度限制 | -Vault 读取包含 `id`、`object: "vault"`、`created_at`、`name` 和 `metadata`。没有更新路由。 +Vault 读取包含 `id`、`object: "vault"`、`created_at`、`name` 和 `metadata`。更新接受可选的 `name` 和 `metadata`。name 的校验与创建相同,显式 `null` 会将其清除。`metadata` 遵循官方更新限制:最多 16 个键值对,键最长 64 个字符,值最长 512 个字符;对象(包括 `{}`)会替换所有键值对,省略 `metadata` 则保持不变。 删除 Vault 在一个事务内移除 Vault 及所有 Credential,无论它们的 status。无需 storage key,不向服务方发送请求。对 Session 的影响见[删除](#deletion)。 ## Credential {#credentials} -创建需要 `name`(去除首尾空白后 1–256 UTF-8 字节)和 `auth` 对象,`type` 为 `static_bearer` 或 `mcp_oauth`。`mcp_server_url` 必须是无 userinfo、无 fragment 的绝对 HTTPS URL;Core 逐字节保留,包括 query,不执行 DNS 或 HTTP 请求。字段错误以该字段作为 param,例如 `auth.type`、`auth.access_token` 或 `auth.mcp_server_url`;未知成员或缺失成员使用官方的 `Unknown parameter` 或 `Missing required parameter` 消息([请求验证](wire-semantics.md#configuration-validation))。 +创建需要 `name`(去除首尾空白后 1–256 UTF-8 字节)和 `auth` 对象,`type` 为 `static_bearer` 或 `mcp_oauth`,并可带 `metadata`。Credential 的 `metadata` 遵循官方限制:最多 16 个键值对、键最长 64 个字符、值最长 512 个字符,非字符串值返回与 Session 相同的错误。固定版本中的 `environment_variable` 类型会被拒绝([不支持的字段](wire-semantics.md#unsupported-fields)):Core 只通过 MCP 服务器的 `credential_id` 注入 Credential,从不注入进程环境。`mcp_server_url` 必须是无 userinfo、无 fragment 的绝对 HTTPS URL;Core 逐字节保留,包括 query,不执行 DNS 或 HTTP 请求。字段错误以该字段作为 param,例如 `auth.type`、`auth.access_token` 或 `auth.mcp_server_url`;未知成员或缺失成员使用官方的 `Unknown parameter` 或 `Missing required parameter` 消息([请求验证](wire-semantics.md#configuration-validation))。 -Credential 读取包含 `id`、`vault_id`、`name`、`object: "vault.credential"`、`created_at`、`updated_at` 和 `auth`。`auth` 包含 `type`、`mcp_server_url`;OAuth Credential 还包含 `expires_at` 和 `refresh`,后者包含 `client_id`、`token_endpoint`、`token_endpoint_auth.type`、`resource` 和 `scope`。读取和列表无需 storage key。 +Credential 读取包含 `id`、`vault_id`、`name`、`object: "vault.credential"`、`created_at`、`updated_at`、`metadata` 和 `auth`。`auth` 包含 `type`、`mcp_server_url`;OAuth Credential 还包含 `expires_at` 和 `refresh`,后者包含 `client_id`、`token_endpoint`、`token_endpoint_auth.type`、`resource` 和 `scope`。读取和列表无需 storage key。 ### 静态 bearer {#static-bearer} `auth` 为 `{type: "static_bearer", mcp_server_url, token}`。`token` 必需且非空。Core 将它作为不透明字节保存,不去除空白。执行时 token 必须符合 RFC 6750 `b64token`;Session 选择了含空白等其他字符的存储 token 时,分派失败。 -通过 `POST /vaults/{vault_id}/credentials/{credential_id}` 替换 token,请求必须正好为 `{"auth": {"type": "static_bearer", "token": "…"}}`。token 缺失、null、空值或任何其他字段均被拒绝。仅 token 和 `updated_at` 改变;ID、Vault、name、type、`mcp_server_url`、`created_at` 和所有 Session 绑定保留。替换失败保留旧 token。 +通过 `POST /vaults/{vault_id}/credentials/{credential_id}` 替换 token,请求为 `{"auth": {"type": "static_bearer", "token": "…"}}`;同一请求可带 `metadata`,它会替换所有键值对(`{}` 对象会将其清除),只含 `metadata` 的请求只修改元数据。既不含 `auth` 也不含 `metadata` 的请求返回 400,这是官方 `minProperties` 的要求。token 缺失、null、空值或 `auth` 中的任何其他字段均被拒绝。仅 token、`metadata` 和 `updated_at` 改变;ID、Vault、name、type、`mcp_server_url`、`created_at` 和所有 Session 绑定保留。替换失败保留旧 token。 ### OAuth {#oauth} diff --git a/contracts/agents-api/zh/wire-semantics.md b/contracts/agents-api/zh/wire-semantics.md index 8aeb6c232..2902c0e53 100644 --- a/contracts/agents-api/zh/wire-semantics.md +++ b/contracts/agents-api/zh/wire-semantics.md @@ -1,7 +1,7 @@ --- title: "API 行为" source: contracts/agents-api/wire-semantics.md -source_hash: 6f57c50e736d1837b3609209812438063cc96c24c145ffe9302a93d5f9c7746f +source_hash: b481386ff50d930d3b8698e0bed882aa512c85adf62d4dc61a42bb77d5a7abe1 --- 已锁定版本的 OpenAI Python SDK([upstream.json](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/contracts/agents-api/upstream.json))定义了 `/v1` 路由、字段和类型。本页面说明这些类型未作规定之处 Core 的行为,例如状态码、错误字段、默认值和列表边界,以及 Core 与官方服务存在差异的地方。[OpenAI 兼容性](index.md) 列出了这些差异和尚存缺口;[Sessions, events and history](sessions-events.md)、[message content](message-content.md)、[Vaults](vaults.md)、[source Files and Skills](source-files.md) 和 [Environment files and Artifacts](environment-files.md) 分别负责各自资源的规则。 @@ -20,8 +20,13 @@ source_hash: 6f57c50e736d1837b3609209812438063cc96c24c145ffe9302a93d5f9c7746f | 对事件流、File 内容、Skill 内容、Skill 版本内容、Artifact 内容或 Environment 文件列表使用 `HEAD` | 返回 405,因此 `HEAD` 绝不会保持流打开或读取内容。 | | 不支持的方法,包括 `FOO` 等未知方法 | 返回 405、代码 `unsupported_operation`、消息 "This API method is not supported.",并返回一个 `Allow` 头,按 `GET,HEAD,POST,DELETE` 的顺序列出该路由支持的方法。 | | `/v1` 下的未知子路由,包括带尾斜杠的情况 | 在 Beta 和身份验证检查后返回 404、代码 `unsupported_operation`。 | +| Core 不运行的固定版本路由 | 参见[不支持的操作](#unsupported-operations)。 | | `OPTIONS` 和 CORS | 不处理 CORS。 | +### 不支持的操作 {#unsupported-operations} + +Automations 路由(共 10 个)、`POST` 和 `GET /agents/environments`,以及 `GET /agents/sessions/{session_id}/traces` 都已注册,因此与其他固定版本路由一样先通过 Beta 和身份验证检查,然后返回 404、代码 `unsupported_operation`、消息 "This API operation is not supported."。Environment 只存在于 Session 内部([归属](environments.md#resources-and-states)),Core 没有 Automations 或 trace 存储。 + 创建 Agent、Vault、Credential、Environment 模板、Environment 文件或 Session 均返回 201,流式 Session 创建也是如此。对 Agent 或 Environment 模板发送空更新正文会推进 `updated_at`,但不会更改其他内容;时间戳精确到秒。 ### 标头 {#headers} @@ -110,7 +115,9 @@ Beta 路由要求 `OpenAI-Beta` 标头中恰好有一个值,且该值必须等 | 重复的支持键,包括标量 `status` | 400 `invalid_request_error`,param 为 null,"Failed to deserialize query string: duplicate field ``" | 400 `unsupported_parameter` | 400 `duplicate_parameter`,param 为 ``,使用官方消息 | | `order` 不是 `asc` 或 `desc`,包括显式空值 `order=` | 400 `invalid_request_error`,param 为 null,"Failed to deserialize query string: order: unknown variant ``, expected `asc` or `desc`" | 400,code 为 null,"order must be asc or desc." | 400 `invalid_value`,param 为 `order`,`"Invalid value: ''. Supported values are: 'asc' and 'desc'."` | -已锁定版本的 Python SDK 会丢弃空查询值,因此 `list(order="")` 不会发送 `order`,而是使用默认值。`after` 会去除首尾空白。检查按以下顺序执行:重复键、`limit`、`order`;Vault 和 Credential 的 `status` 最先检查。这些检查都在任何资源查找之前执行。 +Sessions、Vaults 和 Credentials 列表接受 `metadata[key]=value` 键值对,并保留元数据中含全部键值对的资源。键不能为空,最多 16 个键值对,键最长 64 个字符,值最长 512 个字符。 + +空的 `order` 与 `asc`、`desc` 以外的其他值一样,返回无效 `order` 错误。`after` 会去除首尾空白。检查按以下顺序执行:重复键、`limit`、`order`;Vault 和 Credential 的 `status` 最先检查。这些检查都在任何资源查找之前执行。 Vault 和 Credential 列表接受标量 `status`、`status[]` 条目或两者,并按其并集进行筛选。默认会列出两个状态。其他值会返回 400 `invalid_request_error`,param 为 null,消息为 "Failed to deserialize query string: status: data did not match any variant of untagged enum VaultStatusFilterParam"。 @@ -118,13 +125,12 @@ Vault 和 Credential 列表接受标量 `status`、`status[]` 条目或两者, | 列表 | 默认值 | 接受范围 | 其他值 | | --- | --- | --- | --- | -| Agents、Sessions、Items、Environment 模板、Subagent Items、Subagent Turn Items | 20 | 1–100 | 0 变为 1;大于 100 的值变为 100 | -| Vaults、Credentials | 20 | 1–100 | 0、负数和更大的整数,包括溢出值,都会限制在 1–100 范围内 | +| Agents、Sessions、Items、Turn Items、Environment 模板、Vaults、Credentials、Subagent Items、Subagent Turn Items | 20 | 1–100 | 0 变为 1;大于 100 的值变为 100 | | Turns、Subagents、Subagent Turns、Artifacts | 20 | 1–100 | 400 `invalid_request_error`,"limit must be between 1 and 100" | | Skills、Skill 版本 | 20 | 0–100 | 0 返回空页面,其 `has_more` 表示游标后是否还有资源。负数:400 `integer_below_min_value`,param 为 `limit`。大于 100:400 `integer_above_max_value`,param 为 `limit` | | Files | 10000 | 1–10000 | 400,code 为 null,"limit must be between 1 and 10000." | -`limit` 不是十进制整数时(包括空值),Beta 列表返回 400 `invalid_request_error` 和 "Failed to deserialize query string: limit: invalid digit found in string";在 Vault 和 Credential 列表之外,超出有符号 64 位范围的值会返回 "Failed to deserialize query string: limit: number too large to fit in target type"。编码为 `%2B` 的前导 `+` 会被接受;前导 `-` 在 Beta 列表上会返回无效数字错误,但 Vaults 和 Credentials 除外。Skills 返回 `invalid_request` 和 "limit must be an integer between 0 and 100.";Files 返回 `invalid_request` 以及 Files 范围消息。 +`limit` 不是十进制整数时(包括空值),Beta 列表返回 400 `invalid_request_error` 和 "Failed to deserialize query string: limit: invalid digit found in string",超出有符号 64 位范围的值会返回 "Failed to deserialize query string: limit: number too large to fit in target type"。编码为 `%2B` 的前导 `+` 会被接受;前导 `-` 在 Beta 列表上会返回无效数字错误。Skills 返回 `invalid_request` 和 "limit must be an integer between 0 and 100.";Files 返回 `invalid_request` 以及 Files 范围消息。 ### 游标 {#cursors} @@ -133,7 +139,7 @@ Vault 和 Credential 列表接受标量 `status`、`status[]` 条目或两者, | 列表 | 响应 | | --- | --- | | Agents、Sessions、Turns、Environment 模板、Vaults、Credentials | 404,`type` 和 `code` 均为 `not_found_error`,"Resource not found." | -| Session Items、Subagent Items、Subagent Turn Items | 400 `invalid_request_error`,param 为 null,"Invalid session item ID in `after`" | +| Session Items、Turn Items、Subagent Items、Subagent Turn Items | 400 `invalid_request_error`,param 为 null,"Invalid session item ID in `after`" | | Subagents、Subagent Turns | 400 `invalid_request_error`,param 为 null,"Invalid resource ID in `after`" | | Session Artifacts | 400 `invalid_request_error`,param 为 null,"after is not a valid artifact ID" | | Skill 版本 | 不以 `skillver` 开头的值:400 `invalid_value`,param 为 `after`,`"Invalid 'after': ''. Expected an ID that begins with 'skillver'."`。其他 Skill 的版本:字段相同,消息为 "Skill version cursor does not match this skill."。格式错误的 `skillver` 后缀,或版本缺失、已删除、属于外部租户:404,code 和 param 均为 null | @@ -157,6 +163,7 @@ Agent 创建要求提供 `model`。对于省略的字段,Core 会保存并返 | `multi_agent` | 禁用。启用但未提供 `max_concurrent_subagents` 时为 6 | | Function `defer_loading` | `false` | | `programmatic_tool_calling.enabled` | `true` | +| `compaction`、`experimental` | Core 仅在显式给出 `async` 时保存 `compaction`,否则省略:未指定、为 null 或为空对象的 `compaction`,以及为 null 的 `async`,都是官方默认的后台压缩,而 Harness 会改为运行其原生的阻塞式压缩。更新时 null 的 `compaction` 会清除已保存的值。除非设置,`experimental` 始终读作 `{"time_awareness": false}`;不含成员的 `experimental` 对象保留已保存的值,更新或 Session 覆盖只修改其所发送的成员 | | `web_search` | 保存每个已锁定模式;请参阅 [tool policy](execution-tools.md#web-search-and-programmatic-tool-calling) | | HTTP MCP 传输方式 | 以 `headers: {}` 保存;非空标头按给定值存储,`Authorization` 标头被拒绝。Origin 和 allowlist 默认值见 [public MCP connection origin](environments.md#public-mcp-connection-origin) | @@ -184,13 +191,29 @@ Session 创建和更新、Vault 创建、Credential 创建和更新、Environmen 即使所选 Harness 无法执行,Core 也会保存已锁定形状允许的值:任意长度的函数名称,以及 Harness 未声明的 reasoning、service tier、Web 搜索和 programmatic tool calling 取值。 +### 不支持的字段 {#unsupported-fields} + +这些官方字段在 Core 中没有含义。设置其中任何一个的请求都会返回 400 `invalid_request_error`,以该字段作为 `param`,且不写入任何内容: + +| 字段 | Param | +| --- | --- | +| 含任何成员的 Session 更新 `agent`;`{}` 不改变任何内容 | `agent` | +| Session 创建或更新中的 `review: auto_review`;接受 `none`,响应省略 `review` | `review` | +| `environment.environment_id` | `environment_id` | +| `environment.container_size`;响应携带 `container_size: null` | `container_size` | +| `desktop.enabled: true`;响应携带 `desktop: {"enabled": false}` | `desktop.enabled` | +| 非空的 `network.blocked_domains` | `network.blocked_domains` | +| Credential `auth.type` 为 `environment_variable` | `auth.type` | +| Session 输入 `agent.session.input.computer_use_approval_request_result` | `events[N].type` | + ### Session 准入 {#session-admission} Session 的有效配置还必须通过执行准入,无论配置来自保存还是内联方式。准入会先报告上表中的协议错误,包括已保存 Agent 中的重复工具和 schema 根,然后报告以下错误;在任何写入之前,这些错误均为 400 `unsupported_or_invalid_configuration`: | 配置 | 消息 | | --- | --- | -| Harness 未声明的 `reasoning.effort`、`reasoning.summary`、`service_tier`、`web_search` 模式或设置、`programmatic_tool_calling` 取值或 `text.verbosity` | 指出字段的消息,例如 `reasoning.effort "max" is not supported by this Harness.`;见 [tool policy](execution-tools.md#web-search-and-programmatic-tool-calling) 和 [Harness 能力](harness-capabilities.md#execution-and-input) | +| Harness 未声明的 `reasoning.effort`、`reasoning.summary`、`service_tier`(含 `ultrafast`)、`web_search` 模式或设置、`programmatic_tool_calling` 取值或 `text.verbosity` | 指出字段的消息,例如 `reasoning.effort "max" is not supported by this Harness.`;见 [tool policy](execution-tools.md#web-search-and-programmatic-tool-calling) 和 [Harness 能力](harness-capabilities.md#execution-and-input) | +| 任何 Harness 上的 `compaction.async: true`、`experimental.time_awareness: true`,或 `automations`、`computer_use` 工具,因为没有 Harness 原生运行它们 | 指出字段的消息,例如 `compaction.async=true is not supported.` | | 函数名称为空或重复 | "Function names must be nonempty and unique." | | 未声明 `retained_native_history` 的 Harness,运行在把每个 Environment 都放在 workspace 存储上的 sandbox provider 上([Harness 能力](harness-capabilities.md)) | "This Session's harness does not retain its native history, which the sandbox provider's workspace storage requires. Use a harness that supports retained_native_history, or a sandbox provider with its own disk." | @@ -230,9 +253,9 @@ Session 创建会将 Agent 的有效配置复制到不可变快照中。使用 ` ### 更新和列表 {#update-and-list} -`POST /agents/sessions/{session_id}` 仅接受必需的 `metadata`:null 或 `{}` 会将其清除,对象会替换所有键值对。执行状态和创建重试标识保持不变。 +`POST /agents/sessions/{session_id}` 只修改 `metadata`:null 或 `{}` 会将其清除,对象会替换所有键值对。仅含 `review` 或空 `agent` 的正文不改变任何内容并返回该 Session;`metadata`、`agent`、`review` 都不含的正文返回 400。含成员的 `agent` 会被拒绝([不支持的字段](#unsupported-fields))。执行状态和创建重试标识保持不变。 -`GET /agents/sessions` 接受 `agent_id`,它会匹配 Session 不可变的根 Agent ID,包括内联 Agent ID,以及此后已更新或删除的 Agent。筛选在分页之前应用;空 `agent_id` 是一个筛选条件,而不是省略该筛选条件。 +`GET /agents/sessions` 接受 `agent_id`,它会匹配 Session 不可变的根 Agent ID,包括内联 Agent ID,以及此后已更新或删除的 Agent。筛选在分页之前应用;空 `agent_id` 是一个筛选条件,而不是省略该筛选条件。[`metadata` 筛选](#query-parameters)同样适用。 ### 删除 {#delete} diff --git a/docs/api/public-agent-api.md b/docs/api/public-agent-api.md index 945d141ce..7ff95356c 100644 --- a/docs/api/public-agent-api.md +++ b/docs/api/public-agent-api.md @@ -16,7 +16,7 @@ read -rs OPENAI_API_KEY && export OPENAI_API_KEY **SDK.** Use the pinned version: ```sh -pip install openai==3.13.0 +pip install openai==3.45.0 ``` ```python @@ -532,7 +532,6 @@ curl "$OPENAI_BASE_URL/skills" -H "Authorization: Bearer $OPENAI_API_KEY" -F fil ::: - No Beta header. Select up to 50 Skills per Environment; each archive is at most 5 MiB compressed and 20 MiB expanded. -- SDK 3.13.0 drops a single ZIP file from the upload; use HTTP for a ZIP. - Attach Skills to a Session through its `environment.skills` or a [template](#environment-templates). Details: [Files and Skills](../../contracts/agents-api/source-files.md). A Session installs its Skills, Plugins and packages once, when it is prepared; editing the source later doesn't change a running Session. Preparation errors fail the Session before any work runs: fix the cause instead of retrying in a new Session. diff --git a/docs/getting-started/quickstart.md b/docs/getting-started/quickstart.md index 2a1c891b5..b2b7751cb 100644 --- a/docs/getting-started/quickstart.md +++ b/docs/getting-started/quickstart.md @@ -25,7 +25,7 @@ Core serves the OpenAI Agents API, so the official OpenAI SDK works unchanged. I ```sh python3 -m venv .venv . .venv/bin/activate -pip install openai==3.13.0 +pip install openai==3.45.0 export OPENAI_BASE_URL=https://core.example/v1 read -rs OPENAI_API_KEY && export OPENAI_API_KEY # paste the key; it is not echoed ``` @@ -96,7 +96,7 @@ print(session.id) This makes a real model request and may incur charges. - `x_agents_core` holds Core's additions to the OpenAI API; see [Core extensions](../api/public-agent-api.md#core-extensions). -- Keep the whole `agent` object in `extra_body`. SDK 3.13.0 replaces a body field with the matching `extra_body` field instead of merging them. +- Keep the whole `agent` object in `extra_body`. SDK 3.45.0 replaces a body field with the matching `extra_body` field instead of merging them. ## 3. Wait for the result diff --git a/docs/zh/api/public-agent-api.md b/docs/zh/api/public-agent-api.md index 3c51807d7..045faa3d1 100644 --- a/docs/zh/api/public-agent-api.md +++ b/docs/zh/api/public-agent-api.md @@ -1,7 +1,7 @@ --- title: "Agents API 指南" source: docs/api/public-agent-api.md -source_hash: a32f91dfee6a8eb9c6001310a1d357f5d241a55da12437870ce1c0383fcc3dbc +source_hash: 8c09bb8ae2cc51057298e4f6524e2145d897fcaaa7155a15c233a5267fe2768b --- Core 在 `/v1` 提供 OpenAI Agents API。本指南用官方 OpenAI SDK 和普通 HTTP 两种方式演示每项常见任务,并说明 Core 与 OpenAI 的差异。如果尚未启动过 Session,请先阅读[运行第一个 Session](../getting-started/quickstart.md)。 @@ -18,7 +18,7 @@ read -rs OPENAI_API_KEY && export OPENAI_API_KEY **SDK。** 使用固定版本: ```sh -pip install openai==3.13.0 +pip install openai==3.45.0 ``` ```python @@ -534,7 +534,6 @@ curl "$OPENAI_BASE_URL/skills" -H "Authorization: Bearer $OPENAI_API_KEY" -F fil ::: - 不需要 Beta 请求头。每个 Environment 最多可选择 50 个 Skills;每个归档压缩后最大为 5 MiB,展开后最大为 20 MiB。 -- SDK 3.13.0 会上传内容中丢弃唯一的 ZIP 文件;上传 ZIP 时请使用 HTTP。 - 可通过 Session 的 `environment.skills` 或[模板](#environment-templates)为其附加 Skills。 详细信息请参阅 [文件与 Skill](../../../contracts/agents-api/zh/source-files.md)。Session 会在准备期间一次性安装其 Skills、Plugins 和软件包;之后编辑源文件不会影响正在运行的 Session。准备错误会在任何工作开始前导致 Session 失败:请修复原因,而不是在新 Session 中重试。 diff --git a/docs/zh/getting-started/quickstart.md b/docs/zh/getting-started/quickstart.md index 1d634672f..88ad058a2 100644 --- a/docs/zh/getting-started/quickstart.md +++ b/docs/zh/getting-started/quickstart.md @@ -1,7 +1,7 @@ --- title: "运行第一个 Session" source: docs/getting-started/quickstart.md -source_hash: 784dd62e274e49975af1bc1b136cec5d6028ed0896cbe6e9345d4c686d7423df +source_hash: 463bfed6afcc95bc85284a7063f2303690816d7d1e6fd1c7495e5084615254a0 --- 使用官方 OpenAI Python SDK 通过 Core 运行 Agent:用项目 API 密钥连接,启动一个会写入文件的 Session,并读取结果。你需要管理员提供的密钥和 API 基础 URL。 @@ -27,7 +27,7 @@ Core 提供 OpenAI Agents API,因此无需修改官方 OpenAI SDK。SDK 读取 ```sh python3 -m venv .venv . .venv/bin/activate -pip install openai==3.13.0 +pip install openai==3.45.0 export OPENAI_BASE_URL=https://core.example/v1 read -rs OPENAI_API_KEY && export OPENAI_API_KEY # paste the key; it is not echoed ``` @@ -98,7 +98,7 @@ print(session.id) 这会发起真实模型请求,可能产生费用。 - `x_agents_core` 包含 Core 对 OpenAI API 的扩展;参阅 [Core 扩展](../api/public-agent-api.md#core-extensions)。 -- 将整个 `agent` 对象放入 `extra_body`。SDK 3.13.0 使用 `extra_body` 中的同名字段替换请求体字段,而非合并。 +- 将整个 `agent` 对象放入 `extra_body`。SDK 3.45.0 使用 `extra_body` 中的同名字段替换请求体字段,而非合并。 ## 3. 等待结果 {#_3-wait-for-the-result} diff --git a/example/parsar/tests/fixture.mjs b/example/parsar/tests/fixture.mjs index 9517e8d67..fdc965cc1 100644 --- a/example/parsar/tests/fixture.mjs +++ b/example/parsar/tests/fixture.mjs @@ -209,7 +209,10 @@ createServer(async (req, res) => { deleted: true, }); } - if (req.method === "POST") row.updated_at = now(); + if (req.method === "POST") { + row.updated_at = now(); + if (body.metadata) row.metadata = body.metadata; + } return reply(row); } const row = { @@ -218,6 +221,7 @@ createServer(async (req, res) => { vault_id: vaultId, name: body.name, auth: { type: "static_bearer", mcp_server_url: body.auth.mcp_server_url }, + metadata: body.metadata || {}, created_at: now(), updated_at: now(), }; @@ -401,6 +405,8 @@ createServer(async (req, res) => { : { type: "openai_hosted", id: randomUUID(), + container_size: null, + desktop: { enabled: false }, capability_directories: [], network: { access: "enabled", allowed_domains: [] }, packages: { npm: [], python: [], system: [] }, diff --git a/example/rl-eval/requirements.txt b/example/rl-eval/requirements.txt index 6abd82ee1..38d52be0f 100644 --- a/example/rl-eval/requirements.txt +++ b/example/rl-eval/requirements.txt @@ -1 +1 @@ -openai==3.13.0 +openai==3.45.0 diff --git a/packages/agents-client/src/admin-client.test.ts b/packages/agents-client/src/admin-client.test.ts index 27d605d16..293d6629b 100644 --- a/packages/agents-client/src/admin-client.test.ts +++ b/packages/agents-client/src/admin-client.test.ts @@ -204,7 +204,7 @@ describe("AdminClient response contracts", () => { }); it("reuses Vault metadata validation including write-only credential rejection", async () => { - const credential = { id: resourceId, vault_id: sessionId, object: "vault.credential", name: "MCP", created_at: 1, updated_at: 1, auth: { type: "static_bearer", mcp_server_url: "https://mcp.test" } }; + const credential = { id: resourceId, vault_id: sessionId, object: "vault.credential", metadata: {}, name: "MCP", created_at: 1, updated_at: 1, auth: { type: "static_bearer", mcp_server_url: "https://mcp.test" } }; const { client } = clientWith(credential); expect(await client.retrieveVaultCredential(projectId, sessionId, resourceId)).toEqual(credential); await expect(clientWith({ ...credential, auth: { ...credential.auth, token: "leak" } }).client.retrieveVaultCredential(projectId, sessionId, resourceId)).rejects.toMatchObject({ code: "invalid_vault_credential" }); diff --git a/packages/agents-client/src/client.test.ts b/packages/agents-client/src/client.test.ts index 3b25e1584..2c4d4059d 100644 --- a/packages/agents-client/src/client.test.ts +++ b/packages/agents-client/src/client.test.ts @@ -1662,7 +1662,7 @@ describe("OpenAIAgentsClient", () => { it.each([ null, {}, - { id: "environment", object: "agent.environment", type: "self_hosted", status: "ready", files: [], plugins: [], skills: [] }, + { id: "environment", object: "agent.environment", type: "self_hosted", status: "unknown", files: [], plugins: [], skills: [] }, { id: "another", object: "agent.environment", type: "self_hosted", status: "pending", files: [], plugins: [], skills: [] }, { id: "environment", object: "agent.environment", type: "hosted", status: "pending", files: [], plugins: [], skills: [] }, { id: "environment", object: "agent.environment", type: "self_hosted", status: "pending", files: null, plugins: [], skills: [] }, @@ -2384,7 +2384,7 @@ describe("OpenAIAgentsClient", () => { id: credentialId, vault_id: vaultId, name: "Internal MCP", - object: "vault.credential", + object: "vault.credential", metadata: {}, auth: { type: "static_bearer", mcp_server_url: "https://mcp.example/tools" }, created_at: 21, updated_at: 21, @@ -2511,7 +2511,7 @@ describe("OpenAIAgentsClient", () => { const vaultId = "11111111-1111-4111-8111-111111111111"; const credentialId = "22222222-2222-4222-8222-222222222222"; const valid: Record = { - id: credentialId, vault_id: vaultId, name: "MCP", object: "vault.credential", + id: credentialId, vault_id: vaultId, name: "MCP", object: "vault.credential", metadata: {}, auth: { type: "static_bearer", mcp_server_url: "https://mcp.example/tools" }, created_at: 2, updated_at: 3, }; @@ -2524,7 +2524,7 @@ describe("OpenAIAgentsClient", () => { const responseBearer = ephemeralBearer(); const body = kind === "vault" ? { id: "11111111-1111-4111-8111-111111111111", object: "vault", created_at: 1, name: "Safe", metadata: {}, token: responseBearer } - : { id: "22222222-2222-4222-8222-222222222222", vault_id: "11111111-1111-4111-8111-111111111111", name: "Safe", object: "vault.credential", auth: { type: "static_bearer", mcp_server_url: "https://mcp.example", token: responseBearer }, created_at: 1, updated_at: 1 }; + : { id: "22222222-2222-4222-8222-222222222222", vault_id: "11111111-1111-4111-8111-111111111111", name: "Safe", object: "vault.credential", metadata: {}, auth: { type: "static_bearer", mcp_server_url: "https://mcp.example", token: responseBearer }, created_at: 1, updated_at: 1 }; const calls: FetchCall[] = []; const client = new OpenAIAgentsClient({ fetch: recordingFetch(jsonResponse(body), calls) }); const operation = kind === "vault" @@ -2548,7 +2548,7 @@ describe("OpenAIAgentsClient", () => { id: "22222222-2222-4222-8222-222222222222", vault_id: vaultId, name: "Internal MCP", - object: "vault.credential", + object: "vault.credential", metadata: {}, auth: { type: "static_bearer", mcp_server_url: "https://mcp.example/tools" }, created_at: 2, updated_at: 2, @@ -2577,7 +2577,7 @@ describe("OpenAIAgentsClient", () => { id: credentialId, vault_id: vaultId, name: "Internal MCP", - object: "vault.credential", + object: "vault.credential", metadata: {}, auth: { type: "static_bearer", mcp_server_url: "https://mcp.example/tools" }, created_at: 2, updated_at: 2, @@ -2630,7 +2630,7 @@ describe("OpenAIAgentsClient", () => { id: credentialId, vault_id: vaultId, name: "Internal MCP", - object: "vault.credential", + object: "vault.credential", metadata: {}, auth: { type: "static_bearer", mcp_server_url: "https://mcp.example/tools" }, created_at: 2, updated_at: 2, diff --git a/packages/agents-client/src/client.ts b/packages/agents-client/src/client.ts index 2912ceab2..a110655f3 100644 --- a/packages/agents-client/src/client.ts +++ b/packages/agents-client/src/client.ts @@ -5,7 +5,7 @@ import { type FieldNames, } from "./response-projection"; import { - agentsCoreFields, createVaultCredentialAuthParamStaticBearerFields, createVaultCredentialParamsFields, + agentsCoreFields, createVaultCredentialAuthParamStaticBearerFields, createVaultCredentialParamsFields, createVaultCredentialParamsRequired, deletedEnvironmentTemplateResourceFields, environmentParamNoneFields, environmentParamSelfHostedFields, environmentParamSelfHostedRequired, deletedVaultCredentialResourceFields, deletedVaultResourceFields, deleteFileResponseFields, environmentFileListResourceFields, environmentFileResourceFields, environmentResourceNoneFields, @@ -13,7 +13,7 @@ import { hostedEnvironmentFileParamInlineFields, inputContentParamFields, inputMessageParamFields, inputMessageParamRequired, listFilesResponseFields, multiAgentConfigResourceFields, openAIFileFields, publicEnvironmentResourceFields, reasoningEffortResourceValues, reasoningResourceFields, rotateVaultCredentialAuthParamStaticBearerFields, - rotateVaultCredentialParamsFields, reasoningSummaryResourceValues, savedAgentCoreFields, + rotateVaultCredentialParamsFields, rotateVaultCredentialParamsRequired, reasoningSummaryResourceValues, savedAgentCoreFields, serviceTierResourceValues, sessionAgentResourceFields, sessionAgentResourceRequired, sessionCoreFields, sessionEnvironmentErrorResourceFields, sessionEnvironmentStateResourceFields, sessionErrorResourceFields, sessionEventAgentSessionCreatedFields, sessionEventErrorFields, sessionEventFields, @@ -374,7 +374,8 @@ export function projectVaultCredential( !sameUuid(value.vault_id, expectedVaultId) || value.object !== "vault.credential" || !isTrimmedName(value.name) || !Number.isSafeInteger(value.created_at) || Number(value.created_at) < 0 || - !Number.isSafeInteger(value.updated_at) || Number(value.updated_at) < Number(value.created_at) + !Number.isSafeInteger(value.updated_at) || Number(value.updated_at) < Number(value.created_at) || + !validMetadata(value.metadata) ) { return invalidVaultResponse("invalid_vault_credential", "OpenAgentCore returned invalid Credential metadata."); } @@ -386,6 +387,7 @@ export function projectVaultCredential( name: value.name, object: "vault.credential", auth, + metadata: { ...value.metadata }, created_at: Number(value.created_at), updated_at: Number(value.updated_at), }; @@ -1755,7 +1757,7 @@ export class OpenAIAgentsClient implements AgentCore { async createVaultCredential(vaultId: string, input: CreateVaultCredentialInput): Promise { if ( - !exactFields(input, createVaultCredentialParamsFields) || !isTrimmedName(input.name) || + !schemaFields(input, createVaultCredentialParamsFields, createVaultCredentialParamsRequired) || !isTrimmedName(input.name) || !isRecord(input.auth) || !exactFields(input.auth, createVaultCredentialAuthParamStaticBearerFields) || input.auth.type !== "static_bearer" || !validCredentialURL(input.auth.mcp_server_url) || typeof input.auth.token !== "string" ) { @@ -1793,7 +1795,7 @@ export class OpenAIAgentsClient implements AgentCore { input: ReplaceVaultCredentialTokenInput, ): Promise { if ( - !exactFields(input, rotateVaultCredentialParamsFields) || !isRecord(input.auth) || + !schemaFields(input, rotateVaultCredentialParamsFields, rotateVaultCredentialParamsRequired) || !isRecord(input.auth) || !exactFields(input.auth, rotateVaultCredentialAuthParamStaticBearerFields) || input.auth.type !== "static_bearer" || typeof input.auth.token !== "string" ) { diff --git a/packages/agents-client/src/environment-templates.test.ts b/packages/agents-client/src/environment-templates.test.ts index 613870bfd..a0cd19566 100644 --- a/packages/agents-client/src/environment-templates.test.ts +++ b/packages/agents-client/src/environment-templates.test.ts @@ -191,6 +191,8 @@ describe("Session creation with a referenced Template", () => { environment: { type: "openai_hosted", id: "6f9c1d2e-4b5a-4c7d-8e9f-0a1b2c3d4e5f", + container_size: null, + desktop: { enabled: false }, capability_directories: [], network: { access, allowed_domains: [] }, packages: { npm: [], python: [], system: [] }, @@ -455,6 +457,8 @@ describe("Sessions created from an advanced Template", () => { const basic = { type: "openai_hosted", id: environment.id, + container_size: null, + desktop: { enabled: false }, capability_directories: [], network: { access: "enabled", allowed_domains: [] }, packages: { npm: [], python: [], system: [] }, diff --git a/packages/agents-client/src/fixtures/parsar-d3f55046/environment-templates.json b/packages/agents-client/src/fixtures/parsar-d3f55046/environment-templates.json index 14c937c84..0b9b69859 100644 --- a/packages/agents-client/src/fixtures/parsar-d3f55046/environment-templates.json +++ b/packages/agents-client/src/fixtures/parsar-d3f55046/environment-templates.json @@ -457,6 +457,8 @@ "body": { "type": "openai_hosted", "id": "9d6b4c3f-5e70-4fb1-8c43-0d9e8f7a6b52", + "container_size": null, + "desktop": { "enabled": false }, "capability_directories": [ "/workspace/capabilities" ], diff --git a/packages/agents-client/src/fixtures/parsar-dadf64a7/openai-hosted.json b/packages/agents-client/src/fixtures/parsar-dadf64a7/openai-hosted.json index 694f26603..b1155c9f8 100644 --- a/packages/agents-client/src/fixtures/parsar-dadf64a7/openai-hosted.json +++ b/packages/agents-client/src/fixtures/parsar-dadf64a7/openai-hosted.json @@ -8,6 +8,8 @@ "session_environment": { "type": "openai_hosted", "id": "7a263c51-6bf0-4d53-8518-c792eb1f0d21", + "container_size": null, + "desktop": { "enabled": false }, "capability_directories": [], "network": { "access": "enabled", "allowed_domains": [] }, "packages": { "npm": [], "python": [], "system": [] }, @@ -57,6 +59,8 @@ "missing_packages": { "type": "openai_hosted", "id": "7a263c51-6bf0-4d53-8518-c792eb1f0d21", + "container_size": null, + "desktop": { "enabled": false }, "capability_directories": [], "network": { "access": "enabled", "allowed_domains": [] }, "files": [], @@ -66,6 +70,8 @@ "restricted_network": { "type": "openai_hosted", "id": "7a263c51-6bf0-4d53-8518-c792eb1f0d21", + "container_size": null, + "desktop": { "enabled": false }, "capability_directories": [], "network": { "access": "restricted", "allowed_domains": [] }, "packages": { "npm": [], "python": [], "system": [] }, @@ -76,6 +82,8 @@ "populated_profile": { "type": "openai_hosted", "id": "7a263c51-6bf0-4d53-8518-c792eb1f0d21", + "container_size": null, + "desktop": { "enabled": false }, "capability_directories": ["/workspace/capabilities"], "network": { "access": "enabled", "allowed_domains": ["example.com"] }, "packages": { "npm": ["package"], "python": [], "system": [] }, diff --git a/packages/agents-client/src/generated/public-api.ts b/packages/agents-client/src/generated/public-api.ts index 80d6fa6c0..2b586d508 100644 --- a/packages/agents-client/src/generated/public-api.ts +++ b/packages/agents-client/src/generated/public-api.ts @@ -1,6 +1,14 @@ // Code generated by scripts/generate-public-api.py from contracts/agents-api/openapi.yaml; DO NOT EDIT. export type AgentContentResource = OutputTextResource | EncryptedContentResource; +export interface AgentEnvironmentListResource { + object: "list"; + data: PublicEnvironmentResource[]; + first_id: string | null; + last_id: string | null; + has_more: boolean; +} +export const agentEnvironmentListResourceFields = ["object", "data", "first_id", "last_id", "has_more"] as const; export interface AgentListResource { object: "list"; data: AgentResource[]; @@ -18,7 +26,7 @@ export interface AgentMessageItemResource { content: AgentContentResource[]; } export const agentMessageItemResourceFields = ["id", "turn_id", "type", "sender_agent_id", "recipient_agent_id", "content"] as const; -export type AgentOutputItemResource = AssistantMessageItemResource | ReasoningItemResource | FunctionCallItemResource | McpCallItemResource | WebSearchCallItemResource | CommandExecutionItemResource | CreateSubagentCallItemResource | SendSubagentInputCallItemResource | ResumeSubagentCallItemResource | WaitForSubagentsCallItemResource | InterruptSubagentCallItemResource | CloseSubagentCallItemResource; +export type AgentOutputItemResource = AssistantMessageItemResource | ReasoningItemResource | FunctionCallItemResource | McpCallItemResource | ComputerUseCallItemResource | BrowserAuthenticationRequestItemResource | WebSearchCallItemResource | CommandExecutionItemResource | CreateSubagentCallItemResource | SendSubagentInputCallItemResource | ResumeSubagentCallItemResource | WaitForSubagentsCallItemResource | InterruptSubagentCallItemResource | CloseSubagentCallItemResource; export interface AgentResource { id: string; object: "agent"; @@ -33,11 +41,23 @@ export interface AgentResource { instructions: string | null; tools: PersistedAgentToolResource[]; multi_agent: MultiAgentConfigResource; + compaction?: CompactionResource; + experimental?: ExperimentalConfigResource; x_agents_core?: SavedAgentCore | null; } -export const agentResourceFields = ["id", "object", "created_at", "updated_at", "name", "metadata", "model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent", "x_agents_core"] as const; +export const agentResourceFields = ["id", "object", "created_at", "updated_at", "name", "metadata", "model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent", "compaction", "experimental", "x_agents_core"] as const; export const agentResourceRequired = ["id", "object", "created_at", "updated_at", "name", "metadata", "model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent"] as const; -export type AgentToolConfigParam = AgentToolConfigParamFunction | AgentToolConfigParamToolSearch | AgentToolConfigParamProgrammaticToolCalling | AgentToolConfigParamMcp | AgentToolConfigParamWebSearch; +export type AgentToolConfigParam = AgentToolConfigParamFunction | AgentToolConfigParamToolSearch | AgentToolConfigParamProgrammaticToolCalling | AgentToolConfigParamMcp | AgentToolConfigParamWebSearch | AgentToolConfigParamComputerUse | AgentToolConfigParamAutomations; +export interface AgentToolConfigParamAutomations { + type: "automations"; +} +export const agentToolConfigParamAutomationsFields = ["type"] as const; +export interface AgentToolConfigParamComputerUse { + type: "computer_use"; + include_screenshots?: boolean; +} +export const agentToolConfigParamComputerUseFields = ["type", "include_screenshots"] as const; +export const agentToolConfigParamComputerUseRequired = ["type"] as const; export interface AgentToolConfigParamFunction { type: "function"; name: string; @@ -78,7 +98,16 @@ export interface AgentToolConfigParamWebSearch { } export const agentToolConfigParamWebSearchFields = ["type", "mode", "context_size", "allowed_domains", "location"] as const; export const agentToolConfigParamWebSearchRequired = ["type"] as const; -export type AgentToolResource = AgentToolResourceFunction | AgentToolResourceProgrammaticToolCalling | AgentToolResourceMcp | AgentToolResourceWebSearch; +export type AgentToolResource = AgentToolResourceFunction | AgentToolResourceProgrammaticToolCalling | AgentToolResourceMcp | AgentToolResourceWebSearch | AgentToolResourceComputerUse | AgentToolResourceAutomations; +export interface AgentToolResourceAutomations { + type: "automations"; +} +export const agentToolResourceAutomationsFields = ["type"] as const; +export interface AgentToolResourceComputerUse { + type: "computer_use"; + include_screenshots: boolean; +} +export const agentToolResourceComputerUseFields = ["type", "include_screenshots"] as const; export interface AgentToolResourceFunction { type: "function"; name: string; @@ -127,6 +156,186 @@ export interface AssistantMessageItemResource { phase: MessagePhaseResource | null; } export const assistantMessageItemResourceFields = ["type", "id", "turn_id", "role", "status", "content", "phase"] as const; +export interface AutomationAgentConfigResource { + model: string; + reasoning: ReasoningResource; + text: TextResource; + service_tier: ServiceTierResource; + instructions: string | null; + tools: AgentToolResource[]; + multi_agent: MultiAgentConfigResource; + compaction?: CompactionResource; + experimental?: ExperimentalConfigResource; +} +export const automationAgentConfigResourceFields = ["model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent", "compaction", "experimental"] as const; +export const automationAgentConfigResourceRequired = ["model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent"] as const; +export type AutomationCreatedByResource = AutomationCreatedByResourceDeveloper | AutomationCreatedByResourceAgent; +export interface AutomationCreatedByResourceAgent { + type: "agent"; + session_id: string; + tool_call_id: string; +} +export const automationCreatedByResourceAgentFields = ["type", "session_id", "tool_call_id"] as const; +export interface AutomationCreatedByResourceDeveloper { + type: "developer"; +} +export const automationCreatedByResourceDeveloperFields = ["type"] as const; +export type AutomationEnvironmentResource = AutomationEnvironmentResourceNone | AutomationEnvironmentResourceOpenaiHosted | AutomationEnvironmentResourceSelfHosted; +export interface AutomationEnvironmentResourceNone { + type: "none"; +} +export const automationEnvironmentResourceNoneFields = ["type"] as const; +export interface AutomationEnvironmentResourceOpenaiHosted { + type: "openai_hosted"; + environment_id: string | null; + environment_template_id: string | null; + container_size: ContainerSizeResource | null; + packages: EnvironmentPackagesResource | null; + network: NetworkPolicyResource | null; + desktop: DesktopResource | null; + capability_directories: string[] | null; + skills: HostedTemplateSkillResource[] | null; + plugins: HostedPluginResource[] | null; + files: HostedTemplateFileResource[] | null; +} +export const automationEnvironmentResourceOpenaiHostedFields = ["type", "environment_id", "environment_template_id", "container_size", "packages", "network", "desktop", "capability_directories", "skills", "plugins", "files"] as const; +export interface AutomationEnvironmentResourceSelfHosted { + type: "self_hosted"; + environment_id: string | null; + workspace_directory: string; + capability_directories: string[]; +} +export const automationEnvironmentResourceSelfHostedFields = ["type", "environment_id", "workspace_directory", "capability_directories"] as const; +export interface AutomationInvocationErrorResource { + code: string; + message: string; +} +export const automationInvocationErrorResourceFields = ["code", "message"] as const; +export interface AutomationInvocationResource { + id: string; + object: "agent.automation.invocation"; + automation_id: string; + created_at: number; + source: AutomationInvocationSourceResource; + scheduled_at: number | null; + session_id: string | null; + status: AutomationInvocationStatusResource; + skip_reason: "pending_delivery" | null; + error: AutomationInvocationErrorResource | null; +} +export const automationInvocationResourceFields = ["id", "object", "automation_id", "created_at", "source", "scheduled_at", "session_id", "status", "skip_reason", "error"] as const; +export type AutomationInvocationSourceResource = AutomationInvocationSourceResourceManual | AutomationInvocationSourceResourceAutomation; +export interface AutomationInvocationSourceResourceAutomation { + type: "automation"; + automation: AutomationResource; +} +export const automationInvocationSourceResourceAutomationFields = ["type", "automation"] as const; +export interface AutomationInvocationSourceResourceManual { + type: "manual"; +} +export const automationInvocationSourceResourceManualFields = ["type"] as const; +export const automationInvocationStatusResourceValues = ["queued", "completed", "failed", "skipped"] as const; +export type AutomationInvocationStatusResource = (typeof automationInvocationStatusResourceValues)[number]; +export type AutomationResource = AutomationResourcePeriodic | AutomationResourceOnce; +export interface AutomationResourceOnce { + type: "once"; + id: string; + object: "agent.automation"; + created_at: number; + name: string; + target: AutomationTargetResource; + metadata: Record; + created_by: AutomationCreatedByResource; + run_at: number; + status: OnceAutomationStatusResource; +} +export const automationResourceOnceFields = ["type", "id", "object", "created_at", "name", "target", "metadata", "created_by", "run_at", "status"] as const; +export interface AutomationResourcePeriodic { + type: "periodic"; + id: string; + object: "agent.automation"; + created_at: number; + name: string; + target: AutomationTargetResource; + metadata: Record; + created_by: AutomationCreatedByResource; + expression: string; + timezone: string; + status: PeriodicAutomationStatusResource; +} +export const automationResourcePeriodicFields = ["type", "id", "object", "created_at", "name", "target", "metadata", "created_by", "expression", "timezone", "status"] as const; +export type AutomationTargetParam = AutomationTargetParamNewSession | AutomationTargetParamExistingSession; +export interface AutomationTargetParamExistingSession { + type: "existing_session"; + session_id: string; + instructions: string; +} +export const automationTargetParamExistingSessionFields = ["type", "session_id", "instructions"] as const; +export interface AutomationTargetParamNewSession { + type: "new_session"; + agent?: SessionAgentConfigParam; + agent_id?: string; + environment: EnvironmentParam; + input: InputMessageParam[]; + vault_ids?: string[] | null; + metadata?: Record | null; +} +export const automationTargetParamNewSessionFields = ["type", "agent", "agent_id", "environment", "input", "vault_ids", "metadata"] as const; +export const automationTargetParamNewSessionRequired = ["type", "environment", "input"] as const; +export type AutomationTargetResource = AutomationTargetResourceNewSession | AutomationTargetResourceExistingSession; +export interface AutomationTargetResourceExistingSession { + type: "existing_session"; + session_id: string; + instructions: string; +} +export const automationTargetResourceExistingSessionFields = ["type", "session_id", "instructions"] as const; +export interface AutomationTargetResourceNewSession { + type: "new_session"; + agent_id: string | null; + agent: AutomationAgentConfigResource | null; + environment: AutomationEnvironmentResource; + input: InputMessageResource2[]; + vault_ids: string[]; + metadata: Record; +} +export const automationTargetResourceNewSessionFields = ["type", "agent_id", "agent", "environment", "input", "vault_ids", "metadata"] as const; +export interface BrowserAuthenticationFieldResource { + id: string; + label: string; + type: string; + required: boolean; +} +export const browserAuthenticationFieldResourceFields = ["id", "label", "type", "required"] as const; +export interface BrowserAuthenticationFieldValueParam { + field_id: string; + value: string; +} +export const browserAuthenticationFieldValueParamFields = ["field_id", "value"] as const; +export type BrowserAuthenticationHistoryRequestKindResource = BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication; +export interface BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication { + type: "browser_authentication"; + reason: string | null; + credential_origin: string | null; + fields: BrowserAuthenticationFieldResource[]; + options: BrowserAuthenticationOptionResource[]; +} +export const browserAuthenticationHistoryRequestKindResourceBrowserAuthenticationFields = ["type", "reason", "credential_origin", "fields", "options"] as const; +export interface BrowserAuthenticationOptionResource { + id: string; + label: string; + field_ids: string[]; +} +export const browserAuthenticationOptionResourceFields = ["id", "label", "field_ids"] as const; +export interface BrowserAuthenticationRequestItemResource { + turn_id: string; + request_id: string; + request: BrowserAuthenticationHistoryRequestKindResource; + id: string; + type: "computer_use_approval_request"; +} +export const browserAuthenticationRequestItemResourceFields = ["turn_id", "request_id", "request", "id", "type"] as const; +export const browserOriginAccessDecisionParamValues = ["approve", "deny", "cancel"] as const; +export type BrowserOriginAccessDecisionParam = (typeof browserOriginAccessDecisionParamValues)[number]; export interface CloseSubagentCallItemResource { type: "close_subagent_call"; id: string; @@ -148,7 +357,99 @@ export interface CommandExecutionItemResource { duration_ms: number | null; } export const commandExecutionItemResourceFields = ["type", "id", "turn_id", "command", "cwd", "status", "output", "exit_code", "duration_ms"] as const; +export interface CompactionParam { + async?: boolean | null; +} +export const compactionParamFields = ["async"] as const; +export const compactionParamRequired = [] as const; +export interface CompactionResource { + async: boolean; +} +export const compactionResourceFields = ["async"] as const; +export interface ComputerScreenshotResource { + type: "computer_screenshot"; + image_url: string; +} +export const computerScreenshotResourceFields = ["type", "image_url"] as const; +export type ComputerUseApprovalRequestKindResource = ComputerUseApprovalRequestKindResourceBrowserAuthentication | ComputerUseApprovalRequestKindResourceBrowserOriginAccess; +export interface ComputerUseApprovalRequestKindResourceBrowserAuthentication { + type: "browser_authentication"; + reason: string | null; + credential_origin: string | null; + fields: BrowserAuthenticationFieldResource[]; + options: BrowserAuthenticationOptionResource[]; +} +export const computerUseApprovalRequestKindResourceBrowserAuthenticationFields = ["type", "reason", "credential_origin", "fields", "options"] as const; +export interface ComputerUseApprovalRequestKindResourceBrowserOriginAccess { + type: "browser_origin_access"; + reason: string | null; + origin: string; +} +export const computerUseApprovalRequestKindResourceBrowserOriginAccessFields = ["type", "reason", "origin"] as const; +export interface ComputerUseApprovalRequestResultItemResource { + id: string; + type: "computer_use_approval_request_result"; + turn_id: string; + request_id: string; + response: ComputerUseApprovalResponseKindResource; +} +export const computerUseApprovalRequestResultItemResourceFields = ["id", "type", "turn_id", "request_id", "response"] as const; +export type ComputerUseApprovalResponseKindResource = ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource | ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource; +export interface ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource { + type: "browser_authentication"; + action: "cancel"; +} +export const computerUseApprovalResponseKindResourceBrowserAuthenticationCancelResourceFields = ["type", "action"] as const; +export interface ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource { + type: "browser_authentication"; + action: "submit"; + selected_option: string | null; +} +export const computerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResourceFields = ["type", "action", "selected_option"] as const; +export type ComputerUseApprovalResponseParam = ComputerUseApprovalResponseParamBrowserAuthentication | ComputerUseApprovalResponseParamBrowserOriginAccessParam; +export interface ComputerUseApprovalResponseParamBrowserAuthentication { + type: "browser_authentication"; +} +export const computerUseApprovalResponseParamBrowserAuthenticationFields = ["type"] as const; +export interface ComputerUseApprovalResponseParamBrowserAuthenticationCancelParam { + type: "browser_authentication"; + action: "cancel"; +} +export const computerUseApprovalResponseParamBrowserAuthenticationCancelParamFields = ["type", "action"] as const; +export interface ComputerUseApprovalResponseParamBrowserAuthenticationSubmitParam { + type: "browser_authentication"; + action: "submit"; + fields: BrowserAuthenticationFieldValueParam[]; + selected_option?: string | null; +} +export const computerUseApprovalResponseParamBrowserAuthenticationSubmitParamFields = ["type", "action", "fields", "selected_option"] as const; +export const computerUseApprovalResponseParamBrowserAuthenticationSubmitParamRequired = ["type", "action", "fields"] as const; +export interface ComputerUseApprovalResponseParamBrowserOriginAccessParam { + type: "browser_origin_access"; + decision: BrowserOriginAccessDecisionParam; +} +export const computerUseApprovalResponseParamBrowserOriginAccessParamFields = ["type", "decision"] as const; +export interface ComputerUseCallItemResource { + type: "computer_use_call"; + id: string; + turn_id: string; + title: string | null; + status: FunctionCallStatusResource; + output: ComputerScreenshotResource | null; +} +export const computerUseCallItemResourceFields = ["type", "id", "turn_id", "title", "status", "output"] as const; +export const containerSizeParamValues = ["small", "medium", "large"] as const; +export type ContainerSizeParam = (typeof containerSizeParamValues)[number]; +export const containerSizeResourceValues = ["small", "medium", "large"] as const; +export type ContainerSizeResource = (typeof containerSizeResourceValues)[number]; +export interface CreateAgentEnvironmentParams { + environment: CreateEnvironmentParam; + vault_ids?: string[] | null; +} +export const createAgentEnvironmentParamsFields = ["environment", "vault_ids"] as const; +export const createAgentEnvironmentParamsRequired = ["environment"] as const; export interface CreateAgentParams { + experimental?: ExperimentalConfigParam; metadata?: Record | null; name?: string | null; model: string; @@ -158,11 +459,13 @@ export interface CreateAgentParams { instructions?: string | null; tools?: PersistedAgentToolConfigParam[] | null; multi_agent?: MultiAgentConfigCurrentParam | null; + compaction?: CompactionParam | null; x_agents_core?: SavedAgentCoreInput | null; } -export const createAgentParamsFields = ["metadata", "name", "model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent", "x_agents_core"] as const; +export const createAgentParamsFields = ["experimental", "metadata", "name", "model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent", "compaction", "x_agents_core"] as const; export const createAgentParamsRequired = ["model"] as const; export interface CreateAgentSessionParams { + review?: SessionReviewParam; metadata?: Record | null; agent?: SessionAgentConfigParam; agent_id?: string; @@ -172,12 +475,49 @@ export interface CreateAgentSessionParams { stream?: boolean; x_agents_core?: SessionExecutionInput | null; } -export const createAgentSessionParamsFields = ["metadata", "agent", "agent_id", "environment", "vault_ids", "input", "stream", "x_agents_core"] as const; +export const createAgentSessionParamsFields = ["review", "metadata", "agent", "agent_id", "environment", "vault_ids", "input", "stream", "x_agents_core"] as const; export const createAgentSessionParamsRequired = ["environment"] as const; +export type CreateAutomationParams = CreateAutomationParamsPeriodic | CreateAutomationParamsOnce; +export interface CreateAutomationParamsOnce { + type: "once"; + name: string; + target: AutomationTargetParam; + metadata?: Record; + run_at: number; +} +export const createAutomationParamsOnceFields = ["type", "name", "target", "metadata", "run_at"] as const; +export const createAutomationParamsOnceRequired = ["type", "name", "target", "run_at"] as const; +export interface CreateAutomationParamsPeriodic { + type: "periodic"; + name: string; + target: AutomationTargetParam; + metadata?: Record; + expression: string; + timezone: string; +} +export const createAutomationParamsPeriodicFields = ["type", "name", "target", "metadata", "expression", "timezone"] as const; +export const createAutomationParamsPeriodicRequired = ["type", "name", "target", "expression", "timezone"] as const; +export type CreateEnvironmentParam = CreateEnvironmentParamOpenaiHosted; +export interface CreateEnvironmentParamOpenaiHosted { + type: "openai_hosted"; + packages?: EnvironmentPackagesParam | null; + setup_commands?: SetupCommandParam[] | null; + network?: NetworkPolicyParam | null; + desktop?: DesktopParam | null; + env?: Record | null; + capability_directories?: string[] | null; + skills?: HostedSkillParam[] | null; + plugins?: HostedPluginParam[] | null; + files?: HostedEnvironmentFileParam[] | null; + environment_template_id?: string; +} +export const createEnvironmentParamOpenaiHostedFields = ["type", "packages", "setup_commands", "network", "desktop", "env", "capability_directories", "skills", "plugins", "files", "environment_template_id"] as const; +export const createEnvironmentParamOpenaiHostedRequired = ["type"] as const; export interface CreateEnvironmentTemplateParams { packages?: EnvironmentPackagesParam | null; setup_commands?: SetupCommandParam[] | null; network?: NetworkPolicyParam | null; + desktop?: DesktopParam | null; env?: Record | null; capability_directories?: string[] | null; skills?: HostedSkillParam[] | null; @@ -185,7 +525,7 @@ export interface CreateEnvironmentTemplateParams { files?: HostedEnvironmentFileParam[] | null; name?: string | null; } -export const createEnvironmentTemplateParamsFields = ["packages", "setup_commands", "network", "env", "capability_directories", "skills", "plugins", "files", "name"] as const; +export const createEnvironmentTemplateParamsFields = ["packages", "setup_commands", "network", "desktop", "env", "capability_directories", "skills", "plugins", "files", "name"] as const; export const createEnvironmentTemplateParamsRequired = [] as const; export interface CreateFileRequest { file: string; @@ -245,7 +585,14 @@ export interface CreateSubagentCallItemResource { reasoning_effort: string | null; } export const createSubagentCallItemResourceFields = ["type", "id", "turn_id", "status", "agent_id", "content", "model", "reasoning_effort"] as const; -export type CreateVaultCredentialAuthParam = CreateVaultCredentialAuthParamMcpOauth | CreateVaultCredentialAuthParamStaticBearer; +export type CreateVaultCredentialAuthParam = CreateVaultCredentialAuthParamMcpOauth | CreateVaultCredentialAuthParamStaticBearer | CreateVaultCredentialAuthParamEnvironmentVariable; +export interface CreateVaultCredentialAuthParamEnvironmentVariable { + type: "environment_variable"; + secret_name: string; + secret_value: string; + networking: VaultCredentialNetworkingParam; +} +export const createVaultCredentialAuthParamEnvironmentVariableFields = ["type", "secret_name", "secret_value", "networking"] as const; export interface CreateVaultCredentialAuthParamMcpOauth { type: "mcp_oauth"; mcp_server_url: string; @@ -264,8 +611,10 @@ export const createVaultCredentialAuthParamStaticBearerFields = ["type", "mcp_se export interface CreateVaultCredentialParams { name: string; auth: CreateVaultCredentialAuthParam; + metadata?: Record; } -export const createVaultCredentialParamsFields = ["name", "auth"] as const; +export const createVaultCredentialParamsFields = ["name", "auth", "metadata"] as const; +export const createVaultCredentialParamsRequired = ["auth", "name"] as const; export interface CreateVaultParams { name?: string; metadata?: Record | null; @@ -284,6 +633,12 @@ export interface DeletedAgentResource { deleted: boolean; } export const deletedAgentResourceFields = ["id", "object", "deleted"] as const; +export interface DeletedAutomationResource { + id: string; + object: "agent.automation.deleted"; + deleted: boolean; +} +export const deletedAutomationResourceFields = ["id", "object", "deleted"] as const; export interface DeletedEnvironmentTemplateResource { id: string; object: "agent.environment.template.deleted"; @@ -327,6 +682,14 @@ export interface DeletedVaultResource { deleted: boolean; } export const deletedVaultResourceFields = ["id", "object", "deleted"] as const; +export interface DesktopParam { + enabled: boolean; +} +export const desktopParamFields = ["enabled"] as const; +export interface DesktopResource { + enabled: boolean; +} +export const desktopResourceFields = ["enabled"] as const; export interface EncryptedContentResource { type: "encrypted_content"; encrypted_content: string; @@ -380,21 +743,24 @@ export interface EnvironmentParamOpenaiHosted { packages?: EnvironmentPackagesParam | null; setup_commands?: SetupCommandParam[] | null; network?: NetworkPolicyParam | null; + desktop?: DesktopParam | null; env?: Record | null; capability_directories?: string[] | null; skills?: HostedSkillParam[] | null; plugins?: HostedPluginParam[] | null; files?: HostedEnvironmentFileParam[] | null; + environment_id?: string; environment_template_id?: string; + container_size?: ContainerSizeParam; } -export const environmentParamOpenaiHostedFields = ["type", "packages", "setup_commands", "network", "env", "capability_directories", "skills", "plugins", "files", "environment_template_id"] as const; +export const environmentParamOpenaiHostedFields = ["type", "packages", "setup_commands", "network", "desktop", "env", "capability_directories", "skills", "plugins", "files", "environment_id", "environment_template_id", "container_size"] as const; export const environmentParamOpenaiHostedRequired = ["type"] as const; export interface EnvironmentParamSelfHosted { type: "self_hosted"; - workspace_directory: string; capability_directories?: string[] | null; + workspace_directory: string; } -export const environmentParamSelfHostedFields = ["type", "workspace_directory", "capability_directories"] as const; +export const environmentParamSelfHostedFields = ["type", "capability_directories", "workspace_directory"] as const; export const environmentParamSelfHostedRequired = ["type", "workspace_directory"] as const; export type EnvironmentResource = EnvironmentResourceNone | EnvironmentResourceOpenaiHosted | EnvironmentResourceSelfHosted; export interface EnvironmentResourceNone { @@ -404,14 +770,17 @@ export const environmentResourceNoneFields = ["type"] as const; export interface EnvironmentResourceOpenaiHosted { type: "openai_hosted"; id: string; + container_size?: ContainerSizeResource | null; packages: EnvironmentPackagesResource; network: NetworkPolicyResource; + desktop: DesktopResource; capability_directories: string[]; skills: HostedSkillResource[]; plugins: HostedPluginResource[]; files: HostedEnvironmentFileResource[]; } -export const environmentResourceOpenaiHostedFields = ["type", "id", "packages", "network", "capability_directories", "skills", "plugins", "files"] as const; +export const environmentResourceOpenaiHostedFields = ["type", "id", "container_size", "packages", "network", "desktop", "capability_directories", "skills", "plugins", "files"] as const; +export const environmentResourceOpenaiHostedRequired = ["type", "id", "packages", "network", "desktop", "capability_directories", "skills", "plugins", "files"] as const; export interface EnvironmentResourceSelfHosted { type: "self_hosted"; remote_url: string; @@ -420,7 +789,7 @@ export interface EnvironmentResourceSelfHosted { capability_directories: string[]; } export const environmentResourceSelfHostedFields = ["type", "remote_url", "id", "workspace_directory", "capability_directories"] as const; -export const environmentStatusResourceValues = ["pending", "connected", "disconnected", "expired", "failed"] as const; +export const environmentStatusResourceValues = ["pending", "ready", "connected", "disconnected", "suspended", "expired", "failed"] as const; export type EnvironmentStatusResource = (typeof environmentStatusResourceValues)[number]; export interface EnvironmentTemplateListResource { object: "list"; @@ -438,12 +807,15 @@ export interface EnvironmentTemplateResource { updated_at: number; packages: EnvironmentPackagesResource; network: NetworkPolicyResource; + desktop: DesktopResource; capability_directories: string[]; skills: HostedTemplateSkillResource[]; plugins: HostedPluginResource[]; files: HostedTemplateFileResource[]; } -export const environmentTemplateResourceFields = ["id", "name", "object", "created_at", "updated_at", "packages", "network", "capability_directories", "skills", "plugins", "files"] as const; +export const environmentTemplateResourceFields = ["id", "name", "object", "created_at", "updated_at", "packages", "network", "desktop", "capability_directories", "skills", "plugins", "files"] as const; +export const environmentTypeParamValues = ["openai_hosted"] as const; +export type EnvironmentTypeParam = (typeof environmentTypeParamValues)[number]; export const environmentTypeResourceValues = ["openai_hosted", "self_hosted"] as const; export type EnvironmentTypeResource = (typeof environmentTypeResourceValues)[number]; export interface Error { @@ -470,6 +842,20 @@ export interface ErrorResponse2 { error: ErrorBodyResource; } export const errorResponse2Fields = ["error"] as const; +export interface ExperimentalConfigOverridesParam { + time_awareness?: boolean; +} +export const experimentalConfigOverridesParamFields = ["time_awareness"] as const; +export const experimentalConfigOverridesParamRequired = [] as const; +export interface ExperimentalConfigParam { + time_awareness?: boolean; +} +export const experimentalConfigParamFields = ["time_awareness"] as const; +export const experimentalConfigParamRequired = [] as const; +export interface ExperimentalConfigResource { + time_awareness: boolean; +} +export const experimentalConfigResourceFields = ["time_awareness"] as const; export interface FileExpirationAfter { anchor: "created_at"; seconds: number; @@ -635,10 +1021,16 @@ export interface InputMessageParam { } export const inputMessageParamFields = ["type", "role", "content"] as const; export const inputMessageParamRequired = ["role", "content"] as const; -export interface InputTokensDetailsResource { +export interface InputMessageResource2 { + type: "message"; + role: "user"; + content: InputContentResource[]; +} +export const inputMessageResource2Fields = ["type", "role", "content"] as const; +export interface InputTokensDetailsResource2 { cached_tokens: number; } -export const inputTokensDetailsResourceFields = ["cached_tokens"] as const; +export const inputTokensDetailsResource2Fields = ["cached_tokens"] as const; export const installationStatusValues = ["available", "unavailable"] as const; export type InstallationStatus = (typeof installationStatusValues)[number]; export interface InterruptSubagentCallItemResource { @@ -759,11 +1151,12 @@ export const messageItemResourceFields = ["type", "id", "turn_id", "role", "cont export const messagePhaseResourceValues = ["commentary", "final_answer"] as const; export type MessagePhaseResource = (typeof messagePhaseResourceValues)[number]; export interface MisalignmentErrorDetailsResource { + review_target?: string | null; error_type?: _MisalignmentErrorType; detailed_explanation?: string; steer?: _MisalignmentSteer; } -export const misalignmentErrorDetailsResourceFields = ["error_type", "detailed_explanation", "steer"] as const; +export const misalignmentErrorDetailsResourceFields = ["review_target", "error_type", "detailed_explanation", "steer"] as const; export const misalignmentErrorDetailsResourceRequired = [] as const; export interface ModelProviderInput { api_key: string; @@ -801,17 +1194,20 @@ export type NetworkAccessResource = (typeof networkAccessResourceValues)[number] export interface NetworkPolicyParam { access: NetworkAccessParam; allowed_domains?: string[] | null; + blocked_domains?: string[] | null; } -export const networkPolicyParamFields = ["access", "allowed_domains"] as const; +export const networkPolicyParamFields = ["access", "allowed_domains", "blocked_domains"] as const; export const networkPolicyParamRequired = ["access"] as const; export interface NetworkPolicyResource { access: NetworkAccessResource; allowed_domains: string[]; } export const networkPolicyResourceFields = ["access", "allowed_domains"] as const; +export const onceAutomationStatusResourceValues = ["active", "paused", "completed"] as const; +export type OnceAutomationStatusResource = (typeof onceAutomationStatusResourceValues)[number]; export interface OpenAIFile { id: string; - bytes: number; + bytes: number | null; created_at: number; expires_at?: number; filename: string; @@ -831,11 +1227,23 @@ export interface OutputTextResource { text: string; } export const outputTextResourceFields = ["type", "text"] as const; -export interface OutputTokensDetailsResource { +export interface OutputTokensDetailsResource2 { reasoning_tokens: number; } -export const outputTokensDetailsResourceFields = ["reasoning_tokens"] as const; -export type PersistedAgentToolConfigParam = PersistedAgentToolConfigParamFunction | PersistedAgentToolConfigParamToolSearch | PersistedAgentToolConfigParamProgrammaticToolCalling | PersistedAgentToolConfigParamMcp | PersistedAgentToolConfigParamWebSearch; +export const outputTokensDetailsResource2Fields = ["reasoning_tokens"] as const; +export const periodicAutomationStatusResourceValues = ["active", "paused"] as const; +export type PeriodicAutomationStatusResource = (typeof periodicAutomationStatusResourceValues)[number]; +export type PersistedAgentToolConfigParam = PersistedAgentToolConfigParamFunction | PersistedAgentToolConfigParamToolSearch | PersistedAgentToolConfigParamProgrammaticToolCalling | PersistedAgentToolConfigParamMcp | PersistedAgentToolConfigParamWebSearch | PersistedAgentToolConfigParamComputerUse | PersistedAgentToolConfigParamAutomations; +export interface PersistedAgentToolConfigParamAutomations { + type: "automations"; +} +export const persistedAgentToolConfigParamAutomationsFields = ["type"] as const; +export interface PersistedAgentToolConfigParamComputerUse { + type: "computer_use"; + include_screenshots?: boolean; +} +export const persistedAgentToolConfigParamComputerUseFields = ["type", "include_screenshots"] as const; +export const persistedAgentToolConfigParamComputerUseRequired = ["type"] as const; export interface PersistedAgentToolConfigParamFunction { type: "function"; name: string; @@ -876,7 +1284,16 @@ export interface PersistedAgentToolConfigParamWebSearch { } export const persistedAgentToolConfigParamWebSearchFields = ["type", "mode", "context_size", "allowed_domains", "location"] as const; export const persistedAgentToolConfigParamWebSearchRequired = ["type"] as const; -export type PersistedAgentToolResource = PersistedAgentToolResourceFunction | PersistedAgentToolResourceToolSearch | PersistedAgentToolResourceProgrammaticToolCalling | PersistedAgentToolResourceMcp | PersistedAgentToolResourceWebSearch; +export type PersistedAgentToolResource = PersistedAgentToolResourceFunction | PersistedAgentToolResourceToolSearch | PersistedAgentToolResourceProgrammaticToolCalling | PersistedAgentToolResourceMcp | PersistedAgentToolResourceWebSearch | PersistedAgentToolResourceComputerUse | PersistedAgentToolResourceAutomations; +export interface PersistedAgentToolResourceAutomations { + type: "automations"; +} +export const persistedAgentToolResourceAutomationsFields = ["type"] as const; +export interface PersistedAgentToolResourceComputerUse { + type: "computer_use"; + include_screenshots: boolean; +} +export const persistedAgentToolResourceComputerUseFields = ["type", "include_screenshots"] as const; export interface PersistedAgentToolResourceFunction { type: "function"; name: string; @@ -948,15 +1365,15 @@ export const persistedMcpTransportResourceStdioFields = ["type", "command", "arg export const protocolValues = ["anthropic", "responses", "chat_completions"] as const; export type Protocol = (typeof protocolValues)[number]; export interface PublicEnvironmentResource { + type: EnvironmentTypeResource; id: string; object: "agent.environment"; - type: EnvironmentTypeResource; status: EnvironmentStatusResource; files: HostedEnvironmentFileResource[]; skills: HostedSkillResource[]; plugins: HostedPluginResource[]; } -export const publicEnvironmentResourceFields = ["id", "object", "type", "status", "files", "skills", "plugins"] as const; +export const publicEnvironmentResourceFields = ["type", "id", "object", "status", "files", "skills", "plugins"] as const; export const reasoningEffortParamValues = ["none", "minimal", "low", "medium", "high", "xhigh", "max"] as const; export type ReasoningEffortParam = (typeof reasoningEffortParamValues)[number]; export const reasoningEffortResourceValues = ["none", "minimal", "low", "medium", "high", "xhigh", "max"] as const; @@ -1013,7 +1430,12 @@ export interface RotateMcpOauthTokenEndpointAuthParamClientSecretPost { } export const rotateMcpOauthTokenEndpointAuthParamClientSecretPostFields = ["type", "client_secret"] as const; export const rotateMcpOauthTokenEndpointAuthParamClientSecretPostRequired = ["type"] as const; -export type RotateVaultCredentialAuthParam = RotateVaultCredentialAuthParamMcpOauth | RotateVaultCredentialAuthParamStaticBearer; +export type RotateVaultCredentialAuthParam = RotateVaultCredentialAuthParamMcpOauth | RotateVaultCredentialAuthParamStaticBearer | RotateVaultCredentialAuthParamEnvironmentVariable; +export interface RotateVaultCredentialAuthParamEnvironmentVariable { + type: "environment_variable"; + secret_value: string; +} +export const rotateVaultCredentialAuthParamEnvironmentVariableFields = ["type", "secret_value"] as const; export interface RotateVaultCredentialAuthParamMcpOauth { type: "mcp_oauth"; access_token?: string | null; @@ -1028,9 +1450,11 @@ export interface RotateVaultCredentialAuthParamStaticBearer { } export const rotateVaultCredentialAuthParamStaticBearerFields = ["type", "token"] as const; export interface RotateVaultCredentialParams { - auth: RotateVaultCredentialAuthParam; + auth?: RotateVaultCredentialAuthParam; + metadata?: Record; } -export const rotateVaultCredentialParamsFields = ["auth"] as const; +export const rotateVaultCredentialParamsFields = ["auth", "metadata"] as const; +export const rotateVaultCredentialParamsRequired = [] as const; export interface SavedAgentCore { harness?: "claude_sdk" | "codex" | "mcode"; harness_config?: Record; @@ -1055,21 +1479,23 @@ export interface SendSubagentInputCallItemResource { content: AgentContentResource[]; } export const sendSubagentInputCallItemResourceFields = ["type", "id", "turn_id", "status", "sender_agent_id", "recipient_agent_id", "content"] as const; -export const serviceTierParamValues = ["auto", "default", "flex", "priority", "fast"] as const; +export const serviceTierParamValues = ["auto", "default", "flex", "priority", "fast", "ultrafast"] as const; export type ServiceTierParam = (typeof serviceTierParamValues)[number]; -export const serviceTierResourceValues = ["auto", "default", "flex", "priority", "fast"] as const; +export const serviceTierResourceValues = ["auto", "default", "flex", "priority", "fast", "ultrafast"] as const; export type ServiceTierResource = (typeof serviceTierResourceValues)[number]; export interface SessionAgentConfigParam { + experimental?: ExperimentalConfigOverridesParam; model?: string; reasoning?: ReasoningParam | null; text?: TextParam | null; service_tier?: ServiceTierParam | null; instructions?: string | null; multi_agent?: MultiAgentConfigCurrentParam | null; + compaction?: CompactionParam | null; tools?: AgentToolConfigParam[] | null; x_agents_core?: AgentsCore | null; } -export const sessionAgentConfigParamFields = ["model", "reasoning", "text", "service_tier", "instructions", "multi_agent", "tools", "x_agents_core"] as const; +export const sessionAgentConfigParamFields = ["experimental", "model", "reasoning", "text", "service_tier", "instructions", "multi_agent", "compaction", "tools", "x_agents_core"] as const; export const sessionAgentConfigParamRequired = [] as const; export interface SessionAgentResource { id: string; @@ -1081,9 +1507,11 @@ export interface SessionAgentResource { instructions: string | null; tools: AgentToolResource[]; multi_agent: MultiAgentConfigResource; + compaction?: CompactionResource; + experimental?: ExperimentalConfigResource; x_agents_core?: AgentsCore | null; } -export const sessionAgentResourceFields = ["id", "name", "model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent", "x_agents_core"] as const; +export const sessionAgentResourceFields = ["id", "name", "model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent", "compaction", "experimental", "x_agents_core"] as const; export const sessionAgentResourceRequired = ["id", "name", "model", "reasoning", "text", "service_tier", "instructions", "tools", "multi_agent"] as const; export interface SessionArtifactListResource { object: "list"; @@ -1122,7 +1550,7 @@ export interface SessionEnvironmentStateResource { error: SessionEnvironmentErrorResource | null; } export const sessionEnvironmentStateResourceFields = ["id", "type", "status", "error"] as const; -export const sessionEnvironmentStatusResourceValues = ["pending", "ready", "connected", "disconnected", "failed"] as const; +export const sessionEnvironmentStatusResourceValues = ["pending", "ready", "connected", "disconnected", "suspended", "expired", "failed"] as const; export type SessionEnvironmentStatusResource = (typeof sessionEnvironmentStatusResourceValues)[number]; export interface SessionErrorResource { type: string; @@ -1131,7 +1559,7 @@ export interface SessionErrorResource { param: string | null; } export const sessionErrorResourceFields = ["type", "code", "message", "param"] as const; -export type SessionEvent = SessionEventError | SessionEventAgentSessionEnvironmentReady | SessionEventAgentOutputCommandExecutionOutputDelta | SessionEventAgentSessionCreated | SessionEventAgentSessionTurnCreated | SessionEventAgentSessionTurnInProgress | SessionEventAgentSessionTurnCompleted | SessionEventAgentSessionTurnFailed | SessionEventAgentSessionTurnCancelled | SessionEventAgentSessionTurnItemAdded | SessionEventAgentSessionIdle | SessionEventAgentSessionInProgress | SessionEventAgentSessionRequiresAction | SessionEventAgentSessionFailed | SessionEventAgentSessionEnvironmentPending | SessionEventAgentSessionEnvironmentConnected | SessionEventAgentSessionEnvironmentDisconnected | SessionEventAgentSessionEnvironmentFailed | SessionEventAgentSessionSubagentCreated | SessionEventAgentSessionSubagentActive | SessionEventAgentSessionSubagentClosed | SessionEventAgentSessionTurnItemDone | SessionEventAgentSessionTurnContentPartAdded | SessionEventAgentSessionTurnContentPartDone | SessionEventAgentSessionTurnOutputTextDelta | SessionEventAgentSessionTurnOutputTextDone | SessionEventAgentSessionTurnReasoningSummaryPartAdded | SessionEventAgentSessionTurnReasoningSummaryPartDone | SessionEventAgentSessionTurnReasoningSummaryTextDelta | SessionEventAgentSessionTurnReasoningSummaryTextDone; +export type SessionEvent = SessionEventError | SessionEventAgentSessionEnvironmentReady | SessionEventAgentSessionEnvironmentSuspended | SessionEventAgentSessionEnvironmentExpired | SessionEventAgentSessionEnvironmentReset | SessionEventAgentOutputCommandExecutionOutputDelta | SessionEventAgentSessionCreated | SessionEventAgentSessionTurnCreated | SessionEventAgentSessionTurnInProgress | SessionEventAgentSessionTurnCompleted | SessionEventAgentSessionTurnFailed | SessionEventAgentSessionTurnCancelled | SessionEventAgentSessionTurnItemAdded | SessionEventAgentSessionIdle | SessionEventAgentSessionInProgress | SessionEventAgentSessionRequiresAction | SessionEventAgentSessionFailed | SessionEventAgentSessionEnvironmentPending | SessionEventAgentSessionEnvironmentConnected | SessionEventAgentSessionEnvironmentDisconnected | SessionEventAgentSessionEnvironmentFailed | SessionEventAgentSessionSubagentCreated | SessionEventAgentSessionSubagentActive | SessionEventAgentSessionSubagentClosed | SessionEventAgentSessionTurnItemDone | SessionEventAgentSessionTurnContentPartAdded | SessionEventAgentSessionTurnContentPartDone | SessionEventAgentSessionTurnOutputTextDelta | SessionEventAgentSessionTurnOutputTextDone | SessionEventAgentSessionTurnReasoningSummaryPartAdded | SessionEventAgentSessionTurnReasoningSummaryPartDone | SessionEventAgentSessionTurnReasoningSummaryTextDelta | SessionEventAgentSessionTurnReasoningSummaryTextDone; export interface SessionEventAgentOutputCommandExecutionOutputDelta { type: "agent.output.command_execution_output.delta"; event_id: string; @@ -1164,6 +1592,14 @@ export interface SessionEventAgentSessionEnvironmentDisconnected { environment: SessionEnvironmentStateResource; } export const sessionEventAgentSessionEnvironmentDisconnectedFields = ["type", "event_id", "session_id", "turn_id", "environment"] as const; +export interface SessionEventAgentSessionEnvironmentExpired { + type: "agent.session.environment.expired"; + event_id: string; + session_id: string; + turn_id: string | null; + environment: SessionEnvironmentStateResource; +} +export const sessionEventAgentSessionEnvironmentExpiredFields = ["type", "event_id", "session_id", "turn_id", "environment"] as const; export interface SessionEventAgentSessionEnvironmentFailed { type: "agent.session.environment.failed"; event_id: string; @@ -1188,6 +1624,23 @@ export interface SessionEventAgentSessionEnvironmentReady { environment: SessionEnvironmentStateResource; } export const sessionEventAgentSessionEnvironmentReadyFields = ["type", "event_id", "session_id", "turn_id", "environment"] as const; +export interface SessionEventAgentSessionEnvironmentReset { + type: "agent.session.environment.reset"; + event_id: string; + session_id: string; + turn_id: string | null; + environment_id: string; + reset_count: number; +} +export const sessionEventAgentSessionEnvironmentResetFields = ["type", "event_id", "session_id", "turn_id", "environment_id", "reset_count"] as const; +export interface SessionEventAgentSessionEnvironmentSuspended { + type: "agent.session.environment.suspended"; + event_id: string; + session_id: string; + turn_id: string | null; + environment: SessionEnvironmentStateResource; +} +export const sessionEventAgentSessionEnvironmentSuspendedFields = ["type", "event_id", "session_id", "turn_id", "environment"] as const; export interface SessionEventAgentSessionFailed { type: "agent.session.failed"; event_id: string; @@ -1394,11 +1847,17 @@ export interface SessionExecutionInput { } export const sessionExecutionInputFields = ["environment", "harness_config", "model_provider"] as const; export const sessionExecutionInputRequired = [] as const; -export type SessionInputParam = SessionInputParamAgentSessionInputMessage | SessionInputParamAgentSessionInputCancel | SessionInputParamAgentSessionInputToolResult; +export type SessionInputParam = SessionInputParamAgentSessionInputComputerUseApprovalRequestResult | SessionInputParamAgentSessionInputMessage | SessionInputParamAgentSessionInputCancel | SessionInputParamAgentSessionInputToolResult; export interface SessionInputParamAgentSessionInputCancel { type: "agent.session.input.cancel"; } export const sessionInputParamAgentSessionInputCancelFields = ["type"] as const; +export interface SessionInputParamAgentSessionInputComputerUseApprovalRequestResult { + type: "agent.session.input.computer_use_approval_request_result"; + request_id: string; + response: ComputerUseApprovalResponseParam; +} +export const sessionInputParamAgentSessionInputComputerUseApprovalRequestResultFields = ["type", "request_id", "response"] as const; export interface SessionInputParamAgentSessionInputMessage { type: "agent.session.input.message"; input: InputMessageParam[]; @@ -1432,7 +1891,14 @@ export interface SessionListResource { export const sessionListResourceFields = ["object", "data", "first_id", "last_id", "has_more"] as const; export const sessionMessageRoleResourceValues = ["user", "assistant"] as const; export type SessionMessageRoleResource = (typeof sessionMessageRoleResourceValues)[number]; -export type SessionRequiredActionResource = SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection; +export type SessionRequiredActionResource = SessionRequiredActionResourceComputerUseApprovalRequest | SessionRequiredActionResourceFunctionCall | SessionRequiredActionResourceEnvironmentConnection; +export interface SessionRequiredActionResourceComputerUseApprovalRequest { + type: "computer_use_approval_request"; + turn_id: string; + request_id: string; + request: ComputerUseApprovalRequestKindResource; +} +export const sessionRequiredActionResourceComputerUseApprovalRequestFields = ["type", "turn_id", "request_id", "request"] as const; export interface SessionRequiredActionResourceEnvironmentConnection { type: "environment_connection"; environment_id: string; @@ -1447,6 +1913,7 @@ export interface SessionRequiredActionResourceFunctionCall { } export const sessionRequiredActionResourceFunctionCallFields = ["type", "turn_id", "call_id", "name", "arguments"] as const; export interface SessionResource { + review?: SessionReviewResource; metadata: Record; id: string; object: "agent.session"; @@ -1461,18 +1928,30 @@ export interface SessionResource { usage: TokenUsageResource | null; x_agents_core?: SessionCore | null; } -export const sessionResourceFields = ["metadata", "id", "object", "created_at", "last_active_at", "status", "required_actions", "error", "agent", "environment", "vault_ids", "usage", "x_agents_core"] as const; +export const sessionResourceFields = ["review", "metadata", "id", "object", "created_at", "last_active_at", "status", "required_actions", "error", "agent", "environment", "vault_ids", "usage", "x_agents_core"] as const; export const sessionResourceRequired = ["metadata", "id", "object", "created_at", "last_active_at", "status", "required_actions", "error", "agent", "environment", "vault_ids", "usage"] as const; +export const sessionReviewParamValues = ["none", "auto_review"] as const; +export type SessionReviewParam = (typeof sessionReviewParamValues)[number]; +export const sessionReviewResourceValues = ["none", "auto_review"] as const; +export type SessionReviewResource = (typeof sessionReviewResourceValues)[number]; export const sessionStatusResourceValues = ["idle", "in_progress", "requires_action", "failed"] as const; export type SessionStatusResource = (typeof sessionStatusResourceValues)[number]; -export const sessionTurnErrorCodeResourceValues = ["context_length_exceeded", "session_budget_exceeded", "usage_limit_exceeded", "rate_limit_exceeded", "server_overloaded", "cyber_policy", "connection_failed", "server_error", "authentication_error", "invalid_request", "resource_not_found", "sandbox_error", "executor_version_incompatible", "active_turn_not_steerable", "request_timeout", "internal_error"] as const; +export interface SessionTraceListResource { + object: "list"; + data: SessionTurnTraceResource[]; + first_id: string | null; + last_id: string | null; + has_more: boolean; +} +export const sessionTraceListResourceFields = ["object", "data", "first_id", "last_id", "has_more"] as const; +export const sessionTurnErrorCodeResourceValues = ["context_length_exceeded", "session_budget_exceeded", "usage_limit_exceeded", "project_spend_limit_exceeded", "organization_spend_limit_exceeded", "organization_usage_limit_exceeded", "billing_not_active", "credit_balance_exhausted", "rate_limit_exceeded", "flex_unavailable", "server_overloaded", "cyber_policy", "misalignment_policy_violation", "connection_failed", "server_error", "authentication_error", "invalid_request", "resource_not_found", "sandbox_error", "executor_version_incompatible", "active_turn_not_steerable", "request_timeout", "internal_error"] as const; export type SessionTurnErrorCodeResource = (typeof sessionTurnErrorCodeResourceValues)[number]; export interface SessionTurnErrorResource { code: SessionTurnErrorCodeResource; message: string; } export const sessionTurnErrorResourceFields = ["code", "message"] as const; -export type SessionTurnItemResource = MessageItemResource | ReasoningItemResource | FunctionCallItemResource | FunctionCallOutputItemResource | AgentMessageItemResource | McpCallItemResource | WebSearchCallItemResource | CommandExecutionItemResource | CreateSubagentCallItemResource | SendSubagentInputCallItemResource | ResumeSubagentCallItemResource | WaitForSubagentsCallItemResource | InterruptSubagentCallItemResource | CloseSubagentCallItemResource; +export type SessionTurnItemResource = MessageItemResource | ReasoningItemResource | FunctionCallItemResource | FunctionCallOutputItemResource | AgentMessageItemResource | McpCallItemResource | ComputerUseCallItemResource | BrowserAuthenticationRequestItemResource | ComputerUseApprovalRequestResultItemResource | WebSearchCallItemResource | CommandExecutionItemResource | CreateSubagentCallItemResource | SendSubagentInputCallItemResource | ResumeSubagentCallItemResource | WaitForSubagentsCallItemResource | InterruptSubagentCallItemResource | CloseSubagentCallItemResource; export interface SessionTurnListResource { object: "list"; data: TurnResource[]; @@ -1481,6 +1960,14 @@ export interface SessionTurnListResource { has_more: boolean; } export const sessionTurnListResourceFields = ["object", "data", "first_id", "last_id", "has_more"] as const; +export interface SessionTurnTraceResource { + id: string; + object: "agent.session.trace"; + session_id: string; + created_at: number; + otlp: Record; +} +export const sessionTurnTraceResourceFields = ["id", "object", "session_id", "created_at", "otlp"] as const; export interface SetDefaultSkillVersionBody { default_version: string; } @@ -1581,9 +2068,9 @@ export interface TextResource { export const textResourceFields = ["format", "verbosity"] as const; export interface TokenUsageResource { input_tokens: number; - input_tokens_details: InputTokensDetailsResource; + input_tokens_details: InputTokensDetailsResource2; output_tokens: number; - output_tokens_details: OutputTokensDetailsResource; + output_tokens_details: OutputTokensDetailsResource2; total_tokens: number; } export const tokenUsageResourceFields = ["input_tokens", "input_tokens_details", "output_tokens", "output_tokens_details", "total_tokens"] as const; @@ -1606,38 +2093,78 @@ export const turnResourceFields = ["id", "object", "session_id", "agent_id", "su export const turnStatusResourceValues = ["queued", "in_progress", "waiting", "completed", "failed", "cancelled"] as const; export type TurnStatusResource = (typeof turnStatusResourceValues)[number]; export interface UpdateAgentParams { + experimental?: ExperimentalConfigOverridesParam; model?: string; reasoning?: ReasoningParam | null; text?: TextParam | null; service_tier?: ServiceTierParam | null; instructions?: string | null; multi_agent?: MultiAgentConfigCurrentParam | null; + compaction?: CompactionParam | null; metadata?: Record | null; name?: string | null; tools?: PersistedAgentToolConfigParam[] | null; x_agents_core?: SavedAgentCoreInput | null; } -export const updateAgentParamsFields = ["model", "reasoning", "text", "service_tier", "instructions", "multi_agent", "metadata", "name", "tools", "x_agents_core"] as const; +export const updateAgentParamsFields = ["experimental", "model", "reasoning", "text", "service_tier", "instructions", "multi_agent", "compaction", "metadata", "name", "tools", "x_agents_core"] as const; export const updateAgentParamsRequired = [] as const; export interface UpdateAgentSessionParams { + review?: SessionReviewParam; + agent?: UpdateSessionAgentParam; metadata?: Record | null; } -export const updateAgentSessionParamsFields = ["metadata"] as const; +export const updateAgentSessionParamsFields = ["review", "agent", "metadata"] as const; export const updateAgentSessionParamsRequired = [] as const; +export interface UpdateAutomationParams { + name?: string; + target?: AutomationTargetParam; + metadata?: Record; + expression?: string; + timezone?: string; + run_at?: number; +} +export const updateAutomationParamsFields = ["name", "target", "metadata", "expression", "timezone", "run_at"] as const; +export const updateAutomationParamsRequired = [] as const; export interface UpdateEnvironmentTemplateParams { name?: string | null; packages?: EnvironmentPackagesParam | null; setup_commands?: SetupCommandParam[] | null; network?: NetworkPolicyParam | null; + desktop?: DesktopParam | null; env?: Record | null; capability_directories?: string[] | null; skills?: HostedSkillParam[] | null; plugins?: HostedPluginParam[] | null; files?: HostedEnvironmentFileParam[] | null; } -export const updateEnvironmentTemplateParamsFields = ["name", "packages", "setup_commands", "network", "env", "capability_directories", "skills", "plugins", "files"] as const; +export const updateEnvironmentTemplateParamsFields = ["name", "packages", "setup_commands", "network", "desktop", "env", "capability_directories", "skills", "plugins", "files"] as const; export const updateEnvironmentTemplateParamsRequired = [] as const; -export type VaultCredentialAuthResource = VaultCredentialAuthResourceMcpOauth | VaultCredentialAuthResourceStaticBearer; +export interface UpdateSessionAgentParam { + tools?: AgentToolConfigParam[] | null; + model?: string; + reasoning?: UpdateSessionReasoningParam; + service_tier?: ServiceTierParam | null; +} +export const updateSessionAgentParamFields = ["tools", "model", "reasoning", "service_tier"] as const; +export const updateSessionAgentParamRequired = [] as const; +export interface UpdateSessionReasoningParam { + effort?: ReasoningEffortParam | null; +} +export const updateSessionReasoningParamFields = ["effort"] as const; +export const updateSessionReasoningParamRequired = [] as const; +export interface UpdateVaultParams { + metadata?: Record; + name?: string | null; +} +export const updateVaultParamsFields = ["metadata", "name"] as const; +export const updateVaultParamsRequired = [] as const; +export type VaultCredentialAuthResource = VaultCredentialAuthResourceMcpOauth | VaultCredentialAuthResourceStaticBearer | VaultCredentialAuthResourceEnvironmentVariable; +export interface VaultCredentialAuthResourceEnvironmentVariable { + type: "environment_variable"; + secret_name: string; + networking: VaultCredentialNetworkingResource; +} +export const vaultCredentialAuthResourceEnvironmentVariableFields = ["type", "secret_name", "networking"] as const; export interface VaultCredentialAuthResourceMcpOauth { type: "mcp_oauth"; mcp_server_url: string; @@ -1658,16 +2185,37 @@ export interface VaultCredentialListResource { has_more: boolean; } export const vaultCredentialListResourceFields = ["object", "data", "first_id", "last_id", "has_more"] as const; +export type VaultCredentialNetworkingParam = VaultCredentialNetworkingParamUnrestricted | VaultCredentialNetworkingParamLimited; +export interface VaultCredentialNetworkingParamLimited { + type: "limited"; + allowed_hosts: string[]; +} +export const vaultCredentialNetworkingParamLimitedFields = ["type", "allowed_hosts"] as const; +export interface VaultCredentialNetworkingParamUnrestricted { + type: "unrestricted"; +} +export const vaultCredentialNetworkingParamUnrestrictedFields = ["type"] as const; +export type VaultCredentialNetworkingResource = VaultCredentialNetworkingResourceUnrestricted | VaultCredentialNetworkingResourceLimited; +export interface VaultCredentialNetworkingResourceLimited { + type: "limited"; + allowed_hosts: string[]; +} +export const vaultCredentialNetworkingResourceLimitedFields = ["type", "allowed_hosts"] as const; +export interface VaultCredentialNetworkingResourceUnrestricted { + type: "unrestricted"; +} +export const vaultCredentialNetworkingResourceUnrestrictedFields = ["type"] as const; export interface VaultCredentialResource { id: string; object: "vault.credential"; vault_id: string; name: string; auth: VaultCredentialAuthResource; + metadata: Record; created_at: number; updated_at: number; } -export const vaultCredentialResourceFields = ["id", "object", "vault_id", "name", "auth", "created_at", "updated_at"] as const; +export const vaultCredentialResourceFields = ["id", "object", "vault_id", "name", "auth", "metadata", "created_at", "updated_at"] as const; export interface VaultListResource { object: "list"; data: VaultResource[]; @@ -1767,6 +2315,8 @@ export const agentOutputItemResourceFields = { "reasoning": reasoningItemResourceFields, "function_call": functionCallItemResourceFields, "mcp_call": mcpCallItemResourceFields, + "computer_use_call": computerUseCallItemResourceFields, + "computer_use_approval_request": browserAuthenticationRequestItemResourceFields, "web_search_call": webSearchCallItemResourceFields, "command_execution": commandExecutionItemResourceFields, "interrupt_subagent_call": interruptSubagentCallItemResourceFields, @@ -1782,12 +2332,63 @@ export const agentToolConfigParamFields = { "programmatic_tool_calling": agentToolConfigParamProgrammaticToolCallingFields, "mcp": agentToolConfigParamMcpFields, "web_search": agentToolConfigParamWebSearchFields, + "computer_use": agentToolConfigParamComputerUseFields, + "automations": agentToolConfigParamAutomationsFields, } as const; export const agentToolResourceFields = { "function": agentToolResourceFunctionFields, "programmatic_tool_calling": agentToolResourceProgrammaticToolCallingFields, "mcp": agentToolResourceMcpFields, "web_search": agentToolResourceWebSearchFields, + "computer_use": agentToolResourceComputerUseFields, + "automations": agentToolResourceAutomationsFields, +} as const; +export const automationCreatedByResourceFields = { + "developer": automationCreatedByResourceDeveloperFields, + "agent": automationCreatedByResourceAgentFields, +} as const; +export const automationEnvironmentResourceFields = { + "none": automationEnvironmentResourceNoneFields, + "openai_hosted": automationEnvironmentResourceOpenaiHostedFields, + "self_hosted": automationEnvironmentResourceSelfHostedFields, +} as const; +export const automationInvocationSourceResourceFields = { + "manual": automationInvocationSourceResourceManualFields, + "automation": automationInvocationSourceResourceAutomationFields, +} as const; +export const automationResourceFields = { + "periodic": automationResourcePeriodicFields, + "once": automationResourceOnceFields, +} as const; +export const automationTargetParamFields = { + "new_session": automationTargetParamNewSessionFields, + "existing_session": automationTargetParamExistingSessionFields, +} as const; +export const automationTargetResourceFields = { + "new_session": automationTargetResourceNewSessionFields, + "existing_session": automationTargetResourceExistingSessionFields, +} as const; +export const browserAuthenticationHistoryRequestKindResourceFields = { + "browser_authentication": browserAuthenticationHistoryRequestKindResourceBrowserAuthenticationFields, +} as const; +export const computerUseApprovalRequestKindResourceFields = { + "browser_authentication": computerUseApprovalRequestKindResourceBrowserAuthenticationFields, + "browser_origin_access": computerUseApprovalRequestKindResourceBrowserOriginAccessFields, +} as const; +export const computerUseApprovalResponseKindResourceFields = { + "submit": computerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResourceFields, + "cancel": computerUseApprovalResponseKindResourceBrowserAuthenticationCancelResourceFields, +} as const; +export const computerUseApprovalResponseParamFields = { + "browser_authentication": computerUseApprovalResponseParamBrowserAuthenticationFields, + "browser_origin_access": computerUseApprovalResponseParamBrowserOriginAccessParamFields, +} as const; +export const createAutomationParamsFields = { + "periodic": createAutomationParamsPeriodicFields, + "once": createAutomationParamsOnceFields, +} as const; +export const createEnvironmentParamFields = { + "openai_hosted": createEnvironmentParamOpenaiHostedFields, } as const; export const createMcpOauthTokenEndpointAuthParamFields = { "none": createMcpOauthTokenEndpointAuthParamNoneFields, @@ -1797,6 +2398,7 @@ export const createMcpOauthTokenEndpointAuthParamFields = { export const createVaultCredentialAuthParamFields = { "mcp_oauth": createVaultCredentialAuthParamMcpOauthFields, "static_bearer": createVaultCredentialAuthParamStaticBearerFields, + "environment_variable": createVaultCredentialAuthParamEnvironmentVariableFields, } as const; export const environmentParamFields = { "none": environmentParamNoneFields, @@ -1873,6 +2475,8 @@ export const persistedAgentToolConfigParamFields = { "programmatic_tool_calling": persistedAgentToolConfigParamProgrammaticToolCallingFields, "mcp": persistedAgentToolConfigParamMcpFields, "web_search": persistedAgentToolConfigParamWebSearchFields, + "computer_use": persistedAgentToolConfigParamComputerUseFields, + "automations": persistedAgentToolConfigParamAutomationsFields, } as const; export const persistedAgentToolResourceFields = { "function": persistedAgentToolResourceFunctionFields, @@ -1880,6 +2484,8 @@ export const persistedAgentToolResourceFields = { "programmatic_tool_calling": persistedAgentToolResourceProgrammaticToolCallingFields, "mcp": persistedAgentToolResourceMcpFields, "web_search": persistedAgentToolResourceWebSearchFields, + "computer_use": persistedAgentToolResourceComputerUseFields, + "automations": persistedAgentToolResourceAutomationsFields, } as const; export const persistedMcpTransportConfigParamFields = { "http": persistedMcpTransportConfigParamHttpFields, @@ -1896,10 +2502,17 @@ export const rotateMcpOauthTokenEndpointAuthParamFields = { export const rotateVaultCredentialAuthParamFields = { "mcp_oauth": rotateVaultCredentialAuthParamMcpOauthFields, "static_bearer": rotateVaultCredentialAuthParamStaticBearerFields, + "environment_variable": rotateVaultCredentialAuthParamEnvironmentVariableFields, } as const; export const sessionEventFields = { + "agent.session.turn.reasoning_summary_text.delta": sessionEventAgentSessionTurnReasoningSummaryTextDeltaFields, + "agent.session.turn.reasoning_summary_part.done": sessionEventAgentSessionTurnReasoningSummaryPartDoneFields, + "agent.session.turn.reasoning_summary_text.done": sessionEventAgentSessionTurnReasoningSummaryTextDoneFields, "error": sessionEventErrorFields, "agent.session.environment.ready": sessionEventAgentSessionEnvironmentReadyFields, + "agent.session.environment.suspended": sessionEventAgentSessionEnvironmentSuspendedFields, + "agent.session.environment.expired": sessionEventAgentSessionEnvironmentExpiredFields, + "agent.session.environment.reset": sessionEventAgentSessionEnvironmentResetFields, "agent.output.command_execution_output.delta": sessionEventAgentOutputCommandExecutionOutputDeltaFields, "agent.session.created": sessionEventAgentSessionCreatedFields, "agent.session.turn.created": sessionEventAgentSessionTurnCreatedFields, @@ -1925,16 +2538,15 @@ export const sessionEventFields = { "agent.session.turn.output_text.delta": sessionEventAgentSessionTurnOutputTextDeltaFields, "agent.session.turn.output_text.done": sessionEventAgentSessionTurnOutputTextDoneFields, "agent.session.turn.reasoning_summary_part.added": sessionEventAgentSessionTurnReasoningSummaryPartAddedFields, - "agent.session.turn.reasoning_summary_part.done": sessionEventAgentSessionTurnReasoningSummaryPartDoneFields, - "agent.session.turn.reasoning_summary_text.delta": sessionEventAgentSessionTurnReasoningSummaryTextDeltaFields, - "agent.session.turn.reasoning_summary_text.done": sessionEventAgentSessionTurnReasoningSummaryTextDoneFields, } as const; export const sessionInputParamFields = { + "agent.session.input.computer_use_approval_request_result": sessionInputParamAgentSessionInputComputerUseApprovalRequestResultFields, "agent.session.input.message": sessionInputParamAgentSessionInputMessageFields, "agent.session.input.cancel": sessionInputParamAgentSessionInputCancelFields, "agent.session.input.tool_result": sessionInputParamAgentSessionInputToolResultFields, } as const; export const sessionRequiredActionResourceFields = { + "computer_use_approval_request": sessionRequiredActionResourceComputerUseApprovalRequestFields, "function_call": sessionRequiredActionResourceFunctionCallFields, "environment_connection": sessionRequiredActionResourceEnvironmentConnectionFields, } as const; @@ -1945,6 +2557,9 @@ export const sessionTurnItemResourceFields = { "function_call_output": functionCallOutputItemResourceFields, "agent_message": agentMessageItemResourceFields, "mcp_call": mcpCallItemResourceFields, + "computer_use_call": computerUseCallItemResourceFields, + "computer_use_approval_request": browserAuthenticationRequestItemResourceFields, + "computer_use_approval_request_result": computerUseApprovalRequestResultItemResourceFields, "web_search_call": webSearchCallItemResourceFields, "command_execution": commandExecutionItemResourceFields, "interrupt_subagent_call": interruptSubagentCallItemResourceFields, @@ -1965,6 +2580,15 @@ export const textFormatResourceFields = { export const vaultCredentialAuthResourceFields = { "mcp_oauth": vaultCredentialAuthResourceMcpOauthFields, "static_bearer": vaultCredentialAuthResourceStaticBearerFields, + "environment_variable": vaultCredentialAuthResourceEnvironmentVariableFields, +} as const; +export const vaultCredentialNetworkingParamFields = { + "unrestricted": vaultCredentialNetworkingParamUnrestrictedFields, + "limited": vaultCredentialNetworkingParamLimitedFields, +} as const; +export const vaultCredentialNetworkingResourceFields = { + "unrestricted": vaultCredentialNetworkingResourceUnrestrictedFields, + "limited": vaultCredentialNetworkingResourceLimitedFields, } as const; export const webSearchActionResourceFields = { "search": webSearchActionResourceSearchFields, diff --git a/packages/agents-client/src/history-recovery.test.ts b/packages/agents-client/src/history-recovery.test.ts index a63d5f438..2679c7318 100644 --- a/packages/agents-client/src/history-recovery.test.ts +++ b/packages/agents-client/src/history-recovery.test.ts @@ -57,7 +57,7 @@ function itemEvent(item: Record) { } // Exact wire examples also exercised by contracts/agents-api/v1/subagents_test.go. -// The pinned SDK is openai-python d7c41ef, types/beta/agent_session_item.py. +// The pinned SDK is openai-python 9b3458a, types/beta/agent_session_item.py. const items: Record[] = [ { id: "create", turn_id: "turn", type: "create_subagent_call", status: "completed", agent_id: "root", content: [], model: null, reasoning_effort: null }, { id: "create-model", turn_id: "turn", type: "create_subagent_call", status: "failed", agent_id: "root", content: [{ type: "output_text", text: "" }], model: "requested-model", reasoning_effort: "high" }, diff --git a/packages/agents-client/src/protocol-types.test.ts b/packages/agents-client/src/protocol-types.test.ts index cd1722dcb..e5c0c479f 100644 --- a/packages/agents-client/src/protocol-types.test.ts +++ b/packages/agents-client/src/protocol-types.test.ts @@ -90,7 +90,7 @@ describe("Parsar dadf64a7 basic managed Environment profile", () => { const resource = hostedDadf64.environment_resource as AgentEnvironmentResource; expect(Object.keys(environment).sort()).toEqual([ - "capability_directories", "files", "id", "network", "packages", "plugins", "skills", "type", + "capability_directories", "container_size", "desktop", "files", "id", "network", "packages", "plugins", "skills", "type", ]); expect(environment.network).toEqual({ access: "enabled", allowed_domains: [] }); expect(environment.packages).toEqual({ npm: [], python: [], system: [] }); @@ -380,7 +380,6 @@ describe("Parsar 0438880a Environment retrieve resource", () => { expect(resource.plugins).toEqual([]); expect(resource.skills).toEqual([]); } - expectTypeOf().not.toEqualTypeOf(); }); it("retains raw malformed and unsupported fixtures as untrusted test inputs", () => { diff --git a/packages/agents-client/src/session-environment-projection.ts b/packages/agents-client/src/session-environment-projection.ts index a1577f81d..c929e9f99 100644 --- a/packages/agents-client/src/session-environment-projection.ts +++ b/packages/agents-client/src/session-environment-projection.ts @@ -1,5 +1,5 @@ import { exactFields, isRecord } from "./response-projection"; -import { environmentPackagesResourceFields, environmentResourceOpenaiHostedFields, networkPolicyResourceFields } from "./generated/public-api"; +import { desktopResourceFields, environmentPackagesResourceFields, environmentResourceOpenaiHostedFields, networkPolicyResourceFields } from "./generated/public-api"; import type { OpenAIHostedAgentEnvironment } from "./types"; function strings(list: unknown): list is string[] { @@ -24,6 +24,8 @@ export function projectOpenAIHostedSessionEnvironment(value: unknown): OpenAIHos if ( !exactFields(value, environmentResourceOpenaiHostedFields) || typeof value.id !== "string" || value.id.trim() === "" || + !(value.container_size === undefined || value.container_size === null) || + !isRecord(value.desktop) || !exactFields(value.desktop, desktopResourceFields) || typeof value.desktop.enabled !== "boolean" || !strings(value.capability_directories) || !isRecord(network) || !exactFields(network, networkPolicyResourceFields) || !strings(network.allowed_domains) || @@ -36,6 +38,8 @@ export function projectOpenAIHostedSessionEnvironment(value: unknown): OpenAIHos return { type: "openai_hosted", id: value.id, + container_size: null, + desktop: { enabled: value.desktop.enabled }, capability_directories: [...value.capability_directories], network: { access: network.access, allowed_domains: [...network.allowed_domains] }, packages: { npm: [...packages.npm], python: [...packages.python], system: [...packages.system] }, diff --git a/packages/agents-client/src/types.ts b/packages/agents-client/src/types.ts index d553cc498..083da8c93 100644 --- a/packages/agents-client/src/types.ts +++ b/packages/agents-client/src/types.ts @@ -93,7 +93,10 @@ export type VaultDeleted = DeletedVaultResource; export type McpOAuthRefreshMetadata = McpOauthRefreshResource; -export type VaultCredential = VaultCredentialResource; +// Core never returns the pinned `environment_variable` Credential type. +export type VaultCredential = Omit & { + auth: Exclude; +}; export type VaultCredentialList = ListPage; @@ -203,6 +206,8 @@ export type EnvironmentNetworkPolicy = NetworkPolicyResource; export interface OpenAIHostedAgentEnvironment { type: "openai_hosted"; id: string; + container_size: null; + desktop: { enabled: boolean }; capability_directories: string[]; network: EnvironmentNetworkPolicy; packages: AgentEnvironmentPackages; diff --git a/packages/agents-client/src/usage-projection.ts b/packages/agents-client/src/usage-projection.ts index 3e9dd38e5..9db986466 100644 --- a/packages/agents-client/src/usage-projection.ts +++ b/packages/agents-client/src/usage-projection.ts @@ -1,6 +1,6 @@ import type { AgentSession } from "./types"; import { isRecord, exactFields, isNonnegativeInteger } from "./response-projection"; -import { inputTokensDetailsResourceFields, outputTokensDetailsResourceFields, tokenUsageResourceFields } from "./generated/public-api"; +import { inputTokensDetailsResource2Fields, outputTokensDetailsResource2Fields, tokenUsageResourceFields } from "./generated/public-api"; export function projectTokenUsage(value: unknown, invalid: () => never): AgentSession["usage"] { if (value === null) return null; @@ -11,9 +11,9 @@ export function projectTokenUsage(value: unknown, invalid: () => never): AgentSe !isNonnegativeInteger(value.input_tokens) || !isNonnegativeInteger(value.output_tokens) || !isNonnegativeInteger(value.total_tokens) || - !isRecord(inputDetails) || !exactFields(inputDetails, inputTokensDetailsResourceFields) || + !isRecord(inputDetails) || !exactFields(inputDetails, inputTokensDetailsResource2Fields) || !isNonnegativeInteger(inputDetails.cached_tokens) || - !isRecord(outputDetails) || !exactFields(outputDetails, outputTokensDetailsResourceFields) || + !isRecord(outputDetails) || !exactFields(outputDetails, outputTokensDetailsResource2Fields) || !isNonnegativeInteger(outputDetails.reasoning_tokens) ) return invalid(); return { diff --git a/packages/agents-client/src/vault-credentials-oauth.test.ts b/packages/agents-client/src/vault-credentials-oauth.test.ts index 1920639e9..a9417219b 100644 --- a/packages/agents-client/src/vault-credentials-oauth.test.ts +++ b/packages/agents-client/src/vault-credentials-oauth.test.ts @@ -11,6 +11,7 @@ const staticCredential: VaultCredential = { object: "vault.credential", name: "Internal MCP", auth: { type: "static_bearer", mcp_server_url: "https://mcp.example/tools" }, + metadata: {}, created_at: 1, updated_at: 2, }; diff --git a/scripts/generate-public-api.py b/scripts/generate-public-api.py index 22aca5703..73b737652 100644 --- a/scripts/generate-public-api.py +++ b/scripts/generate-public-api.py @@ -19,7 +19,7 @@ 'CreateAgentParams': (), 'UpdateAgentParams': (), 'SessionAgentConfigParam': (), 'CreateAgentSessionParams': ('agent', 'environment'), 'UpdateAgentSessionParams': (), - 'CreateVaultParams': (), + 'CreateVaultParams': (), 'UpdateVaultParams': (), 'CreateVaultCredentialParams': (), 'RotateVaultCredentialParams': (), 'CreateEnvironmentTemplateParams': ('network',), @@ -179,7 +179,7 @@ def go_types(document, bindings): if nullable(document, schema): tags.append('extensions:"x-nullable"') enums = enum_values(document, schema) - if enums: + if enums and 'json.RawMessage' not in typ: tags.append('enums:"' + ','.join(str(v).lower() if isinstance(v, bool) else str(v) for v in enums) + '"') # Swag still projects the internal APIs that reference these types. if 'json.RawMessage' in typ: @@ -216,7 +216,7 @@ def go_shape(document, schema, required=False): for option in value['oneOf']: option = dereference(document, option) tag, = option['properties']['type']['enum'] - variants[tag] = go_members(document, option, 'type') + variants[tag] = go_members(document, merge_union(document, option), 'type') fields = ['kind: unionValue', 'values: []string{' + ', '.join(json.dumps(tag) for tag in variants) + '}', 'variants: map[string][]member{\n' + ''.join(f'{json.dumps(tag)}: {members.removeprefix("[]member")},\n' for tag, members in variants.items()) + '}'] elif 'enum' in value: @@ -241,6 +241,28 @@ def go_shape(document, schema, required=False): return 'shape{' + ', '.join(fields) + '}' +def merge_union(document, schema): + """Project a variant that is itself a union, such as one selected again by "action", onto one object. + + The walker selects variants by "type" only. The members of the nested variants + merge: a member is required when every variant requires it, and the values of a + member that is an enum in several variants join. + """ + if 'oneOf' not in schema: + return schema + leaves = [dereference(document, leaf) for leaf in schema['oneOf']] + properties = {} + for leaf in leaves: + for name, value in {**schema['properties'], **leaf['properties']}.items(): + if name in properties and properties[name] != value: + if 'enum' not in value or 'enum' not in properties[name]: + raise ValueError(f'Cannot merge union member {name}') + value = {**value, 'enum': list(dict.fromkeys(properties[name]['enum'] + value['enum']))} + properties[name] = value + required = set.intersection(*(set(leaf.get('required', [])) for leaf in leaves)) + return {'type': 'object', 'properties': properties, 'required': sorted(required, key=list(properties).index), 'additionalProperties': False} + + def go_members(document, schema, skip=None, opaque=()): # The walker rejects unknown members, so only closed objects project. if schema.get('additionalProperties') is not False: diff --git a/scripts/generate-public-api.test.py b/scripts/generate-public-api.test.py index 48ebbed83..351ef449a 100644 --- a/scripts/generate-public-api.test.py +++ b/scripts/generate-public-api.test.py @@ -62,7 +62,7 @@ def test_new_official_members_and_values_reach_request_shapes(self): schemas['ServiceTierParam']['enum'].append('future_tier') generated = generator.request_shapes(source, generator.extension_owners(self.bindings)).decode() self.assertIn('{"future_field", shape{kind: stringValue}}', generated) - self.assertEqual(generated.count('"future_tier"'), 3) + self.assertEqual(generated.count('"future_tier"'), 4) def test_open_request_objects_are_rejected(self): source = copy.deepcopy(self.source) diff --git a/services/core/internal/agents/configuration.go b/services/core/internal/agents/configuration.go index 209e98998..41228f81b 100644 --- a/services/core/internal/agents/configuration.go +++ b/services/core/internal/agents/configuration.go @@ -111,7 +111,12 @@ func mergeConfiguration(saved json.RawMessage, patch map[string]json.RawMessage) corePatch["harness_config"] = json.RawMessage(`{}`) } for field, value := range patch { - if field != "x_agents_core" { + switch { + case field == "x_agents_core": + case field == "compaction" && string(value) == "null": + // Null compaction restores the official default, which the resource omits. + delete(configuration, field) + default: configuration[field] = value } } diff --git a/services/core/internal/api/agents_update.go b/services/core/internal/api/agents_update.go index b72a4424e..57b904dc1 100644 --- a/services/core/internal/api/agents_update.go +++ b/services/core/internal/api/agents_update.go @@ -61,6 +61,13 @@ func resolveAgentUpdate(raw []byte) (agents.UpdateCommand, error) { delete(patch, field) } } + // Null compaction restores the default; an experimental object without members keeps the current settings. + if _, supplied := fields["compaction"]; supplied && isNull(request.Compaction) { + patch["compaction"] = json.RawMessage(`null`) + } + if emptyObject(request.Experimental) { + delete(patch, "experimental") + } var result agents.UpdateCommand if extension, supplied := fields["x_agents_core"]; supplied { _, coreFields := orderedMembers(extension) diff --git a/services/core/internal/api/configuration_validation_test.go b/services/core/internal/api/configuration_validation_test.go index 361cbecb0..d87277aa0 100644 --- a/services/core/internal/api/configuration_validation_test.go +++ b/services/core/internal/api/configuration_validation_test.go @@ -76,7 +76,7 @@ func assertConfigurationError(t *testing.T, w *httptest.ResponseRecorder, code s } func TestAgentConfigurationProtocolErrorsUseOfficialFields(t *testing.T) { - const tools = `, 'tool_search', 'programmatic_tool_calling', 'mcp', and 'web_search'.` + const tools = `, 'tool_search', 'programmatic_tool_calling', 'mcp', 'web_search', 'computer_use', and 'automations'.` cases := []struct{ name, fields, param, message string }{ // C1, observed (TV-01). {p} is the Session "agent." prefix. {"F02", `"tools":[{"type":"function","name":"lookup","description":"Look up a value.","parameters":[]}]`, "{p}tools[0].parameters", "Invalid type for '{p}tools[0].parameters': expected an object with string keys and unknown value values, but got an array instead."}, @@ -94,7 +94,7 @@ func TestAgentConfigurationProtocolErrorsUseOfficialFields(t *testing.T) { {"T03", `"text":{"format":{"type":"json_object"}}`, "{p}text.format.type", "Invalid value: 'json_object'. Supported values are: 'text' and 'json_schema'."}, {"R01", `"reasoning":{"effort":"extreme"}`, "{p}reasoning.effort", "Invalid value: 'extreme'. Supported values are: 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', and 'max'."}, {"R02", `"reasoning":{"summary":"verbose"}`, "{p}reasoning.summary", "Invalid value: 'verbose'. Supported values are: 'concise', 'detailed', and 'auto'."}, - {"S01", `"service_tier":"turbo"`, "{p}service_tier", "Invalid value: 'turbo'. Supported values are: 'auto', 'default', 'flex', 'priority', and 'fast'."}, + {"S01", `"service_tier":"turbo"`, "{p}service_tier", "Invalid value: 'turbo'. Supported values are: 'auto', 'default', 'flex', 'priority', 'fast', and 'ultrafast'."}, {"X01", `"tool_choice":"auto"`, "{p}tool_choice", "Unknown parameter: '{p}tool_choice'."}, {"TS1", `"tools":[{"type":"tool_search","max_results":3}]`, "{p}tools[0].max_results", "Unknown parameter: '{p}tools[0].max_results'."}, {"F09", `"tools":["lookup"]`, "{p}tools[0]", "Invalid type for '{p}tools[0]': expected an object, but got a string instead."}, @@ -343,8 +343,8 @@ func TestAgentConfigurationErrorsBoundEchoedInput(t *testing.T) { {`"tools":[{"type":"tool_search","\ufffd":1}]`, nil, "Unknown parameter."}, {`"tools":[{"type":"tool_search","` + strings.Repeat("<>", 64) + `":1}]`, param(p + "tools[0]." + strings.Repeat("<>", 64)), "Unknown parameter: '" + p + "tools[0]." + strings.Repeat("<>", 64) + "'."}, {`"reasoning":{"` + strings.Repeat("a", 4<<10) + `":1}`, nil, "Unknown parameter."}, - {`"service_tier":"` + long + `"`, param(p + "service_tier"), "Invalid value. Supported values are: 'auto', 'default', 'flex', 'priority', and 'fast'."}, - {`"tools":[{"type":"line\u2028break"}]`, param(p + "tools[0].type"), "Invalid value. Supported values are: 'function', 'tool_search', 'programmatic_tool_calling', 'mcp', and 'web_search'."}, + {`"service_tier":"` + long + `"`, param(p + "service_tier"), "Invalid value. Supported values are: 'auto', 'default', 'flex', 'priority', 'fast', and 'ultrafast'."}, + {`"tools":[{"type":"line\u2028break"}]`, param(p + "tools[0].type"), "Invalid value. Supported values are: 'function', 'tool_search', 'programmatic_tool_calling', 'mcp', 'web_search', 'computer_use', and 'automations'."}, {`"tools":[` + lookupTool(long, "") + `,` + lookupTool(long, "") + `]`, nil, "duplicate function tool name"}, {`"tools":[{"type":"function","name":"` + long + `","description":"","parameters":{"type":"string"}}]`, nil, `Invalid schema for function: schema must be a JSON Schema of 'type: "object"', got 'type: "string"'.`}, {`"tools":[{"type":"function","name":"lookup","description":"","parameters":{"type":"` + long + `"}}]`, nil, `Invalid schema for function 'lookup': schema must be a JSON Schema of 'type: "object"'.`}, diff --git a/services/core/internal/api/credentials.go b/services/core/internal/api/credentials.go index ec2cb94a4..2e991bc13 100644 --- a/services/core/internal/api/credentials.go +++ b/services/core/internal/api/credentials.go @@ -6,6 +6,7 @@ import ( "net/http" v1 "github.com/MiniMax-AI/OpenAgentCore/contracts/agents-api/v1" + "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/metadata" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/vaults" "github.com/go-chi/chi/v5" "github.com/google/uuid" @@ -18,8 +19,9 @@ func (h *Handler) createCredential(w http.ResponseWriter, r *http.Request) { return } var request struct { - Name string `json:"name"` - Auth json.RawMessage `json:"auth"` + Name string `json:"name"` + Auth json.RawMessage `json:"auth"` + Metadata map[string]string `json:"metadata"` } _ = json.Unmarshal(raw, &request) name, err := normalizedVaultName(request.Name) @@ -28,18 +30,21 @@ func (h *Handler) createCredential(w http.ResponseWriter, r *http.Request) { } var auth v1.CredentialAuthInput _ = json.Unmarshal(request.Auth, &auth) + if writeFieldError(w, cmp.Or(rejectEnvironmentVariable(auth.Type), metadataFieldError(metadata.Validate(request.Metadata)))) { + return + } var credential vaults.Credential if auth.Type == "static_bearer" { if writeFieldError(w, cmp.Or(httpsURL("auth.mcp_server_url", *auth.MCPServerURL), nonEmptyString("auth.token", *auth.Token))) { return } - credential, err = h.Vaults.CreateStaticCredential(r.Context(), vaults.CreateStaticCredential{TenantID: tenantID(r), VaultID: vaultID, Name: name, MCPServerURL: *auth.MCPServerURL, Token: *auth.Token}) + credential, err = h.Vaults.CreateStaticCredential(r.Context(), vaults.CreateStaticCredential{TenantID: tenantID(r), VaultID: vaultID, Name: name, MCPServerURL: *auth.MCPServerURL, Token: *auth.Token, Metadata: request.Metadata}) } else { command, fieldErr := oauthCredentialCreate(auth, name) if writeFieldError(w, fieldErr) { return } - command.TenantID, command.VaultID = tenantID(r), vaultID + command.TenantID, command.VaultID, command.Metadata = tenantID(r), vaultID, request.Metadata credential, err = h.Vaults.CreateOAuthCredential(r.Context(), command) } if err != nil { @@ -77,6 +82,14 @@ func credentialResourceID(w http.ResponseWriter, r *http.Request, param string) return id.String(), true } +// rejectEnvironmentVariable rejects the official credential type Core cannot run. +func rejectEnvironmentVariable(authType string) error { + if authType == "environment_variable" { + return &fieldError{param: "auth.type", message: "Environment variable credentials are not supported. Use an mcp_oauth or static_bearer credential."} + } + return nil +} + func credentialResponse(c vaults.Credential) v1.Credential { auth := v1.CredentialAuth{Type: c.AuthType, MCPServerURL: c.MCPServerURL} if c.OAuth != nil { @@ -85,5 +98,5 @@ func credentialResponse(c vaults.Credential) v1.Credential { auth.Refresh = &v1.OAuthCredentialRefresh{ClientID: r.ClientID, TokenEndpoint: r.TokenEndpoint, TokenEndpointAuth: v1.OAuthEndpointAuth{Type: r.TokenEndpointAuth}, Resource: r.Resource, Scope: r.Scope} } } - return v1.Credential{ID: c.ID, VaultID: c.VaultID, Name: c.Name, Object: "vault.credential", Auth: auth, CreatedAt: c.CreatedAt.Unix(), UpdatedAt: c.UpdatedAt.Unix()} + return v1.Credential{ID: c.ID, VaultID: c.VaultID, Name: c.Name, Object: "vault.credential", Auth: auth, CreatedAt: c.CreatedAt.Unix(), UpdatedAt: c.UpdatedAt.Unix(), Metadata: metadataOrEmpty(c.Metadata)} } diff --git a/services/core/internal/api/credentials_list_test.go b/services/core/internal/api/credentials_list_test.go index 78c15941f..c68a7b995 100644 --- a/services/core/internal/api/credentials_list_test.go +++ b/services/core/internal/api/credentials_list_test.go @@ -25,7 +25,7 @@ func TestCredentialListScopeProjectionAndParameters(t *testing.T) { {"?status=archived", 20, []string{"archived"}}, {"?status[]=active&status[]=archived", 20, []string{"active", "archived"}}, {"?status=active&status[]=archived", 20, []string{"active", "archived"}}, - {"?limit=-3&tenant_id=foreign&unknown=1", 1, nil}, + {"?limit=3&tenant_id=foreign&unknown=1", 3, nil}, } { h, f, tenant := credentialHandler(t) f.page = vaults.CredentialPage{Credentials: []vaults.Credential{f.credential}, NextCursor: f.credential.ID} diff --git a/services/core/internal/api/credentials_test.go b/services/core/internal/api/credentials_test.go index fcc60c811..2cf447170 100644 --- a/services/core/internal/api/credentials_test.go +++ b/services/core/internal/api/credentials_test.go @@ -73,7 +73,7 @@ func TestCredentialSafeProjectionAndOpaqueInput(t *testing.T) { if w.Code != 201 || json.Unmarshal(w.Body.Bytes(), &got) != nil { t.Fatal(w.Code, w.Body) } - want := map[string]any{"id": f.credential.ID, "vault_id": f.credential.VaultID, "name": "Vault credential", "object": "vault.credential", "created_at": float64(1700000000), "updated_at": float64(1700000000), "auth": map[string]any{"type": "static_bearer", "mcp_server_url": "https://example.invalid/mcp?q=x"}} + want := map[string]any{"id": f.credential.ID, "vault_id": f.credential.VaultID, "name": "Vault credential", "object": "vault.credential", "created_at": float64(1700000000), "updated_at": float64(1700000000), "metadata": map[string]any{}, "auth": map[string]any{"type": "static_bearer", "mcp_server_url": "https://example.invalid/mcp?q=x"}} if !reflect.DeepEqual(got, want) || f.tenant != tenant || f.vault != f.credential.VaultID || f.input.Token != " \tcredential-canary\n雪 " { t.Fatal("resource projection or authenticated request changed") } diff --git a/services/core/internal/api/credentials_update.go b/services/core/internal/api/credentials_update.go index 75c3b81a1..786f03f63 100644 --- a/services/core/internal/api/credentials_update.go +++ b/services/core/internal/api/credentials_update.go @@ -5,6 +5,7 @@ import ( "net/http" v1 "github.com/MiniMax-AI/OpenAgentCore/contracts/agents-api/v1" + "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/metadata" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/vaults" "github.com/go-chi/chi/v5" ) @@ -16,23 +17,32 @@ func (h *Handler) updateCredential(w http.ResponseWriter, r *http.Request) { return } var request struct { - Auth v1.CredentialAuthReplacement `json:"auth"` + Auth *v1.CredentialAuthReplacement `json:"auth"` + Metadata map[string]string `json:"metadata"` } _ = json.Unmarshal(raw, &request) - auth := request.Auth + if request.Auth == nil && request.Metadata == nil { + writeFieldError(w, &fieldError{message: "At least one of auth or metadata is required."}) + return + } + if request.Auth != nil && writeFieldError(w, rejectEnvironmentVariable(request.Auth.Type)) || writeFieldError(w, metadataFieldError(metadata.Validate(request.Metadata))) { + return + } var credential vaults.Credential var err error - if auth.Type == "static_bearer" { + if request.Auth == nil { + credential, err = h.Vaults.UpdateCredentialMetadata(r.Context(), vaults.UpdateCredentialMetadata{TenantID: tenantID(r), VaultID: vaultID, CredentialID: id, Metadata: request.Metadata}) + } else if auth := *request.Auth; auth.Type == "static_bearer" { if writeFieldError(w, nonEmptyString("auth.token", *auth.Token)) { return } - credential, err = h.Vaults.UpdateStaticCredential(r.Context(), vaults.UpdateStaticCredential{TenantID: tenantID(r), VaultID: vaultID, CredentialID: id, Token: *auth.Token}) + credential, err = h.Vaults.UpdateStaticCredential(r.Context(), vaults.UpdateStaticCredential{TenantID: tenantID(r), VaultID: vaultID, CredentialID: id, Token: *auth.Token, Metadata: request.Metadata}) } else { command, fieldErr := oauthCredentialUpdate(auth) if writeFieldError(w, fieldErr) { return } - command.TenantID, command.VaultID, command.CredentialID = tenantID(r), vaultID, id + command.TenantID, command.VaultID, command.CredentialID, command.Metadata = tenantID(r), vaultID, id, request.Metadata credential, err = h.Vaults.UpdateOAuthCredential(r.Context(), command) } if err != nil { diff --git a/services/core/internal/api/credentials_update_test.go b/services/core/internal/api/credentials_update_test.go index cd7f65050..50cfea0b1 100644 --- a/services/core/internal/api/credentials_update_test.go +++ b/services/core/internal/api/credentials_update_test.go @@ -36,7 +36,7 @@ func TestCredentialUpdatePreservesOpaqueInputAndSafeProjection(t *testing.T) { } want := map[string]any{"id": f.credential.ID, "vault_id": f.credential.VaultID, "name": f.credential.Name, "object": "vault.credential", "created_at": float64(f.credential.CreatedAt.Unix()), "updated_at": float64(f.credential.UpdatedAt.Unix()), - "auth": map[string]any{"type": "static_bearer", "mcp_server_url": f.credential.MCPServerURL}} + "metadata": map[string]any{}, "auth": map[string]any{"type": "static_bearer", "mcp_server_url": f.credential.MCPServerURL}} if !reflect.DeepEqual(got, want) || f.tenant != tenant || f.vault != f.credential.VaultID || f.id != f.credential.ID || f.replacement.Token != token || f.calls != 1 || strings.Contains(w.Body.String(), "credential-canary") { t.Fatal("update changed scope, secret bytes or safe resource shape") } diff --git a/services/core/internal/api/environment_setup.go b/services/core/internal/api/environment_setup.go index 45ddccfb8..9ad13baab 100644 --- a/services/core/internal/api/environment_setup.go +++ b/services/core/internal/api/environment_setup.go @@ -31,8 +31,58 @@ func rejectSystemPackages(raw json.RawMessage) error { return nil } +func isNull(raw json.RawMessage) bool { + trimmed := bytes.TrimSpace(raw) + return len(trimmed) == 0 || bytes.Equal(trimmed, []byte("null")) +} + +// Pinned shapes of the Environment fields Core cannot honor. Neither environment_id +// nor container_size is nullable. +var ( + environmentIDShape = shape{kind: stringValue} + containerSizeShape = shape{kind: enumValue, values: []string{"small", "medium", "large"}} + environmentDesktopShape = shape{kind: objectValue, members: []member{{"enabled", shape{kind: booleanValue, required: true}}}, nullable: true} +) + +// rejectUnsupportedEnvironmentFields checks the official Environment fields Core cannot +// honor against their pinned shapes, then rejects every value that asks for them. +func rejectUnsupportedEnvironmentFields(fields map[string]json.RawMessage) error { + for name, field := range map[string]shape{"environment_id": environmentIDShape, "container_size": containerSizeShape, "desktop": environmentDesktopShape} { + if raw, supplied := fields[name]; supplied { + if err := checkValue(name, raw, field); err != nil { + return err + } + } + } + for _, name := range []string{"environment_id", "container_size"} { + if _, supplied := fields[name]; supplied { + return &fieldError{param: name, message: "Environment " + name + " is not supported."} + } + } + if desktop := fields["desktop"]; !isNull(desktop) { + var input struct { + Enabled bool `json:"enabled"` + } + if json.Unmarshal(desktop, &input) == nil && input.Enabled { + return &fieldError{param: "desktop.enabled", message: "Desktop environments are not supported."} + } + } + if network := fields["network"]; !isNull(network) { + var input struct { + BlockedDomains []json.RawMessage `json:"blocked_domains"` + } + if json.Unmarshal(network, &input) == nil && len(input.BlockedDomains) != 0 { + return &fieldError{param: "network.blocked_domains", message: "Blocked domains are not supported. Use restricted access with allowed_domains."} + } + } + return nil +} + func decodeEnvironmentSetup(fields map[string]json.RawMessage) (environmentconfig.Setup, error) { var result environmentconfig.Setup + if err := rejectUnsupportedEnvironmentFields(fields); err != nil { + return result, err + } if err := rejectSystemPackages(fields["packages"]); err != nil { return result, err } diff --git a/services/core/internal/api/environment_templates.go b/services/core/internal/api/environment_templates.go index c0240d057..ad00c06ed 100644 --- a/services/core/internal/api/environment_templates.go +++ b/services/core/internal/api/environment_templates.go @@ -31,7 +31,7 @@ type EnvironmentTemplatesReader interface { func decodeTemplateInput(raw []byte) (environmenttemplates.Input, error) { var fields map[string]json.RawMessage - if decodeInputObject(raw, &fields, "name", "network", "capability_directories", "env", "files", "packages", "plugins", "skills", "setup_commands") != nil { + if decodeInputObject(raw, &fields, "name", "network", "capability_directories", "env", "files", "packages", "plugins", "skills", "setup_commands", "desktop") != nil { return environmenttemplates.Input{}, environmenttemplates.ErrInvalidInput } in := environmenttemplates.Input{} @@ -97,7 +97,7 @@ func templateEnvError(raw json.RawMessage) error { } func templateResponse(t environmenttemplates.Template) v1.EnvironmentTemplate { - return v1.EnvironmentTemplate{ID: t.ID, Object: "agent.environment.template", Name: t.Name, CreatedAt: t.CreatedAt.Unix(), UpdatedAt: t.UpdatedAt.Unix(), CapabilityDirectories: append([]string{}, t.CapabilityDirectories...), Network: v1.EnvironmentNetwork{Access: t.NetworkAccess, AllowedDomains: append([]string{}, t.AllowedDomains...)}, Packages: packageMetadata(&t.Packages), Files: templateFileResponse(t.Files), Plugins: pluginResponse(t.Plugins), Skills: skillResponse(t.Skills)} + return v1.EnvironmentTemplate{ID: t.ID, Object: "agent.environment.template", Name: t.Name, CreatedAt: t.CreatedAt.Unix(), UpdatedAt: t.UpdatedAt.Unix(), CapabilityDirectories: append([]string{}, t.CapabilityDirectories...), Network: v1.EnvironmentNetwork{Access: t.NetworkAccess, AllowedDomains: append([]string{}, t.AllowedDomains...)}, Packages: packageMetadata(&t.Packages), Files: templateFileResponse(t.Files), Plugins: pluginResponse(t.Plugins), Skills: skillResponse(t.Skills), Desktop: json.RawMessage(`{"enabled":false}`)} } func readTemplateInput(w http.ResponseWriter, r *http.Request, pinned shape) (environmenttemplates.Input, bool) { diff --git a/services/core/internal/api/fakes_test.go b/services/core/internal/api/fakes_test.go index f70accccc..2f196e34d 100644 --- a/services/core/internal/api/fakes_test.go +++ b/services/core/internal/api/fakes_test.go @@ -544,8 +544,9 @@ func (f *fakeInstallationBindings) AddressBindings(a0 context.Context) (deployme } type fakeItems struct { - t testing.TB - listItems func(context.Context, string, string, string, int, bool) (sessions.ItemPage, error) + t testing.TB + listItems func(context.Context, string, string, string, int, bool) (sessions.ItemPage, error) + listTurnItems func(context.Context, string, string, string, string, int, bool) (sessions.ItemPage, error) } func (f *fakeItems) ListItems(a0 context.Context, a1 string, a2 string, a3 string, a4 int, a5 bool) (sessions.ItemPage, error) { @@ -555,6 +556,13 @@ func (f *fakeItems) ListItems(a0 context.Context, a1 string, a2 string, a3 strin return f.listItems(a0, a1, a2, a3, a4, a5) } +func (f *fakeItems) ListTurnItems(a0 context.Context, a1 string, a2 string, a3 string, a4 string, a5 int, a6 bool) (sessions.ItemPage, error) { + if f.listTurnItems == nil { + unexpectedCall(f.t, "ListTurnItems") + } + return f.listTurnItems(a0, a1, a2, a3, a4, a5, a6) +} + type fakeMetrics struct { t testing.TB read func(context.Context, string) (coremetrics.View, error) @@ -866,7 +874,7 @@ func (f *fakeSessions) AuditSessionOperation(a0 context.Context, a1 sessions.Aud type fakeSessionsReader struct { t testing.TB getSession func(context.Context, string, string) (sessions.Session, error) - listSessions func(context.Context, string, string, int, bool, *string) (sessions.Page, error) + listSessions func(context.Context, string, string, int, bool, *string, map[string]string) (sessions.Page, error) } func (f *fakeSessionsReader) GetSession(a0 context.Context, a1 string, a2 string) (sessions.Session, error) { @@ -876,11 +884,11 @@ func (f *fakeSessionsReader) GetSession(a0 context.Context, a1 string, a2 string return f.getSession(a0, a1, a2) } -func (f *fakeSessionsReader) ListSessions(a0 context.Context, a1 string, a2 string, a3 int, a4 bool, a5 *string) (sessions.Page, error) { +func (f *fakeSessionsReader) ListSessions(a0 context.Context, a1 string, a2 string, a3 int, a4 bool, a5 *string, a6 map[string]string) (sessions.Page, error) { if f.listSessions == nil { unexpectedCall(f.t, "ListSessions") } - return f.listSessions(a0, a1, a2, a3, a4, a5) + return f.listSessions(a0, a1, a2, a3, a4, a5, a6) } type fakeSkills struct { @@ -1054,11 +1062,13 @@ func (f *fakeTurns) ListTurns(a0 context.Context, a1 string, a2 string, a3 strin type fakeVaults struct { t testing.TB createVault func(context.Context, vaults.CreateVault) (vaults.Vault, error) + updateVault func(context.Context, vaults.UpdateVault) (vaults.Vault, error) deleteVault func(context.Context, vaults.DeleteVault) (string, error) createStaticCredential func(context.Context, vaults.CreateStaticCredential) (vaults.Credential, error) updateStaticCredential func(context.Context, vaults.UpdateStaticCredential) (vaults.Credential, error) createOAuthCredential func(context.Context, vaults.CreateOAuthCredential) (vaults.Credential, error) updateOAuthCredential func(context.Context, vaults.UpdateOAuthCredential) (vaults.Credential, error) + updateCredentialMeta func(context.Context, vaults.UpdateCredentialMetadata) (vaults.Credential, error) deleteCredential func(context.Context, vaults.DeleteCredential) (string, error) resolveMCPCredentials func(context.Context, vaults.ResolveMCPCredentials) ([]vaults.MCPCredentialBinding, error) } @@ -1070,6 +1080,20 @@ func (f *fakeVaults) CreateVault(a0 context.Context, a1 vaults.CreateVault) (vau return f.createVault(a0, a1) } +func (f *fakeVaults) UpdateVault(a0 context.Context, a1 vaults.UpdateVault) (vaults.Vault, error) { + if f.updateVault == nil { + unexpectedCall(f.t, "UpdateVault") + } + return f.updateVault(a0, a1) +} + +func (f *fakeVaults) UpdateCredentialMetadata(a0 context.Context, a1 vaults.UpdateCredentialMetadata) (vaults.Credential, error) { + if f.updateCredentialMeta == nil { + unexpectedCall(f.t, "UpdateCredentialMetadata") + } + return f.updateCredentialMeta(a0, a1) +} + func (f *fakeVaults) DeleteVault(a0 context.Context, a1 vaults.DeleteVault) (string, error) { if f.deleteVault == nil { unexpectedCall(f.t, "DeleteVault") diff --git a/services/core/internal/api/handler.go b/services/core/internal/api/handler.go index 2f5f3b303..6ebf8debc 100644 --- a/services/core/internal/api/handler.go +++ b/services/core/internal/api/handler.go @@ -42,7 +42,7 @@ type Sessions interface { // SessionsReader reads Sessions. type SessionsReader interface { GetSession(context.Context, string, string) (sessions.Session, error) - ListSessions(context.Context, string, string, int, bool, *string) (sessions.Page, error) + ListSessions(context.Context, string, string, int, bool, *string, map[string]string) (sessions.Page, error) } // routes builds the router. HEAD runs the GET route without a body after the @@ -79,6 +79,7 @@ func (h *Handler) routes() *chi.Mux { r.Post("/vaults", h.createVault) r.Get("/vaults", h.listVaults) r.Get("/vaults/{vault_id}", h.getVault) + r.Post("/vaults/{vault_id}", h.updateVault) r.Delete("/vaults/{vault_id}", h.deleteVault) r.Post("/vaults/{vault_id}/credentials", h.createCredential) r.Get("/vaults/{vault_id}/credentials", h.listCredentials) @@ -110,20 +111,36 @@ func (h *Handler) routes() *chi.Mux { r.Get("/agents/sessions/{session_id}/items", h.listItems) r.Get("/agents/sessions/{session_id}/turns", h.listTurns) r.Get("/agents/sessions/{session_id}/turns/{turn_id}", h.getTurn) + r.Get("/agents/sessions/{session_id}/turns/{turn_id}/items", h.listItems) h.registerSubagentRoutes(r) r.Get("/agents/sessions/{session_id}/artifacts", h.listSessionArtifacts) r.Get("/agents/sessions/{session_id}/artifacts/{artifact_id}", h.getSessionArtifact) r.Get("/agents/sessions/{session_id}/artifacts/{artifact_id}/content", h.sessionArtifactContent) r.Head("/agents/sessions/{session_id}/artifacts/{artifact_id}/content", methodNotAllowed) r.Delete("/agents/sessions/{session_id}/artifacts/{artifact_id}", h.deleteSessionArtifact) - r.NotFound(func(w http.ResponseWriter, _ *http.Request) { - writeError(w, http.StatusNotFound, "unsupported_operation", "This API operation is not supported.") - }) + // Official operations Core does not run answer like an unknown route. + const automations = "/agents/automations" + for _, route := range []struct{ method, path string }{ + {http.MethodPost, automations}, {http.MethodGet, automations}, + {http.MethodGet, automations + "/{automation_id}"}, {http.MethodPost, automations + "/{automation_id}"}, {http.MethodDelete, automations + "/{automation_id}"}, + {http.MethodPost, automations + "/{automation_id}/pause"}, {http.MethodPost, automations + "/{automation_id}/resume"}, + {http.MethodPost, automations + "/{automation_id}/invocations"}, {http.MethodGet, automations + "/{automation_id}/invocations"}, + {http.MethodGet, automations + "/{automation_id}/invocations/{invocation_id}"}, + {http.MethodPost, "/agents/environments"}, {http.MethodGet, "/agents/environments"}, + {http.MethodGet, "/agents/sessions/{session_id}/traces"}, + } { + r.MethodFunc(route.method, route.path, unsupportedOperation) + } + r.NotFound(unsupportedOperation) r.MethodNotAllowed(methodNotAllowed) }) return router } +func unsupportedOperation(w http.ResponseWriter, _ *http.Request) { + writeError(w, http.StatusNotFound, "unsupported_operation", "This API operation is not supported.") +} + // createSession atomically reserves or admits initial text with the Session. func (h *Handler) createSession(w http.ResponseWriter, r *http.Request) { raw, ok := readJSONObjectLimit(w, r, 16*1024*1024, "Request exceeds 16 MiB.") @@ -298,11 +315,15 @@ func (h *Handler) listSessions(w http.ResponseWriter, r *http.Request) { if !ok { return } + filter, ok := readMetadataFilter(w, r) + if !ok { + return + } var agentID *string if values, present := r.URL.Query()["agent_id"]; present { agentID = &values[0] } - page, err := h.SessionsReader.ListSessions(r.Context(), tenantID(r), options.after, options.limit, options.ascending, agentID) + page, err := h.SessionsReader.ListSessions(r.Context(), tenantID(r), options.after, options.limit, options.ascending, agentID, filter) if err != nil { writeSessionsError(w, r, err) return diff --git a/services/core/internal/api/handler_test.go b/services/core/internal/api/handler_test.go index a8909dc2c..055c82df4 100644 --- a/services/core/internal/api/handler_test.go +++ b/services/core/internal/api/handler_test.go @@ -31,7 +31,7 @@ type recordingStore struct { listAscending bool } -func (s *recordingStore) ListSessions(_ context.Context, tenant, after string, limit int, ascending bool, _ *string) (sessions.Page, error) { +func (s *recordingStore) ListSessions(_ context.Context, tenant, after string, limit int, ascending bool, _ *string, _ map[string]string) (sessions.Page, error) { s.listTenant, s.listAfter, s.listLimit, s.listAscending = tenant, after, limit, ascending return sessions.Page{Sessions: append([]sessions.Session(nil), s.sessions...), NextCursor: s.nextSessionCursor}, nil } diff --git a/services/core/internal/api/hosted_environment.go b/services/core/internal/api/hosted_environment.go index e88f452ad..fdc6d22f1 100644 --- a/services/core/internal/api/hosted_environment.go +++ b/services/core/internal/api/hosted_environment.go @@ -58,7 +58,7 @@ func decodePreparedEnvironment(raw json.RawMessage) (*v1.Environment, error) { env.Plugins = pluginResponse(setup.PluginMetadata()) case "capability_directories": env.CapabilityDirectories = append([]string{}, setup.CapabilityDirectories...) - case "env", "setup_commands": + case "env", "setup_commands", "desktop", "container_size", "environment_id": // Confidential values remain in the separate initialization snapshot. case "packages": packages := setup.PackageMetadata() @@ -68,14 +68,17 @@ func decodePreparedEnvironment(raw json.RawMessage) (*v1.Environment, error) { } } if value, supplied := fields["network"]; supplied && !bytes.Equal(bytes.TrimSpace(value), []byte("null")) { - var network v1.EnvironmentNetworkInput - if decodeInputObject(value, &network, "access", "allowed_domains") != nil { + var network struct { + v1.EnvironmentNetworkInput + BlockedDomains []string `json:"blocked_domains"` // empty only; see rejectUnsupportedEnvironmentFields + } + if decodeInputObject(value, &network, "access", "allowed_domains", "blocked_domains") != nil { return nil, sessions.ErrInvalidInput } if (agentnetwork.Policy{Access: network.Access, AllowedDomains: network.AllowedDomains}).Validate() != nil { return nil, errNetworkPolicy } - env.Network = &network + env.Network = &network.EnvironmentNetworkInput } if kind == "openai_hosted" && agentcapabilities.ValidateDirectories(env.CapabilityDirectories) != nil { return nil, sessions.ErrInvalidInput @@ -99,7 +102,8 @@ func hostedSessionEnvironment(environment sessions.Environment) (v1.SessionEnvir directories := append([]string{}, cfg.CapabilityDirectories...) return v1.SessionEnvironment{ID: environment.ID, Type: cfg.Type, CapabilityDirectories: &directories, Network: &v1.EnvironmentNetwork{Access: cfg.Network.Access, AllowedDomains: append([]string{}, cfg.Network.AllowedDomains...)}, - Packages: func() *v1.EnvironmentPackagesResponse { value := packageMetadata(cfg.Packages); return &value }(), Files: &files, Plugins: &cfg.Plugins, Skills: &cfg.Skills}, nil + Packages: func() *v1.EnvironmentPackagesResponse { value := packageMetadata(cfg.Packages); return &value }(), Files: &files, Plugins: &cfg.Plugins, Skills: &cfg.Skills, + ContainerSize: json.RawMessage(`null`), Desktop: json.RawMessage(`{"enabled":false}`)}, nil } func storedEnvironment(raw json.RawMessage) (*v1.Environment, error) { diff --git a/services/core/internal/api/hosted_environment_test.go b/services/core/internal/api/hosted_environment_test.go index ea3df0f10..64144816c 100644 --- a/services/core/internal/api/hosted_environment_test.go +++ b/services/core/internal/api/hosted_environment_test.go @@ -43,12 +43,11 @@ func TestHostedEnvironmentDefaultsAndExplicitGaps(t *testing.T) { } } -// The pinned openai_hosted input has no environment_id, so a request naming an -// existing Environment gets the route's existing error instead of a new -// Environment, with or without a Template. +// A request naming an existing Environment is rejected by param instead of +// creating a new Environment, with or without a Template. func TestSessionCreationRejectsExistingEnvironmentReference(t *testing.T) { h, s := validationHandler(t) - rejected := `{"error":{"message":"Request fields have invalid types or null values.","type":"invalid_request_error","code":"invalid_request","param":null}}` + "\n" + rejected := `{"error":{"message":"Environment environment_id is not supported.","type":"invalid_request_error","code":"invalid_request_error","param":"environment_id"}}` + "\n" for _, environment := range []string{ `{"type":"openai_hosted","environment_id":"` + uuid.NewString() + `"}`, `{"type":"openai_hosted","environment_id":"` + uuid.NewString() + `","environment_template_id":"` + uuid.NewString() + `"}`, @@ -83,7 +82,7 @@ func TestHostedEnvironmentResponseHasPinnedShapeAndNoConnectionAction(t *testing if json.Unmarshal(raw, &got) != nil { t.Fatal("invalid environment JSON") } - expected := map[string]any{"id": "environment", "type": "openai_hosted", "capability_directories": []any{}, "files": []any{}, "plugins": []any{}, "skills": []any{}, "packages": map[string]any{"npm": []any{}, "python": []any{}, "system": []any{}}, "network": map[string]any{"access": "enabled", "allowed_domains": []any{}}} + expected := map[string]any{"id": "environment", "type": "openai_hosted", "capability_directories": []any{}, "files": []any{}, "plugins": []any{}, "skills": []any{}, "packages": map[string]any{"npm": []any{}, "python": []any{}, "system": []any{}}, "network": map[string]any{"access": "enabled", "allowed_domains": []any{}}, "container_size": nil, "desktop": map[string]any{"enabled": false}} if !reflect.DeepEqual(got, expected) { t.Fatal("hosted response shape changed", string(raw)) } diff --git a/services/core/internal/api/inputs.go b/services/core/internal/api/inputs.go index 7b20a09bf..b17bd5d38 100644 --- a/services/core/internal/api/inputs.go +++ b/services/core/internal/api/inputs.go @@ -3,6 +3,7 @@ package api import ( "context" "encoding/json" + "fmt" "net/http" "github.com/MiniMax-AI/OpenAgentCore/internal/agentdaemon/proto" @@ -50,6 +51,9 @@ func (h *Handler) createEvents(w http.ResponseWriter, r *http.Request) { return } inputs, err := executionInputs(request.Events) + if writeFieldError(w, err) { + return + } if err != nil { writeSessionsError(w, r, err) return @@ -72,7 +76,13 @@ func executionInputs(events []json.RawMessage) ([]sessions.Input, error) { return nil, sessions.ErrInvalidInput } inputs := make([]sessions.Input, 0, len(events)) - for _, raw := range events { + for index, raw := range events { + var kind struct { + Type string `json:"type"` + } + if json.Unmarshal(raw, &kind) == nil && kind.Type == "agent.session.input.computer_use_approval_request_result" { + return nil, &fieldError{param: fmt.Sprintf("events[%d].type", index), message: "Computer use approvals are not supported."} + } event, err := decodeInputEvent(raw) if err != nil { return nil, err diff --git a/services/core/internal/api/items.go b/services/core/internal/api/items.go index 82dc61e59..9524d23af 100644 --- a/services/core/internal/api/items.go +++ b/services/core/internal/api/items.go @@ -9,9 +9,10 @@ import ( "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/sessions" ) -// Items reads a Session's root Items. +// Items reads a Session's root Items, or those of one root Turn. type Items interface { ListItems(context.Context, string, string, string, int, bool) (sessions.ItemPage, error) + ListTurnItems(context.Context, string, string, string, string, int, bool) (sessions.ItemPage, error) } func (h *Handler) listItems(w http.ResponseWriter, r *http.Request) { @@ -19,7 +20,13 @@ func (h *Handler) listItems(w http.ResponseWriter, r *http.Request) { if !ok { return } - page, err := h.Items.ListItems(r.Context(), tenantID(r), chi.URLParam(r, "session_id"), options.after, options.limit, options.ascending) + var page sessions.ItemPage + var err error + if turnID := chi.URLParam(r, "turn_id"); turnID != "" { + page, err = h.Items.ListTurnItems(r.Context(), tenantID(r), chi.URLParam(r, "session_id"), turnID, options.after, options.limit, options.ascending) + } else { + page, err = h.Items.ListItems(r.Context(), tenantID(r), chi.URLParam(r, "session_id"), options.after, options.limit, options.ascending) + } if err != nil { writeSessionsError(w, r, err) return diff --git a/services/core/internal/api/official_shapes.gen.go b/services/core/internal/api/official_shapes.gen.go index ae71e6d90..729e78e9c 100644 --- a/services/core/internal/api/official_shapes.gen.go +++ b/services/core/internal/api/official_shapes.gen.go @@ -4,6 +4,9 @@ package api // Pinned request shapes; x_agents_core is checked by its own parser. var ( createAgentParams = shape{kind: objectValue, members: []member{ + {"experimental", shape{kind: objectValue, members: []member{ + {"time_awareness", shape{kind: booleanValue}}, + }}}, {"metadata", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, {"name", shape{kind: stringValue, nullable: true}}, {"model", shape{kind: stringValue, required: true}}, @@ -20,9 +23,9 @@ var ( }, nullable: true}}, {"verbosity", shape{kind: enumValue, values: []string{"low", "medium", "high"}, nullable: true}}, }, nullable: true}}, - {"service_tier", shape{kind: enumValue, values: []string{"auto", "default", "flex", "priority", "fast"}, nullable: true}}, + {"service_tier", shape{kind: enumValue, values: []string{"auto", "default", "flex", "priority", "fast", "ultrafast"}, nullable: true}}, {"instructions", shape{kind: stringValue, nullable: true}}, - {"tools", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"function", "tool_search", "programmatic_tool_calling", "mcp", "web_search"}, variants: map[string][]member{ + {"tools", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"function", "tool_search", "programmatic_tool_calling", "mcp", "web_search", "computer_use", "automations"}, variants: map[string][]member{ "function": { {"name", shape{kind: stringValue, required: true}}, {"description", shape{kind: stringValue, required: true}}, @@ -64,14 +67,24 @@ var ( {"timezone", shape{kind: stringValue, nullable: true}}, }, nullable: true}}, }, + "computer_use": { + {"include_screenshots", shape{kind: booleanValue}}, + }, + "automations": {}, }}, nullable: true}}, {"multi_agent", shape{kind: objectValue, members: []member{ {"enabled", shape{kind: booleanValue, required: true}}, {"max_concurrent_subagents", shape{kind: integerValue, minimum: 1}}, }, nullable: true}}, + {"compaction", shape{kind: objectValue, members: []member{ + {"async", shape{kind: booleanValue, nullable: true}}, + }, nullable: true}}, {"x_agents_core", shape{}}, }} updateAgentParams = shape{kind: objectValue, members: []member{ + {"experimental", shape{kind: objectValue, members: []member{ + {"time_awareness", shape{kind: booleanValue}}, + }}}, {"model", shape{kind: stringValue}}, {"reasoning", shape{kind: objectValue, members: []member{ {"effort", shape{kind: enumValue, values: []string{"none", "minimal", "low", "medium", "high", "xhigh", "max"}, nullable: true}}, @@ -86,15 +99,18 @@ var ( }, nullable: true}}, {"verbosity", shape{kind: enumValue, values: []string{"low", "medium", "high"}, nullable: true}}, }, nullable: true}}, - {"service_tier", shape{kind: enumValue, values: []string{"auto", "default", "flex", "priority", "fast"}, nullable: true}}, + {"service_tier", shape{kind: enumValue, values: []string{"auto", "default", "flex", "priority", "fast", "ultrafast"}, nullable: true}}, {"instructions", shape{kind: stringValue, nullable: true}}, {"multi_agent", shape{kind: objectValue, members: []member{ {"enabled", shape{kind: booleanValue, required: true}}, {"max_concurrent_subagents", shape{kind: integerValue, minimum: 1}}, }, nullable: true}}, + {"compaction", shape{kind: objectValue, members: []member{ + {"async", shape{kind: booleanValue, nullable: true}}, + }, nullable: true}}, {"metadata", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, {"name", shape{kind: stringValue, nullable: true}}, - {"tools", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"function", "tool_search", "programmatic_tool_calling", "mcp", "web_search"}, variants: map[string][]member{ + {"tools", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"function", "tool_search", "programmatic_tool_calling", "mcp", "web_search", "computer_use", "automations"}, variants: map[string][]member{ "function": { {"name", shape{kind: stringValue, required: true}}, {"description", shape{kind: stringValue, required: true}}, @@ -136,10 +152,17 @@ var ( {"timezone", shape{kind: stringValue, nullable: true}}, }, nullable: true}}, }, + "computer_use": { + {"include_screenshots", shape{kind: booleanValue}}, + }, + "automations": {}, }}, nullable: true}}, {"x_agents_core", shape{}}, }} sessionAgentConfigParam = shape{kind: objectValue, members: []member{ + {"experimental", shape{kind: objectValue, members: []member{ + {"time_awareness", shape{kind: booleanValue}}, + }}}, {"model", shape{kind: stringValue}}, {"reasoning", shape{kind: objectValue, members: []member{ {"effort", shape{kind: enumValue, values: []string{"none", "minimal", "low", "medium", "high", "xhigh", "max"}, nullable: true}}, @@ -154,13 +177,16 @@ var ( }, nullable: true}}, {"verbosity", shape{kind: enumValue, values: []string{"low", "medium", "high"}, nullable: true}}, }, nullable: true}}, - {"service_tier", shape{kind: enumValue, values: []string{"auto", "default", "flex", "priority", "fast"}, nullable: true}}, + {"service_tier", shape{kind: enumValue, values: []string{"auto", "default", "flex", "priority", "fast", "ultrafast"}, nullable: true}}, {"instructions", shape{kind: stringValue, nullable: true}}, {"multi_agent", shape{kind: objectValue, members: []member{ {"enabled", shape{kind: booleanValue, required: true}}, {"max_concurrent_subagents", shape{kind: integerValue, minimum: 1}}, }, nullable: true}}, - {"tools", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"function", "tool_search", "programmatic_tool_calling", "mcp", "web_search"}, variants: map[string][]member{ + {"compaction", shape{kind: objectValue, members: []member{ + {"async", shape{kind: booleanValue, nullable: true}}, + }, nullable: true}}, + {"tools", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"function", "tool_search", "programmatic_tool_calling", "mcp", "web_search", "computer_use", "automations"}, variants: map[string][]member{ "function": { {"name", shape{kind: stringValue, required: true}}, {"description", shape{kind: stringValue, required: true}}, @@ -204,10 +230,15 @@ var ( {"timezone", shape{kind: stringValue, nullable: true}}, }, nullable: true}}, }, + "computer_use": { + {"include_screenshots", shape{kind: booleanValue}}, + }, + "automations": {}, }}, nullable: true}}, {"x_agents_core", shape{}}, }} createAgentSessionParams = shape{kind: objectValue, members: []member{ + {"review", shape{kind: enumValue, values: []string{"none", "auto_review"}}}, {"metadata", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, {"agent", shape{kind: openObject}}, {"agent_id", shape{kind: stringValue}}, @@ -229,15 +260,76 @@ var ( {"x_agents_core", shape{}}, }} updateAgentSessionParams = shape{kind: objectValue, members: []member{ + {"review", shape{kind: enumValue, values: []string{"none", "auto_review"}}}, + {"agent", shape{kind: objectValue, members: []member{ + {"tools", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"function", "tool_search", "programmatic_tool_calling", "mcp", "web_search", "computer_use", "automations"}, variants: map[string][]member{ + "function": { + {"name", shape{kind: stringValue, required: true}}, + {"description", shape{kind: stringValue, required: true}}, + {"parameters", shape{kind: mapValue, required: true}}, + {"defer_loading", shape{kind: booleanValue}}, + }, + "tool_search": {}, + "programmatic_tool_calling": { + {"enabled", shape{kind: booleanValue}}, + }, + "mcp": { + {"server_label", shape{kind: stringValue, required: true}}, + {"credential_id", shape{kind: stringValue, nullable: true}}, + {"transport", shape{kind: unionValue, values: []string{"http", "stdio"}, variants: map[string][]member{ + "http": { + {"server_url", shape{kind: stringValue, required: true}}, + {"authorization", shape{kind: stringValue, nullable: true}}, + {"headers", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, + }, + "stdio": { + {"command", shape{kind: stringValue, required: true}}, + {"args", shape{kind: arrayValue, items: &shape{kind: stringValue}, nullable: true}}, + {"cwd", shape{kind: stringValue, required: true}}, + {"env", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, + {"env_vars", shape{kind: arrayValue, items: &shape{kind: stringValue}, nullable: true}}, + }, + }, required: true}}, + {"request_metadata", shape{kind: mapValue, nullable: true}}, + {"allowed_tools", shape{kind: arrayValue, items: &shape{kind: stringValue}, nullable: true}}, + {"required", shape{kind: booleanValue}}, + {"connection_origin", shape{kind: enumValue, values: []string{"service", "environment"}, nullable: true}}, + }, + "web_search": { + {"mode", shape{kind: enumValue, values: []string{"disabled", "cached", "live"}, nullable: true}}, + {"context_size", shape{kind: enumValue, values: []string{"low", "medium", "high"}, nullable: true}}, + {"allowed_domains", shape{kind: arrayValue, items: &shape{kind: stringValue}, nullable: true}}, + {"location", shape{kind: objectValue, members: []member{ + {"country", shape{kind: stringValue, nullable: true}}, + {"region", shape{kind: stringValue, nullable: true}}, + {"city", shape{kind: stringValue, nullable: true}}, + {"timezone", shape{kind: stringValue, nullable: true}}, + }, nullable: true}}, + }, + "computer_use": { + {"include_screenshots", shape{kind: booleanValue}}, + }, + "automations": {}, + }}, nullable: true}}, + {"model", shape{kind: stringValue}}, + {"reasoning", shape{kind: objectValue, members: []member{ + {"effort", shape{kind: enumValue, values: []string{"none", "minimal", "low", "medium", "high", "xhigh", "max"}, nullable: true}}, + }}}, + {"service_tier", shape{kind: enumValue, values: []string{"auto", "default", "flex", "priority", "fast", "ultrafast"}, nullable: true}}, + }}}, {"metadata", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, }} createVaultParams = shape{kind: objectValue, members: []member{ {"name", shape{kind: stringValue}}, {"metadata", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, }} + updateVaultParams = shape{kind: objectValue, members: []member{ + {"metadata", shape{kind: mapValue, items: &shape{kind: stringValue}}}, + {"name", shape{kind: stringValue, nullable: true}}, + }} createVaultCredentialParams = shape{kind: objectValue, members: []member{ {"name", shape{kind: stringValue, required: true}}, - {"auth", shape{kind: unionValue, values: []string{"mcp_oauth", "static_bearer"}, variants: map[string][]member{ + {"auth", shape{kind: unionValue, values: []string{"mcp_oauth", "static_bearer", "environment_variable"}, variants: map[string][]member{ "mcp_oauth": { {"mcp_server_url", shape{kind: stringValue, required: true}}, {"access_token", shape{kind: stringValue, required: true}}, @@ -263,10 +355,21 @@ var ( {"mcp_server_url", shape{kind: stringValue, required: true}}, {"token", shape{kind: stringValue, required: true}}, }, + "environment_variable": { + {"secret_name", shape{kind: stringValue, required: true}}, + {"secret_value", shape{kind: stringValue, required: true}}, + {"networking", shape{kind: unionValue, values: []string{"unrestricted", "limited"}, variants: map[string][]member{ + "unrestricted": {}, + "limited": { + {"allowed_hosts", shape{kind: arrayValue, items: &shape{kind: stringValue}, required: true}}, + }, + }, required: true}}, + }, }, required: true}}, + {"metadata", shape{kind: mapValue, items: &shape{kind: stringValue}}}, }} rotateVaultCredentialParams = shape{kind: objectValue, members: []member{ - {"auth", shape{kind: unionValue, values: []string{"mcp_oauth", "static_bearer"}, variants: map[string][]member{ + {"auth", shape{kind: unionValue, values: []string{"mcp_oauth", "static_bearer", "environment_variable"}, variants: map[string][]member{ "mcp_oauth": { {"access_token", shape{kind: stringValue, nullable: true}}, {"expires_at", shape{kind: stringValue, nullable: true}}, @@ -286,7 +389,11 @@ var ( "static_bearer": { {"token", shape{kind: stringValue, required: true}}, }, - }, required: true}}, + "environment_variable": { + {"secret_value", shape{kind: stringValue, required: true}}, + }, + }}}, + {"metadata", shape{kind: mapValue, items: &shape{kind: stringValue}}}, }} createEnvironmentTemplateParams = shape{kind: objectValue, members: []member{ {"packages", shape{kind: objectValue, members: []member{ @@ -299,6 +406,9 @@ var ( {"cwd", shape{kind: stringValue, nullable: true}}, }}, nullable: true}}, {"network", shape{kind: openObject, nullable: true}}, + {"desktop", shape{kind: objectValue, members: []member{ + {"enabled", shape{kind: booleanValue, required: true}}, + }, nullable: true}}, {"env", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, {"capability_directories", shape{kind: arrayValue, items: &shape{kind: stringValue}, nullable: true}}, {"skills", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"skill_reference", "inline"}, variants: map[string][]member{ @@ -353,6 +463,9 @@ var ( {"cwd", shape{kind: stringValue, nullable: true}}, }}, nullable: true}}, {"network", shape{kind: openObject, nullable: true}}, + {"desktop", shape{kind: objectValue, members: []member{ + {"enabled", shape{kind: booleanValue, required: true}}, + }, nullable: true}}, {"env", shape{kind: mapValue, items: &shape{kind: stringValue}, nullable: true}}, {"capability_directories", shape{kind: arrayValue, items: &shape{kind: stringValue}, nullable: true}}, {"skills", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"skill_reference", "inline"}, variants: map[string][]member{ @@ -395,7 +508,23 @@ var ( }}, nullable: true}}, }} createSessionEventsParams = shape{kind: objectValue, members: []member{ - {"events", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"agent.session.input.message", "agent.session.input.cancel", "agent.session.input.tool_result"}, variants: map[string][]member{ + {"events", shape{kind: arrayValue, items: &shape{kind: unionValue, values: []string{"agent.session.input.computer_use_approval_request_result", "agent.session.input.message", "agent.session.input.cancel", "agent.session.input.tool_result"}, variants: map[string][]member{ + "agent.session.input.computer_use_approval_request_result": { + {"request_id", shape{kind: stringValue, required: true}}, + {"response", shape{kind: unionValue, values: []string{"browser_authentication", "browser_origin_access"}, variants: map[string][]member{ + "browser_authentication": { + {"action", shape{kind: enumValue, values: []string{"submit", "cancel"}, required: true}}, + {"fields", shape{kind: arrayValue, items: &shape{kind: objectValue, members: []member{ + {"field_id", shape{kind: stringValue, required: true}}, + {"value", shape{kind: stringValue, required: true}}, + }}}}, + {"selected_option", shape{kind: stringValue, nullable: true}}, + }, + "browser_origin_access": { + {"decision", shape{kind: enumValue, values: []string{"approve", "deny", "cancel"}, required: true}}, + }, + }, required: true}}, + }, "agent.session.input.message": { {"input", shape{kind: arrayValue, items: &shape{kind: objectValue, members: []member{ {"type", shape{kind: enumValue, values: []string{"message"}}}, diff --git a/services/core/internal/api/pagination.go b/services/core/internal/api/pagination.go index 112f737bc..d81efbf71 100644 --- a/services/core/internal/api/pagination.go +++ b/services/core/internal/api/pagination.go @@ -4,6 +4,8 @@ import ( "net/http" "net/url" "strings" + + "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/metadata" ) type pageOptions struct { @@ -49,3 +51,34 @@ func readPageQueryLimits(w http.ResponseWriter, r *http.Request, q url.Values, d } return pageOptions{after: strings.TrimSpace(q.Get("after")), limit: limit, ascending: order == "asc"}, true } + +// readMetadataFilter reads the exact-match pairs of metadata[key]=value. Every +// pair must match; keys and values follow the official metadata limits. +func readMetadataFilter(w http.ResponseWriter, r *http.Request) (map[string]string, bool) { + var filter map[string]string + for name, values := range r.URL.Query() { + key, found := strings.CutPrefix(name, "metadata[") + key, closed := strings.CutSuffix(key, "]") + switch { + case !found || !closed: + continue + case len(values) > 1: + writeListDuplicateError(w, r, name, nil) + return nil, false + case key == "": + writeFieldError(w, &fieldError{param: "metadata", message: "Invalid property name in 'metadata': '' is too short. Expected a string with minimum length 1, but got a string with length 0 instead."}) + return nil, false + } + if filter == nil { + filter = map[string]string{} + } + filter[key] = values[0] + } + if len(filter) > 0 { + if err := metadata.Validate(filter); err != nil { + writeFieldError(w, metadataFieldError(err)) + return nil, false + } + } + return filter, true +} diff --git a/services/core/internal/api/request_shapes_test.go b/services/core/internal/api/request_shapes_test.go index 0c9d49b1a..ef3d2d8f8 100644 --- a/services/core/internal/api/request_shapes_test.go +++ b/services/core/internal/api/request_shapes_test.go @@ -35,7 +35,7 @@ func TestRequestShapesReportFieldErrors(t *testing.T) { {"template env value", validation, "/v1/agents/environments/templates/" + uuid.NewString(), `{"env":{"KEY":1}}`, "env.KEY", "Invalid type for 'env.KEY': expected a string, but got an integer instead."}, {"template env name", validation, "/v1/agents/environments/templates", `{"env":{"PATH":"x"}}`, "env.PATH", "Environment variable names must match [A-Za-z_][A-Za-z0-9_]* and must not be PATH, OPENAI_API_KEY or start with CODEX_ or OAC_; values must not contain U+0000."}, {"credential missing token", credentials, credentialPath, `{"name":"n","auth":{"type":"static_bearer","mcp_server_url":"https://mcp.example/tools"}}`, "auth.token", "Missing required parameter: 'auth.token'."}, - {"credential auth type", credentials, credentialPath, `{"name":"n","auth":{"type":"basic"}}`, "auth.type", "Invalid value: 'basic'. Supported values are: 'mcp_oauth' and 'static_bearer'."}, + {"credential auth type", credentials, credentialPath, `{"name":"n","auth":{"type":"basic"}}`, "auth.type", "Invalid value: 'basic'. Supported values are: 'mcp_oauth', 'static_bearer', and 'environment_variable'."}, {"credential missing access token", credentials, credentialPath, `{"name":"n","auth":{"type":"mcp_oauth","mcp_server_url":"https://mcp.example/tools"}}`, "auth.access_token", "Missing required parameter: 'auth.access_token'."}, {"credential url", credentials, credentialPath, `{"name":"n","auth":{"type":"static_bearer","mcp_server_url":"http://mcp.example","token":"t"}}`, "auth.mcp_server_url", "auth.mcp_server_url must be an absolute HTTPS URL without userinfo or a fragment."}, {"credential empty token", credentials, credentialPath, `{"name":"n","auth":{"type":"static_bearer","mcp_server_url":"https://mcp.example","token":""}}`, "auth.token", "auth.token must be a nonempty string."}, diff --git a/services/core/internal/api/routing_test.go b/services/core/internal/api/routing_test.go index 8547c403a..00fbcf5d9 100644 --- a/services/core/internal/api/routing_test.go +++ b/services/core/internal/api/routing_test.go @@ -348,7 +348,14 @@ func TestEveryRouteAuthenticatesItsCanonicalPath(t *testing.T) { if !slices.Equal(served, pinned.Routes) { t.Errorf("/v1 routes differ from the pinned set:\nserved %v\npinned %v", served, pinned.Routes) } - if routes < 73 || len(s.lookups) != 0 || len(s.updates) != 0 { + // Official operations Core does not run answer like an unknown route. + for _, route := range []string{"POST /v1/agents/automations", "GET /v1/agents/automations/a/invocations/i", "GET /v1/agents/environments", "GET /v1/agents/sessions/s/traces"} { + method, target, _ := strings.Cut(route, " ") + if got := serve(handler, method, target, "", withHeaders(project, beta)); got.Code != http.StatusNotFound || !strings.Contains(got.Body.String(), `"code":"unsupported_operation"`) { + t.Errorf("%s = %d %s", route, got.Code, got.Body) + } + } + if routes < 88 || len(s.lookups) != 0 || len(s.updates) != 0 { t.Fatalf("walked %d routes; store lookups %v updates %v", routes, s.lookups, s.updates) } // Traversal into internal groups keeps their own authentication. diff --git a/services/core/internal/api/saved_configuration.go b/services/core/internal/api/saved_configuration.go index 167e04753..e991c1158 100644 --- a/services/core/internal/api/saved_configuration.go +++ b/services/core/internal/api/saved_configuration.go @@ -61,6 +61,10 @@ func resolveSavedFields(input v1.CreateAgentRequest) (agents.CreateCommand, erro if err != nil { return agents.CreateCommand{}, err } + cfg.Compaction, cfg.Experimental, err = resolveAgentOptions(input.Compaction, input.Experimental) + if err != nil { + return agents.CreateCommand{}, err + } configuration, err := json.Marshal(cfg) result := agents.CreateCommand{Metadata: values, Configuration: configuration} if input.XAgentsCore != nil { @@ -69,6 +73,36 @@ func resolveSavedFields(input v1.CreateAgentRequest) (agents.CreateCommand, erro return result, err } +// resolveAgentOptions stores compaction only with an explicit async value: an omitted, +// null or empty compaction, or a null async, is the official default, which leaves the +// Harness's native compaction. Experimental always carries its official default, time +// awareness off. Session admission rejects the values no Harness runs. +func resolveAgentOptions(compaction, experimental json.RawMessage) (resolvedCompaction, resolvedExperimental json.RawMessage, err error) { + if !isNull(compaction) { + input := struct { + Async *bool `json:"async"` + }{} + if err = json.Unmarshal(compaction, &input); err != nil { + return nil, nil, &storedDataError{err} + } + if input.Async != nil { + resolvedCompaction, _ = json.Marshal(struct { + Async bool `json:"async"` + }{*input.Async}) + } + } + input := struct { + TimeAwareness bool `json:"time_awareness"` + }{} + if !isNull(experimental) { + if err = json.Unmarshal(experimental, &input); err != nil { + return nil, nil, &storedDataError{err} + } + } + resolvedExperimental, _ = json.Marshal(input) + return resolvedCompaction, resolvedExperimental, nil +} + // resolveSavedMultiAgent and resolveText read values whose pinned shape was // checked at decode; only the uint32 bound of max_concurrent_subagents remains. func resolveSavedMultiAgent(raw json.RawMessage) (v1.MultiAgentConfig, error) { diff --git a/services/core/internal/api/saved_tools.go b/services/core/internal/api/saved_tools.go index 04cf2eb66..cfd12df79 100644 --- a/services/core/internal/api/saved_tools.go +++ b/services/core/internal/api/saved_tools.go @@ -40,6 +40,14 @@ func resolveSavedTools(input []json.RawMessage) ([]json.RawMessage, error) { return nil, err } value = resolved + case "computer_use": + resolved, err := resolveComputerUseTool(raw) + if err != nil { + return nil, err + } + value = resolved + case "automations": + value = json.RawMessage(`{"type":"automations"}`) case "mcp": resolved, err := resolveMCPTool(raw, fmt.Sprintf("tools[%d]", i), true) if err != nil { diff --git a/services/core/internal/api/session_agent.go b/services/core/internal/api/session_agent.go index 5e8a12ee1..4e3518d08 100644 --- a/services/core/internal/api/session_agent.go +++ b/services/core/internal/api/session_agent.go @@ -23,6 +23,7 @@ func resolveSessionAgent(input sessionRequest, saved *v1.SavedAgent) (v1.Agent, request.Model, request.Instructions = agent.Model, agent.Instructions request.MultiAgent, request.Reasoning, request.ServiceTier = agent.MultiAgent, agent.Reasoning, agent.ServiceTier request.Text, request.Tools = agent.Text, agent.Tools + request.Compaction, request.Experimental = agent.Compaction, agent.Experimental } if saved != nil && request.Model == nil { request.Model = &saved.Model @@ -70,12 +71,25 @@ func resolveSessionAgent(input sessionRequest, saved *v1.SavedAgent) (v1.Agent, cfg.Text = override.Text case "tools": cfg.Tools = override.Tools + case "compaction": + cfg.Compaction = override.Compaction + case "experimental": + // Experimental overrides per member, so an object without members keeps the saved settings. + if !emptyObject(input.Agent.Experimental) { + cfg.Experimental = override.Experimental + } } } } return admitSessionAgent(cfg) } +// emptyObject reports a supplied JSON object without members. +func emptyObject(raw json.RawMessage) bool { + var members map[string]json.RawMessage + return !isNull(raw) && json.Unmarshal(raw, &members) == nil && len(members) == 0 +} + func admitSessionAgent(cfg v1.SavedAgentConfiguration) (v1.Agent, error) { if strings.TrimSpace(cfg.Model) == "" { return v1.Agent{}, errors.New("Execution currently requires a nonempty model.") @@ -90,5 +104,5 @@ func admitSessionAgent(cfg v1.SavedAgentConfiguration) (v1.Agent, error) { } return v1.Agent{XAgentsCore: extension, Model: cfg.Model, Name: cfg.Name, Instructions: cfg.Instructions, MultiAgent: cfg.MultiAgent, Reasoning: cfg.Reasoning, ServiceTier: cfg.ServiceTier, - Text: cfg.Text, Tools: tools}, nil + Text: cfg.Text, Tools: tools, Compaction: cfg.Compaction, Experimental: cfg.Experimental}, nil } diff --git a/services/core/internal/api/session_environment_http_test.go b/services/core/internal/api/session_environment_http_test.go index ab7d088a1..3811843e5 100644 --- a/services/core/internal/api/session_environment_http_test.go +++ b/services/core/internal/api/session_environment_http_test.go @@ -18,7 +18,7 @@ import ( type environmentHTTPFixture struct{ streamFixture } -func (f *environmentHTTPFixture) ListSessions(_ context.Context, tenant, _ string, _ int, _ bool, _ *string) (sessions.Page, error) { +func (f *environmentHTTPFixture) ListSessions(_ context.Context, tenant, _ string, _ int, _ bool, _ *string, _ map[string]string) (sessions.Page, error) { if tenant != f.session.TenantID { return sessions.Page{}, sessions.ErrNotFound } diff --git a/services/core/internal/api/session_metadata.go b/services/core/internal/api/session_metadata.go index c4caabc54..423e1dbc1 100644 --- a/services/core/internal/api/session_metadata.go +++ b/services/core/internal/api/session_metadata.go @@ -20,11 +20,25 @@ func (h *Handler) updateSession(w http.ResponseWriter, r *http.Request) { return } var request struct { + Agent json.RawMessage `json:"agent"` + Review *string `json:"review"` Metadata json.RawMessage `json:"metadata"` } _ = json.Unmarshal(raw, &request) + // An agent object without members changes nothing, as in the official update. + if request.Agent != nil && !emptyObject(request.Agent) { + writeFieldError(w, &fieldError{param: "agent", message: "Updating the Session agent is not supported."}) + return + } + if err := rejectAutoReview(request.Review); writeFieldError(w, err) { + return + } if len(request.Metadata) == 0 { - writeError(w, http.StatusBadRequest, "invalid_request_error", "At least one update field is required") + if request.Review == nil && request.Agent == nil { + writeError(w, http.StatusBadRequest, "invalid_request_error", "At least one update field is required") + return + } + h.getSession(w, r) return } var values map[string]string @@ -106,3 +120,11 @@ func metadataFieldError(err error) error { } return err } + +// rejectAutoReview accepts review none; automatic review has no Harness-native equivalent. +func rejectAutoReview(review *string) error { + if review != nil && *review == "auto_review" { + return &fieldError{param: "review", message: "Automatic action review is not supported. Use review none."} + } + return nil +} diff --git a/services/core/internal/api/session_request.go b/services/core/internal/api/session_request.go index 776dab025..1ad729348 100644 --- a/services/core/internal/api/session_request.go +++ b/services/core/internal/api/session_request.go @@ -47,6 +47,9 @@ func (request decodedSessionRequest) validated() (sessionRequest, error) { _ = json.Unmarshal(request.Execution, &fields) input.modelProviderNull = bytes.Equal(bytes.TrimSpace(fields["model_provider"]), []byte("null")) } + if err := rejectAutoReview(request.Review); err != nil { + return input, err + } input.VaultIDs = append([]string{}, request.VaultIDs...) canonicalEnvironment, err := preparationEnvironmentInput(request.Environment, input.XAgentsCore) if err != nil { @@ -74,7 +77,7 @@ func (request decodedSessionRequest) validated() (sessionRequest, error) { if err := validateSessionAgent(request.Agent); err != nil { return input, err } - if decodeInputObject(request.Agent, &input.Agent, "model", "instructions", "multi_agent", "reasoning", "service_tier", "text", "tools", "x_agents_core") != nil { + if decodeInputObject(request.Agent, &input.Agent, "model", "instructions", "multi_agent", "reasoning", "service_tier", "text", "tools", "compaction", "experimental", "x_agents_core") != nil { return input, sessions.ErrInvalidInput } if err := json.Unmarshal(request.Agent, &input.agentFields); err != nil { diff --git a/services/core/internal/api/session_tools.go b/services/core/internal/api/session_tools.go index fc744566d..4a6dfdc6a 100644 --- a/services/core/internal/api/session_tools.go +++ b/services/core/internal/api/session_tools.go @@ -22,14 +22,19 @@ func resolveSessionTools(input []json.RawMessage) ([]json.RawMessage, error) { return nil, &storedDataError{err} } switch kind.Type { - case "programmatic_tool_calling", "web_search": + case "programmatic_tool_calling", "web_search", "computer_use", "automations": if controls[kind.Type] { return nil, errors.New("Execution requires distinct tool controls.") } controls[kind.Type] = true resolve := resolveProgrammaticTool - if kind.Type == "web_search" { + switch kind.Type { + case "web_search": resolve = resolveWebSearch + case "computer_use": + resolve = resolveComputerUseTool + case "automations": + resolve = func(json.RawMessage) (json.RawMessage, error) { return json.RawMessage(`{"type":"automations"}`), nil } } resolved, err := resolve(raw) if err != nil { diff --git a/services/core/internal/api/source_files.go b/services/core/internal/api/source_files.go index fbcd18798..d59bf3c90 100644 --- a/services/core/internal/api/source_files.go +++ b/services/core/internal/api/source_files.go @@ -47,7 +47,7 @@ func (h *Handler) deleteSourceFile(w http.ResponseWriter, r *http.Request) { } func sourceFileResponse(file files.File) v1.SourceFile { - return v1.SourceFile{ID: file.ID, Object: "file", Bytes: file.SizeBytes, + return v1.SourceFile{ID: file.ID, Object: "file", Bytes: &file.SizeBytes, CreatedAt: file.CreatedAt.Unix(), Filename: file.Filename, Purpose: file.Purpose, Status: "processed"} } diff --git a/services/core/internal/api/source_files_test.go b/services/core/internal/api/source_files_test.go index a45392fdd..2d804e8d6 100644 --- a/services/core/internal/api/source_files_test.go +++ b/services/core/internal/api/source_files_test.go @@ -157,7 +157,7 @@ func TestSourceFilesPublicLifecycleAndEnvironmentCopy(t *testing.T) { body, contentType := sourceMultipart(t, fields, data) status, raw := sourceRequest(t, server, "POST", "/v1/files", "files-key", contentType, body) var file v1.SourceFile - if status != 200 || json.Unmarshal(raw, &file) != nil || file.Bytes != int64(len(data)) || file.Object != "file" || file.Purpose != "user_data" || file.Status != "processed" || file.ExpiresAt != nil { + if status != 200 || json.Unmarshal(raw, &file) != nil || file.Bytes == nil || *file.Bytes != int64(len(data)) || file.Object != "file" || file.Purpose != "user_data" || file.Status != "processed" || file.ExpiresAt != nil { t.Fatalf("upload: %d %s", status, raw) } for _, path := range []string{"/v1/files/" + file.ID, "/v1/files/" + file.ID + "/content"} { diff --git a/services/core/internal/api/tool_controls.go b/services/core/internal/api/tool_controls.go index e7006f120..b1826a292 100644 --- a/services/core/internal/api/tool_controls.go +++ b/services/core/internal/api/tool_controls.go @@ -16,6 +16,18 @@ func resolveProgrammaticTool(raw json.RawMessage) (json.RawMessage, error) { return json.Marshal(input) } +// resolveComputerUseTool saves the official computer_use tool with its default; Session admission rejects it. +func resolveComputerUseTool(raw json.RawMessage) (json.RawMessage, error) { + input := struct { + Type string `json:"type"` + IncludeScreenshots bool `json:"include_screenshots"` + }{} + if err := json.Unmarshal(raw, &input); err != nil { + return nil, &storedDataError{err} + } + return json.Marshal(input) +} + // webSearchTool is the resolved web_search projection. A present location // projects all four keys; null and empty allowed_domains stay distinct. type webSearchTool struct { diff --git a/services/core/internal/api/unsupported_fields_test.go b/services/core/internal/api/unsupported_fields_test.go new file mode 100644 index 000000000..678e7d772 --- /dev/null +++ b/services/core/internal/api/unsupported_fields_test.go @@ -0,0 +1,37 @@ +package api + +import ( + "net/http" + "testing" +) + +// Official fields without a native home are rejected by param, before storage. +func TestUnsupportedOfficialFieldsAreRejectedByParam(t *testing.T) { + h, s := validationHandler(t) + for _, test := range []struct{ path, body, param string }{ + {"/v1/agents/sessions/s", `{"agent":{"model":"m"}}`, "agent"}, + {"/v1/agents/sessions/s", `{"review":"auto_review"}`, "review"}, + {"/v1/agents/sessions", `{"agent":{"model":"m"},"review":"auto_review","environment":{"type":"none"},"input":"hi"}`, "review"}, + {"/v1/agents/sessions", `{"agent":{"model":"m"},"environment":{"type":"openai_hosted","container_size":"small"},"input":"hi"}`, "container_size"}, + {"/v1/agents/sessions", `{"agent":{"model":"m"},"environment":{"type":"openai_hosted","desktop":{"enabled":true}},"input":"hi"}`, "desktop.enabled"}, + {"/v1/agents/sessions", `{"agent":{"model":"m"},"environment":{"type":"openai_hosted","network":{"access":"enabled","blocked_domains":["a.example"]}},"input":"hi"}`, "network.blocked_domains"}, + {"/v1/agents/environments/templates", `{"desktop":{"enabled":true}}`, "desktop.enabled"}, + {"/v1/agents/environments/templates", `{"desktop":7}`, "desktop"}, + {"/v1/agents/environments/templates", `{"desktop":{"enabled":"yes"}}`, "desktop.enabled"}, + {"/v1/agents/environments/templates", `{"desktop":{}}`, "desktop.enabled"}, + {"/v1/agents/environments/templates", `{"desktop":{"enabled":false,"x":1}}`, "desktop.x"}, + {"/v1/agents/sessions", `{"agent":{"model":"m"},"environment":{"type":"openai_hosted","environment_id":null},"input":"hi"}`, "environment_id"}, + {"/v1/agents/sessions", `{"agent":{"model":"m"},"environment":{"type":"openai_hosted","container_size":null},"input":"hi"}`, "container_size"}, + {"/v1/agents/sessions", `{"agent":{"model":"m"},"environment":{"type":"openai_hosted","desktop":{"enabled":"yes"}},"input":"hi"}`, "desktop.enabled"}, + {"/v1/agents/sessions/s/events", `{"events":[{"type":"agent.session.input.computer_use_approval_request_result","request_id":"r","response":{"type":"browser_origin_access","decision":"approve"}}]}`, "events[0].type"}, + } { + w := bodyGateRequest(h, test.path, "application/json", []byte(test.body)) + _, param, _ := errorFields(t, w) + if w.Code != http.StatusBadRequest || param == nil || *param != test.param { + t.Errorf("%s %s: %d %s", test.path, test.body, w.Code, w.Body) + } + } + if s.writes != 0 { + t.Fatalf("a rejected request reached storage: %d writes", s.writes) + } +} diff --git a/services/core/internal/api/vault_pagination.go b/services/core/internal/api/vault_pagination.go index 5e46b3f8b..3eabc56b8 100644 --- a/services/core/internal/api/vault_pagination.go +++ b/services/core/internal/api/vault_pagination.go @@ -1,10 +1,8 @@ package api import ( - "errors" "net/http" "slices" - "strconv" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/vaults" ) @@ -23,13 +21,10 @@ func readVaultPage(w http.ResponseWriter, r *http.Request) (vaults.PageQuery, bo return vaults.PageQuery{}, false } } - // Vault and Credential limits also clamp negative and overflowing integers; - // other values reach the shared Beta parser. - if raw := q["limit"]; len(raw) == 1 { - if requested, err := strconv.ParseInt(raw[0], 10, 64); err == nil || errors.Is(err, strconv.ErrRange) { - q.Set("limit", strconv.FormatInt(max(1, min(requested, 100)), 10)) - } - } options, ok := readPageQuery(w, r, q, true) - return vaults.PageQuery{After: options.after, Limit: options.limit, Ascending: options.ascending, Statuses: statuses}, ok + if !ok { + return vaults.PageQuery{}, false + } + filter, ok := readMetadataFilter(w, r) + return vaults.PageQuery{After: options.after, Limit: options.limit, Ascending: options.ascending, Statuses: statuses, Metadata: filter}, ok } diff --git a/services/core/internal/api/vault_pagination_test.go b/services/core/internal/api/vault_pagination_test.go index 24eec708c..fc1d858bb 100644 --- a/services/core/internal/api/vault_pagination_test.go +++ b/services/core/internal/api/vault_pagination_test.go @@ -58,8 +58,7 @@ func TestVaultStatusUnionAndDuplicates(t *testing.T) { func TestVaultLimitClamp(t *testing.T) { for _, path := range []string{"/v1/vaults", "/v1/vaults/vault-example/credentials"} { for query, limit := range map[string]int{ - "": 20, "limit=0": 1, "limit=-1": 1, "limit=-8": 1, "limit=3": 3, "limit=100": 100, "limit=101": 100, - "limit=9999999999999999999999999": 100, "limit=-9999999999999999999999999": 1, + "": 20, "limit=0": 1, "limit=3": 3, "limit=100": 100, "limit=101": 100, } { t.Run(path+"?"+query, func(t *testing.T) { w := httptest.NewRecorder() @@ -69,7 +68,7 @@ func TestVaultLimitClamp(t *testing.T) { } }) } - for _, query := range []string{"limit=abc", "limit=1.5", "limit=", "limit=null"} { + for _, query := range []string{"limit=abc", "limit=1.5", "limit=", "limit=null", "limit=-1"} { t.Run(path+"?"+query, func(t *testing.T) { w := httptest.NewRecorder() if _, ok := readVaultPage(w, httptest.NewRequest(http.MethodGet, path+"?"+query, nil)); ok { diff --git a/services/core/internal/api/vaults.go b/services/core/internal/api/vaults.go index 95b463a47..4ff10fdec 100644 --- a/services/core/internal/api/vaults.go +++ b/services/core/internal/api/vaults.go @@ -6,6 +6,8 @@ import ( "net/http" "strings" + "github.com/go-chi/chi/v5" + v1 "github.com/MiniMax-AI/OpenAgentCore/contracts/agents-api/v1" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/metadata" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/vaults" @@ -15,9 +17,11 @@ import ( // a Session's MCP servers use at creation. type Vaults interface { CreateVault(context.Context, vaults.CreateVault) (vaults.Vault, error) + UpdateVault(context.Context, vaults.UpdateVault) (vaults.Vault, error) DeleteVault(context.Context, vaults.DeleteVault) (string, error) CreateStaticCredential(context.Context, vaults.CreateStaticCredential) (vaults.Credential, error) UpdateStaticCredential(context.Context, vaults.UpdateStaticCredential) (vaults.Credential, error) + UpdateCredentialMetadata(context.Context, vaults.UpdateCredentialMetadata) (vaults.Credential, error) CreateOAuthCredential(context.Context, vaults.CreateOAuthCredential) (vaults.Credential, error) UpdateOAuthCredential(context.Context, vaults.UpdateOAuthCredential) (vaults.Credential, error) DeleteCredential(context.Context, vaults.DeleteCredential) (string, error) @@ -64,6 +68,37 @@ func (h *Handler) createVault(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusCreated, vaultResponse(vault)) } +func (h *Handler) updateVault(w http.ResponseWriter, r *http.Request) { + raw, ok := readJSONObject(w, r) + if !ok || writeFieldError(w, validateBody(raw, updateVaultParams)) { + return + } + var request struct { + Name *string `json:"name"` + Metadata map[string]string `json:"metadata"` + } + _ = json.Unmarshal(raw, &request) + _, fields := orderedMembers(raw) + _, nameSet := fields["name"] + input := vaults.UpdateVault{TenantID: tenantID(r), VaultID: chi.URLParam(r, "vault_id"), NameSet: nameSet, Metadata: request.Metadata} + if request.Name != nil { + name, err := normalizedVaultName(*request.Name) + if writeFieldError(w, err) { + return + } + input.Name = &name + } + if writeFieldError(w, metadataFieldError(metadata.Validate(input.Metadata))) { + return + } + vault, err := h.Vaults.UpdateVault(r.Context(), input) + if err != nil { + writeVaultsError(w, r, err) + return + } + writeJSON(w, http.StatusOK, vaultResponse(vault)) +} + func (h *Handler) getVault(w http.ResponseWriter, r *http.Request) { id, ok := credentialResourceID(w, r, "vault_id") if !ok { diff --git a/services/core/internal/api/vaults_list_test.go b/services/core/internal/api/vaults_list_test.go index 302504fd5..5e89fd4d1 100644 --- a/services/core/internal/api/vaults_list_test.go +++ b/services/core/internal/api/vaults_list_test.go @@ -22,9 +22,8 @@ func TestVaultListParameters(t *testing.T) { limit int statuses []string }{ - {"", 20, nil}, {"?limit=0", 1, nil}, {"?limit=-8", 1, nil}, {"?limit=3", 3, nil}, - {"?limit=101", 100, nil}, {"?limit=9999999999999999999999999", 100, nil}, - {"?limit=-9999999999999999999999999", 1, nil}, + {"", 20, nil}, {"?limit=0", 1, nil}, {"?limit=3", 3, nil}, + {"?limit=101", 100, nil}, {"?status=active", 20, []string{"active"}}, {"?status=archived", 20, []string{"archived"}}, {"?status[]=archived&status[]=active", 20, []string{"archived", "active"}}, {"?status=archived&status[]=active", 20, []string{"archived", "active"}}, @@ -46,7 +45,7 @@ func TestVaultListParameters(t *testing.T) { } }) } - for _, query := range []string{"limit=", "limit=null", "limit=1.5", "limit=1&limit=2", "order=invalid", "status=", "status=deleted", "status[]=active&status[]=invalid", "status=active&status=archived", "status=active&status[]=deleted", "after=a&after=b"} { + for _, query := range []string{"limit=", "limit=null", "limit=1.5", "limit=-8", "limit=1&limit=2", "order=invalid", "status=", "status=deleted", "status[]=active&status[]=invalid", "status=active&status=archived", "status=active&status[]=deleted", "after=a&after=b", "metadata[k]=a&metadata[k]=b", "metadata[]=x"} { h, f := vaultResourceHandler(t) w := vaultRequest(h, http.MethodGet, "/v1/vaults?"+query, "") if w.Code != 400 || f.calls != 0 { diff --git a/services/core/internal/db/queries/oauth_credentials.sql b/services/core/internal/db/queries/oauth_credentials.sql index 44ff44c11..d1c32da64 100644 --- a/services/core/internal/db/queries/oauth_credentials.sql +++ b/services/core/internal/db/queries/oauth_credentials.sql @@ -1,13 +1,13 @@ -- name: CreateOAuthCredential :one -INSERT INTO vault_credentials (id, vault_id, name, auth_type, mcp_server_url, token_ciphertext, oauth_metadata) -SELECT sqlc.arg(id), v.id, sqlc.arg(name), 'mcp_oauth', sqlc.arg(mcp_server_url), sqlc.arg(token_ciphertext), sqlc.arg(oauth_metadata) +INSERT INTO vault_credentials (id, vault_id, name, auth_type, mcp_server_url, token_ciphertext, oauth_metadata, metadata) +SELECT sqlc.arg(id), v.id, sqlc.arg(name), 'mcp_oauth', sqlc.arg(mcp_server_url), sqlc.arg(token_ciphertext), sqlc.arg(oauth_metadata), sqlc.arg(metadata) FROM vaults v WHERE v.tenant_id = sqlc.arg(tenant_id) AND v.id = sqlc.arg(vault_id) -RETURNING id, vault_id, name, auth_type, mcp_server_url, created_at, updated_at, oauth_metadata; +RETURNING id, vault_id, name, auth_type, mcp_server_url, created_at, updated_at, oauth_metadata, metadata; -- name: GetOAuthCredentialForUpdate :one SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, - c.oauth_metadata, c.token_ciphertext + c.oauth_metadata, c.metadata, c.token_ciphertext FROM vault_credentials c JOIN vaults v ON v.id = c.vault_id WHERE v.tenant_id = sqlc.arg(tenant_id) AND v.id = sqlc.arg(vault_id) @@ -16,10 +16,10 @@ FOR UPDATE OF c; -- name: UpdateOAuthCredential :one UPDATE vault_credentials c -SET token_ciphertext = sqlc.arg(token_ciphertext), oauth_metadata = sqlc.arg(oauth_metadata), +SET token_ciphertext = sqlc.arg(token_ciphertext), oauth_metadata = sqlc.arg(oauth_metadata), metadata = COALESCE(sqlc.narg(metadata)::jsonb, c.metadata), updated_at = statement_timestamp() FROM vaults v WHERE v.id = c.vault_id AND v.tenant_id = sqlc.arg(tenant_id) AND v.id = sqlc.arg(vault_id) AND c.id = sqlc.arg(id) AND c.auth_type = 'mcp_oauth' AND c.mcp_server_url = sqlc.arg(mcp_server_url) -RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata; +RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata; diff --git a/services/core/internal/db/queries/session_items.sql b/services/core/internal/db/queries/session_items.sql index 269897731..0cffb5549 100644 --- a/services/core/internal/db/queries/session_items.sql +++ b/services/core/internal/db/queries/session_items.sql @@ -34,6 +34,7 @@ SELECT i.id, i.created_at, THEN jsonb_set(i.payload, '{status}', '"incomplete"') ELSE i.payload END)::jsonb AS payload FROM session_items i JOIN turns t ON t.id = i.turn_id WHERE i.session_id = sqlc.arg(session_id) + AND (sqlc.narg(turn_id)::uuid IS NULL OR i.turn_id = sqlc.narg(turn_id)) AND (sqlc.narg(after_created)::timestamptz IS NULL OR (sqlc.arg(ascending)::boolean AND (i.created_at, i.position, i.id) > (sqlc.narg(after_created)::timestamptz, sqlc.arg(after_position)::integer, sqlc.arg(after_id)::uuid)) OR (NOT sqlc.arg(ascending)::boolean AND (i.created_at, i.position, i.id) < (sqlc.narg(after_created)::timestamptz, sqlc.arg(after_position)::integer, sqlc.arg(after_id)::uuid))) diff --git a/services/core/internal/db/queries/sessions.sql b/services/core/internal/db/queries/sessions.sql index 173d1ea31..0c61261bc 100644 --- a/services/core/internal/db/queries/sessions.sql +++ b/services/core/internal/db/queries/sessions.sql @@ -20,6 +20,7 @@ SELECT created_at, id FROM sessions WHERE tenant_id = $1 AND id = $2; SELECT * FROM sessions WHERE tenant_id = sqlc.arg(tenant_id) AND deleted_at IS NULL AND (sqlc.narg(agent_id)::text IS NULL OR configuration #>> '{agent,id}' = sqlc.narg(agent_id)::text) + AND (sqlc.narg(metadata)::jsonb IS NULL OR metadata @> sqlc.narg(metadata)::jsonb) AND (sqlc.narg(after_created)::timestamptz IS NULL OR (NOT sqlc.arg(ascending)::boolean AND (created_at, id) < (sqlc.narg(after_created)::timestamptz, sqlc.arg(after_id)::uuid)) OR (sqlc.arg(ascending)::boolean AND (created_at, id) > (sqlc.narg(after_created)::timestamptz, sqlc.arg(after_id)::uuid))) diff --git a/services/core/internal/db/queries/vault_credentials.sql b/services/core/internal/db/queries/vault_credentials.sql index 735f0a621..dea7d44f6 100644 --- a/services/core/internal/db/queries/vault_credentials.sql +++ b/services/core/internal/db/queries/vault_credentials.sql @@ -1,31 +1,32 @@ -- name: CreateStaticCredential :one -INSERT INTO vault_credentials (id, vault_id, name, auth_type, mcp_server_url, token_ciphertext) -SELECT sqlc.arg(id), v.id, sqlc.arg(name), 'static_bearer', sqlc.arg(mcp_server_url), sqlc.arg(token_ciphertext) +INSERT INTO vault_credentials (id, vault_id, name, auth_type, mcp_server_url, token_ciphertext, metadata) +SELECT sqlc.arg(id), v.id, sqlc.arg(name), 'static_bearer', sqlc.arg(mcp_server_url), sqlc.arg(token_ciphertext), sqlc.arg(metadata) FROM vaults v WHERE v.tenant_id = sqlc.arg(tenant_id) AND v.id = sqlc.arg(vault_id) -RETURNING id, vault_id, name, auth_type, mcp_server_url, created_at, updated_at, oauth_metadata; +RETURNING id, vault_id, name, auth_type, mcp_server_url, created_at, updated_at, oauth_metadata, metadata; -- name: GetCredential :one -SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata +SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata FROM vault_credentials c JOIN vaults v ON v.id = c.vault_id WHERE v.tenant_id = sqlc.arg(tenant_id) AND v.id = sqlc.arg(vault_id) AND c.id = sqlc.arg(id); -- name: UpdateStaticCredential :one UPDATE vault_credentials c -SET token_ciphertext = sqlc.arg(token_ciphertext), updated_at = statement_timestamp() +SET token_ciphertext = sqlc.arg(token_ciphertext), metadata = COALESCE(sqlc.narg(metadata)::jsonb, c.metadata), updated_at = statement_timestamp() FROM vaults v WHERE v.id = c.vault_id AND v.tenant_id = sqlc.arg(tenant_id) AND v.id = sqlc.arg(vault_id) AND c.id = sqlc.arg(id) AND c.auth_type = 'static_bearer' AND c.mcp_server_url = sqlc.arg(mcp_server_url) -RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata; +RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata; -- name: ListCredentials :many -SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata +SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata FROM vault_credentials c JOIN vaults v ON v.id = c.vault_id WHERE v.tenant_id = sqlc.arg(tenant_id) AND v.id = sqlc.arg(vault_id) AND c.status = ANY(sqlc.arg(statuses)::text[]) + AND (sqlc.narg(metadata)::jsonb IS NULL OR c.metadata @> sqlc.narg(metadata)::jsonb) AND (sqlc.narg(after_created)::timestamptz IS NULL OR (NOT sqlc.arg(ascending)::boolean AND (c.created_at, c.id) < (sqlc.narg(after_created)::timestamptz, sqlc.arg(after_id)::uuid)) OR (sqlc.arg(ascending)::boolean AND (c.created_at, c.id) > (sqlc.narg(after_created)::timestamptz, sqlc.arg(after_id)::uuid))) @@ -42,3 +43,11 @@ USING vaults v WHERE v.id = c.vault_id AND v.tenant_id = sqlc.arg(tenant_id) AND v.id = sqlc.arg(vault_id) AND c.id = sqlc.arg(id) RETURNING c.id; + +-- name: UpdateCredentialMetadata :one +UPDATE vault_credentials c +SET metadata = sqlc.arg(metadata), updated_at = statement_timestamp() +FROM vaults v +WHERE v.id = c.vault_id AND v.tenant_id = sqlc.arg(tenant_id) + AND v.id = sqlc.arg(vault_id) AND c.id = sqlc.arg(id) +RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata; diff --git a/services/core/internal/db/queries/vaults.sql b/services/core/internal/db/queries/vaults.sql index 10a898cd8..9170a1579 100644 --- a/services/core/internal/db/queries/vaults.sql +++ b/services/core/internal/db/queries/vaults.sql @@ -6,6 +6,13 @@ RETURNING *; -- name: GetVault :one SELECT * FROM vaults WHERE tenant_id = $1 AND id = $2; +-- name: UpdateVault :one +UPDATE vaults +SET name = CASE WHEN sqlc.arg(set_name)::boolean THEN sqlc.narg(name) ELSE name END, + metadata = COALESCE(sqlc.narg(metadata)::jsonb, metadata) +WHERE tenant_id = sqlc.arg(tenant_id) AND id = sqlc.arg(id) +RETURNING *; + -- name: DeleteVault :one DELETE FROM vaults WHERE tenant_id = $1 AND id = $2 RETURNING id; @@ -13,6 +20,7 @@ DELETE FROM vaults WHERE tenant_id = $1 AND id = $2 RETURNING id; SELECT * FROM vaults WHERE tenant_id = sqlc.arg(tenant_id) AND status = ANY(sqlc.arg(statuses)::text[]) + AND (sqlc.narg(metadata)::jsonb IS NULL OR metadata @> sqlc.narg(metadata)::jsonb) AND (sqlc.narg(after_created)::timestamptz IS NULL OR (NOT sqlc.arg(ascending)::boolean AND (created_at, id) < (sqlc.narg(after_created)::timestamptz, sqlc.arg(after_id)::uuid)) OR (sqlc.arg(ascending)::boolean AND (created_at, id) > (sqlc.narg(after_created)::timestamptz, sqlc.arg(after_id)::uuid))) diff --git a/services/core/internal/db/sqlc/models.go b/services/core/internal/db/sqlc/models.go index 4d11656ca..df010d010 100644 --- a/services/core/internal/db/sqlc/models.go +++ b/services/core/internal/db/sqlc/models.go @@ -545,6 +545,7 @@ type VaultCredential struct { UpdatedAt pgtype.Timestamptz `json:"updated_at"` Status string `json:"status"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` } type WorkspaceFsConfiguration struct { diff --git a/services/core/internal/db/sqlc/oauth_credentials.sql.go b/services/core/internal/db/sqlc/oauth_credentials.sql.go index f6e69f97e..4571c09ec 100644 --- a/services/core/internal/db/sqlc/oauth_credentials.sql.go +++ b/services/core/internal/db/sqlc/oauth_credentials.sql.go @@ -12,11 +12,11 @@ import ( ) const createOAuthCredential = `-- name: CreateOAuthCredential :one -INSERT INTO vault_credentials (id, vault_id, name, auth_type, mcp_server_url, token_ciphertext, oauth_metadata) -SELECT $1, v.id, $2, 'mcp_oauth', $3, $4, $5 +INSERT INTO vault_credentials (id, vault_id, name, auth_type, mcp_server_url, token_ciphertext, oauth_metadata, metadata) +SELECT $1, v.id, $2, 'mcp_oauth', $3, $4, $5, $6 FROM vaults v -WHERE v.tenant_id = $6 AND v.id = $7 -RETURNING id, vault_id, name, auth_type, mcp_server_url, created_at, updated_at, oauth_metadata +WHERE v.tenant_id = $7 AND v.id = $8 +RETURNING id, vault_id, name, auth_type, mcp_server_url, created_at, updated_at, oauth_metadata, metadata ` type CreateOAuthCredentialParams struct { @@ -25,6 +25,7 @@ type CreateOAuthCredentialParams struct { McpServerUrl string `json:"mcp_server_url"` TokenCiphertext []byte `json:"token_ciphertext"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` TenantID pgtype.UUID `json:"tenant_id"` VaultID pgtype.UUID `json:"vault_id"` } @@ -38,6 +39,7 @@ type CreateOAuthCredentialRow struct { CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` } func (q *Queries) CreateOAuthCredential(ctx context.Context, arg CreateOAuthCredentialParams) (CreateOAuthCredentialRow, error) { @@ -47,6 +49,7 @@ func (q *Queries) CreateOAuthCredential(ctx context.Context, arg CreateOAuthCred arg.McpServerUrl, arg.TokenCiphertext, arg.OauthMetadata, + arg.Metadata, arg.TenantID, arg.VaultID, ) @@ -60,13 +63,14 @@ func (q *Queries) CreateOAuthCredential(ctx context.Context, arg CreateOAuthCred &i.CreatedAt, &i.UpdatedAt, &i.OauthMetadata, + &i.Metadata, ) return i, err } const getOAuthCredentialForUpdate = `-- name: GetOAuthCredentialForUpdate :one SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, - c.oauth_metadata, c.token_ciphertext + c.oauth_metadata, c.metadata, c.token_ciphertext FROM vault_credentials c JOIN vaults v ON v.id = c.vault_id WHERE v.tenant_id = $1 AND v.id = $2 @@ -89,6 +93,7 @@ type GetOAuthCredentialForUpdateRow struct { CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` TokenCiphertext []byte `json:"token_ciphertext"` } @@ -104,6 +109,7 @@ func (q *Queries) GetOAuthCredentialForUpdate(ctx context.Context, arg GetOAuthC &i.CreatedAt, &i.UpdatedAt, &i.OauthMetadata, + &i.Metadata, &i.TokenCiphertext, ) return i, err @@ -111,18 +117,19 @@ func (q *Queries) GetOAuthCredentialForUpdate(ctx context.Context, arg GetOAuthC const updateOAuthCredential = `-- name: UpdateOAuthCredential :one UPDATE vault_credentials c -SET token_ciphertext = $1, oauth_metadata = $2, +SET token_ciphertext = $1, oauth_metadata = $2, metadata = COALESCE($3::jsonb, c.metadata), updated_at = statement_timestamp() FROM vaults v -WHERE v.id = c.vault_id AND v.tenant_id = $3 - AND v.id = $4 AND c.id = $5 - AND c.auth_type = 'mcp_oauth' AND c.mcp_server_url = $6 -RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata +WHERE v.id = c.vault_id AND v.tenant_id = $4 + AND v.id = $5 AND c.id = $6 + AND c.auth_type = 'mcp_oauth' AND c.mcp_server_url = $7 +RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata ` type UpdateOAuthCredentialParams struct { TokenCiphertext []byte `json:"token_ciphertext"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` TenantID pgtype.UUID `json:"tenant_id"` VaultID pgtype.UUID `json:"vault_id"` ID pgtype.UUID `json:"id"` @@ -138,12 +145,14 @@ type UpdateOAuthCredentialRow struct { CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` } func (q *Queries) UpdateOAuthCredential(ctx context.Context, arg UpdateOAuthCredentialParams) (UpdateOAuthCredentialRow, error) { row := q.db.QueryRow(ctx, updateOAuthCredential, arg.TokenCiphertext, arg.OauthMetadata, + arg.Metadata, arg.TenantID, arg.VaultID, arg.ID, @@ -159,6 +168,7 @@ func (q *Queries) UpdateOAuthCredential(ctx context.Context, arg UpdateOAuthCred &i.CreatedAt, &i.UpdatedAt, &i.OauthMetadata, + &i.Metadata, ) return i, err } diff --git a/services/core/internal/db/sqlc/session_items.sql.go b/services/core/internal/db/sqlc/session_items.sql.go index d7c498c15..daa8777f7 100644 --- a/services/core/internal/db/sqlc/session_items.sql.go +++ b/services/core/internal/db/sqlc/session_items.sql.go @@ -142,21 +142,23 @@ SELECT i.id, i.created_at, THEN jsonb_set(i.payload, '{status}', '"incomplete"') ELSE i.payload END)::jsonb AS payload FROM session_items i JOIN turns t ON t.id = i.turn_id WHERE i.session_id = $1 - AND ($2::timestamptz IS NULL - OR ($3::boolean AND (i.created_at, i.position, i.id) > ($2::timestamptz, $4::integer, $5::uuid)) - OR (NOT $3::boolean AND (i.created_at, i.position, i.id) < ($2::timestamptz, $4::integer, $5::uuid))) + AND ($2::uuid IS NULL OR i.turn_id = $2) + AND ($3::timestamptz IS NULL + OR ($4::boolean AND (i.created_at, i.position, i.id) > ($3::timestamptz, $5::integer, $6::uuid)) + OR (NOT $4::boolean AND (i.created_at, i.position, i.id) < ($3::timestamptz, $5::integer, $6::uuid))) ORDER BY - CASE WHEN $3::boolean THEN i.created_at END ASC, - CASE WHEN $3::boolean THEN i.position END ASC, - CASE WHEN $3::boolean THEN i.id END ASC, - CASE WHEN NOT $3::boolean THEN i.created_at END DESC, - CASE WHEN NOT $3::boolean THEN i.position END DESC, - CASE WHEN NOT $3::boolean THEN i.id END DESC -LIMIT $6 + CASE WHEN $4::boolean THEN i.created_at END ASC, + CASE WHEN $4::boolean THEN i.position END ASC, + CASE WHEN $4::boolean THEN i.id END ASC, + CASE WHEN NOT $4::boolean THEN i.created_at END DESC, + CASE WHEN NOT $4::boolean THEN i.position END DESC, + CASE WHEN NOT $4::boolean THEN i.id END DESC +LIMIT $7 ` type ListSessionItemsParams struct { SessionID pgtype.UUID `json:"session_id"` + TurnID pgtype.UUID `json:"turn_id"` AfterCreated pgtype.Timestamptz `json:"after_created"` Ascending bool `json:"ascending"` AfterPosition int32 `json:"after_position"` @@ -173,6 +175,7 @@ type ListSessionItemsRow struct { func (q *Queries) ListSessionItems(ctx context.Context, arg ListSessionItemsParams) ([]ListSessionItemsRow, error) { rows, err := q.db.Query(ctx, listSessionItems, arg.SessionID, + arg.TurnID, arg.AfterCreated, arg.Ascending, arg.AfterPosition, diff --git a/services/core/internal/db/sqlc/sessions.sql.go b/services/core/internal/db/sqlc/sessions.sql.go index 5d986c08a..bf5ff735b 100644 --- a/services/core/internal/db/sqlc/sessions.sql.go +++ b/services/core/internal/db/sqlc/sessions.sql.go @@ -155,20 +155,22 @@ const listSessions = `-- name: ListSessions :many SELECT id, tenant_id, engine, metadata, idempotency_key, request_hash, created_at, configuration, event_sequence, creation_request_hash, deleted_at, creator_kind, creator_id FROM sessions WHERE tenant_id = $1 AND deleted_at IS NULL AND ($2::text IS NULL OR configuration #>> '{agent,id}' = $2::text) - AND ($3::timestamptz IS NULL - OR (NOT $4::boolean AND (created_at, id) < ($3::timestamptz, $5::uuid)) - OR ($4::boolean AND (created_at, id) > ($3::timestamptz, $5::uuid))) + AND ($3::jsonb IS NULL OR metadata @> $3::jsonb) + AND ($4::timestamptz IS NULL + OR (NOT $5::boolean AND (created_at, id) < ($4::timestamptz, $6::uuid)) + OR ($5::boolean AND (created_at, id) > ($4::timestamptz, $6::uuid))) ORDER BY - CASE WHEN $4::boolean THEN created_at END ASC, - CASE WHEN $4::boolean THEN id END ASC, - CASE WHEN NOT $4::boolean THEN created_at END DESC, - CASE WHEN NOT $4::boolean THEN id END DESC -LIMIT $6 + CASE WHEN $5::boolean THEN created_at END ASC, + CASE WHEN $5::boolean THEN id END ASC, + CASE WHEN NOT $5::boolean THEN created_at END DESC, + CASE WHEN NOT $5::boolean THEN id END DESC +LIMIT $7 ` type ListSessionsParams struct { TenantID pgtype.UUID `json:"tenant_id"` AgentID pgtype.Text `json:"agent_id"` + Metadata []byte `json:"metadata"` AfterCreated pgtype.Timestamptz `json:"after_created"` Ascending bool `json:"ascending"` AfterID pgtype.UUID `json:"after_id"` @@ -179,6 +181,7 @@ func (q *Queries) ListSessions(ctx context.Context, arg ListSessionsParams) ([]S rows, err := q.db.Query(ctx, listSessions, arg.TenantID, arg.AgentID, + arg.Metadata, arg.AfterCreated, arg.Ascending, arg.AfterID, diff --git a/services/core/internal/db/sqlc/vault_credentials.sql.go b/services/core/internal/db/sqlc/vault_credentials.sql.go index f20245175..9d82e66c6 100644 --- a/services/core/internal/db/sqlc/vault_credentials.sql.go +++ b/services/core/internal/db/sqlc/vault_credentials.sql.go @@ -12,11 +12,11 @@ import ( ) const createStaticCredential = `-- name: CreateStaticCredential :one -INSERT INTO vault_credentials (id, vault_id, name, auth_type, mcp_server_url, token_ciphertext) -SELECT $1, v.id, $2, 'static_bearer', $3, $4 +INSERT INTO vault_credentials (id, vault_id, name, auth_type, mcp_server_url, token_ciphertext, metadata) +SELECT $1, v.id, $2, 'static_bearer', $3, $4, $5 FROM vaults v -WHERE v.tenant_id = $5 AND v.id = $6 -RETURNING id, vault_id, name, auth_type, mcp_server_url, created_at, updated_at, oauth_metadata +WHERE v.tenant_id = $6 AND v.id = $7 +RETURNING id, vault_id, name, auth_type, mcp_server_url, created_at, updated_at, oauth_metadata, metadata ` type CreateStaticCredentialParams struct { @@ -24,6 +24,7 @@ type CreateStaticCredentialParams struct { Name string `json:"name"` McpServerUrl string `json:"mcp_server_url"` TokenCiphertext []byte `json:"token_ciphertext"` + Metadata []byte `json:"metadata"` TenantID pgtype.UUID `json:"tenant_id"` VaultID pgtype.UUID `json:"vault_id"` } @@ -37,6 +38,7 @@ type CreateStaticCredentialRow struct { CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` } func (q *Queries) CreateStaticCredential(ctx context.Context, arg CreateStaticCredentialParams) (CreateStaticCredentialRow, error) { @@ -45,6 +47,7 @@ func (q *Queries) CreateStaticCredential(ctx context.Context, arg CreateStaticCr arg.Name, arg.McpServerUrl, arg.TokenCiphertext, + arg.Metadata, arg.TenantID, arg.VaultID, ) @@ -58,6 +61,7 @@ func (q *Queries) CreateStaticCredential(ctx context.Context, arg CreateStaticCr &i.CreatedAt, &i.UpdatedAt, &i.OauthMetadata, + &i.Metadata, ) return i, err } @@ -84,7 +88,7 @@ func (q *Queries) DeleteCredential(ctx context.Context, arg DeleteCredentialPara } const getCredential = `-- name: GetCredential :one -SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata +SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata FROM vault_credentials c JOIN vaults v ON v.id = c.vault_id WHERE v.tenant_id = $1 AND v.id = $2 AND c.id = $3 @@ -105,6 +109,7 @@ type GetCredentialRow struct { CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` } func (q *Queries) GetCredential(ctx context.Context, arg GetCredentialParams) (GetCredentialRow, error) { @@ -119,31 +124,34 @@ func (q *Queries) GetCredential(ctx context.Context, arg GetCredentialParams) (G &i.CreatedAt, &i.UpdatedAt, &i.OauthMetadata, + &i.Metadata, ) return i, err } const listCredentials = `-- name: ListCredentials :many -SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata +SELECT c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata FROM vault_credentials c JOIN vaults v ON v.id = c.vault_id WHERE v.tenant_id = $1 AND v.id = $2 AND c.status = ANY($3::text[]) - AND ($4::timestamptz IS NULL - OR (NOT $5::boolean AND (c.created_at, c.id) < ($4::timestamptz, $6::uuid)) - OR ($5::boolean AND (c.created_at, c.id) > ($4::timestamptz, $6::uuid))) + AND ($4::jsonb IS NULL OR c.metadata @> $4::jsonb) + AND ($5::timestamptz IS NULL + OR (NOT $6::boolean AND (c.created_at, c.id) < ($5::timestamptz, $7::uuid)) + OR ($6::boolean AND (c.created_at, c.id) > ($5::timestamptz, $7::uuid))) ORDER BY - CASE WHEN $5::boolean THEN c.created_at END ASC, - CASE WHEN $5::boolean THEN c.id END ASC, - CASE WHEN NOT $5::boolean THEN c.created_at END DESC, - CASE WHEN NOT $5::boolean THEN c.id END DESC -LIMIT $7 + CASE WHEN $6::boolean THEN c.created_at END ASC, + CASE WHEN $6::boolean THEN c.id END ASC, + CASE WHEN NOT $6::boolean THEN c.created_at END DESC, + CASE WHEN NOT $6::boolean THEN c.id END DESC +LIMIT $8 ` type ListCredentialsParams struct { TenantID pgtype.UUID `json:"tenant_id"` VaultID pgtype.UUID `json:"vault_id"` Statuses []string `json:"statuses"` + Metadata []byte `json:"metadata"` AfterCreated pgtype.Timestamptz `json:"after_created"` Ascending bool `json:"ascending"` AfterID pgtype.UUID `json:"after_id"` @@ -159,6 +167,7 @@ type ListCredentialsRow struct { CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` } func (q *Queries) ListCredentials(ctx context.Context, arg ListCredentialsParams) ([]ListCredentialsRow, error) { @@ -166,6 +175,7 @@ func (q *Queries) ListCredentials(ctx context.Context, arg ListCredentialsParams arg.TenantID, arg.VaultID, arg.Statuses, + arg.Metadata, arg.AfterCreated, arg.Ascending, arg.AfterID, @@ -187,6 +197,7 @@ func (q *Queries) ListCredentials(ctx context.Context, arg ListCredentialsParams &i.CreatedAt, &i.UpdatedAt, &i.OauthMetadata, + &i.Metadata, ); err != nil { return nil, err } @@ -198,18 +209,69 @@ func (q *Queries) ListCredentials(ctx context.Context, arg ListCredentialsParams return items, nil } -const updateStaticCredential = `-- name: UpdateStaticCredential :one +const updateCredentialMetadata = `-- name: UpdateCredentialMetadata :one UPDATE vault_credentials c -SET token_ciphertext = $1, updated_at = statement_timestamp() +SET metadata = $1, updated_at = statement_timestamp() FROM vaults v WHERE v.id = c.vault_id AND v.tenant_id = $2 AND v.id = $3 AND c.id = $4 - AND c.auth_type = 'static_bearer' AND c.mcp_server_url = $5 -RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata +RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata +` + +type UpdateCredentialMetadataParams struct { + Metadata []byte `json:"metadata"` + TenantID pgtype.UUID `json:"tenant_id"` + VaultID pgtype.UUID `json:"vault_id"` + ID pgtype.UUID `json:"id"` +} + +type UpdateCredentialMetadataRow struct { + ID pgtype.UUID `json:"id"` + VaultID pgtype.UUID `json:"vault_id"` + Name string `json:"name"` + AuthType string `json:"auth_type"` + McpServerUrl string `json:"mcp_server_url"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` + OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` +} + +func (q *Queries) UpdateCredentialMetadata(ctx context.Context, arg UpdateCredentialMetadataParams) (UpdateCredentialMetadataRow, error) { + row := q.db.QueryRow(ctx, updateCredentialMetadata, + arg.Metadata, + arg.TenantID, + arg.VaultID, + arg.ID, + ) + var i UpdateCredentialMetadataRow + err := row.Scan( + &i.ID, + &i.VaultID, + &i.Name, + &i.AuthType, + &i.McpServerUrl, + &i.CreatedAt, + &i.UpdatedAt, + &i.OauthMetadata, + &i.Metadata, + ) + return i, err +} + +const updateStaticCredential = `-- name: UpdateStaticCredential :one +UPDATE vault_credentials c +SET token_ciphertext = $1, metadata = COALESCE($2::jsonb, c.metadata), updated_at = statement_timestamp() +FROM vaults v +WHERE v.id = c.vault_id AND v.tenant_id = $3 + AND v.id = $4 AND c.id = $5 + AND c.auth_type = 'static_bearer' AND c.mcp_server_url = $6 +RETURNING c.id, c.vault_id, c.name, c.auth_type, c.mcp_server_url, c.created_at, c.updated_at, c.oauth_metadata, c.metadata ` type UpdateStaticCredentialParams struct { TokenCiphertext []byte `json:"token_ciphertext"` + Metadata []byte `json:"metadata"` TenantID pgtype.UUID `json:"tenant_id"` VaultID pgtype.UUID `json:"vault_id"` ID pgtype.UUID `json:"id"` @@ -225,11 +287,13 @@ type UpdateStaticCredentialRow struct { CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` OauthMetadata []byte `json:"oauth_metadata"` + Metadata []byte `json:"metadata"` } func (q *Queries) UpdateStaticCredential(ctx context.Context, arg UpdateStaticCredentialParams) (UpdateStaticCredentialRow, error) { row := q.db.QueryRow(ctx, updateStaticCredential, arg.TokenCiphertext, + arg.Metadata, arg.TenantID, arg.VaultID, arg.ID, @@ -245,6 +309,7 @@ func (q *Queries) UpdateStaticCredential(ctx context.Context, arg UpdateStaticCr &i.CreatedAt, &i.UpdatedAt, &i.OauthMetadata, + &i.Metadata, ) return i, err } diff --git a/services/core/internal/db/sqlc/vaults.sql.go b/services/core/internal/db/sqlc/vaults.sql.go index 8d83bfa9b..437c3a3e2 100644 --- a/services/core/internal/db/sqlc/vaults.sql.go +++ b/services/core/internal/db/sqlc/vaults.sql.go @@ -86,20 +86,22 @@ const listVaults = `-- name: ListVaults :many SELECT id, tenant_id, name, metadata, created_at, status FROM vaults WHERE tenant_id = $1 AND status = ANY($2::text[]) - AND ($3::timestamptz IS NULL - OR (NOT $4::boolean AND (created_at, id) < ($3::timestamptz, $5::uuid)) - OR ($4::boolean AND (created_at, id) > ($3::timestamptz, $5::uuid))) + AND ($3::jsonb IS NULL OR metadata @> $3::jsonb) + AND ($4::timestamptz IS NULL + OR (NOT $5::boolean AND (created_at, id) < ($4::timestamptz, $6::uuid)) + OR ($5::boolean AND (created_at, id) > ($4::timestamptz, $6::uuid))) ORDER BY - CASE WHEN $4::boolean THEN created_at END ASC, - CASE WHEN $4::boolean THEN id END ASC, - CASE WHEN NOT $4::boolean THEN created_at END DESC, - CASE WHEN NOT $4::boolean THEN id END DESC -LIMIT $6 + CASE WHEN $5::boolean THEN created_at END ASC, + CASE WHEN $5::boolean THEN id END ASC, + CASE WHEN NOT $5::boolean THEN created_at END DESC, + CASE WHEN NOT $5::boolean THEN id END DESC +LIMIT $7 ` type ListVaultsParams struct { TenantID pgtype.UUID `json:"tenant_id"` Statuses []string `json:"statuses"` + Metadata []byte `json:"metadata"` AfterCreated pgtype.Timestamptz `json:"after_created"` Ascending bool `json:"ascending"` AfterID pgtype.UUID `json:"after_id"` @@ -110,6 +112,7 @@ func (q *Queries) ListVaults(ctx context.Context, arg ListVaultsParams) ([]Vault rows, err := q.db.Query(ctx, listVaults, arg.TenantID, arg.Statuses, + arg.Metadata, arg.AfterCreated, arg.Ascending, arg.AfterID, @@ -139,3 +142,39 @@ func (q *Queries) ListVaults(ctx context.Context, arg ListVaultsParams) ([]Vault } return items, nil } + +const updateVault = `-- name: UpdateVault :one +UPDATE vaults +SET name = CASE WHEN $1::boolean THEN $2 ELSE name END, + metadata = COALESCE($3::jsonb, metadata) +WHERE tenant_id = $4 AND id = $5 +RETURNING id, tenant_id, name, metadata, created_at, status +` + +type UpdateVaultParams struct { + SetName bool `json:"set_name"` + Name pgtype.Text `json:"name"` + Metadata []byte `json:"metadata"` + TenantID pgtype.UUID `json:"tenant_id"` + ID pgtype.UUID `json:"id"` +} + +func (q *Queries) UpdateVault(ctx context.Context, arg UpdateVaultParams) (Vault, error) { + row := q.db.QueryRow(ctx, updateVault, + arg.SetName, + arg.Name, + arg.Metadata, + arg.TenantID, + arg.ID, + ) + var i Vault + err := row.Scan( + &i.ID, + &i.TenantID, + &i.Name, + &i.Metadata, + &i.CreatedAt, + &i.Status, + ) + return i, err +} diff --git a/services/core/internal/deployment/fakes_test.go b/services/core/internal/deployment/fakes_test.go index 9510e5d4a..f264a6158 100644 --- a/services/core/internal/deployment/fakes_test.go +++ b/services/core/internal/deployment/fakes_test.go @@ -596,7 +596,7 @@ func (f *fakeSessionReader) MeasuredSessionUsage(ctx context.Context, tenantID, return f.measuredSessionUsage(ctx, tenantID, sessionID) } -func (f *fakeSessionReader) ListSessions(context.Context, string, string, int, bool, *string) (sessions.Page, error) { +func (f *fakeSessionReader) ListSessions(context.Context, string, string, int, bool, *string, map[string]string) (sessions.Page, error) { unexpected(f.t, "ListSessions") return sessions.Page{}, nil } diff --git a/services/core/internal/execution/harness_admission.go b/services/core/internal/execution/harness_admission.go index 6065a82aa..64012acf1 100644 --- a/services/core/internal/execution/harness_admission.go +++ b/services/core/internal/execution/harness_admission.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/MiniMax-AI/OpenAgentCore/internal/runtimebootstrap" + v1 "github.com/MiniMax-AI/OpenAgentCore/contracts/agents-api/v1" "github.com/MiniMax-AI/OpenAgentCore/internal/agentdaemon/proto" "github.com/MiniMax-AI/OpenAgentCore/internal/harnessconfig" "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/sessions" @@ -49,6 +50,9 @@ func validateDeclaredConfiguration(declaration harnessconfig.Declaration, snapsh return admissionError(err) } } + if err := rejectUnsupportedAgentOptions(snapshot.Agent); err != nil { + return err + } tools, err := executionTools(snapshot.Agent.Tools) if err != nil { return err @@ -108,3 +112,32 @@ func validateDeclaredInputs(declaration harnessconfig.Declaration, inputs []sess } return nil } + +// rejectUnsupportedAgentOptions refuses the official settings no Harness has a native home for. +// A Harness gains one by declaring it together with its pass-through to the native side. +func rejectUnsupportedAgentOptions(agent v1.Agent) error { + var compaction struct { + Async bool `json:"async"` + } + var experimental struct { + TimeAwareness bool `json:"time_awareness"` + } + _ = json.Unmarshal(agent.Compaction, &compaction) + _ = json.Unmarshal(agent.Experimental, &experimental) + if compaction.Async { + return errors.New("compaction.async=true is not supported.") + } + if experimental.TimeAwareness { + return errors.New("experimental.time_awareness=true is not supported.") + } + for _, raw := range agent.Tools { + var tool struct { + Type string `json:"type"` + } + _ = json.Unmarshal(raw, &tool) + if tool.Type == "automations" || tool.Type == "computer_use" { + return fmt.Errorf("The %s tool is not supported.", tool.Type) + } + } + return nil +} diff --git a/services/core/internal/execution/harness_admission_test.go b/services/core/internal/execution/harness_admission_test.go index 64e65e5a1..a2100b415 100644 --- a/services/core/internal/execution/harness_admission_test.go +++ b/services/core/internal/execution/harness_admission_test.go @@ -158,3 +158,31 @@ func TestSelfHostedAdmissionRejectsNetworkPolicy(t *testing.T) { } } } + +// Saved settings no Harness runs natively are rejected at admission on every Harness. +func TestAgentOptionsWithoutNativeHomeAreRejected(t *testing.T) { + declaration := harnesstest.Declaration("fixture", nil) + agent := func(mutate func(*v1.Agent)) Snapshot { + a := v1.Agent{Model: "fixture", ServiceTier: "auto", Tools: []json.RawMessage{}} + mutate(&a) + return Snapshot{Agent: a, Environment: v1.Environment{Type: "none"}} + } + for name, mutate := range map[string]func(*v1.Agent){ + "compaction": func(a *v1.Agent) { a.Compaction = json.RawMessage(`{"async":true}`) }, + "time": func(a *v1.Agent) { a.Experimental = json.RawMessage(`{"time_awareness":true}`) }, + "automations": func(a *v1.Agent) { a.Tools = []json.RawMessage{json.RawMessage(`{"type":"automations"}`)} }, + "computer_use": func(a *v1.Agent) { a.Tools = []json.RawMessage{json.RawMessage(`{"type":"computer_use"}`)} }, + "ultrafast": func(a *v1.Agent) { a.ServiceTier = "ultrafast" }, + } { + if err := validateDeclaredConfiguration(declaration, agent(mutate)); err == nil { + t.Errorf("%s admitted without declared support", name) + } + } + // Blocking compaction and disabled time awareness are the native defaults. + ok := agent(func(a *v1.Agent) { + a.Compaction, a.Experimental = json.RawMessage(`{"async":false}`), json.RawMessage(`{"time_awareness":false}`) + }) + if err := validateDeclaredConfiguration(declaration, ok); err != nil { + t.Fatal(err) + } +} diff --git a/services/core/internal/persistence/postgres/sessionpg/item_reads.go b/services/core/internal/persistence/postgres/sessionpg/item_reads.go index 24abe280a..02dcedf19 100644 --- a/services/core/internal/persistence/postgres/sessionpg/item_reads.go +++ b/services/core/internal/persistence/postgres/sessionpg/item_reads.go @@ -15,17 +15,41 @@ import ( ) func (s *Store) ListItems(ctx context.Context, tenantID, sessionID, cursor string, limit int, ascending bool) (sessions.ItemPage, error) { + return s.listItems(ctx, tenantID, sessionID, "", cursor, limit, ascending) +} + +// ListTurnItems lists the Items of one root Turn with the Session Item cursor rules. +func (s *Store) ListTurnItems(ctx context.Context, tenantID, sessionID, turnID, cursor string, limit int, ascending bool) (sessions.ItemPage, error) { + return s.listItems(ctx, tenantID, sessionID, turnID, cursor, limit, ascending) +} + +// listItems lists the Items of the Session, or of one of its Turns when turnID is not empty. +func (s *Store) listItems(ctx context.Context, tenantID, sessionID, turnID, cursor string, limit int, ascending bool) (sessions.ItemPage, error) { if limit < 1 || limit > 100 { return sessions.ItemPage{}, sessions.ErrInvalidInput } page := sessions.ItemPage{Items: make([]v1.Item, 0, limit)} err := s.withPublicSession(ctx, tenantID, sessionID, func(ctx context.Context, q *sqlc.Queries, session pgtype.UUID) error { p := sqlc.ListSessionItemsParams{SessionID: session, PageLimit: int32(limit + 1), Ascending: ascending, AfterID: pgtype.UUID{Valid: true}} + if turnID != "" { + tenant, err := parseID(tenantID) + if err != nil { + return err + } + turn, err := q.GetTurn(ctx, sqlc.GetTurnParams{TenantID: tenant, SessionID: session, ID: pgunit.PathID(turnID)}) + if errors.Is(err, pgx.ErrNoRows) { + return sessions.ErrNotFound + } + if err != nil { + return err + } + p.TurnID = turn.ID + } if cursor != "" { // Any cursor that is not an Item of this Session, including a // malformed one, is an invalid cursor rather than a missing resource. row, err := q.GetSessionItem(ctx, sqlc.GetSessionItemParams{SessionID: session, ID: pgunit.PathID(cursor)}) - if errors.Is(err, pgx.ErrNoRows) { + if errors.Is(err, pgx.ErrNoRows) || (err == nil && p.TurnID.Valid && p.TurnID != row.TurnID) { return sessions.ErrItemCursor } if err != nil { diff --git a/services/core/internal/persistence/postgres/sessionpg/session_reads.go b/services/core/internal/persistence/postgres/sessionpg/session_reads.go index a3982164d..4d76792e0 100644 --- a/services/core/internal/persistence/postgres/sessionpg/session_reads.go +++ b/services/core/internal/persistence/postgres/sessionpg/session_reads.go @@ -23,7 +23,7 @@ func (s *Store) GetSession(ctx context.Context, tenantID, sessionID string) (ses return session, err } -func (s *Store) ListSessions(ctx context.Context, tenantID, cursor string, limit int, ascending bool, agentID *string) (sessions.Page, error) { +func (s *Store) ListSessions(ctx context.Context, tenantID, cursor string, limit int, ascending bool, agentID *string, metadata map[string]string) (sessions.Page, error) { tenant, err := parseID(tenantID) if err != nil { return sessions.Page{}, err @@ -35,6 +35,11 @@ func (s *Store) ListSessions(ctx context.Context, tenantID, cursor string, limit if agentID != nil { params.AgentID = pgtype.Text{String: *agentID, Valid: true} } + if len(metadata) > 0 { + if params.Metadata, err = json.Marshal(metadata); err != nil { + return sessions.Page{}, err + } + } var page sessions.Page err = s.units.Snapshot(ctx, func(ctx context.Context, tx pgx.Tx) error { q := sqlc.New(tx) diff --git a/services/core/internal/persistence/postgres/sessionpg/session_reads_test.go b/services/core/internal/persistence/postgres/sessionpg/session_reads_test.go index beddd9087..2637396be 100644 --- a/services/core/internal/persistence/postgres/sessionpg/session_reads_test.go +++ b/services/core/internal/persistence/postgres/sessionpg/session_reads_test.go @@ -24,11 +24,11 @@ func TestListSessionsPagesFromDeletedCursor(t *testing.T) { } exec(t, pool, `UPDATE sessions SET deleted_at = now() WHERE id = $1`, ids[1]) - page, err := store.ListSessions(t.Context(), tenant.String(), ids[1], 10, false, nil) + page, err := store.ListSessions(t.Context(), tenant.String(), ids[1], 10, false, nil, nil) if err != nil || len(page.Sessions) != 1 || page.Sessions[0].ID != ids[0] { t.Fatalf("deleted cursor: %+v %v", page, err) } - if _, err := store.ListSessions(t.Context(), uuid.NewString(), ids[1], 10, false, nil); !errors.Is(err, sessions.ErrNotFound) { + if _, err := store.ListSessions(t.Context(), uuid.NewString(), ids[1], 10, false, nil, nil); !errors.Is(err, sessions.ErrNotFound) { t.Fatalf("foreign tenant cursor: %v", err) } } diff --git a/services/core/internal/persistence/postgres/vaultpg/credentials.go b/services/core/internal/persistence/postgres/vaultpg/credentials.go index 852c0448e..5a64531a2 100644 --- a/services/core/internal/persistence/postgres/vaultpg/credentials.go +++ b/services/core/internal/persistence/postgres/vaultpg/credentials.go @@ -72,11 +72,11 @@ func insertCredential(ctx context.Context, q *sqlc.Queries, credential vaults.Ne switch credential.AuthType { case vaults.AuthStaticBearer: row, err := q.CreateStaticCredential(ctx, sqlc.CreateStaticCredentialParams{ID: id, TenantID: tenant, VaultID: vault, - Name: credential.Name, McpServerUrl: credential.MCPServerURL, TokenCiphertext: ciphertext}) + Name: credential.Name, McpServerUrl: credential.MCPServerURL, TokenCiphertext: ciphertext, Metadata: credential.Metadata}) return sqlc.GetCredentialRow(row), err case vaults.AuthMCPOAuth: row, err := q.CreateOAuthCredential(ctx, sqlc.CreateOAuthCredentialParams{ID: id, TenantID: tenant, VaultID: vault, - Name: credential.Name, McpServerUrl: credential.MCPServerURL, OauthMetadata: metadata, TokenCiphertext: ciphertext}) + Name: credential.Name, McpServerUrl: credential.MCPServerURL, OauthMetadata: metadata, TokenCiphertext: ciphertext, Metadata: credential.Metadata}) return sqlc.GetCredentialRow(row), err } return sqlc.GetCredentialRow{}, errors.New("unknown credential authentication type") @@ -125,6 +125,11 @@ func (s *Store) ListCredentials(ctx context.Context, tenantID, vaultID string, q return err } params := sqlc.ListCredentialsParams{TenantID: tenant, VaultID: vault, PageLimit: int32(query.Limit + 1), AfterID: pgtype.UUID{Valid: true}, Ascending: query.Ascending, Statuses: statuses} + if len(query.Metadata) > 0 { + if params.Metadata, err = json.Marshal(query.Metadata); err != nil { + return err + } + } if query.After != "" { // A cursor that cannot name a Credential of this Vault follows the // missing-cursor path. @@ -170,7 +175,7 @@ func (s *Store) ReplaceStaticToken(ctx context.Context, replacement vaults.Stati var updated vaults.Credential err = s.write(ctx, func(ctx context.Context, q *sqlc.Queries) error { row, err := q.UpdateStaticCredential(ctx, sqlc.UpdateStaticCredentialParams{ - TenantID: tenant, VaultID: vault, ID: id, McpServerUrl: replacement.MCPServerURL, TokenCiphertext: ciphertext, + TenantID: tenant, VaultID: vault, ID: id, McpServerUrl: replacement.MCPServerURL, TokenCiphertext: ciphertext, Metadata: replacement.Metadata, }) if err != nil { return err @@ -187,6 +192,25 @@ func (s *Store) ReplaceStaticToken(ctx context.Context, replacement vaults.Stati return updated, nil } +// ReplaceCredentialMetadata changes no secret, so the seal stays valid. +func (s *Store) ReplaceCredentialMetadata(ctx context.Context, key vaults.CredentialKey, metadata []byte) (vaults.Credential, error) { + var updated vaults.Credential + err := s.write(ctx, func(ctx context.Context, q *sqlc.Queries) error { + row, err := q.UpdateCredentialMetadata(ctx, sqlc.UpdateCredentialMetadataParams{TenantID: pgunit.PathID(key.TenantID), VaultID: pgunit.PathID(key.VaultID), ID: pgunit.PathID(key.CredentialID), Metadata: metadata}) + if err != nil { + return err + } + if updated, err = credentialFromRow(sqlc.GetCredentialRow(row)); err != nil { + return err + } + return auditpg.RecordWriteAudit(ctx, q, key.TenantID, writeaudit.ActionUpdate, writeaudit.ResourceCredential, updated.ID, updated.VaultID) + }) + if err != nil { + return vaults.Credential{}, err + } + return updated, nil +} + // DeleteCredential removes the sealed secret without reading it. func (s *Store) DeleteCredential(ctx context.Context, key vaults.CredentialKey) (string, error) { vault := pgunit.PathID(key.VaultID) @@ -211,6 +235,9 @@ func credentialFromRow(row sqlc.GetCredentialRow) (vaults.Credential, error) { Name: row.Name, AuthType: row.AuthType, MCPServerURL: row.McpServerUrl, CreatedAt: row.CreatedAt.Time, UpdatedAt: row.UpdatedAt.Time, } + if err := json.Unmarshal(row.Metadata, &credential.Metadata); err != nil { + return vaults.Credential{}, errors.New("invalid stored credential metadata") + } if row.AuthType == vaults.AuthMCPOAuth { credential.OAuth = &vaults.OAuthMetadata{} if err := json.Unmarshal(row.OauthMetadata, credential.OAuth); err != nil { diff --git a/services/core/internal/persistence/postgres/vaultpg/oauth.go b/services/core/internal/persistence/postgres/vaultpg/oauth.go index 4131ed111..d991c48e1 100644 --- a/services/core/internal/persistence/postgres/vaultpg/oauth.go +++ b/services/core/internal/persistence/postgres/vaultpg/oauth.go @@ -39,7 +39,7 @@ func (t *oauthTx) LoadOAuthGrant(ctx context.Context, destination string) (vault return vaults.OAuthGrant{}, translate(err) } credential, err := credentialFromRow(sqlc.GetCredentialRow{ID: row.ID, VaultID: row.VaultID, Name: row.Name, AuthType: row.AuthType, - McpServerUrl: row.McpServerUrl, CreatedAt: row.CreatedAt, UpdatedAt: row.UpdatedAt, OauthMetadata: row.OauthMetadata}) + McpServerUrl: row.McpServerUrl, CreatedAt: row.CreatedAt, UpdatedAt: row.UpdatedAt, OauthMetadata: row.OauthMetadata, Metadata: row.Metadata}) if err != nil { return vaults.OAuthGrant{}, err } @@ -55,12 +55,12 @@ func (t *oauthTx) LoadOAuthGrant(ctx context.Context, destination string) (vault } func (t *oauthTx) ApplyOAuthRefresh(ctx context.Context, grant vaults.OAuthGrant) error { - _, err := t.update(ctx, grant) + _, err := t.update(ctx, grant, nil) return err } -func (t *oauthTx) ApplyOAuthReplacement(ctx context.Context, grant vaults.OAuthGrant) (vaults.Credential, error) { - updated, err := t.update(ctx, grant) +func (t *oauthTx) ApplyOAuthReplacement(ctx context.Context, grant vaults.OAuthGrant, metadata []byte) (vaults.Credential, error) { + updated, err := t.update(ctx, grant, metadata) if err != nil { return vaults.Credential{}, err } @@ -72,7 +72,7 @@ func (t *oauthTx) ApplyOAuthReplacement(ctx context.Context, grant vaults.OAuthG // update seals the grant to the loaded Credential and matches the destination // it is sealed to. -func (t *oauthTx) update(ctx context.Context, grant vaults.OAuthGrant) (vaults.Credential, error) { +func (t *oauthTx) update(ctx context.Context, grant vaults.OAuthGrant, publicMetadata []byte) (vaults.Credential, error) { if t.loaded == nil { return vaults.Credential{}, errors.New("OAuth credential was not loaded") } @@ -81,7 +81,7 @@ func (t *oauthTx) update(ctx context.Context, grant vaults.OAuthGrant) (vaults.C return vaults.Credential{}, err } row, err := t.q.UpdateOAuthCredential(ctx, sqlc.UpdateOAuthCredentialParams{TenantID: t.tenant, VaultID: t.vault, ID: t.id, - McpServerUrl: t.loaded.MCPServerURL, OauthMetadata: metadata, TokenCiphertext: ciphertext}) + McpServerUrl: t.loaded.MCPServerURL, OauthMetadata: metadata, TokenCiphertext: ciphertext, Metadata: publicMetadata}) if err != nil { return vaults.Credential{}, translate(err) } diff --git a/services/core/internal/persistence/postgres/vaultpg/vaultpg.go b/services/core/internal/persistence/postgres/vaultpg/vaultpg.go index 51bf0e2b0..81ae89337 100644 --- a/services/core/internal/persistence/postgres/vaultpg/vaultpg.go +++ b/services/core/internal/persistence/postgres/vaultpg/vaultpg.go @@ -121,6 +121,11 @@ func (s *Store) ListVaults(ctx context.Context, tenantID string, query vaults.Pa var page vaults.VaultPage err = s.read(ctx, func(ctx context.Context, q *sqlc.Queries) error { params := sqlc.ListVaultsParams{TenantID: tenant, PageLimit: int32(query.Limit + 1), AfterID: pgtype.UUID{Valid: true}, Ascending: query.Ascending, Statuses: statuses} + if len(query.Metadata) > 0 { + if params.Metadata, err = json.Marshal(query.Metadata); err != nil { + return err + } + } if query.After != "" { // A cursor that cannot name a Vault follows the missing-cursor path. after, err := getVault(ctx, q, tenant, pgunit.PathID(query.After)) @@ -154,6 +159,29 @@ func (s *Store) ListVaults(ctx context.Context, tenantID string, query vaults.Pa return page, nil } +// UpdateVault is ErrNotFound for a Vault the tenant does not own. +func (s *Store) UpdateVault(ctx context.Context, update vaults.VaultUpdate) (vaults.Vault, error) { + var name pgtype.Text + if update.Name != nil { + name = pgtype.Text{String: *update.Name, Valid: true} + } + var updated vaults.Vault + err := s.write(ctx, func(ctx context.Context, q *sqlc.Queries) error { + row, err := q.UpdateVault(ctx, sqlc.UpdateVaultParams{TenantID: pgunit.PathID(update.TenantID), ID: pgunit.PathID(update.VaultID), SetName: update.NameSet, Name: name, Metadata: update.Metadata}) + if err != nil { + return err + } + if updated, err = vaultFromRow(row); err != nil { + return err + } + return auditpg.RecordWriteAudit(ctx, q, update.TenantID, writeaudit.ActionUpdate, writeaudit.ResourceVault, updated.ID, "") + }) + if err != nil { + return vaults.Vault{}, err + } + return updated, nil +} + // DeleteVault relies on the owning foreign key to remove every stored Credential. func (s *Store) DeleteVault(ctx context.Context, tenantID, vaultID string) (string, error) { var deleted string diff --git a/services/core/internal/vaults/credential.go b/services/core/internal/vaults/credential.go index 5a28ddfd9..586d55370 100644 --- a/services/core/internal/vaults/credential.go +++ b/services/core/internal/vaults/credential.go @@ -13,6 +13,7 @@ const ( type Credential struct { ID, VaultID, Name, AuthType, MCPServerURL string CreatedAt, UpdatedAt time.Time + Metadata map[string]string // OAuth is set for mcp_oauth Credentials only. OAuth *OAuthMetadata } diff --git a/services/core/internal/vaults/page.go b/services/core/internal/vaults/page.go index bd3cd0f70..af02cb8bb 100644 --- a/services/core/internal/vaults/page.go +++ b/services/core/internal/vaults/page.go @@ -18,6 +18,8 @@ type PageQuery struct { Ascending bool // Statuses filters by status; empty selects every status. Statuses []string + // Metadata keeps resources whose metadata holds every pair; empty keeps all. + Metadata map[string]string } // Validate checks the page size and statuses and returns the statuses to diff --git a/services/core/internal/vaults/service.go b/services/core/internal/vaults/service.go index 5c189e72d..256beaffa 100644 --- a/services/core/internal/vaults/service.go +++ b/services/core/internal/vaults/service.go @@ -55,6 +55,44 @@ func (s *Service) CreateVault(ctx context.Context, command CreateVault) (Vault, return s.storage.CreateVault(ctx, NewVault{TenantID: command.TenantID, Name: command.Name, Metadata: encoded}) } +// UpdateVault replaces the name when NameSet, which clears it for a nil Name, +// and the metadata unless it is nil. +type UpdateVault struct { + TenantID, VaultID string + Name *string + NameSet bool + Metadata map[string]string +} + +// UpdateVault applies the update to the Vault. +func (s *Service) UpdateVault(ctx context.Context, command UpdateVault) (Vault, error) { + tenant, ok1 := canonicalID(command.TenantID) + vault, ok2 := canonicalID(command.VaultID) + if !ok1 || !ok2 { + return Vault{}, ErrNotFound + } + if command.Name != nil && !validName(*command.Name) { + return Vault{}, fmt.Errorf("%w: vault name must contain 1–256 UTF-8 bytes", ErrInvalidInput) + } + encoded, err := encodeUpdate(command.Metadata) + if err != nil { + return Vault{}, err + } + return s.storage.UpdateVault(ctx, VaultUpdate{TenantID: tenant, VaultID: vault, Name: command.Name, NameSet: command.NameSet, Metadata: encoded}) +} + +// encodeUpdate encodes replacement metadata; nil keeps the stored metadata. +func encodeUpdate(values map[string]string) ([]byte, error) { + if values == nil { + return nil, nil + } + encoded, err := metadata.Encode(values) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrInvalidInput, err) + } + return encoded, nil +} + type DeleteVault struct{ TenantID, VaultID string } // DeleteVault deletes a Vault with its Credentials. Sessions keep their frozen @@ -66,6 +104,7 @@ func (s *Service) DeleteVault(ctx context.Context, command DeleteVault) (string, type CreateStaticCredential struct { TenantID, VaultID string Name, MCPServerURL, Token string + Metadata map[string]string } // CreateStaticCredential stores a bearer token under a new Credential ID. @@ -81,16 +120,22 @@ func (s *Service) CreateStaticCredential(ctx context.Context, command CreateStat // Storage reports a missing credential key before a malformed or missing // Vault. key := CredentialKey{TenantID: tenant, VaultID: command.VaultID, CredentialID: uuid.NewString()} + encoded, err := metadata.Encode(command.Metadata) + if err != nil { + return Credential{}, fmt.Errorf("%w: %w", ErrInvalidInput, err) + } return s.storage.CreateCredential(ctx, NewCredential{CredentialKey: key, Name: command.Name, - AuthType: AuthStaticBearer, MCPServerURL: command.MCPServerURL, Token: command.Token}) + AuthType: AuthStaticBearer, MCPServerURL: command.MCPServerURL, Token: command.Token, Metadata: encoded}) } type UpdateStaticCredential struct { TenantID, VaultID, CredentialID string Token string + // Metadata replaces the stored metadata unless it is nil. + Metadata map[string]string } -// UpdateStaticCredential replaces only the token and the update time. The +// UpdateStaticCredential replaces only the token, the metadata and the update time. The // stored destination is the seal's scope, which the write checks again, so // the existing frozen bindings read the replacement. func (s *Service) UpdateStaticCredential(ctx context.Context, command UpdateStaticCredential) (Credential, error) { @@ -105,7 +150,29 @@ func (s *Service) UpdateStaticCredential(ctx context.Context, command UpdateStat if current.AuthType != AuthStaticBearer { return Credential{}, ErrInvalidInput } - return s.storage.ReplaceStaticToken(ctx, StaticTokenReplacement{CredentialKey: key, MCPServerURL: current.MCPServerURL, Token: command.Token}) + encoded, err := encodeUpdate(command.Metadata) + if err != nil { + return Credential{}, err + } + return s.storage.ReplaceStaticToken(ctx, StaticTokenReplacement{CredentialKey: key, MCPServerURL: current.MCPServerURL, Token: command.Token, Metadata: encoded}) +} + +// UpdateCredentialMetadata replaces only a Credential's metadata, whatever its authentication type. +type UpdateCredentialMetadata struct { + TenantID, VaultID, CredentialID string + Metadata map[string]string +} + +func (s *Service) UpdateCredentialMetadata(ctx context.Context, command UpdateCredentialMetadata) (Credential, error) { + key, ok := credentialKey(command.TenantID, command.VaultID, command.CredentialID) + if !ok { + return Credential{}, ErrNotFound + } + encoded, err := metadata.Encode(command.Metadata) + if err != nil { + return Credential{}, fmt.Errorf("%w: %w", ErrInvalidInput, err) + } + return s.storage.ReplaceCredentialMetadata(ctx, key, encoded) } // CreateOAuthCredential keeps the write-only secrets apart from the metadata. @@ -114,6 +181,7 @@ type CreateOAuthCredential struct { Name, MCPServerURL, AccessToken string OAuth OAuthMetadata RefreshToken, ClientSecret string + Metadata map[string]string } // CreateOAuthCredential stores a grant, with the metadata it is refreshed by, @@ -130,18 +198,24 @@ func (s *Service) CreateOAuthCredential(ctx context.Context, command CreateOAuth // Storage reports a missing credential key before a malformed or missing // Vault. key := CredentialKey{TenantID: tenant, VaultID: command.VaultID, CredentialID: uuid.NewString()} - return s.storage.CreateCredential(ctx, NewCredential{CredentialKey: key, Name: command.Name, AuthType: AuthMCPOAuth, MCPServerURL: command.MCPServerURL, + encoded, err := metadata.Encode(command.Metadata) + if err != nil { + return Credential{}, fmt.Errorf("%w: %w", ErrInvalidInput, err) + } + return s.storage.CreateCredential(ctx, NewCredential{CredentialKey: key, Name: command.Name, AuthType: AuthMCPOAuth, MCPServerURL: command.MCPServerURL, Metadata: encoded, OAuth: OAuthGrant{Metadata: command.OAuth, AccessToken: command.AccessToken, RefreshToken: command.RefreshToken, ClientSecret: command.ClientSecret}}) } // UpdateOAuthCredential patches an OAuth grant. ExpiresAtSet keeps omitted -// apart from null; a nil AccessToken keeps the stored one. +// apart from null; a nil AccessToken keeps the stored one, and nil Metadata +// keeps the stored metadata. type UpdateOAuthCredential struct { TenantID, VaultID, CredentialID string AccessToken *string ExpiresAt *string ExpiresAtSet bool Refresh *OAuthRefreshUpdate + Metadata map[string]string } // UpdateOAuthCredential applies the patch to the locked grant, so it @@ -158,6 +232,10 @@ func (s *Service) UpdateOAuthCredential(ctx context.Context, command UpdateOAuth if current.AuthType != AuthMCPOAuth { return Credential{}, ErrInvalidInput } + encoded, err := encodeUpdate(command.Metadata) + if err != nil { + return Credential{}, err + } var updated Credential err = s.withOAuth(ctx, key, "", "credential update failed", func(tx OAuthTx, grant OAuthGrant) error { grant, err := applyOAuthUpdate(grant, command) @@ -167,7 +245,7 @@ func (s *Service) UpdateOAuthCredential(ctx context.Context, command UpdateOAuth if !validOAuthMetadata(grant.Metadata) { return ErrInvalidInput } - updated, err = tx.ApplyOAuthReplacement(ctx, grant) + updated, err = tx.ApplyOAuthReplacement(ctx, grant, encoded) return err }) if err != nil { diff --git a/services/core/internal/vaults/service_test.go b/services/core/internal/vaults/service_test.go index 28f5d952f..be6962e4d 100644 --- a/services/core/internal/vaults/service_test.go +++ b/services/core/internal/vaults/service_test.go @@ -21,9 +21,11 @@ type fakeStorage struct { getCredential func(context.Context, string, string, string) (Credential, error) listCredentials func(context.Context, string, string, PageQuery) (CredentialPage, error) createVault func(context.Context, NewVault) (Vault, error) + updateVault func(context.Context, VaultUpdate) (Vault, error) deleteVault func(context.Context, string, string) (string, error) createCredential func(context.Context, NewCredential) (Credential, error) replaceStaticToken func(context.Context, StaticTokenReplacement) (Credential, error) + replaceMetadata func(context.Context, CredentialKey, []byte) (Credential, error) deleteCredential func(context.Context, CredentialKey) (string, error) withOAuthCredential func(context.Context, CredentialKey, func(OAuthTx) error) error countOwnedVaults func(context.Context, string, []string) (int, error) @@ -71,6 +73,20 @@ func (f *fakeStorage) CreateVault(ctx context.Context, vault NewVault) (Vault, e return f.createVault(ctx, vault) } +func (f *fakeStorage) UpdateVault(ctx context.Context, update VaultUpdate) (Vault, error) { + if f.updateVault == nil { + f.unexpected("UpdateVault") + } + return f.updateVault(ctx, update) +} + +func (f *fakeStorage) ReplaceCredentialMetadata(ctx context.Context, key CredentialKey, metadata []byte) (Credential, error) { + if f.replaceMetadata == nil { + f.unexpected("ReplaceCredentialMetadata") + } + return f.replaceMetadata(ctx, key, metadata) +} + func (f *fakeStorage) DeleteVault(ctx context.Context, tenantID, vaultID string) (string, error) { if f.deleteVault == nil { f.unexpected("DeleteVault") @@ -149,7 +165,7 @@ func (f *fakeOAuthTx) ApplyOAuthRefresh(ctx context.Context, grant OAuthGrant) e return f.refresh(ctx, grant) } -func (f *fakeOAuthTx) ApplyOAuthReplacement(ctx context.Context, grant OAuthGrant) (Credential, error) { +func (f *fakeOAuthTx) ApplyOAuthReplacement(ctx context.Context, grant OAuthGrant, _ []byte) (Credential, error) { if f.replacement == nil { f.t.Fatal("unexpected call to ApplyOAuthReplacement") } @@ -253,7 +269,7 @@ func TestCreateCredentialsPassPlaintextUnderANewID(t *testing.T) { stored = append(stored, credential) return Credential{ID: credential.CredentialID}, nil }}, unexpectedRefresh(t)) - created, err := service.CreateStaticCredential(t.Context(), CreateStaticCredential{TenantID: strings.ToUpper(tenant.String()), VaultID: vault.String(), Name: "static", MCPServerURL: url, Token: "private-token"}) + created, err := service.CreateStaticCredential(t.Context(), CreateStaticCredential{TenantID: strings.ToUpper(tenant.String()), VaultID: vault.String(), Name: "static", MCPServerURL: url, Token: "private-token", Metadata: map[string]string{"owner": "ops"}}) if err != nil || created.ID != stored[0].CredentialID { t.Fatal(err) } @@ -263,8 +279,8 @@ func TestCreateCredentialsPassPlaintextUnderANewID(t *testing.T) { t.Fatal(err) } want := []NewCredential{ - {CredentialKey: CredentialKey{tenant.String(), vault.String(), stored[0].CredentialID}, Name: "static", AuthType: AuthStaticBearer, MCPServerURL: url, Token: "private-token"}, - {CredentialKey: CredentialKey{tenant.String(), vault.String(), stored[1].CredentialID}, Name: "oauth", AuthType: AuthMCPOAuth, MCPServerURL: url, + {CredentialKey: CredentialKey{tenant.String(), vault.String(), stored[0].CredentialID}, Name: "static", AuthType: AuthStaticBearer, MCPServerURL: url, Token: "private-token", Metadata: []byte(`{"owner":"ops"}`)}, + {CredentialKey: CredentialKey{tenant.String(), vault.String(), stored[1].CredentialID}, Name: "oauth", AuthType: AuthMCPOAuth, MCPServerURL: url, Metadata: []byte("{}"), OAuth: OAuthGrant{Metadata: metadata, AccessToken: "access", RefreshToken: "refresh", ClientSecret: "client-secret"}}, } if !reflect.DeepEqual(stored, want) || stored[0].CredentialID == stored[1].CredentialID { @@ -294,7 +310,7 @@ func TestUpdateStaticCredential(t *testing.T) { t.Fatal("an OAuth Credential took a static token", err) } service := testService(t, &fakeStorage{getCredential: current(AuthStaticBearer), replaceStaticToken: func(_ context.Context, replacement StaticTokenReplacement) (Credential, error) { - if replacement != (StaticTokenReplacement{CredentialKey: CredentialKey{tenant, vault, id}, MCPServerURL: url, Token: "replacement"}) { + if replacement.CredentialKey != (CredentialKey{tenant, vault, id}) || replacement.MCPServerURL != url || replacement.Token != "replacement" || replacement.Metadata != nil { t.Fatalf("unexpected replacement %+v", replacement) } return Credential{}, errStorage diff --git a/services/core/internal/vaults/storage.go b/services/core/internal/vaults/storage.go index eae8030d8..e13eac882 100644 --- a/services/core/internal/vaults/storage.go +++ b/services/core/internal/vaults/storage.go @@ -24,6 +24,8 @@ type Storage interface { // CreateVault stores a new Vault and allocates its ID. CreateVault(ctx context.Context, vault NewVault) (Vault, error) + // UpdateVault replaces the Vault's name and metadata the update sets. + UpdateVault(ctx context.Context, update VaultUpdate) (Vault, error) // DeleteVault deletes a Vault with all of its Credentials and returns its ID. DeleteVault(ctx context.Context, tenantID, vaultID string) (string, error) // CreateCredential seals the Credential's secret and stores it in a Vault @@ -32,6 +34,8 @@ type Storage interface { // ReplaceStaticToken seals and replaces a static_bearer Credential's // token. ReplaceStaticToken(ctx context.Context, replacement StaticTokenReplacement) (Credential, error) + // ReplaceCredentialMetadata replaces a Credential's metadata only. + ReplaceCredentialMetadata(ctx context.Context, key CredentialKey, metadata []byte) (Credential, error) // DeleteCredential deletes a Credential and its sealed secret and returns its ID. DeleteCredential(ctx context.Context, key CredentialKey) (string, error) @@ -63,8 +67,8 @@ type OAuthTx interface { // audit row. ApplyOAuthRefresh(ctx context.Context, grant OAuthGrant) error // ApplyOAuthReplacement seals and stores a caller's replacement for the - // loaded Credential and audits it. - ApplyOAuthReplacement(ctx context.Context, grant OAuthGrant) (Credential, error) + // loaded Credential, with new metadata unless it is nil, and audits it. + ApplyOAuthReplacement(ctx context.Context, grant OAuthGrant, metadata []byte) (Credential, error) } // CredentialKey names one Credential of one Vault of one tenant. @@ -79,22 +83,35 @@ type NewVault struct { Metadata []byte } +// VaultUpdate replaces the name when NameSet, which clears it for a nil Name, +// and the encoded metadata unless it is nil. +type VaultUpdate struct { + TenantID, VaultID string + Name *string + NameSet bool + Metadata []byte +} + // NewCredential is a Credential with its new ID, ready to store. Storage // seals its secret to the tenant, the Vault, that ID, the authentication type -// and the destination: Token for static_bearer, OAuth for mcp_oauth. +// and the destination: Token for static_bearer, OAuth for mcp_oauth. Metadata +// is its encoded JSON object. type NewCredential struct { CredentialKey Name, AuthType, MCPServerURL string + Metadata []byte Token string OAuth OAuthGrant } -// StaticTokenReplacement is a new static_bearer token. The write matches the -// destination the token is sealed to. +// StaticTokenReplacement is a new static_bearer token, with new encoded +// metadata unless it is nil. The write matches the destination the token is +// sealed to. type StaticTokenReplacement struct { CredentialKey MCPServerURL string Token string + Metadata []byte } // MCPCredentialQuery selects a named Credential by ID alone, so its diff --git a/services/core/migrations/000011_credential_metadata.sql b/services/core/migrations/000011_credential_metadata.sql new file mode 100644 index 000000000..7b4ab1c81 --- /dev/null +++ b/services/core/migrations/000011_credential_metadata.sql @@ -0,0 +1,4 @@ +-- +goose Up +ALTER TABLE vault_credentials + ADD COLUMN metadata jsonb NOT NULL DEFAULT '{}'::jsonb, + ADD CONSTRAINT vault_credentials_metadata_check CHECK (jsonb_typeof(metadata) = 'object'); diff --git a/services/core/tests/integration/configuration_validation_public_test.go b/services/core/tests/integration/configuration_validation_public_test.go index 4847f3af8..897d703d1 100644 --- a/services/core/tests/integration/configuration_validation_public_test.go +++ b/services/core/tests/integration/configuration_validation_public_test.go @@ -33,7 +33,7 @@ func TestAgentConfigurationValidationRejectsWithoutWritesPostgres(t *testing.T) agent := client.created(owner, "/v1/agents", `{"model":"config-model","tools":[`+lookup+`]}`) before := databaseDigest(t, pool) - const tools = `'function', 'tool_search', 'programmatic_tool_calling', 'mcp', and 'web_search'.` + const tools = `'function', 'tool_search', 'programmatic_tool_calling', 'mcp', 'web_search', 'computer_use', and 'automations'.` cases := []struct{ name, fields, param, message string }{ {"F01", `"tools":[{"type":"function","name":"lookup","description":"Look up a value.","parameters":{"type":"string"}}]`, "", `Invalid schema for function 'lookup': schema must be a JSON Schema of 'type: "object"', got 'type: "string"'.`}, {"F02", `"tools":[{"type":"function","name":"lookup","description":"Look up a value.","parameters":[]}]`, "{p}tools[0].parameters", "Invalid type for '{p}tools[0].parameters': expected an object with string keys and unknown value values, but got an array instead."}, @@ -57,7 +57,7 @@ func TestAgentConfigurationValidationRejectsWithoutWritesPostgres(t *testing.T) {"T04", `"text":{"format":{"type":"json_schema","schema":{"type":"array","items":{"type":"string"}}}}`, "", `agent.text.format.schema must have top-level type "object"; got "array"`}, {"R01", `"reasoning":{"effort":"extreme"}`, "{p}reasoning.effort", "Invalid value: 'extreme'. Supported values are: 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', and 'max'."}, {"R02", `"reasoning":{"summary":"verbose"}`, "{p}reasoning.summary", "Invalid value: 'verbose'. Supported values are: 'concise', 'detailed', and 'auto'."}, - {"S01", `"service_tier":"turbo"`, "{p}service_tier", "Invalid value: 'turbo'. Supported values are: 'auto', 'default', 'flex', 'priority', and 'fast'."}, + {"S01", `"service_tier":"turbo"`, "{p}service_tier", "Invalid value: 'turbo'. Supported values are: 'auto', 'default', 'flex', 'priority', 'fast', and 'ultrafast'."}, {"X01", `"tool_choice":"auto"`, "{p}tool_choice", "Unknown parameter: '{p}tool_choice'."}, {"M01", `"multi_agent":{}`, "{p}multi_agent.enabled", "Missing required parameter: '{p}multi_agent.enabled'."}, {"M02", `"multi_agent":{"enabled":true,"max_concurrent_subagents":0}`, "{p}multi_agent.max_concurrent_subagents", "Invalid '{p}multi_agent.max_concurrent_subagents': integer below minimum value. Expected a value >= 1, but got 0 instead."}, diff --git a/services/core/tests/integration/environment_input_activity_test.go b/services/core/tests/integration/environment_input_activity_test.go index 7f83ee2b1..aeae2f4be 100644 --- a/services/core/tests/integration/environment_input_activity_test.go +++ b/services/core/tests/integration/environment_input_activity_test.go @@ -26,7 +26,7 @@ func requireEnvironmentInputActivity(t *testing.T, s *Store, tenant, session, st } else if activity == nil || activity.Status != status || activity.EnvironmentID != environment || activity.LastActiveAt.IsZero() { t.Fatal("input activity", activity, status, environment) } - page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 100, false, nil) + page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 100, false, nil, nil) if err != nil || len(page.Sessions) != 1 || !reflect.DeepEqual(page.Sessions[0].EnvironmentInputActivity, activity) { t.Fatal("list and retrieve activity differ", err) } diff --git a/services/core/tests/integration/executor_principals_test.go b/services/core/tests/integration/executor_principals_test.go index eadc5ad1e..d4c64a6d0 100644 --- a/services/core/tests/integration/executor_principals_test.go +++ b/services/core/tests/integration/executor_principals_test.go @@ -19,7 +19,7 @@ func TestExecutorPrincipalBeforeSessionAndSharedLifecycle(t *testing.T) { if err != nil || issued.KeyID != keyID || issued.EnvironmentID != "" || len(issued.Token) != 43 { t.Fatal("pre-Session principal issuance failed", err) } - page, err := sessionAdapter(s).ListSessions(ctx, p.TenantID, "", 10, false, nil) + page, err := sessionAdapter(s).ListSessions(ctx, p.TenantID, "", 10, false, nil, nil) if err != nil || len(page.Sessions) != 0 { t.Fatal("issuance created a Session", err) } diff --git a/services/core/tests/integration/function_state_test.go b/services/core/tests/integration/function_state_test.go index ad7aa2383..799c2807e 100644 --- a/services/core/tests/integration/function_state_test.go +++ b/services/core/tests/integration/function_state_test.go @@ -176,7 +176,7 @@ func assertFunctionState(t *testing.T, s *Store, tenant, sessionID, status strin if err != nil || current.LastTurn == nil || current.LastTurn.Status != status || len(current.RequiredActions) != count { t.Fatalf("state: %+v; %v", current, err) } - page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 10, true, nil) + page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 10, true, nil, nil) if err != nil || len(page.Sessions) != 1 || len(page.Sessions[0].RequiredActions) != count || page.Sessions[0].LastTurn.Status != status { t.Fatal("list differs from retrieve", page, err) } diff --git a/services/core/tests/integration/hosted_initialization_failure_public_test.go b/services/core/tests/integration/hosted_initialization_failure_public_test.go index 06956d80d..a12e5b417 100644 --- a/services/core/tests/integration/hosted_initialization_failure_public_test.go +++ b/services/core/tests/integration/hosted_initialization_failure_public_test.go @@ -182,7 +182,7 @@ func TestHostedInitializationFailureRecordsSafeSessionFailure(t *testing.T) { if err != nil || read.Environment.Status != "failed" || read.EnvironmentFailure == nil || read.EnvironmentFailure.Reason != test.reason || read.EnvironmentInputActivity != nil || read.LastTurn != nil { t.Fatal("Session read", read.EnvironmentFailure, err) } - page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 10, false, nil) + page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 10, false, nil, nil) if err != nil || len(page.Sessions) != 1 || !reflect.DeepEqual(page.Sessions[0].EnvironmentFailure, read.EnvironmentFailure) { t.Fatal("Session list", page, err) } @@ -223,7 +223,7 @@ func TestHostedInitializationFailureRecordsSafeSessionFailure(t *testing.T) { if _, err := sessionAdapter(s).ListSessionEvents(t.Context(), other, session.ID, 0); !errors.Is(err, sessions.ErrNotFound) { t.Fatal("foreign Session events", err) } - if page, err := sessionAdapter(s).ListSessions(t.Context(), other, "", 10, false, nil); err != nil || len(page.Sessions) != 0 { + if page, err := sessionAdapter(s).ListSessions(t.Context(), other, "", 10, false, nil, nil); err != nil || len(page.Sessions) != 0 { t.Fatal("foreign Session list", page, err) } }) diff --git a/services/core/tests/integration/session_agent_filter_test.go b/services/core/tests/integration/session_agent_filter_test.go index 4679836d2..ff471df8b 100644 --- a/services/core/tests/integration/session_agent_filter_test.go +++ b/services/core/tests/integration/session_agent_filter_test.go @@ -45,7 +45,7 @@ func TestSessionAgentFilterPaginationAndIsolation(t *testing.T) { var got []string cursor := "" for { - page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, cursor, 2, ascending, &root) + page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, cursor, 2, ascending, &root, nil) if err != nil { t.Fatal(err) } @@ -75,20 +75,20 @@ func TestSessionAgentFilterPaginationAndIsolation(t *testing.T) { if got := read(s, false); !slices.Equal(got, reverse) { t.Fatal(got, reverse) } - unfiltered, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 100, false, nil) + unfiltered, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 100, false, nil, nil) if err != nil || len(unfiltered.Sessions) != 9 { t.Fatal(unfiltered, err) } for _, id := range []string{"", "unknown", root + " ", "' OR true --"} { - page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 100, false, &id) + page, err := sessionAdapter(s).ListSessions(t.Context(), tenant, "", 100, false, &id, nil) if err != nil || page.Sessions == nil || len(page.Sessions) != 0 || page.NextCursor != "" { t.Fatal(page, err) } } - if _, err := sessionAdapter(s).ListSessions(t.Context(), tenant, other.ID, 2, true, &root); !errors.Is(err, sessions.ErrNotFound) { + if _, err := sessionAdapter(s).ListSessions(t.Context(), tenant, other.ID, 2, true, &root, nil); !errors.Is(err, sessions.ErrNotFound) { t.Fatal("foreign cursor", err) } - page, err := sessionAdapter(s).ListSessions(t.Context(), foreign, "", 100, false, &root) + page, err := sessionAdapter(s).ListSessions(t.Context(), foreign, "", 100, false, &root, nil) if err != nil || len(page.Sessions) != 1 || page.Sessions[0].ID != other.ID { t.Fatal(page, err) } diff --git a/services/core/tests/integration/session_configuration_test.go b/services/core/tests/integration/session_configuration_test.go index 04f4ed07e..8a1206213 100644 --- a/services/core/tests/integration/session_configuration_test.go +++ b/services/core/tests/integration/session_configuration_test.go @@ -26,7 +26,7 @@ func TestConfigurationSizeLimitSurvivesJSONBRoundTrip(t *testing.T) { if err != nil || string(got.Configuration) != string(first.Configuration) { t.Fatalf("configuration failed round trip: %v", err) } - page, err := sessionAdapter(s).ListSessions(ctx, tenant, "", 10, false, nil) + page, err := sessionAdapter(s).ListSessions(ctx, tenant, "", 10, false, nil, nil) if err != nil || len(page.Sessions) != 1 || page.Sessions[0].ID != first.ID { t.Fatalf("configuration broke listing: %v", err) } diff --git a/services/core/tests/integration/sessions_test.go b/services/core/tests/integration/sessions_test.go index d222712f4..aa3ea3bdf 100644 --- a/services/core/tests/integration/sessions_test.go +++ b/services/core/tests/integration/sessions_test.go @@ -73,7 +73,7 @@ func TestSessionsPersistAndStayTenantScoped(t *testing.T) { if _, err := sessionAdapter(s).GetSession(ctx, tenantB, first.ID); !errors.Is(err, sessions.ErrNotFound) { t.Fatalf("cross-tenant read: %v", err) } - if _, err := sessionAdapter(s).ListSessions(ctx, tenantB, first.ID, 10, false, nil); !errors.Is(err, sessions.ErrNotFound) { + if _, err := sessionAdapter(s).ListSessions(ctx, tenantB, first.ID, 10, false, nil, nil); !errors.Is(err, sessions.ErrNotFound) { t.Fatalf("cross-tenant cursor: %v", err) } for _, key := range []string{"second", "third"} { @@ -92,7 +92,7 @@ func TestSessionsPersistAndStayTenantScoped(t *testing.T) { seen := map[string]bool{} cursor := "" for { - page, err := sessionAdapter(recovered).ListSessions(ctx, tenantA, cursor, 2, false, nil) + page, err := sessionAdapter(recovered).ListSessions(ctx, tenantA, cursor, 2, false, nil, nil) if err != nil { t.Fatal(err) } @@ -113,7 +113,7 @@ func TestSessionsPersistAndStayTenantScoped(t *testing.T) { if len(seen) != 3 || !seen[first.ID] || seen[other.ID] { t.Fatalf("pagination lost or leaked sessions: %+v", seen) } - empty, err := sessionAdapter(recovered).ListSessions(ctx, uuid.NewString(), "", 10, false, nil) + empty, err := sessionAdapter(recovered).ListSessions(ctx, uuid.NewString(), "", 10, false, nil, nil) if err != nil || empty.Sessions == nil || len(empty.Sessions) != 0 { t.Fatalf("empty tenant = %+v, %v", empty, err) } @@ -164,7 +164,7 @@ func TestConcurrentSessionCreationIsIdempotent(t *testing.T) { t.Fatalf("changed request = %v", err) } } - page, err := sessionAdapter(s).ListSessions(ctx, tenant, "", 10, false, nil) + page, err := sessionAdapter(s).ListSessions(ctx, tenant, "", 10, false, nil, nil) if err != nil || len(page.Sessions) != 1 || !reflect.DeepEqual(page.Sessions[0], replay) { t.Fatalf("retry changed stored session: %+v, %v", page, err) } diff --git a/services/core/tests/integration/template_composition_public_test.go b/services/core/tests/integration/template_composition_public_test.go index 775744128..7ea86f959 100644 --- a/services/core/tests/integration/template_composition_public_test.go +++ b/services/core/tests/integration/template_composition_public_test.go @@ -64,7 +64,7 @@ func TestTemplateCompositionOfficialClientPostgres(t *testing.T) { if err := json.Unmarshal(output, &receipt); err != nil { t.Fatalf("invalid acceptance receipt: %v %s", err, output) } - if len(receipt.Sessions) != 6 || len(receipt.RejectedKeys) != 10 { + if len(receipt.Sessions) != 6 || len(receipt.RejectedKeys) != 8 { t.Fatalf("incomplete acceptance receipt: %s", output) } t.Cleanup(func() { diff --git a/services/core/tests/integration/token_usage_integration_test.go b/services/core/tests/integration/token_usage_integration_test.go index a43ad2dfa..79f69803c 100644 --- a/services/core/tests/integration/token_usage_integration_test.go +++ b/services/core/tests/integration/token_usage_integration_test.go @@ -95,7 +95,7 @@ func TestTokenUsageDurableSnapshotsAndSessionTotals(t *testing.T) { if total.InputTokens != 40 || total.OutputTokens != 6 || total.TotalTokens != 46 || total.InputTokensDetails.CachedTokens != 8 || total.OutputTokensDetails.ReasoningTokens != 4 { t.Fatalf("double counted totals: %+v", total) } - page, err := sessionAdapter(fresh).ListSessions(ctx, tenant, "", 100, true, nil) + page, err := sessionAdapter(fresh).ListSessions(ctx, tenant, "", 100, true, nil, nil) if err != nil || len(page.Sessions) != 1 || string(page.Sessions[0].Usage) != string(got.Usage) { t.Fatalf("list totals: %+v %v", page, err) } @@ -170,7 +170,7 @@ func TestSessionUsageRequiresEveryRootTurnEndedAndMeasured(t *testing.T) { if err != nil { t.Fatal(err) } - page, err := sessionAdapter(s).ListSessions(ctx, tenant, "", 100, true, nil) + page, err := sessionAdapter(s).ListSessions(ctx, tenant, "", 100, true, nil, nil) if err != nil || len(page.Sessions) != 1 || string(page.Sessions[0].Usage) != string(got.Usage) { t.Fatalf("list usage: %+v %v", page, err) } diff --git a/services/core/tests/integration/tool_policy_native_test.go b/services/core/tests/integration/tool_policy_native_test.go index 8f5030ca3..9c6f7f7e2 100644 --- a/services/core/tests/integration/tool_policy_native_test.go +++ b/services/core/tests/integration/tool_policy_native_test.go @@ -76,11 +76,11 @@ func TestNativeToolPolicyPublicExecution(t *testing.T) { if err != nil || json.Unmarshal(raw, &proof) != nil || len(proof.Sessions) != 4 { t.Fatal("invalid public evidence", err) } - page, err := sessionAdapter(h.s).ListSessions(ctx, h.tenant, "", 100, true, nil) + page, err := sessionAdapter(h.s).ListSessions(ctx, h.tenant, "", 100, true, nil, nil) if err != nil || len(page.Sessions) != 1+len(proof.Sessions) { t.Fatal("rejected configuration persisted a Session", err) } - foreignPage, err := sessionAdapter(h.s).ListSessions(ctx, foreignTenant, "", 100, true, nil) + foreignPage, err := sessionAdapter(h.s).ListSessions(ctx, foreignTenant, "", 100, true, nil, nil) if err != nil || len(foreignPage.Sessions) != 0 { t.Fatal("foreign Agent reference persisted a Session", err) } diff --git a/services/core/tests/official_agent_update.py b/services/core/tests/official_agent_update.py index bfcb395aa..8091f5c3a 100644 --- a/services/core/tests/official_agent_update.py +++ b/services/core/tests/official_agent_update.py @@ -48,6 +48,15 @@ def main(): k: v for k, v in updated.to_dict().items() if k != "updated_at"} assert sessions.retrieve(old.id) == old updated = touched + # Compaction and experimental settings: saved, returned, merged per member and cleared by null. + assert updated.experimental.time_awareness is False and updated.compaction is None + assert agents.create(model="default", compaction={}).compaction is None + tuned = agents.create(model="tuned", compaction={"async": False}, experimental={"time_awareness": True}) + assert tuned.compaction.async_ is False and tuned.experimental.time_awareness is True + assert agents.update(tuned.id, experimental={}).experimental.time_awareness is True + assert agents.update(tuned.id, experimental={"time_awareness": False}).experimental.time_awareness is False + cleared = agents.update(tuned.id, compaction=None) + assert cleared.compaction is None and "compaction" not in http.get(base + "/v1/agents/" + tuned.id, headers=headers).json() for body in ([], {"model": None}, {"model": 3}, {"name": "x" * 129}, {"metadata": {"bad": None}}, {"text": {"unexpected": True}}, {"metadata": {"replace": "no"}, "instructions": False}, @@ -73,7 +82,7 @@ def main(): # the Agent lookup, so owned, foreign and missing Agents get the same response. for body, param, message in [ ({"reasoning": {"effort": "extreme"}}, "reasoning.effort", "Invalid value: 'extreme'. Supported values are: 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', and 'max'."), - ({"service_tier": "turbo"}, "service_tier", "Invalid value: 'turbo'. Supported values are: 'auto', 'default', 'flex', 'priority', and 'fast'."), + ({"service_tier": "turbo"}, "service_tier", "Invalid value: 'turbo'. Supported values are: 'auto', 'default', 'flex', 'priority', 'fast', and 'ultrafast'."), ({"text": {"format": {"type": "json_schema"}}}, "text.format.schema", "Missing required parameter: 'text.format.schema'."), ({"tools": [{**tool, "strict": True}]}, "tools[0].strict", "Unknown parameter: 'tools[0].strict'."), ({"tools": ["lookup"]}, "tools[0]", "Invalid type for 'tools[0]': expected an object, but got a string instead."), diff --git a/services/core/tests/official_agents.py b/services/core/tests/official_agents.py index c193d82f3..28347ed2b 100644 --- a/services/core/tests/official_agents.py +++ b/services/core/tests/official_agents.py @@ -24,7 +24,7 @@ def verify_agents(client, other, invalid, expect_error): assert response.status_code == 201 body, agent = response.http_response.json(), response.parse() assert set(body) == {"id", "object", "created_at", "updated_at", "metadata", "model", "name", - "instructions", "multi_agent", "reasoning", "service_tier", "text", "tools"} + "instructions", "multi_agent", "reasoning", "service_tier", "text", "tools", "experimental"} assert body["object"] == "agent" and body["model"] == " caller-model " assert body["name"] is None and body["instructions"] is None and body["metadata"] == {} assert body["multi_agent"] == {"enabled": False, "max_concurrent_subagents": None} @@ -121,7 +121,7 @@ def verify_agents(client, other, invalid, expect_error): ({"tools": [{**lookup, "parameters": []}]}, "tools[0].parameters", "Invalid type for 'tools[0].parameters': expected an object with string keys and unknown value values, but got an array instead."), ({"tools": [{k: v for k, v in lookup.items() if k != "parameters"}]}, "tools[0].parameters", "Missing required parameter: 'tools[0].parameters'."), ({"tools": [{"type": "tool_search", "max_results": 3}]}, "tools[0].max_results", "Unknown parameter: 'tools[0].max_results'."), - ({"tools": [{"type": "bogus_tool"}]}, "tools[0].type", "Invalid value: 'bogus_tool'. Supported values are: 'function', 'tool_search', 'programmatic_tool_calling', 'mcp', and 'web_search'."), + ({"tools": [{"type": "bogus_tool"}]}, "tools[0].type", "Invalid value: 'bogus_tool'. Supported values are: 'function', 'tool_search', 'programmatic_tool_calling', 'mcp', 'web_search', 'computer_use', and 'automations'."), ({"tool_choice": "auto"}, "tool_choice", "Unknown parameter: 'tool_choice'."), ({"text": {"format": {"type": "json_object"}}}, "text.format.type", "Invalid value: 'json_object'. Supported values are: 'text' and 'json_schema'."), ({"multi_agent": {"enabled": True, "max_concurrent_subagents": 0}}, "multi_agent.max_concurrent_subagents", "Invalid 'multi_agent.max_concurrent_subagents': integer below minimum value. Expected a value >= 1, but got 0 instead."), diff --git a/services/core/tests/official_client.py b/services/core/tests/official_client.py index a6523a2e6..a760974ad 100644 --- a/services/core/tests/official_client.py +++ b/services/core/tests/official_client.py @@ -21,7 +21,7 @@ from official_schema import ResponseValidator from official_items import verify_items from official_agents import verify_agents -from official_vaults import verify_vaults, verify_vault_recovery +from official_vaults import verify_vaults, verify_vault_recovery, verify_vault_update from official_vault_list import verify_vault_list, verify_vault_list_recovery from official_credentials import verify_credentials, verify_credential_recovery, create_old_key_credential, verify_old_key_credential from official_credential_list import verify_credential_list, verify_credential_list_recovery @@ -155,6 +155,7 @@ def issue_key(project_id, name): listed_files = verify_source_file_list(a, b, invalid, peer, expect_error) saved_agents = verify_agents(a, b, invalid, expect_error) listed_agents = verify_agent_list(a, b, invalid, saved_agents, expect_error) + verify_vault_update(a, b, expect_error) verify_http_routing(base, tokens[0]) sessions = a.beta.agents.sessions spec = {"input": "Verify client fixture admission.", "agent": {"model": "requested-test-model", "instructions": "Keep the configuration."}, "environment": {"type": "none"}} diff --git a/services/core/tests/official_credential_list.py b/services/core/tests/official_credential_list.py index ffbca380a..993ac0ccd 100644 --- a/services/core/tests/official_credential_list.py +++ b/services/core/tests/official_credential_list.py @@ -64,7 +64,7 @@ def sdk_page(values, has_more, query, **request): sdk_page(descending[:20], True, {}) sdk_page(descending[:20], True, {}, limit=None) sdk_page(descending[:20], True, {}, status=[]) - for limit, size in ((0, 1), (-7, 1), (101, 100)): + for limit, size in ((0, 1), (101, 100)): sdk_page(descending[:size], True, {"limit": [str(limit)]}, limit=limit) sdk_page(list(reversed(archived))[:20], True, {"status": ["archived"]}, status="archived") sdk_page(active[:20], True, {"status[]": ["active"], "order": ["asc"]}, @@ -108,7 +108,7 @@ def safe_error(response, status): with httpx2.Client(trust_env=False, timeout=10) as raw: verify_page(raw.get(endpoint, headers=headers), vault.id, descending[:20], True, canary) - for limit, size in (("0", 1), ("-7", 1), ("101", 100)): + for limit, size in (("0", 1), ("101", 100)): verify_page(raw.get(endpoint, headers=headers, params={"limit": limit}), vault.id, descending[:size], True, canary) for params, values in (({"status": "active"}, list(reversed(active))), diff --git a/services/core/tests/official_credential_rotation.py b/services/core/tests/official_credential_rotation.py index e7ae40cb9..1e8eb3e75 100644 --- a/services/core/tests/official_credential_rotation.py +++ b/services/core/tests/official_credential_rotation.py @@ -71,7 +71,6 @@ def metadata(response, previous): {"auth": {"type": "static_bearer", "token": 3}}, {"auth": {"type": "mcp_oauth", "access_token": canary}}, {**replacement, "name": "Unexpected rename"}, - {**replacement, "metadata": {}}, {"auth": {**replacement["auth"], "mcp_server_url": destination + "/other"}}, ] for body in invalid_bodies: diff --git a/services/core/tests/official_credentials.py b/services/core/tests/official_credentials.py index 7fadff761..eac65db7a 100644 --- a/services/core/tests/official_credentials.py +++ b/services/core/tests/official_credentials.py @@ -10,8 +10,9 @@ import official_body -def verify_credential(body, vault_id, name, destination): - assert set(body) == {"id", "auth", "created_at", "name", "object", "updated_at", "vault_id"} +def verify_credential(body, vault_id, name, destination, metadata=None): + assert set(body) == {"id", "auth", "created_at", "metadata", "name", "object", "updated_at", "vault_id"} + assert body["metadata"] == (metadata or {}) assert uuid.UUID(body["id"]).int != 0 and body["object"] == "vault.credential" assert body["vault_id"] == vault_id and body["name"] == name assert body["auth"] == {"type": "static_bearer", "mcp_server_url": destination} @@ -75,7 +76,7 @@ def safe_body(response, status): {**request, "auth": {**auth, "token": 3}}, {**request, "auth": {**auth, "token": ""}}, {**request, "auth": {"type": "mcp_oauth", "mcp_server_url": destination, "access_token": None}}, - {**request, "metadata": {"unexpected": "field"}}, + {**request, "metadata": {"unexpected": 1}}, ] for field in ("type", "mcp_server_url", "token"): invalid_requests.extend([{**request, "auth": {key: value for key, value in auth.items() if key != field}}, diff --git a/services/core/tests/official_file_resource_semantics.py b/services/core/tests/official_file_resource_semantics.py index fc0cdc29f..6f300dfba 100644 --- a/services/core/tests/official_file_resource_semantics.py +++ b/services/core/tests/official_file_resource_semantics.py @@ -184,7 +184,7 @@ def main(): settings = json.load(sys.stdin) pin = json.loads((Path(__file__).resolve().parents[3] / "contracts/agents-api/upstream.json").read_text()) distribution = importlib.metadata.distribution("openai") - assert distribution.version == pin["sdk_version"] == "3.13.0" + assert distribution.version == pin["sdk_version"] == "3.45.0" assert json.loads(distribution.read_text("direct_url.json"))["vcs_info"]["commit_id"] == pin["commit"] with ExitStack() as cleanup: raw = cleanup.enter_context(httpx2.Client(trust_env=False, timeout=20)) diff --git a/services/core/tests/official_function_inputs.py b/services/core/tests/official_function_inputs.py index 16e5adef4..44e899cad 100644 --- a/services/core/tests/official_function_inputs.py +++ b/services/core/tests/official_function_inputs.py @@ -37,9 +37,9 @@ def submit(api, events, key, expected=202, error=None, target=session): assert response.content == b"" except APIStatusError as failure: assert failure.status_code == expected, (failure.status_code, expected, failure.message) - kind, code, message = error + kind, code, message, *param = error body = failure.body - assert (body["type"], body["code"], body["param"]) == (kind, code, None), body + assert (body["type"], body["code"], body["param"]) == (kind, code, param[0] if param else None), body assert message is None or body["message"] == message, body @@ -52,7 +52,7 @@ def submit(api, events, key, expected=202, error=None, target=session): submit(api, [result("a", str(uuid.uuid4()), success=True)], "other-turn", 400, OTHER_TURN) submit(api, [message, result("rollback", "turn_malformed", success=True)], "malformed-turn", 400, OTHER_TURN) submit(api, [result("a", success=True)], "other-session", 400, unknown_call("a"), other) - submit(api, [message, result("rollback", success=None)], "malformed", 400, INVALID) + submit(api, [message, result("rollback", success=None)], "malformed", 400, ("invalid_request_error", "invalid_request_error", "Invalid type for 'events[1].success': expected a boolean, but got null instead.", "events[1].success")) stranger = api.with_options(api_key=foreign) submit(stranger, [result("a", success=True)], "foreign", 404, MISSING) submit(stranger, [result("missing", "turn_malformed", success=True)], "foreign-malformed", 404, MISSING) diff --git a/services/core/tests/official_items.py b/services/core/tests/official_items.py index 26333f5ef..1ad0a30c7 100644 --- a/services/core/tests/official_items.py +++ b/services/core/tests/official_items.py @@ -2,6 +2,10 @@ from openai import AuthenticationError, BadRequestError, NotFoundError +def items_b_turn(b, session, turn): + return b.beta.agents.sessions.turns.items.list(turn, session_id=session) + + def verify_items(a, b, invalid, session, peer_session, turns, expect_error): items = a.beta.agents.sessions.items recovered = list(items.list(session, limit=3, order="asc")) @@ -41,5 +45,12 @@ def verify_items(a, b, invalid, session, peer_session, turns, expect_error): assert patch.arguments["changes"][0]["diff"] == "+example" search = next(item for item in group if item.type == "web_search_call") assert search.status == "completed" and search.action.query == "reference" + turn_items = a.beta.agents.sessions.turns.items + assert list(turn_items.list(turn, session_id=session, order="asc")) == group + assert list(turn_items.list(turn, session_id=session, order="desc")) == list(reversed(group)) + assert turn_items.list(turn, session_id=session, after=group[2].id, order="asc", limit=2).data == group[3:5] + expect_error(NotFoundError, lambda: items_b_turn(b, session, turns[0])) + expect_error(NotFoundError, lambda: a.beta.agents.sessions.turns.items.list(turns[0], session_id=peer_session)) + expect_error(BadRequestError, lambda: a.beta.agents.sessions.turns.items.list(turns[1], session_id=session, after=recovered[1].id if recovered[1].turn_id != turns[1] else recovered[0].id)) print("Official Items client: native result shapes, partial/completed states, ordering, pagination and isolation passed.") return recovered diff --git a/services/core/tests/official_list_query.py b/services/core/tests/official_list_query.py index 876023985..7289e8508 100644 --- a/services/core/tests/official_list_query.py +++ b/services/core/tests/official_list_query.py @@ -26,7 +26,6 @@ "clamp": {"0": 1, "101": None, "-1": ("invalid_request_error", None, BETA_DIGIT), "abc": ("invalid_request_error", None, BETA_DIGIT)}, "strict": {"0": ("invalid_request_error", None, "limit must be between 1 and 100"), "101": ("invalid_request_error", None, "limit must be between 1 and 100"), "-1": ("invalid_request_error", None, BETA_DIGIT), "abc": ("invalid_request_error", None, BETA_DIGIT)}, - "vault": {"0": 1, "-1": 1, "101": None, "abc": ("invalid_request_error", None, BETA_DIGIT)}, "skills": {"0": 0, "101": ("integer_above_max_value", "limit", "Invalid 'limit': integer above maximum value. Expected a value <= 100, but got 101 instead."), "-1": ("integer_below_min_value", "limit", "Invalid 'limit': integer below minimum value. Expected a value >= 0, but got -1 instead.")}, "files": {"0": (None, None, "limit must be between 1 and 10000."), "10001": (None, None, "limit must be between 1 and 10000.")}, @@ -375,7 +374,7 @@ def main(): ("skills", "/skills", client.skills.list, False, False), ] policies = {"agents": "clamp", "templates": "clamp", "sessions": "clamp", "items": "clamp", "turns": "strict", - "vaults": "vault", "credentials": "vault", "files": "files", "skills": "skills"} + "vaults": "clamp", "credentials": "clamp", "files": "files", "skills": "skills"} tolerated = 0 state_before = {name: [value.to_dict() for value in listing(order="asc", limit=1)] for name, _, listing, _, _ in families} rejected = 0 @@ -403,17 +402,12 @@ def main(): assert body["type"] == "invalid_request_error" and body["code"] == expected_code and body["param"] == expected_param, (name, body) assert isinstance(body["message"], str) and body["message"], name assert secret not in response.text and all(value not in response.text for value in owned[name]), name - if order: - try: - listing(order=order) - except APIStatusError as error: - assert error.status_code == 400 and error.body == body, (name, error.body) - else: - raise AssertionError(f"SDK accepted invalid {name} order") + try: + listing(order=order) + except APIStatusError as error: + assert error.status_code == 400 and error.body == body, (name, error.body) else: - # Fixed 3.13 drops empty query values in _qs.stringify_items. - # Only the raw request above exercises an explicit order=. - assert [value.id for value in listing(order="", limit=1)] == owned[name][::-1], name + raise AssertionError(f"SDK accepted invalid {name} order") foreign_error = raw.get(url, headers={**headers, "Authorization": "Bearer " + foreign}, params={"order": order}) assert foreign_error.status_code == 400 and foreign_error.json() == response.json(), name unauthorized = raw.get(url, headers={k: v for k, v in headers.items() if k != "Authorization"}, params={"order": order}) diff --git a/services/core/tests/official_schema_test.py b/services/core/tests/official_schema_test.py index 0187d8a25..9c4e86e29 100644 --- a/services/core/tests/official_schema_test.py +++ b/services/core/tests/official_schema_test.py @@ -42,7 +42,7 @@ def test_file_nulls_do_not_relax_other_fields(self): "purpose": "user_data", "status": "processed", "expires_at": None, "status_details": None} self.response("/files/file_1", body) with self.assertRaises(ValidationError): - self.response("/files/file_1", {**body, "bytes": None}) + self.response("/files/file_1", {**body, "bytes": "0"}) with self.assertRaises(ValidationError): self.response("/files/file_1", {**body, "purpose": "unknown"}) diff --git a/services/core/tests/official_session_metadata.py b/services/core/tests/official_session_metadata.py index e99136752..ac5343163 100644 --- a/services/core/tests/official_session_metadata.py +++ b/services/core/tests/official_session_metadata.py @@ -52,7 +52,7 @@ def assert_metadata(session, expected): invalid_fields = [ ({"metadata": []}, "metadata"), ({"metadata": "value"}, "metadata"), ({"metadata": False}, "metadata"), - ({"agent": spec["agent"]}, "agent"), ({"environment": spec["environment"]}, "environment"), + ({"agent": spec["agent"]}, "agent.instructions"), ({"environment": spec["environment"]}, "environment"), ({"tenant_id": str(uuid.uuid4())}, "tenant_id"), ({"Metadata": {}}, "Metadata"), ] for fields, param in invalid_fields: @@ -111,6 +111,18 @@ def assert_metadata(session, expected): expect_error(NotFoundError, lambda: sessions.update(malformed, metadata={})) expect_error(BadRequestError, lambda: sessions.update(first.id, extra_headers={"OpenAI-Beta": ""})) assert sessions.retrieve(first.id) == current + key, value = next(iter(current.metadata.items())) + assert first.id in {item.id for item in sessions.list(metadata={key: value})} + assert list(sessions.list(metadata={key: "no-such-value"})) == [] + assert list(sessions.list(metadata={key: value, "absent": "x"})) == [] + assert list(other.beta.agents.sessions.list(metadata={key: value})) == [] + expect_error(BadRequestError, lambda: sessions.list(metadata={"k" * 65: "v"})) + # Core cannot run a Session review or change the agent of a Session. + for fields in [{"review": "auto_review"}, {"agent": {"model": "other"}}]: + expect_error(BadRequestError, lambda: sessions.update(first.id, **fields)) + assert sessions.update(first.id, review="none") == current + assert sessions.update(first.id, agent={}) == current + assert sessions.retrieve(first.id) == current print("Session metadata: pinned SDK and raw HTTP replacement, clearing, omission, limits, authentication, tenant isolation, unchanged configuration and creation retry identity passed.") return current diff --git a/services/core/tests/official_session_requests.py b/services/core/tests/official_session_requests.py index 70d7087fc..5f5307aab 100644 --- a/services/core/tests/official_session_requests.py +++ b/services/core/tests/official_session_requests.py @@ -41,7 +41,7 @@ def verify_session_create_requests(client, spec): # prefix, and precede the none input requirement (TV-01..04). lookup = {"type": "function", "name": "lookup", "description": "Look up a value.", "parameters": {"type": "object"}} agent_errors = [ - ({"tools": [{"type": "bogus_tool"}]}, "agent.tools[0].type", "Invalid value: 'bogus_tool'. Supported values are: 'function', 'tool_search', 'programmatic_tool_calling', 'mcp', and 'web_search'."), + ({"tools": [{"type": "bogus_tool"}]}, "agent.tools[0].type", "Invalid value: 'bogus_tool'. Supported values are: 'function', 'tool_search', 'programmatic_tool_calling', 'mcp', 'web_search', 'computer_use', and 'automations'."), ({"tools": [{k: v for k, v in lookup.items() if k != "parameters"}]}, "agent.tools[0].parameters", "Missing required parameter: 'agent.tools[0].parameters'."), ({"reasoning": {"effort": "extreme"}}, "agent.reasoning.effort", "Invalid value: 'extreme'. Supported values are: 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', and 'max'."), ({"tool_choice": "auto"}, "agent.tool_choice", "Unknown parameter: 'agent.tool_choice'."), diff --git a/services/core/tests/official_skill_selectors.py b/services/core/tests/official_skill_selectors.py index 45bed8284..9e9da3e93 100644 --- a/services/core/tests/official_skill_selectors.py +++ b/services/core/tests/official_skill_selectors.py @@ -15,7 +15,7 @@ def main(): - assert openai.__version__ == "3.13.0", openai.__version__ + assert openai.__version__ == "3.45.0", openai.__version__ settings = json.load(sys.stdin) options = dict(max_retries=0, _strict_response_validation=True) client = OpenAI(base_url=settings["base"] + "/v1", api_key=settings["token"], http_client=DefaultHttpxClient(trust_env=False), **options) @@ -39,7 +39,7 @@ def projection(response, selector, status): assert response.status_code == status, response.text safe(response.http_response) body = response.http_response.json() - assert set(body) == {"id", "object", "created_at", "updated_at", "name", "network", "packages", "capability_directories", "files", "plugins", "skills"} + assert set(body) == {"id", "object", "created_at", "updated_at", "name", "network", "packages", "capability_directories", "desktop", "files", "plugins", "skills"} assert body["skills"] == [{"type": "skill_reference", "skill_id": skill_id, "version": selector}], body["skills"] parsed = response.parse() assert parsed.skills[0].version == selector diff --git a/services/core/tests/official_skills.py b/services/core/tests/official_skills.py index bac0e0b05..19eefc9a5 100644 --- a/services/core/tests/official_skills.py +++ b/services/core/tests/official_skills.py @@ -24,7 +24,7 @@ def bundle(marker): def main(): - assert openai.__version__ == "3.13.0", openai.__version__ + assert openai.__version__ == "3.45.0", openai.__version__ settings = json.load(sys.stdin) client = OpenAI(base_url=settings["base"] + "/v1", api_key=settings["token"], max_retries=0, http_client=DefaultHttpxClient(trust_env=False), _strict_response_validation=True) recovered = OpenAI(base_url=settings["recovered"] + "/v1", api_key=settings["token"], max_retries=0, http_client=DefaultHttpxClient(trust_env=False), _strict_response_validation=True) diff --git a/services/core/tests/official_template_composition.py b/services/core/tests/official_template_composition.py index 7ccc0b956..a331bbb77 100644 --- a/services/core/tests/official_template_composition.py +++ b/services/core/tests/official_template_composition.py @@ -141,7 +141,7 @@ def projection(client, session_id, expected_files, expected_packages): retry_body, retry_key, frozen = body, key, projected assert api.retrieve(template_id).to_dict() == template_snapshot - for system in (None, [], ["jq"]): + for system in (["jq"],): invalid = {**base, "environment": {**base["environment"], "packages": {"system": system}}} rejected(invalid, 400, param="packages.system") response = raw.post(settings["base"] + "/v1/agents/environments/templates", diff --git a/services/core/tests/official_template_null_selection.py b/services/core/tests/official_template_null_selection.py index 7e9c92491..2eea24093 100644 --- a/services/core/tests/official_template_null_selection.py +++ b/services/core/tests/official_template_null_selection.py @@ -50,7 +50,7 @@ def main(): settings = json.load(sys.stdin) pin = json.loads((Path(__file__).resolve().parents[3] / "contracts/agents-api/upstream.json").read_text()) distribution = importlib.metadata.distribution("openai") - assert distribution.version == pin["sdk_version"] == "3.13.0" + assert distribution.version == pin["sdk_version"] == "3.45.0" assert json.loads(distribution.read_text("direct_url.json"))["vcs_info"]["commit_id"] == pin["commit"] marker = settings["canary"] sessions, expected, replays, rejected_keys = {}, {}, {}, [] diff --git a/services/core/tests/official_vault_list.py b/services/core/tests/official_vault_list.py index 549729fc2..5e4a3d968 100644 --- a/services/core/tests/official_vault_list.py +++ b/services/core/tests/official_vault_list.py @@ -55,7 +55,7 @@ def sdk_page(values, has_more, query, **request): sdk_page(descending[:20], True, {}) sdk_page(descending[:20], True, {}, limit=None) sdk_page(descending[:20], True, {}, status=[]) - for limit, size in ((0, 1), (-7, 1), (101, 100)): + for limit, size in ((0, 1), (101, 100)): sdk_page(descending[:size], True, {"limit": [str(limit)]}, limit=limit) sdk_page(list(reversed(archived))[:20], True, {"status": ["archived"]}, status="archived") sdk_page(active[:20], True, {"status[]": ["active"], "order": ["asc"]}, @@ -81,7 +81,7 @@ def sdk_page(values, has_more, query, **request): headers = {"Authorization": f"Bearer {client.api_key}", "OpenAI-Beta": "agents=v1"} with httpx2.Client(trust_env=False, timeout=10) as raw: verify_page(raw.get(endpoint, headers=headers), descending[:20], True) - for limit, size in (("0", 1), ("-7", 1), ("101", 100)): + for limit, size in (("0", 1), ("101", 100)): verify_page(raw.get(endpoint, headers=headers, params={"limit": limit}), descending[:size], True) for params, values in (({"status": "active"}, list(reversed(active))), @@ -107,7 +107,7 @@ def sdk_page(values, has_more, query, **request): # A malformed cursor is a missing one. invalid_cursor = raw.get(endpoint, headers=headers, params={"after": "invalid-vault"}) assert invalid_cursor.status_code == 404 and invalid_cursor.json() == response.json() - for params in ({"status": "unknown"}, {"limit": "null"}): + for params in ({"status": "unknown"}, {"limit": "null"}, {"limit": "-7"}): response = raw.get(endpoint, headers=headers, params=params) assert response.status_code == 400 assert response.json()["error"]["type"] == "invalid_request_error" diff --git a/services/core/tests/official_vaults.py b/services/core/tests/official_vaults.py index a8ff4f47b..c2792de26 100644 --- a/services/core/tests/official_vaults.py +++ b/services/core/tests/official_vaults.py @@ -138,3 +138,43 @@ def verify_vault_recovery(client, other, peer, saved): assert response.status_code == 200 and response.json() == value.to_dict() assert other.beta.agents.vaults.retrieve(foreign.id) == foreign print("Vault resources: exact SDK/raw responses and shared-project reads survived the server restart.") + + +def verify_vault_update(client, other, expect_error): + """Vault update replaces name and metadata; Credential metadata rides on create and update.""" + from official_credentials import verify_credential + vaults = client.beta.agents.vaults + vault = vaults.create(name="Before", metadata={"old": "1"}) + only_name = vaults.update(vault.id, name="After") + assert only_name.name == "After" and only_name.metadata == {"old": "1"} and only_name.id == vault.id + only_metadata = vaults.update(vault.id, metadata={"team": "core", "empty": ""}) + assert only_metadata.name == "After" and only_metadata.metadata == {"team": "core", "empty": ""} + cleared = vaults.update(vault.id, name=None, metadata={}) + assert cleared.name is None and cleared.metadata == {} + assert vaults.retrieve(vault.id) == cleared + expect_error(NotFoundError, lambda: other.beta.agents.vaults.update(vault.id, name="Foreign")) + expect_error(BadRequestError, lambda: vaults.update(vault.id, extra_body={"metadata": {"k": 1}})) + + credentials = vaults.credentials + auth = {"type": "static_bearer", "mcp_server_url": "https://example.invalid/mcp", "token": "metadata-token"} + created = credentials.create(vault.id, name="With metadata", auth=auth, metadata={"team": "core"}) + verify_credential(created.to_dict(), vault.id, "With metadata", auth["mcp_server_url"], {"team": "core"}) + updated = credentials.update(created.id, vault_id=vault.id, metadata={"team": "ops", "empty": ""}) + assert updated.metadata == {"team": "ops", "empty": ""} and updated.auth == created.auth + rotated = credentials.update(created.id, vault_id=vault.id, auth={"type": "static_bearer", "token": "rotated-token"}) + assert rotated.metadata == updated.metadata and credentials.retrieve(created.id, vault_id=vault.id) == rotated + other_credential = credentials.create(vault.id, name="Other", auth=auth, metadata={"team": "ops", "tier": "b"}) + assert {item.id for item in credentials.list(vault.id, extra_query={"metadata[team]": "ops"})} == {other_credential.id, created.id} + both = credentials.list(vault.id, extra_query={"metadata[team]": "ops", "metadata[tier]": "b"}) + assert [item.id for item in both] == [other_credential.id] + assert list(credentials.list(vault.id, extra_query={"metadata[team]": "none"})) == [] + environment = {"type": "environment_variable", "secret_name": "X", "secret_value": "v", "networking": {"type": "unrestricted"}} + rejected = expect_error(BadRequestError, lambda: credentials.create(vault.id, name="Environment", auth=environment)) + assert rejected.body["param"] == "auth.type", rejected.body + credentials.delete(created.id, vault_id=vault.id) + tagged = vaults.create(name="Tagged", metadata={"team": "filter-a", "tier": "x"}) + vaults.create(name="Untagged", metadata={"team": "filter-b"}) + assert [item.id for item in vaults.list(extra_query={"metadata[team]": "filter-a"})] == [tagged.id] + assert [item.id for item in vaults.list(extra_query={"metadata[team]": "filter-a", "metadata[tier]": "x"})] == [tagged.id] + assert list(vaults.list(extra_query={"metadata[team]": "filter-a", "metadata[tier]": "y"})) == [] + vaults.delete(vault.id)